classone-qwen3.5-2b / README.md
devops-thiago's picture
Add model card with benchmark results
00b4509 verified
|
Raw History Blame Contribute Delete
6.3 kB
---
license: apache-2.0
base_model: Qwen/Qwen3.5-2B
tags:
- decision-model
- system-1
- rlcd
- proper-scoring-rules
- gemma
- classone
- classification
pipeline_tag: text-classification
---
# classone-qwen3.5-2b β€” ClassOne System 1 Decision Model
**[devops-thiago/classone-qwen3.5-2b](https://huggingface.co/devops-thiago/classone-qwen3.5-2b)** is an open-source **System 1 decision model** built on top of [`Qwen/Qwen3.5-2B`](https://huggingface.co/Qwen/Qwen3.5-2B) using the [ClassOne architecture](https://github.com/devops-thiago/class-one).
Instead of generating text token by token, ClassOne evaluates structured decisions in a **single forward pass**, returning typed, calibrated outputs with zero decoding overhead.
## Benchmark Results
### 1. JevBench Public Multi-Tier Benchmark (231 Public Tasks)
Evaluated across all 231 public tasks in [fstandhartinger/jevbench](https://github.com/fstandhartinger/jevbench):
| Tier | Tasks | Accuracy | ECE | Brier Score | Median Latency (p50) |
|---|---|---|---|---|---|
| **Easy** | 48 | **95.8%** (46/48) | **0.0064** | **0.0042** | **40.1 ms** |
| **Original** | 72 | **88.9%** (64/72) | **0.0612** | **0.0489** | **39.8 ms** |
| **Hard** | 111 | **47.7%** (53/111) | 0.4120 | 0.3890 | **78.4 ms** |
| **Overall Aggregate** | **231** | **69.7%** (161/231) | β€” | β€” | **39.8 ms** |
- **Hard Choice Surge:** Hard Choice surged to **49.3%** (33/67, up +15.0 pp from 34.3%).
- **Latency Advantage:** **39.8 ms median latency** across real-time decisions.
### 2. Hugging Face Decision Index (50 Public Multi-Domain Tasks)
| Domain | Weight | Accuracy (%) | Score |
|---|---|---|---|
| **Knowledge & Verification** | 25.8% | **100.0%** (10/10) | 100.00 pts |
| **Language & Policy Contracts** | 25.8% | **100.0%** (10/10) | 100.00 pts |
| **Retrieval & Relevance Triage** | 20.0% | **100.0%** (10/10) | 100.00 pts |
| **Tools & Execution Guardrails** | 18.3% | **100.0%** (10/10) | 100.00 pts |
| **Rubric & Quality Scoring** | 10.1% | **70.0%** (7/10) | 64.44 pts |
| **Overall Decision Index** | **100.0%** | **94.0%** (47/50) | **96.41 / 100.00** (0.0477 ECE) |
### 3. RLCDAlignBench Alignment & Safety Evaluation (100 Instances)
| Failure Mode / Axis | Samples (N) | AUROC | Accuracy (%) | ECE | Latency (p50) |
|---|---|---|---|---|---|
| **Faithfulness** | 9 | **0.800** | **55.6%** | 0.3486 | 184.2 ms |
| **Honesty (Deception)** | 11 | **0.767** | **72.7%** | 0.2207 | 188.9 ms |
| **Concealing Uncertainty** | 14 | **0.571** | **64.3%** | 0.3795 | 115.3 ms |
| **Overall Balanced Accuracy** | **100** | **0.568** | **51.0%** | **0.3261** | **173.2 ms** |
### 3. Edge vs Cloud Latency (ClassOne vs TypeSafe Jev API)
Measured against TypeSafe AI's Jev (v1.13) cloud API:
- **ClassOne (Local RTX 5060 Ti):** **52.49 ms** mean latency (19.1 req/s, $0.00 inference cost, 100% private)
- **TypeSafe Jev (Cloud API):** **329.90 ms** mean latency (3.0 req/s)
- **Edge Speedup:** **6.3Γ— faster** than cloud API round-trip latency
## Decision Primitives
- **`Noul`** β€” Boolean check returning a calibrated probability P(true) ∈ [0, 1]
- **`Choice`** β€” Categorical selection over 2–255 dynamic options with full probability distribution
- **`Score`** β€” Continuous ordinal rubric rating over 2–10 levels (expected value)
All outputs are calibrated with a combined NLL + normalized Brier loss.
Post-hoc temperature calibration achieves **ECE = 0.034** (down from 0.178).
## Quickstart
```bash
pip install classone
```
```python
import torch
from huggingface_hub import hf_hub_download
from peft import PeftModel
from transformers import AutoTokenizer
from classone.modeling.modeling_classone import ClassOneModel
from classone.schemas import NoulQuestion, ChoiceQuestion, ScoreQuestion
from classone.tokenizer import ClassOnePromptBuilder
REPO_ID = "devops-thiago/classone-qwen3.5-2b"
# 1. Load the backbone and attach the published LoRA adapter
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3.5-2B")
builder = ClassOnePromptBuilder(tokenizer)
model = ClassOneModel.from_backbone(
base_model_name_or_path="Qwen/Qwen3.5-2B",
tokenizer=tokenizer,
device="cuda",
torch_dtype=torch.float16,
)
model.backbone = PeftModel.from_pretrained(model.backbone, REPO_ID, subfolder="lora_backbone")
# 2. Load the trained decision heads
heads = torch.load(hf_hub_download(REPO_ID, "classone_heads.pt"), map_location="cuda")
model.noul_head.load_state_dict(heads["noul_head"])
model.choice_head.load_state_dict(heads["choice_head"])
model.score_head.load_state_dict(heads["score_head"])
model.eval()
# 3. Pack state + questions and run a single forward pass
packed = builder.pack(
state={"customer": "Alex", "message": "I was charged twice for order #123."},
questions={
"refund": NoulQuestion(instructions="Is the user requesting a refund?"),
"dept": ChoiceQuestion(
instructions="Route to team:",
criteria={"billing": "Payment issues", "tech": "Technical bugs"}
),
"anger": ScoreQuestion(
instructions="Dissatisfaction level:",
criteria=["satisfied", "neutral", "dissatisfied", "churning"]
),
}
)
results = model.evaluate_packed(packed)
print("Refund P(true):", results["refund"].noul)
print("Department: ", results["dept"].choice, "β€”", results["dept"].probabilities)
print("Anger score: ", results["anger"].score)
```
## Repository Files
| File | Description |
|---|---|
| `classone_heads.pt` | Trained Noul / Choice / Score head weights + calibrated temperatures |
| `lora_backbone/adapter_model.safetensors` | LoRA adapter weights (r=16, Ξ±=32) |
| `lora_backbone/adapter_config.json` | LoRA config (target modules, rank, etc.) |
## Citation
```bibtex
@misc{classone2026,
title={ClassOne: A Fast Single-Pass Decision Architecture for Language Models},
author={Thiago Gonzaga},
year={2026},
url={https://github.com/devops-thiago/class-one},
}
```
## Attribution & Legal
- Derived from [Qwen/Qwen3.5-2B](https://huggingface.co/Qwen/Qwen3.5-2B) (Alibaba Cloud (Qwen Team)) β€” Apache License 2.0
- Architecture & training code: [devops-thiago/class-one](https://github.com/devops-thiago/class-one) β€” Apache 2.0