Views
No views yet
| Metric | Value |
|---|---|
| F1 Score | 85.6% |
| Recall | 91% |
| Precision | 81% |
| Accuracy | 87.8% |
| Training Samples | 2,500 |
| Training Steps | ~750 |
| Mean Latency | ~5.7ms |
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4# Load model and tokenizer
5model_name = "vincentoh/deberta-v3-xsmall-l0-bouncer-mega"
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForSequenceClassification.from_pretrained(model_name)
8
9# Classify text
10text = "What is the capital of France?"
11inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=256)
12
13with torch.no_grad():
14 outputs = model(**inputs)
15 probs = torch.softmax(outputs.logits, dim=-1)
16
17# Labels: 0 = safe, 1 = harmful
18safe_prob = probs[0][0].item()
19harmful_prob = probs[0][1].item()
20
21label = "safe" if safe_prob > harmful_prob else "harmful"
22confidence = max(safe_prob, harmful_prob)
23
24print(f"Label: {label}, Confidence: {confidence:.2%}")| Variant | Samples | F1 | Recall | Best For |
|---|---|---|---|---|
| l0-bouncer-12k | 12K | 93% | 99% | Balanced performance |
| l0-bouncer-full | 124K | 95.2% | 97% | Maximum accuracy |
| l0-bouncer-mega | 2.5K | 85.6% | 91% | Lightweight/iterative |
Input → L0 Bouncer (6ms) → 70% pass through
↓ 30% escalate
L1 Analyst (50ms) → Deeper reasoning
↓
L2 Gauntlet (200ms) → Expert ensemble1@misc{l0-bouncer-2024,
2 author = {Vincent Oh},
3 title = {L0 Bouncer: A Fast Safety Classifier for Content Moderation},
4 year = {2024},
5 publisher = {HuggingFace},
6 url = {https://huggingface.co/vincentoh/deberta-v3-xsmall-l0-bouncer-mega}
7}