CoolFace
Modelpublic

cunxin/llama-email-fraud-detector-awq

sourceHugging Facellama3.2updated 6mo agoView on Hugging Face
0likes8downloads
Model Card

Llama Email Fraud Detector (AWQ 4-bit)

AWQ 4-bit quantized version of cunxin/llama-email-fraud-detector. Same fine-tuned email fraud detection capability at 1/3 the size with ~1-1.5% accuracy loss.

This model is optimized for low VRAM GPUs (6-8 GB) such as RTX 3050, RTX 3060 laptop, and similar consumer GPUs.


cunxin/llama-email-fraud-detector 的 AWQ 4-bit 量化版本。同样的邮件欺诈检测能力,体积仅为原来的 1/3,精度损失约 1-1.5%。

本模型为低显存 GPU(6-8 GB)优化,如 RTX 3050、RTX 3060 笔记本版等消费级显卡。

Model Details / 模型详情

ArchitectureLlamaForCausalLM (Decoder-only Transformer)
Base Modelmeta-llama/Llama-3.2-3B-Instruct
Fine-TuningLoRA (r=16, alpha=32) merged, then AWQ quantized
QuantizationAWQ 4-bit, groupsize=128, GEMM kernel, zeropoint=True
Parameters3.2B (quantized)
Precision4-bit weights (int4)
Model Size2.2 GB (vs 6.4 GB for bf16)
Compression Ratio~2.9x
Accuracy Loss vs bf16~1-1.5%

Lineage / 模型血统

meta-llama/Llama-3.2-3B-Instruct
    │
    ├── LoRA fine-tuning (email fraud detection)
    │
    ├── Merge LoRA into base weights (6.4 GB, bf16)
    │     └─► cunxin/llama-email-fraud-detector
    │
    └── AWQ 4-bit quantization (2.2 GB)
          └─► cunxin/llama-email-fraud-detector-awq (this model)

Output Format / 输出格式

Same structured JSON output as the bf16 version:

与 bf16 版本相同的结构化 JSON 输出:

json
{
  "is_fraud": true,
  "risk_score": 95,
  "confidence_level": 0.97,
  "detected_threats": ["DOMAIN_MISMATCH", "CREDENTIAL_REQUEST", "URGENCY_FEAR"],
  "reason": "The sender domain 'amaz0n-verify.com' typosquats amazon.com...",
  "suggestion": "Do not click any links. Report this email as phishing."
}

11 threat types with point-based scoring: CREDENTIAL_REQUEST (35), DOMAIN_MISMATCH (30), URL_DISCREPANCY (30), TOO_GOOD_TO_BE_TRUE (30), PROMPT_INJECTION (30), URGENCY_FEAR (15), REPLY_TO_MISMATCH (15), GENERIC_SALUTATION (8), ANOMALOUS_TIMING (8), MISSING_SIGNATURE (8), GRAMMAR_ANOMALY (5).

See cunxin/llama-email-fraud-detector for full documentation of threat types, dual-model pipeline, and training details.

详细的威胁类型、双模型流水线和训练细节请参阅 cunxin/llama-email-fraud-detector。

Usage / 使用方法

With vLLM (Recommended) / 使用 vLLM(推荐)

bash
# Set in .env
MODEL_PATH=cunxin/llama-email-fraud-detector-awq
QUANTIZATION=awq

# Start service
docker compose --profile gpu up -d

With Transformers / 使用 Transformers

python
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_name = "cunxin/llama-email-fraud-detector-awq"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")

VRAM Requirements / 显存要求

Configuration / 配置VRAM / 显存Example GPU / 示例 GPU
AWQ model only~2.5 GBAny 4GB+ GPU
AWQ + RoBERTa~3.0 GBRTX 3050 (8GB)
AWQ + RoBERTa + KV Cache (4096 ctx)~3.5 GBRTX 3060 Laptop (6GB)
AWQ + RoBERTa + KV Cache + TurboQuant~2.7 GBRTX 3050 (4GB laptop)

Comparison with bf16 / 与 bf16 对比

bf16AWQ 4-bit (this)
Model size6.4 GB2.2 GB
Min VRAM12 GB6 GB
Max concurrent requests (24GB GPU)~21~50+
Accuracy lossbaseline~1-1.5%
Inference speedbaselinecomparable

Quantization Details / 量化细节

AWQ (Activation-Aware Weight Quantization) identifies the most important 1% of weights by observing activation magnitudes, then scales those channels up before uniform 4-bit quantization. This preserves model quality far better than naive quantization.

AWQ(激活感知权重量化)通过观察激活值大小识别最重要的 1% 权重,在统一 4-bit 量化前对这些通道进行缩放。这比朴素量化更好地保留了模型质量。

MethodAWQ (Activation-Aware Weight Quantization)
Bit Width4-bit (int4)
Group Size128
KernelGEMM
Zero PointYes
Calibration DataPile validation set (214K samples)
Quantization Time~4 minutes on RTX 4090

Related Models / 相关模型

Model / 模型Type / 类型Size / 大小Speed / 速度Use Case / 用途
cunxin/roberta-email-fraud-detectorDiscriminative475 MB<50msFast binary pre-screen / 快速二元预筛
cunxin/llama-email-fraud-detectorGenerative (bf16)6.4 GB~1-3sDetailed threat analysis / 详细威胁分析
cunxin/llama-email-fraud-detector-awq (this)Generative (4-bit)2.2 GB~1-3sSame as above, for low VRAM / 同上,低显存版

Citation / 引用

bibtex
@misc{cunxin2025llama-email-fraud-awq,
  title={Llama Email Fraud Detector (AWQ 4-bit)},
  author={cunxin},
  year={2025},
  url={https://huggingface.co/cunxin/llama-email-fraud-detector-awq}
}