SemGrad Detects LLM Hallucinations in a Single Pass Without Extra Tokens

SemGrad ditches sampling entirely, using gradients in semantic space to detect LLM hallucinations faster and more accurately than state-of-the-art methods

·
·
·
SemGrad Detects LLM Hallucinations in a Single Pass Without Extra TokensPRO
  • SemGrad is the first gradient-based uncertainty quantification method for free-form LLM generation, requiring no extra sampling passes.
  • It measures how much a model's output changes under meaning-preserving input rewrites, using gradients in semantic space rather than parameter space.
  • A Semantic Preservation Score (SPS) identifies which embedding layer best captures meaning, anchoring the gradient computation.
  • HybridGrad combines semantic-space and parameter-space gradients for additional accuracy gains.
  • Both methods outperform state-of-the-art sampling-based baselines, especially on tasks with multiple valid answers, across Llama 3.1, Qwen3, and Mistral-Nemo.
  • The paper was accepted at ICML 2026; no public code repo has been released yet.

Knowing when an LLM is about to hallucinate is one of the most practically valuable problems in applied AI right now. A new paper accepted at ICML 2026 proposes SemGrad, the first gradient-based uncertainty quantification method for free-form language generation -- and it does so without generating a single extra token.

The cost of knowing what you don't know

Uncertainty quantification (UQ) is the discipline of getting a model to signal when it is unsure. For LLMs, this matters enormously: a model that confidently hallucinates a drug dosage or a legal precedent is far more dangerous than one that says "I'm not sure." LLMs are increasingly applied in high-stakes areas such as medical diagnosis, law, and financial advice, and hallucinations -- where models generate plausible but false or fabricated content -- pose significant risks.

The dominant approach today is semantic entropy (SE): generate 5 to 20 different responses to the same prompt, cluster them by meaning, and measure how spread out those meanings are. High spread means high uncertainty. It works well, but the 5-to-10-fold increase in computation cost associated with SE computation hinders practical adoption. For a production system serving thousands of requests per second, that overhead is simply not viable.

Prior gradient-based alternatives existed, but they were designed for classification tasks -- asking "is this output correct?" rather than "how uncertain is the model about what to say next?" Free-form generation, where there may be many equally valid answers, is a fundamentally harder problem.

Gradients as a confidence signal

The core intuition behind SemGrad is elegant: a confident model should not change its output much when you rephrase the input without changing its meaning. If you ask "What is the capital of France?" and then ask "Can you tell me France's capital?", a confident model gives the same answer both times. An uncertain one might waver.

Pro article

This story is for Pro members

You've reached the end of the free preview. Upgrade to AlphaSignal Pro to read the full article - and everything else behind the paywall.

Trending
  • No trending articles

Comments

avatar

Next Reads