🧠 Tiny model. Tiny dataset. Real classification.
A compact few-shot spam classifier built with SetFit + BAAI/bge-small-en-v1.5.
⚡ TINY → FAST → USEFUL
This model is a small experiment in few-shot text classification.
It learns to separate:
✉️ HAM — legitimate email 🚨 SPAM — unwanted / suspicious email
The interesting part?
Only 16 labeled training examples.
┌──────────────────────┐
│ 16 EXAMPLES │
│ │
│ 8 HAM + 8 SPAM │
└──────────┬───────────┘
│
▼
┌───────────────────────┐
│ BAAI/bge-small-en-v1.5│
└───────────┬───────────┘
│
▼
┌────────────────┐
│ SetFit │
│ Few-shot NLP │
└───────┬────────┘
│
▼
┌───────────────────────┐
│ Logistic Regression │
└───────────┬───────────┘
│
┌──────┴──────┐
▼ ▼
HAM SPAM
📡 Model Status
| ⚙️ Component | 🔧 Configuration |
|---|---|
| Task | Spam Classification |
| Classes | 2 |
| Backbone | BAAI/bge-small-en-v1.5 |
| Framework | SetFit |
| Dataset | SetFit/enron_spam |
| Training Examples | 16 |
| Examples / Class | 8 |
| Iterations | 20 |
| Epochs | 1 |
| Batch Size | 16 |
| Classification Head | Logistic Regression |
| Language | English |
📊 Results
91.4% Accuracy
91.4% Macro F1
Accuracy ██████████████████░░ 91.4%
Macro F1 ██████████████████░░ 91.4%
These results come from a very small few-shot training setup. They should not be interpreted as a benchmark against production spam-filtering systems.
🧬 The TinyModels Recipe
┌───────────────────┐
│ SetFit/enron │
│ _spam │
└─────────┬─────────┘
│
16 examples
│
▼
┌───────────────────┐
│ BGE-small │
│ text encoder │
└─────────┬─────────┘
│
embeddings
│
▼
┌───────────────────┐
│ SetFit │
│ contrastive loss │
└─────────┬─────────┘
│
▼
┌───────────────────┐
│ LogisticRegression│
└─────────┬─────────┘
│
┌──────┴──────┐
▼ ▼
✉️ HAM 🚨 SPAM
Training configuration
backbone: BAAI/bge-small-en-v1.5
dataset: SetFit/enron_spam
examples:
total: 16
per_class: 8
setfit:
iterations: 20
epochs: 1
batch_size: 16
loss: CosineSimilarityLoss
distance_metric: cosine_distance
classifier:
type: LogisticRegression
seed: 42
🚀 Run It
pip install -q setfit
from setfit import SetFitModel
model = SetFitModel.from_pretrained(
"TinyModels/setfit-banking-spam"
)
text = """
Congratulations! You have won $1,000,000.
Click here immediately to claim your prize.
"""
prediction = model(text)
print(prediction)
Example output
1
🧪 Quick Examples
🚨 Spam
CONGRATULATIONS!!!
You have been selected to receive
$1,000,000. Click the link below
to claim your prize immediately.
→ SPAM
✉️ Legitimate
Please find attached the global markets
monitor for the week ending 12 January 2001.
→ HAM
🧠 Why SetFit?
Traditional supervised classification can require a large labeled dataset.
SetFit takes a different route:
Large Dataset
✕
│
│
┌─────▼─────┐
│ SetFit │
└─────┬─────┘
│
▼
Few labeled examples
│
▼
Useful classifier
This makes the experiment useful for exploring:
- ⚡ Few-shot learning
- 🧠 Sentence embeddings
- 📚 Text classification
- 🚨 Spam detection
- 🔬 Efficient training
- 🤗 SetFit
🧩 Architecture
INPUT
│
▼
┌─────────────────────────────┐
│ BAAI/bge-small-en-v1.5 │
│ │
│ Sentence Transformer │
└──────────────┬──────────────┘
│
▼
Dense Embedding
│
▼
┌─────────────────────────────┐
│ Logistic Regression │
└──────────────┬──────────────┘
│
┌──────┴──────┐
▼ ▼
HAM SPAM
✉️ 🚨
⚠️ Limitations
This is intentionally a tiny experimental model.
Because only 16 examples were used for training:
- Performance can vary on unseen data.
- Domain shift can significantly affect predictions.
- Unusual spam may be missed.
- Enron-style email does not represent every modern spam pattern.
- The reported score comes from a lightweight few-shot experiment.
Do not use this model as the sole component of a security-critical email filtering system.
📦 Model Identity
╭──────────────────────────────────────╮
│ TINYMODEL │
├──────────────────────────────────────┤
│ │
│ MODEL SetFit Banking Spam │
│ BACKBONE BGE-small │
│ TASK Binary Classification │
│ DATA Enron Spam │
│ EXAMPLES 16 │
│ RESULT 91.4% Accuracy │
│ │
│ STATUS ● EXPERIMENTAL │
│ │
╰──────────────────────────────────────╯
⚡ 16 Examples.
🧠 One Small Model.
🚨 One Real Task.
TinyModels — building small models that actually do things.