Devocean-06/Spam_Filter-gemma
Update @ 2025.10.19: First release of Spam filter XAI
Resources and Technical Documentation:
Model Developers: SK Devoceon-06 On device LLM
Model Information
- Skitty is an explainable small language model (sLLM) that classifies spam messages and provides brief reasoning for each decision.
Description
- Skitty was trained on an updated 2025 spam message dataset collected through the Smart Police Big Data Platform in South Korea.
- The model leverages deduplication, curriculum sampling, and off-policy distillation to improve both classification accuracy and interpretability.
Data and Preprocessing
- Data source: 2025 Smart Police Big Data Platform spam message dataset
- Dataset: Devocean-06/Spam_QA-Corpus
- Format: Alpaca instruction format (instruction, input, output)
- Deduplication: Performed near-duplicate removal using SimHash filtering
- Sampling strategy: Applied curriculum-based sampling to control difficulty and improve generalization
- Labeling: Trained using hard-label supervision after label confidence refinement
Training and Distillation
- Utilized off-policy distillation to compress the decision process of a large teacher LLM into a smaller student model
- Instead of directly mimicking the teacher's text generation, the model distills the reasoning trace for spam detection
- Combined curriculum learning with hard-label distillation to balance accuracy, interpretability, and generalization
Training Configuration
Base Model
- Base Model: google/gemma-3-4b-it
- Training Framework: Axolotl
- Fine-tuning Method: QLoRA (Quantized Low-Rank Adaptation)
Hyperparameters
| Parameter | Value | Description |
|---|---|---|
| Quantization | 4-bit | Load pretrained model in 4-bit |
| Adapter | QLoRA | Low-rank adaptation method |
| LoRA Rank (r) | 16 | Rank of low-rank matrices |
| LoRA Alpha | 32 | Scaling factor for LoRA |
| LoRA Dropout | 0.05 | Dropout rate for LoRA layers |
| Target Modules | attention + MLP | Applied to q,k,v,o,up,down,gate projections |
| Sequence Length | 1500 | Maximum input sequence length |
| Sample Packing | True | Pack multiple samples into one sequence |
| Micro Batch Size | 10 | Batch size per GPU |
| Gradient Accumulation | 15 | Effective batch size: 150 |
| Number of Epochs | 5 | Total training epochs |
| Learning Rate | 2e-5 | Peak learning rate |
| LR Scheduler | Cosine | Cosine annealing schedule |
| Warmup Steps | 10 | Learning rate warmup steps |
| Optimizer | AdamW (8-bit) | 8-bit quantized AdamW |
| Weight Decay | 0.0 | L2 regularization |
| Precision | BF16 | Brain floating point 16 |
| Gradient Checkpointing | True | Save memory by recomputing gradients |
| Flash Attention | True | Optimized attention kernel |
Training Monitoring
- Logging Steps: 100
- Evaluation Steps: 50
- Save Steps: 50
- Evaluation Strategy: Steps-based
- Tracking: Weights & Biases (wandb)
Running with the vllm API
You can initialize the model and processor for inference with pipeline as follows.
vllm serve Devocean-06/Spam_Filter-gemma
from openai import OpenAI
client = OpenAI(
base_url="model-endpoint",
api_key="api-key"
)
SYSTEM_PROMPT = """๋น์ ์ ์คํธ ๋ฌธ์๋ก ํ์ ํ ๊ทผ๊ฑฐ๋ฅผ ์์ฑํ๋ ๋ํ ์ธ์ด ๋ชจ๋ธ์
๋๋ค.
์๋ ๊ธฐ์ค์ ๋ฐ๋ผ ์คํธ์ฌ๋ถ ํ์ ์ ๊ทผ๊ฑฐ๋ฅผ ๊ฐ๋จ๋ช
๋ฃํ๊ฒ ํ ๋ฌธ์ฅ์ผ๋ก ์์ฑํด ์ฃผ์ธ์. ์ถ๋ ฅ ํฌ๋งท์ XAI ์ค๋ช
์ ์ ํฉํ๋๋ก ์ผ๊ด์ฑ ์๊ฒ ํ
ํ๋ฆฟ ํ์์ผ๋ก ๊ณ ์ ๋์ด์ผ ํ๋ฉฐ, ์คํธ ์ฌ๋ถ ๋ฐ ๊ทธ ๊ทผ๊ฑฐ๋ฅผ ๋ช
์พํ๊ฒ ์ ์ํด์ผ ํฉ๋๋ค.
**1. ํ์ ๊ทผ๊ฑฐ(ํ ๋ฌธ์ฅ, ํ
ํ๋ฆฟ):**
- **๊ฐ์ธ ์ ๋ณด ์๊ตฌ:** ์ ๋ถ์ฆ, ๋น๋ฐ๋ฒํธ, ์นด๋ ๋ฒํธ ๋ฑ ๊ฐ์ธ ์ ๋ณด๋ฅผ ์๊ตฌํ๊ธฐ ๋๋ฌธ์
๋๋ค.
- **๊ธฐํ ํน์ด์ฌํญ:** ์ ํญ๋ชฉ ์ธ์ ์คํธ์ผ๋ก ์์ฌ๋๋ ๋ค๋ฅธ ํจํด์ด ์์ต๋๋ค.
- **๋ฐ์ ์/์์ ์:** ๋ฐ์ ๋ฒํธ๊ฐ ์ผ๋ฐ์ ์ด์ง ์๊ฑฐ๋ ๋ถ๋ถ๋ช
ํ๊ธฐ ๋๋ฌธ์
๋๋ค.
- **๋ด์ฉ์ ๋ชฉ์ :** ๊ธ์ต ์ํ, ๋์ถ, ๋๋ฐ, ํฌ์, ๋ถ๋ฒ ๋ณต์ ๋ฑ์ ํ๋ณด๋ ๊ถ์ ๊ฐ ํฌํจ๋์ด ์๊ธฐ ๋๋ฌธ์
๋๋ค.
- **์ฌ๋ฆฌ์ ์๋ฐ:** ๊ธด๊ธ์ฑ, ๊ณตํฌ, ํธ๊ธฐ์ฌ์ ์ ๋ฐํ์ฌ ์ฆ๊ฐ์ ์ธ ํ๋์ ์ ๋ํ๊ธฐ ๋๋ฌธ์
๋๋ค. (์: "๊ธฐ๊ฐ ํ์ ", "์ง๊ธ ์ฆ์", "ํด๋ฆญํ์ง ์์ผ๋ฉด ๋ถ์ด์ต")
- **๋งํฌ/URL:** ์ผ๋ฐ์ ์ด์ง ์์ ์งง์ URL, ๋จ์ถ URL ๋๋ ์์ฌ์ค๋ฌ์ด ๋งํฌ๊ฐ ํฌํจ๋์ด ์๊ธฐ ๋๋ฌธ์
๋๋ค.
**2. ํ์ ์กฐ๊ฑด**
- ๋ฐ๋์ ์ถ๋ ฅ ํ์์ ๋ฐ๋ผ์ [์คํธ ํ์ ์ด์ ] ํ
ํ๋ฆฟ์ ์ฌ์ฉํด์ผ ํฉ๋๋ค.
- ์คํธ์ผ๋ก ํ์ ํ ์ด์ ์ ๋ํด์ ๊ตฌ์ฒด์ ์ธ ์ด์ ๋ก 100์ ์ด์์ผ๋ก ์ค๋ช
ํด์ผ ํฉ๋๋ค.
- ๋ฐ๋์ ์ ํ์ ๊ทผ๊ฑฐ๋ฅผ ๋จผ์ ์ธ๊ธํ ๋ค์ ์ถ๋ ฅ ํ์์ ๋ง๊ฒ ์คํธ ํ์ ์ด์ ๋ฅผ ์์ฑํด์ผ ํฉ๋๋ค.
- ์คํธ ํ์ ์ด์ ์์ฑ ์, ์ ์คํธ ๋ฌธ์๋ ~~ ์ผ๋ก ์์ํด์ผํฉ๋๋ค.
- ๊ทธ๋ฆฌ๊ณ ์ ์ ์กฐ๊ฑด์ ๋ชจ๋ ์คํธ ๋ฌธ์๋ก ๋ถ๋ฅ๋ ํ์์ด๋ ์คํธ์ด ์๋๋ผ๊ณ ์ธ๊ธํ๋ฉด ์๋ฉ๋๋ค.
### ์ถ๋ ฅ ํ์ ์์
- ํ์ ๊ทผ๊ฑฐ : ๊ฐ์ธ์ ๋ณด ์๊ตฌ
- ์คํธ ํ์ ์ด์ : ์ ์คํธ ๋ฌธ์๋ ๊ฐ์ธ์ ๋ณด๋ฅผ ์๊ตฌํ๋ ์คํธ์ผ๋ก ์ํํธ ๋ถ์ ๋ฐ ๋ถ๋์ฐ ํฌ์ ๊ถ์ ๊ฐ ํฌํจ๋์ด ์์ผ๋ฉฐ, ๊ธด๊ธ์ฑ์ ๊ฐ์กฐํ์ฌ ์ฆ๊ฐ์ ์ธ ํ๋์ ์ ๋ํ๊ณ ์์ต๋๋ค."""
response = client.chat.completions.create(
model="Devocean-06/Spam_Filter-gemma",
messages=[
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": user_message}
],
temperature=0.7,
max_tokens=2048
)
print(response.choices[0].message.content)
๐ง Example Output
- ํ์ ๊ทผ๊ฑฐ: ๋ด์ฉ์ ๋ชฉ์
- ์คํธ ํ์ ์ด์ : ์ ์คํธ ๋ฌธ์๋ ๊ธ์ต ์ํ๊ณผ ๋์ถ ๊ด๋ จ ๊ถ์ ๋ด์ฉ์ ํฌํจํ๊ณ ์์ผ๋ฉฐ,
โ์ง๊ธ ๋ฐ๋กโ, โ์ฆ์ ์ ์ฒญโ๊ณผ ๊ฐ์ ์ฌ๋ฆฌ์ ์๋ฐ ์ด๊ตฌ๋ฅผ ์ฌ์ฉํ์ฌ ์์ ์์ ํ๋์ ์ ๋ํ๊ณ ์์ต๋๋ค.
Software
Training was conducted using the Axolotl framework, a flexible and efficient fine-tuning system designed for large language models.
Axolotl enables seamless configuration and execution of full fine-tuning, LoRA, and DPO pipelines through simple YAML-based workflows. It integrates with PyTorch and Hugging Face Transformers, supporting distributed strategies such as FSDP and DeepSpeed for optimized performance on multi-GPU environments.
This framework streamlines experimentation and scaling by allowing researchers to define training parameters, datasets, and model behaviors declaratively โ reducing boilerplate and ensuring reproducible results across setups.
Key Features Used:
- QLoRA for parameter-efficient fine-tuning
- 4-bit quantization during training
- Flash Attention for faster training
- Gradient checkpointing for memory efficiency
- Alpaca dataset format support
Citation
@misc{Devocean-06/Spam_Filter-gemma,
author = { {SK Devoceon-06 On device LLM} },
title = { Spam filter & XAI },
year = 2025,
url = { https://huggingface.co/Devocean-06/Spam_Filter-gemma },
publisher = { Hugging Face }
}
License
This model is released under the Gemma license. Please refer to the original Gemma license for usage terms and conditions.
- Downloads last month
- 99