EU-Halt heads for meta-llama/Llama-3.1-70B-Instruct (frontier-panel, FLIPPED regime)
Lightweight epistemic-uncertainty detector: K=4 prediction heads sharing the frozen meta-llama/Llama-3.1-70B-Instruct 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(
"meta-llama/Llama-3.1-70B-Instruct", torch_dtype=torch.bfloat16,
).to("cuda").eval()
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.1-70B-Instruct")
uncertainty = attach(
model,
heads_repo="debajyotidasgupta/eu-halt-llama-3-1-70b-instruct",
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), 420 samples total:
| Signal | AUROC | 95% CI |
|---|---|---|
| disagreement | 0.3331 | [0.2675, 0.4043] |
| entropy | 0.6787 | [0.6194, 0.7370] |
| last_token_unc | 0.5777 | [0.5018, 0.6572] |
| mahalanobis | 0.5773 | [0.4316, 0.7102] |
| targ_margin | 0.5581 | [0.4830, 0.6342] |
| etc_trend | 0.4827 | [0.4061, 0.5589] |
| llm_check | 0.6278 | [0.5455, 0.7110] |
| mc_dropout | 0.6569 | [0.5939, 0.7217] |
| 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: entropy
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 meta-llama/Llama-3.1-70B-Instruct 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 = {Conference on AI Safety and Control (CAISc)},
year = {2026},
url = {https://huggingface.co/debajyotidasgupta/eu-halt-llama-3-1-70b-instruct},
}
- Downloads last month
- 33
Model tree for debajyotidasgupta/eu-halt-llama-3-1-70b-instruct
Base model
meta-llama/Llama-3.1-70B