CoolFace
Modelpublic

debajyotidasgupta/eu-halt-qwen2-5-72b-instruct

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes10downloads
Model Card

EU-Halt heads for Qwen/Qwen2.5-72B-Instruct (frontier-panel, NORMAL regime)

Lightweight epistemic-uncertainty detector: K=4 prediction heads sharing the frozen Qwen/Qwen2.5-72B-Instruct trunk. Configuration: mid_dim=128, K=4 (frontier-panel, NORMAL 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

python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from eu_halt import attach

model = AutoModelForCausalLM.from_pretrained(
    "Qwen/Qwen2.5-72B-Instruct", torch_dtype=torch.bfloat16,
).to("cuda").eval()
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-72B-Instruct")

uncertainty = attach(
    model,
    heads_repo="debajyotidasgupta/eu-halt-qwen2-5-72b-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: numheads, middim, sourcelayers, basemodel, 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, batchsize 2-4, seqlen 512, ~2000-2500 steps.
  • —AdamW (lr 3e-4 to 5e-4), 100-200 warmup steps.
  • —K=4 heads, middim=128, trainingnoise_std=0.01, dropout=0.1 (or both 0 for quiet variants).
  • —Single GPU (~10-15 min on RTX A5000/A6000/L40S).

Evaluation

OOD AUROC (id vs ood), 1050 samples total:

SignalAUROC95% CI
disagreement0.3537[0.3048, 0.4034]
entropy0.4911[0.4528, 0.5311]
lasttokenunc0.3693[0.3169, 0.4287]
mahalanobis0.8716[0.7987, 0.9319]
targ_margin0.3942[0.3421, 0.4526]
etc_trend0.3726[0.3338, 0.4113]
llm_check0.2874[0.2378, 0.3339]
mc_dropout0.5016[0.4642, 0.5410]
rauqnan[nan, nan]
p_truenan[nan, nan]
semantic_entropynan[nan, nan]
semanticentropynlinan[nan, nan]
eigenscorenan[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 Qwen/Qwen2.5-72B-Instruct retains its own license (Qwen3 / Llama-3 / Phi / Gemma).

Citation

bibtex
@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-qwen2-5-72b-instruct},
}