Skip to content
AI.info

Papers

Detection Is Not Early Warning: Evaluating Token-Level Alarms on Language Model Failures

Calibrates token-level alarms against annotated failure onsets and shows response-level AUROC saturates, changing how early-warning monitors should be evaluated.

The paper’s first page · arXiv:2611.16803
arXiv
2611.16803 · accepted · NEURIPS workshop
Published
2026-11-12
Authors
Marco De Negri, Luca Sartori, Lorenzo Baggi, Moritz Reihs, Eduard Frank Ďurech, Mennatallah El-Assady, Valentina Pyatkin, Anna Hedström

In plain words

Many language model failures — repetition loops, harmful content, unsupported claims — begin at a specific token, called the onset. Existing evaluations score monitors with response-level metrics such as AUROC, which say whether a response failed but not when the monitor fired; a probe that only fires once the failure is already visible in the text can score as well as one that fires before it begins.

AI summary

Overview

Research area: Interpretability and evaluation methodology for large language models — specifically, how to evaluate token-level monitors that try to warn about an impending generation failure before it happens.

Technical level: Intermediate. The paper assumes familiarity with linear probes, LoRA adapters, residual-stream activations, and standard classification metrics (AUROC, F1, recall), but its central argument is conceptual rather than mathematical.

Scope: The paper introduces PREWARN, an evaluation protocol for token-level failure monitors, and applies it to repetitive degeneration in three open 8B-class and 7B-class instruction-tuned models using linear probes on activations plus six untrained baselines.

What This Paper Is About

Many language model failures — repetition loops, harmful content, unsupported claims — begin at a specific token, called the onset. Existing evaluations score monitors with response-level metrics such as AUROC, which say whether a response failed but not when the monitor fired; a probe that only fires once the failure is already visible in the text can score as well as one that fires before it begins. The paper argues that early warning is a distinct task requiring two things that prior evaluations lack: an annotated onset, and a threshold fixed in advance at the error rate the monitor will actually be deployed with. It then proposes a protocol that supplies both and demonstrates it on repetitive degeneration.

