EU-Halt heads for deepseek-ai/DeepSeek-R1-Distill-Llama-70B (frontier-panel, FLIPPED regime)
Lightweight epistemic-uncertainty detector: K=4 prediction heads sharing the frozen deepseek-ai/DeepSeek-R1-Distill-Llama-70B trunk. Configuration: mid_dim=128, K=4 (frontier-panel, FLIPPED regime).
Calibrate the sign before deploying. The direction of the disagreement signal is trunk-family-specific: on some families it rises on out-of-distribution input, on others (Llama-70B-class, gpt-oss-120B) it falls. Score ~50 known-ID and ~50 known-OOD prompts once and check which direction separates. Details: the paper and repo below.
Paper: When Uncertainty Lies (CAISc 2026, oral) Β· Code: github.com/debajyotidasgupta/eu-halt
Quick start
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from eu_halt import attach
model = AutoModelForCausalLM.from_pretrained(
"deepseek-ai/DeepSeek-R1-Distill-Llama-70B", torch_dtype=torch.bfloat16,
).to("cuda").eval()
tokenizer = AutoTokenizer.from_pretrained("deepseek-ai/DeepSeek-R1-Distill-Llama-70B")
uncertainty = attach(
model,
heads_repo="debajyotidasgupta/eu-halt-r1-distill-llama-70b",
mid_dim=128,
)
print(uncertainty("Who founded Quora in 2008?", tokenizer))
# Higher = more uncertain.
Files in this repo
model.safetensorsβ the K=4 head weights (preferred format; config embedded as metadata).config.jsonβ head geometry: num_heads, mid_dim, source_layers, base_model, dims.heads_final.ptβ the original torch checkpoint (kept for backward compatibility).heads_step{500,1000,1500,2000,2500}.ptβ intermediate checkpoints (where uploaded).source_layers.jsonβ the K=4 trunk-layer indices the heads read from.history.jsonβ per-step loss + disagreement + GPU stats.
Training
- Dataset:
HuggingFaceFW/fineweb-edu(streaming). - ~2-5M tokens, batch_size 2-4, seq_len 512, ~2000-2500 steps.
- AdamW (lr 3e-4 to 5e-4), 100-200 warmup steps.
- K=4 heads, mid_dim=128, training_noise_std=0.01, dropout=0.1 (or both 0 for
quietvariants). - Single GPU (~10-15 min on RTX A5000/A6000/L40S).
Evaluation
OOD AUROC (id vs ood), 1050 samples total:
| Signal | AUROC | 95% CI |
|---|---|---|
| disagreement | 0.3716 | [0.3266, 0.4118] |
| entropy | 0.6979 | [0.6677, 0.7275] |
| last_token_unc | 0.7401 | [0.7062, 0.7758] |
| mahalanobis | 0.9303 | [0.8835, 0.9706] |
| targ_margin | 0.6966 | [0.6557, 0.7374] |
| etc_trend | 0.7203 | [0.6842, 0.7567] |
| llm_check | 0.5676 | [0.5263, 0.6082] |
| mc_dropout | 0.6699 | [0.6391, 0.7044] |
| rauq | nan | [nan, nan] |
| p_true | nan | [nan, nan] |
| semantic_entropy | nan | [nan, nan] |
| semantic_entropy_nli | nan | [nan, nan] |
| eigenscore | nan | [nan, nan] |
Best signal: mahalanobis
Intended use
- Hallucination flagging at inference time (score before / during generation).
- Dynamic-RAG gating (retrieve iff uncertainty > Ο).
- Selective prediction / risk-coverage trade-offs.
- Token-level uncertainty visualization via
uncertainty.per_token(text, tokenizer).
Limitations
- No fine-tuning of the trunk β only the auxiliary heads are trained.
- Heads are trained on web text. Specialized domains (medical, legal) may need a domain-specific recalibration.
- For Gemma's 256k vocab, head output projection is ~70-100M params per head β still small relative to the trunk.
License
Apache-2.0 for the heads.
The trunk model deepseek-ai/DeepSeek-R1-Distill-Llama-70B retains its own license (Qwen3 / Llama-3 / Phi / Gemma).
Citation
@inproceedings{dasgupta2026euhalt,
author = {Dasgupta, Debajyoti and Mondal, Arijit and Chakrabarti, Partha P.},
title = {When Uncertainty Lies: How Model Scale and Layer Geometry Quietly
Invert the Meaning of Internal Disagreement in Large Language Models},
booktitle = {1st Conference For AI Scientists (CAISc)},
year = {2026},
url = {https://huggingface.co/debajyotidasgupta/eu-halt-r1-distill-llama-70b},
}
- Downloads last month
- 40
Model tree for debajyotidasgupta/eu-halt-r1-distill-llama-70b
Base model
deepseek-ai/DeepSeek-R1-Distill-Llama-70B