Downloads · 30 days
7
21% of all-time downloads
hamdallah/budgeted-exit-qwen3.5-2b-civil-comments
budgeted-exit-qwen3.5-2b-civil-comments is a text classification model from hamdallah. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
Stop computing when the decision is settled. This is a LoRA fine-tune of the hybrid linear-attention model Qwen3.5-2B with a trained classification head at seven exit layers and a frozen, risk-calibrated exit policy.…
Downloads · 30 days
7
21% of all-time downloads
All-time downloads
33
Public
Parameters
26.7M
107 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors107 MB · 100%
From the Hugging Face model README
Stop computing when the decision is settled. This is a LoRA fine-tune of the hybrid linear-attention model Qwen3.5-2B with a trained classification head at seven exit layers and a frozen, risk-calibrated exit policy. It answers four moderation questions about a comment (threat, identity attack, insult, obscene language), composes them with a rule, and leaves the network early when the rule's outcome can no longer change within an explicit error budget.
On a locked, pre-registered test it keeps decision quality within 0.2 points of the full model while running 5.45 of 24 layers on average, and a runtime that really stops is 3.99x faster in measured throughput.
Research release. Trained and evaluated on one dataset (Civil Comments) and one seed. Read the limitations before using it.
Rule: threat or identity_attack or (insult and obscene) (about 1.2% positive). Official Civil Comments test split, 96,862 comments,
read once after the policy, weights, code and test file were hashed. Pass rule fixed in advance: the 95% interval of the change in
balanced accuracy must exclude a 1-point loss.
| System | Balanced accuracy | Change vs full depth [95% CI] | Mean depth | Throughput (A100, 16k dev texts) |
|---|---|---|---|---|
| Full depth | 94.05% | - | 24 | 282 texts/s |
| Static truncation at layer 11 | 93.92% | -0.13 [-0.47, +0.21] | 11 | 593 texts/s (2.10x) |
| Frozen exit policy (this release) | 93.87% | -0.18 [-0.43, +0.07] | 5.45 | 1,124 texts/s (3.99x) |
Balanced accuracy of each exit on the validation split, if every comment stopped there:
| Exit layer | 3 | 7 | 11 | 15 | 19 | 23 | 24 |
|---|---|---|---|---|---|---|---|
| Balanced accuracy | 91.78% | 93.54% | 94.02% | 94.01% | 94.15% | 94.24% | 94.03% |
The policy changed 2.54% of the full model's positive decisions (budget 2%) and 0.92% of its negative decisions (budget 1%). The first figure overshoots its budget: the isotonic maps and the dials were fitted on the same calibration rows. Treat the budget as approximate.
frozen_policy.json as plain numbers.model.safetensors: LoRA adapters (rank 16, all large linear maps) and the seven exit heads, 26.7M parameters. The base weights are downloaded from Qwen/Qwen3.5-2B.config.json: base model, exit layers, questions, LoRA rank, prompt prefix and suffixfrozen_policy.json: the exact policy evaluated on the locked test (Platt parameters, isotonic maps, dials, cut-offs)The loading and runtime code lives in the project repository: github.com/hamdallah90/decision-aware-inference (folder budgeted_exit/).
git clone https://github.com/hamdallah90/decision-aware-inference.git && cd decision-aware-inference
pip install -r requirements.txt && cd budgeted_exit
from huggingface_hub import snapshot_download
from hub import load # budgeted_exit/hub.py
from runtime_exits import Runtime # budgeted_exit/runtime_exits.py
folder = snapshot_download("hamdallah/budgeted-exit-qwen3.5-2b-civil-comments")
model, encode, _ = load(folder) # logits = model(ids, mask) -> [batch, exits, 4 questions]
runtime = Runtime(tag=None, folder=folder)
decisions, exit_layers = runtime.dynamic(encode(["your comment here"]))
LoRA (rank 16) on a frozen bf16 backbone, last-token readout, one sequence per comment with all four questions in a fixed prompt prefix, on 55,271 Civil Comments training rows (an enriched sample with extra rare positives), binary cross-entropy summed over all exits, two epochs, one seed. Calibration used a separate uniform sample of 99,140 training rows.
transformers 5.17.Apache-2.0, following the base model. Dataset: Civil Comments (CC0-1.0).