Key Contributions

  1. PREWARN, an evaluation protocol for token-level monitors of any failure with an annotated onset. It calibrates each monitor's threshold on validation data to a chosen error budget, runs the monitor on test data with that threshold held fixed, and scores alarms on three separate tasks (response classification, failure detection, early warning) relative to the onset.

  2. Evidence that response-level metrics saturate on repetitive degeneration: AUROC and best accuracy rate the monitors as near-perfect and only weakly predict which ones actually warn early, with a length-only rule scoring almost perfectly despite being unable to warn by construction.

  3. A comparison against six untrained baselines (reading only response length, emitted tokens, the generator's confidence, or its activations), showing that only the probes warn before most loops on two of the three models, plus an analysis of what low-rank adaptation adds to a probe.

  4. Released artifacts: frozen and adapted linear probes for Apertus, Llama and Mistral with thresholds calibrated at 1%, 5% and 10%, published at huggingface.co/collections/marcodene/prewarn-degeneration-probes, with training/scoring/evaluation code at github.com/swiss-ai/degeneration-probe.

Main Findings

  • Response-level metrics cannot tell monitors apart. On Apertus at layer 15, four scorers — a token-cap rule that flags only the final token of a capped response, an adapted probe, and the frozen probes with the highest and lowest validation AUROC — are indistinguishable on response classification, and the token-cap rule achieves the highest best accuracy. The detection rate is close to 1 for all four. Differences appear only in the onset-aligned metrics.

  • A length-only rule nearly tops AUROC. The token-cap rule reaches AUROC 0.9990 (Apertus), 0.9988 (Llama) and 0.9995 (Mistral) — the highest on two of the three models — yet its only flag falls after the loop has filled the token budget.

  • AUROC rankings are stable but misaligned with warning quality. Ranking 27 probes by AUROC on validation reproduces itself on test (Kendall's τ = 0.79, versus 0.53 for best accuracy), but agrees only weakly with the test ranking by warning coverage (τ = 0.33). Validation warning coverage predicts the test ranking closely (τ = 0.94), which is why the paper's selection rule uses it.

  • Layer choice barely moves AUROC but strongly moves warning coverage. Across layers of Apertus, AUROC stays above 0.96 and best accuracy varies by less than 3%, while warning coverage is seven times higher at the best layer than at the worst.

  • Probes warn before most loops on Apertus and Llama. The early-warning rate of both frozen and adapted probes exceeds one half and is well above random alarms, with the median first alarm falling 137 to 232 tokens before the onset. Warning coverage is 1.4 to 3 times pre-window coverage.

  • On Mistral the probes are detectors, not early warners. Every probe's early-warning rate stays below one half (though above random), the median first alarm comes after the onset (e.g. +108 tokens for the frozen probe at layer 5), and warning coverage is close to pre-window coverage. Detection rate is still 0.99.

  • Adaptation more than doubles warning coverage but barely moves the early-warning rate. Comparing frozen and adapted probes at the same layer isolates the LoRA effect: on Apertus, warning coverage rises from 0.186 to 0.523 while the early-warning rate moves from 0.658 to 0.695; on Llama from 0.087 to 0.488 and 0.594 to 0.655. Because the early-warning rate counts a response once at its first alarm, added flags to a response already warned do not raise it.

  • Much of the adaptation gain comes from flags long before the onset. On Apertus and Llama, flags rise as the onset approaches, and adaptation adds a level of flags present more than a thousand tokens before the onset; pre-window coverage rises alongside warning coverage.

  • No untrained baseline warns much more often than random alarms. Windowed seq-rep-n and rep/ℓ cover more of the warning window than the frozen probe on every model, but they also flag much of the text before it and their first alarm comes well after the onset — they measure how repetitive the response has already been, and both select windows of 1,024 to 4,096 tokens on validation.

  • Calibration carries over. At the 5% budget, validation-fixed thresholds yield false-alarm rates of 4.5% to 5.6% on test and below 1% on held-out sources, though frozen probes on Llama and Mistral see their early-warning rate drop to 0.20 and 0.12 there.

Methodology in Plain English

The researchers define a monitor as a scorer that assigns each generated token a score in [0,1], combined with a threshold: a token is flagged when its score crosses the threshold, and a response's "first alarm" is its first flagged position. A failure has an onset, the first token of the failure, and a warning window of the 256 positions immediately before it.

PREWARN then does three things. First, it sets the threshold on a validation split at the lowest value that keeps the monitor's chosen error rate within a budget β — for degeneration, the share of healthy responses allowed to raise an alarm. Second, it runs the monitor with that threshold fixed on a test split. Third, it scores the alarms against the onset: response-level metrics for classification, detection rate and post-onset coverage for detection, and warning coverage, early-warning rate and lead (median first alarm minus onset) for early warning, with pre-window coverage and false-alarm rate reported alongside as context. Early-warning numbers are read against a "random alarms" chance reference calibrated to the same budget.

For the case study, the team sampled 10 responses to each of 3,630 prompts from seven sources spanning mathematics, code, instruction following and medical reasoning, at temperature 0.7, top-p 0.9 and at most 4,096 new tokens, using Apertus-8B-Instruct, Llama-3.1-8B-Instruct and Mistral-7B-Instruct (all with 32 layers). A response counts as degenerate only if it enters a repetition loop that persists until the token budget is exhausted. Since all such responses are capped, only capped responses needed labelling: Claude Sonnet 5 acted as an LLM judge that quotes where the loop begins, and every capped response in both test splits was then reviewed by hand, with reviewers confirming 97% to 99% of the judge's degenerate labels and keeping its onset for 74% to 92% of confirmed responses.

The monitors under test are linear probes on residual-stream activations, trained with binary cross-entropy on a target that is positive from 256 tokens before the onset onward, at every layer from 1 to 31. Frozen probes train only the probe weights and the layer-norm affine parameters and read the generator's own activations at no extra cost; adapted probes additionally train rank-16 LoRA adapters in the layers below the probe, which requires a second forward pass. The layer and checkpoint are selected by validation warning coverage at β = 1% among candidates with post-onset coverage of at least 0.3 — this was the best of 26 strategies compared. Six training-free baselines (token-cap, repeated-n-gram, windowed seq-rep-n, rep/ℓ, windowed entropy, windowed negative log-probability) are tuned on validation with the same selection rule.

Why This Matters

The paper reframes a measurement problem as a design problem: if the point of a monitor is to buy time to intervene, then metrics that ignore when the monitor fires cannot tell a useful monitor from a useless one. For interpretability research, this gives a reusable template — token scores, annotated onsets, an error budget — that applies to any failure with a locatable start, and it warns against selecting probes by AUROC.

Real-world applications:

  • Streaming chat and long-form generation: detecting a repetition loop hundreds of tokens before it begins, so the system can stop, steer or resample instead of burning the full token budget.
  • Code and mathematical reasoning assistants: catching degenerate loops in long generations, where the paper's prompt sources include code and mathematics.
  • Agentic pipelines with hard token limits: avoiding wasted compute and latency when a model spirals, since loops run until the budget is exhausted.
  • Safety monitoring: the same protocol is proposed for harmful content, where a missed failure can cost more than a false alarm, so the false-negative rate rather than the false-alarm rate would be fixed.

Industry relevance is direct: the paper releases probes with thresholds already calibrated at 1%, 5% and 10%, so they can be attached to an intervention trigger without further tuning, and the frozen variant costs no extra forward pass. The adapted variant's cost — a second forward pass — is stated explicitly as a deployment trade-off.

Future Directions

  • Applying PREWARN beyond degeneration. The authors state that other failures with an onset, such as harmful content or hallucinated entities, are left to future work, and that a different failure may need a different probe training strategy or selection rule than the one chosen on degeneration.
  • Testing interventions end to end. The released calibrated thresholds are meant to trigger stopping, resampling or steering before a loop begins, but the authors note this direction has not yet been explored.
  • Separating legitimate repetition from degeneration. Prompts that request repetition, enumerations, brute-force search or code are labelled healthy, but the paper does not test whether probes can distinguish such repetition from a genuine loop.
  • Disentangling onset from response length. On Apertus and Llama the onset usually comes after a healthy response has ended, so part of what the probes flag may reflect how long the response has run rather than the coming failure.

Target Audience

Researchers and engineers working on LLM interpretability, activation probing and runtime monitoring will get the most from this paper, particularly those building guardrails or intervention systems who need to choose between candidate monitors that all look equally good under AUROC. It is also valuable for evaluation-methodology researchers interested in how metric choice shapes which methods appear to work, and for practitioners deploying open models who want off-the-shelf probes with pre-calibrated thresholds.

Authors’ abstract

Many failures of language models begin at a specific token, the onset. A monitor that reads the model during generation can classify the finished response, detect the failure once it is under way, or warn before it begins, and only a warning leaves time to stop or steer the generation. Monitors are usually evaluated with response-level metrics such as AUROC, which ignore when the monitor fires. We introduce PREWARN, an evaluation protocol for any failure with an annotated…

The full abstract on arXiv
Read the original paper

Related papers