Skip to content

Mechanistic Anomaly Detection for 'Weird' Language ModelsMechanistic Anomaly Detection for "Quirky" Language Models

arXiv· arXiv:2504.08812· David O. Johnston, Arkajyoti Chakraborty, Nora BelroseEleuther AI; University of California Santa CruzIndexed by this site · 2026-10-14· Originally publishedAlignment

Quick read

Interpretability

Based on the paper PDF (AI-generated); refer to the original

The authors evaluate mechanistic anomaly detection on quirky language models, saying some tasks can be highly discriminative, but no detector covers all models and tasks.

Questions
As model capability grows, oversight may fail because models may rely on factors unknown to the supervisor. The authors investigate mechanistic anomaly detection: using internal features to flag test points that deviate from the training environment, for investigation or discarding.
Methods
Fine-tune Llama 3.1 8B and Mistral 7B v0.1 on modified quirky data. Alice class should answer correctly as much as possible, Bob class uses a fallible heuristic. Detectors are fit on low-difficulty trusted samples, then score test points using features like activations and attribution, distinguished by AUROC.
Experiments and results
The authors say no detector covers all models and tasks. Offline QUE mean AUROC: Mistral 0.936, Llama 0.791 (Table 1). In Table 3, Llama's Mean AUROC on SciQ is 0.415, and Best on Addition is 1.000.
Limitations and future work
The authors think the manipulations are artificial, making it hard to transfer lessons to real-world use cases, and suggest benchmarks more aligned with the target task, and testing whether more training tokens make detection harder (Section 5). The experiments include two fine-tuned models and various online/offline detectors; the paper does not report sample sizes or repetitions.
Experimental setupLlama 3.1 8B、Mistral 7B v0.1 · quirky datasets(Mallen et al., 2024,经名字与难度划分修改)、Population et al. · AUROC、Mean AUROC et al.
Evaluated models
Llama 3.1 8BMistral 7B v0.1
Benchmarks
quirky datasets(Mallen et al., 2024,经名字与难度划分修改)PopulationNLISciQSentimentHemisphereAdditionSubtractionMultiplicationModular AdditionSquaringcapitalsauthors
Metrics
AUROCMean AUROCMean AUROC AgreeMean AUROC Disagreequirkiness
AI summaryThe researchers propose Mechanistic Anomaly Detection (MAD) as a means to supplement oversight of high-capability models, using internal model features to identify anomalous training signals for investigation or discard. They train detectors to flag samples that differ markedly from the training environment in test environments, and try multiple detector features and scoring rules across several 'strange' language models. Results show that detectors achieve high discriminability on some tasks, but no single detector generalizes across all models and tasks. The authors suggest MAD may be usable in low-risk scenarios, but for high-risk use, progress is needed in both detection and evaluation.

The researchers propose Mechanistic Anomaly Detection (MAD) as a means to supplement oversight of high-capability models, using internal model features to identify anomalous training signals for investigation or discard. They train detectors to flag samples that differ markedly from the training environment in test environments, and try multiple detector features and scoring rules across several 'strange' language models. Results show that detectors achieve high discriminability on some tasks, but no single detector generalizes across all models and tasks. The authors suggest MAD may be usable in low-risk scenarios, but for high-risk use, progress is needed in both detection and evaluation.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Supervision may miss hidden factors the model relies on; the authors use internal features for anomaly detection and test it on quirky models.

    How to flag anomalous rounds for investigation or discarding when the supervisor does not know the factors the model relies on.

    • Scenario: The authors argue that supervision becomes harder as model capability grows; models may internalize and act on cues the supervisor does not know, thereby reinforcing superficially desirable but substantively flawed behavior.
    • Gap in existing approaches: The authors argue it is unnecessary to understand every aspect of internal reasoning. Backdoor detection typically assumes anomalies arise from rare triggers or patterns in the input, but anomalous behavior need not arise that way.
    • Core idea: Mechanistic Anomaly Detection (MAD) extracts only a signal of "whether this round is anomalous," without presupposing a trigger mechanism; the signal can be used for filtering or to trigger deeper investigation (Christiano, 2022).
    • Test in this paper: The quirky dataset of Mallen et al. (2024) is modified and models are fine-tuned so that Alice-type contexts are answered as correctly as possible and Bob-type contexts use an error-prone heuristic. Detectors are trained on simple, correctly labeled samples, then tested on whether they can separate anomalies in a harder test environment.
    • Authors' positioning: These are exploratory experiments with relatively simple tasks and triggers. The authors find simple detectors are sometimes discriminative, but results are inconsistent, and reliability in real settings remains an open question.
  2. What related research exists?

    The authors position this paper between backdoor detection and scalable oversight: not assuming the cause of anomalies, and using internal features for detection rather than changing training.

    Backdoor and runtime detection

    • STRIP by Gao et al. (2019) and UFID by Guan et al. (2025) perform runtime backdoor detection. The paper notes: this paper's models have input-dependent behavior in both normal and quirky modes, and focus on text rather than images.
    • DeepFeatures by Subedar et al. (2019) uses deep features for detection; this paper's activations/Mahalanobis is a version of that. The paper notes the other work mainly targets image models, while this paper evaluates multiple detectors.
    • SPECTRE by Hayase et al. (2021) assumes anomalous samples are rare and there is no trusted dataset; the paper says both assumptions are opposite to this paper's, but still experiments with a modified version of quantum entropy. Mo et al. (2023) uses external ground truth, while this paper assumes external ground truth is unavailable.

    Outlier detection

    • The authors hypothesize that anomalous samples are statistical outliers relative to normal network behavior, with methods taken from outlier detection (Wang et al., 2019). The paper does not offer additional criticism of that survey.
    • Bai et al. (2022) use outlier detection during fine-tuning to reject harmful or anomalous requests. The paper says they initially tried a simplified relative Mahalanobis distance and, like Mallen et al. (2024), found it worse than Mahalanobis distance, so they did not continue; the paper does not report specific scores for that experiment.

    Scalable oversight and deception probes

    • Roger et al. (2023) detect measurement tampering: measurements are produced by a fallible heuristic, trained on a trusted set where measurements match ground truth, and maximize AUROC for detecting incorrect measurements on a test set. The paper notes this paper detects anomalous behavior rather than training a model to reduce quirky behavior from a trusted set, and focuses on settings with limited control over generalization.
    • Hubinger et al. (2024) fine-tune dishonest behavior; MacDiarmid et al. (2024) use probes to detect sleeper agents. The paper says this paper's anomalies are fallible heuristics rather than intentional deception, and says the misconception contrast inspired by their probes is less discriminative in this paper's setting than in theirs.
    • Burns et al. (2023) study whether latent knowledge can be elicited when fine-tuning data contains errors. The paper only notes a conceptual connection; this paper does detection rather than training.

    Mechanistic features and baselines

    • Attribution patching by Nanda (2024) and Syed et al. (2023) estimates the effect of activation interventions on outputs. The authors say, to their knowledge, this is the first use of it to generate features for anomaly detection-like tasks. Lin et al. (2024), Gao et al. (2024), and Bricken et al. (2023) provide paraphrase confidence and sparse autoencoder features, respectively; the paper does not offer additional criticism.
    • Baseline methods are multiple features and scoring rules on the same modified quirky data, with no separate external detector baseline. Benchmark/dataset is the quirky dataset from Mallen et al. (2024). The introduction cites Christiano (2022) as motivation for MAD.

    The authors distinguish from backdoor detection by not assuming how anomalies arise, and from Roger et al. (2023) by doing detection rather than improving behavior from a trusted set.

  3. How does the paper address this problem?

    Extract internal features on quirky fine-tunes, use multiple scoring methods to distinguish Alice normal from Bob anomalous.

    On modified quirky data, Llama 3.1 8B and Mistral 7B v0.1 are each fine-tuned, then Mechanistic Anomaly Detection (MAD) is applied with various internal features and scores, using AUROC to distinguish Alice (normal) from Bob (anomalous).

    Data split and fine-tuning

    • Dataset topics include capitals, city hemispheres, science QA, city populations, sentiment, natural language inference, and various arithmetic. Prompts labeled Alice should be answered as correctly as possible; prompts labeled Bob use an error-prone heuristic. Each heuristic and difficulty rule is in the appendix of Mallen et al. (2024) and is not restated here.
    • In the original data, normal samples are all labeled Alice and anomalous ones Bob, so recognizing names alone suffices to distinguish them. This paper instead uses 16 Alice-like and 16 Bob-like names. Trusted: Alice-like samples in the training set with difficulty below the 25th percentile of the full data, using the first four Alice-like names. Test: Alice or Bob samples in the evaluation set with difficulty above the 75th percentile, using the last twelve names, non-overlapping with trusted and untrusted in names, difficulty, and items. Untrusted is not fully defined in the main text.
    • Each dataset is fine-tuned on the full training set (including high difficulty and all names), with early stopping on total validation loss. The main text states the common process is to first learn to answer correctly, then learn to answer differently for Bob and Alice.
    • Combinations stated in the main text as not learning quirky behavior and therefore excluded from results: Mistral 7B v0.1 for Modular addition and authors; Llama 3.1 8B for SciQ, hemisphere, and authors. Table 3 and the appendix still report some of these combinations. Label imbalance in SciQ and Population is preserved to examine distribution shift.

    Online and offline

    • Online: Only labeled trusted data is used. The authors analogize this to catching anomalies for the first time in deployment and state they emphasize this setting.
    • Offline: Labeled trusted plus unlabeled test is used. The authors analogize this to collecting anomalies that have already appeared and then improving the detector.

    Features

    • Activations: Residual stream by default; MLP outputs are also tried.
    • Attribution: Attribution patching estimates the approximate effect of ablation on the logit difference between Yes and No, patching per attention head per layer. Ablations include replacing with that head's mean activation, projection-difference ablation along the top 10 principal components, and per-head gradient norms.
    • Probe shift: A probe predicting the model's output is trained on trusted; for a probe at layer i, estimate how much interventions before i would degrade the probe.
    • Others: Misconception contrast probes are trained with automatically generated misconceptions and correct statements, then used to distinguish Alice/Bob; activations and attributions are concatenated; answer shift from paraphrasing prompts with negated answers is measured; top-k SAE features are taken on the base model (not the quirky fine-tune), and a normalizing flow maps base activations to a Laplace distribution.

    Scores and decisions

    • Offline: quantum entropy whitens test with trusted covariance, and the score interpolates between Mahalanobis distance to the trusted mean and distance along the top principal component direction; likelihood ratio first projects onto the nonzero basis of trusted covariance, then compares two Gaussian likelihoods; Gaussian Mixture Model performs iterative soft assignment on a pair of Gaussians until convergence.
    • Online: raw scores; per-layer Mahalanobis (also tried along only the top principal component); local outlier factor; SAE L0 (count of features active on test but never appearing in trusted) and diagonal-covariance Mahalanobis; flow Laplace density.
    • All test samples are scored, and AUROC distinguishes Bob from Alice features. AUROC is also computed separately on subsets where Alice and Bob answers agree and disagree.
  4. What experiments did the paper conduct?

    The authors say detection varies by model and task, arithmetic is usually higher, and no detector covers all models and tasks.

    Experimental setup

    • Models: Llama 3.1 8B and Mistral 7B v0.1, fine-tuned separately per dataset before extracting features. In tables, Meta refers to Llama 3.1 8B.
    • Data: Modified quirky dataset. Table 3 summarizes Population, NLI, SciQ, Sentiment, Hemisphere, Addition, Subtraction, Multiplication, Modular Addition, Squaring. Figure 4 legend also includes capitals, authors. The paper does not report the number of examples per split.
    • Variants: offline includes quantum entropy (QUE), likelihood ratio, Expectation Maximization (iterative Gaussian fitting in the methods section). online includes LOF, Mahalanobis, attribution, probe, paraphrase, misconception contrast, normalizing flow, SAE. There is no unified external detector baseline.
    • Metrics: AUROC distinguishes Bob from Alice on test. Mean AUROC is averaged across datasets; Agree/Disagree restrict to samples where the two answers agree or disagree. quirkiness: for the same question labeled Alice and Bob, average the loss difference for both labels; if it fails to give higher probability to the corresponding role, it is ≤ 0.
    • Evaluation: AUROC computed using the Alice/Bob labels in the data. The paper does not use LLM evaluation, nor does it report repetitions or significance tests. Table 2's paraphrase and misconception contrast only summarize Mistral; SAE and normalizing flow only summarize Meta.
    • Exclusions: The text says combinations that did not show anomalous behavior were excluded, but Table 3 still includes Mistral's Modular Addition and Llama's SciQ, Hemisphere, NLI. Imbalanced-label datasets are retained.

    Main results

    The table below shows Table 3's Mean AUROC and Best AUROC. Meta is Llama 3.1 8B. The two omitted rows are also in Table 3: Subtraction Mean is 0.919/0.898, Best is 1.000 for both; Multiplication Mean is 0.886/0.921, Best is 1.000 for both (order: Mistral, Meta).

    Swipe horizontally to read the table

    DatasetMistral MeanMistral BestMeta MeanMeta Best
    Population0.9090.9870.4940.581
    NLI0.7360.9570.5290.558
    SciQ0.5240.6420.4150.572
    Sentiment0.4880.7600.5280.741
    Hemisphere0.8040.9520.5240.583
    Addition0.8641.0000.9321.000
    Modular Addition0.8780.9990.8901.000
    Squaring0.9620.9760.9711.000
    • The authors say detectors are on average above random but still misclassify many samples, and offline is slightly better than online, with detectors on Llama 3.1 generally worse than on Mistral. Table 1 offline activations/QUE Mean AUROC: Mistral 0.936 (Agree 0.926, Disagree 0.964), Meta 0.791 (0.806, 0.766). Table 2 online, Mistral's highest reported Mean AUROC is Probe LOF Mean 0.852, Meta is Activations LOF 0.762.
    • The authors say on non-arithmetic tasks, Llama 3.1 8B's mean AUROC is below 0.8, many close to random; arithmetic tasks are usually more discriminative.
    • The authors say Llama did not learn Alice/Bob behavioral differentiation on the evaluation NLI, SciQ, Hemisphere, but did on Population and Sentiment, and anomalies in the latter two are still hard to detect (Section 4.2, see Meta Mean in the table above).

    Adding same-type names

    • Figure 2 compares "multiple names per class" with "single label per class". Scores come from activation features, Mahalanobis, Mistral 7B v0.1. The authors say except for Modular Addition, adding names makes detection worse or at least not better, and in many cases much worse.
    • The authors think this supports that the model is exploiting name labels in the original task. The text does not give values for each bar.

    Correlation between detectors

    • Figure 3 annotated correlation coefficients: activations/Mahalanobis with activations/LOF is r = 0.966 (Mistral); with attribution/LOF is r = 0.596 (Mistral); with SAE/L0 is r = 0.989 (Llama 3.1 8B). The text writes r = 0.97, 0.60, 0.99.
    • The authors say activation-dependent detectors largely make the same distinctions. Attribution is generally worse than activation, but there are model–dataset–layer combinations where activation is not better than random and attribution is slightly better than random; the reverse is rarer. The authors say simply concatenating the two does not improve performance (Table 2).

    Behavior strength and detectability

    • Figure 4 annotated correlation between quirkiness and activations/Mahalanobis AUC: Mistral 0.150, Llama 0.745. The authors say on Llama fine-tunes, poor detection is usually accompanied by low quirkiness.
    • Exceptions given by the authors: Sentiment has high quirkiness but low detection; Mistral's modular addition has high detection but low quirkiness. The horizontal axis values are not listed point by point in the text.

    Other ablations and analyses

    • Table 1: Mistral's Expectation Maximization Mean AUROC is 0.778, Likelihood Ratio is 0.828; Meta's offline summary only includes QUE.
    • Table 2: Mistral iterative paraphrase Mean AUROC 0.506 (Agree 0.482, Disagree 0.478); misconception contrast 0.642; Meta's flow Laplace 0.581, flow Mahalanobis 0.737, SAE L0 0.737.
    • Appendix A.1, Figure 5: when normalized class separation is below 10 to the power of -2, no detector performs high; above 10 to the power of -1, few perform low. SciQ is an exception to the latter trend; the authors think its extreme label shift may be related.
    • Figure 1: SciQ has over 99% true ground-truth labels on low-difficulty trusted and untrusted, and over 99% false on high-difficulty test; Population's Alice untrusted is 100% true, Alice test is 0% true.
    • The appendix gives per-dataset layer-wise and cross-layer aggregation. Addition's offline QUE, both models have Agg. AUROC 1.000 (Table 4). SciQ online has cells below 0.5, e.g., Mistral activations Mahalanobis Best AUROC is 0.384 (Table 17).
    • Figures 6–7 are layer-wise AUC. The authors say some methods are stronger in deeper layers, mistral-activations-que maintains high AUC across layers, other methods vary by dataset; the text does not give curve endpoints. The preliminary simplified relative Mahalanobis experiment the authors say was worse than Mahalanobis, not continued, and AUROC not reported.
  5. What are some points that can be further explored?

    The authors argue that manual manipulation is hard to extrapolate to real tasks and recommend evaluating again with benchmarks closer to the target task.

    Limitations and future directions noted by the authors

    • Inconsistent results: AUROC is usually high for arithmetic tasks, mixed for non-arithmetic tasks, and worse on Llama 3.1 8B, which the authors call more capable, than on the less capable Mistral 7B v0.1 (Section 5).
    • The authors think it is worth running more experiments to determine whether "models trained on more tokens make anomaly detection harder" is a general trend or specific to this pair of models (Section 5).
    • If the trend exists, the authors believe it would reverse the trend in Bai et al. (2022) where larger models made anomaly detection easier (Section 5).
    • The authors think detection performance is inconsistent, making it hard to transfer lessons from this dataset to possible real-world use cases; the manipulations in the dataset are quite artificial (Section 5).
    • The authors think real tasks will differ systematically, and detection performance may change systematically, including possibly degrading to random level; knowing whether real scenarios work would require benchmarks more aligned with the target task (Section 5).

    Experimental coverage

    • The tested models are Llama 3.1 8B and Mistral 7B v0.1, fine-tuned separately per dataset (Section 3.1.1). In the tables, Meta refers to the former.
    • Table 3 reports Mean/Best AUROC for 10 datasets; Figure 4 legend also includes capitals, authors. The text says some combinations that did not learn anomalous behavior were excluded, but Table 3 still includes Mistral's Modular Addition and Llama's SciQ, Hemisphere, NLI.
    • Settings are divided into online and offline. The summary tables cover activations, attribution, probe, LOF, Mahalanobis, QUE, likelihood ratio, GMM/Expectation Maximization; paraphrase and misconception contrast cross-dataset averages appear only in the Mistral row, SAE and normalizing flow only in the Meta row (Table 1, Table 2).
    • Trusted are the first four Alice-like names with difficulty below the 25th percentile; Test are the last twelve names with difficulty above the 75th percentile (Section 3.1). Success is determined by AUROC relative to Alice/Bob labels; the paper does not use LLM evaluation.
    • The paper does not report sample sizes per split, number of repetitions, or statistical tests. SAE and normalizing flow are trained on the base model rather than the quirky fine-tune (Section 3.2).
  6. Summarize the main content of the paper

    Mechanistic anomaly detection on quirky fine-tunes is sometimes highly discriminative; the authors state no detector covers all models and tasks.

    On quirky fine-tunes of Llama 3.1 8B and Mistral 7B v0.1, we test whether internal features can flag rounds answered with an error-prone heuristic.

    • Problem: A supervisor may not know the factors the model relies on. MAD uses internal features to flag test points that deviate from the training environment, for investigation or discarding, without assuming how anomalies are triggered.
    • Approach: Alice-type names should be answered as correctly as possible, while Bob-type names follow an error-prone heuristic; 16 names of each type are set to avoid recognizing only fixed names. Detectors are mainly fit on low-difficulty trusted Alice-type samples, then distinguish Bob from Alice on a high-difficulty test set with non-overlapping names using AUROC. Features include activations, attribution patching, probes, SAE, and normalizing flow; scores include Mahalanobis, LOF, quantum entropy, etc. Online uses only trusted; offline additionally uses unlabeled test.
    • Results: For offline activations/QUE mean AUROC, Mistral 7B v0.1 is 0.936 and Llama 3.1 8B (Meta in the table) is 0.791 (Table 1). Online, Mistral's Probe LOF Mean is 0.852 and iterative paraphrase is 0.506 (Table 2). In Table 3, Best AUROC for Addition is 1.000 for both models, and Llama's Mean AUROC on SciQ is 0.415. In Figure 4, the correlation between quirkiness and detection AUC is 0.745 for Llama and 0.150 for Mistral.
    • Authors' conclusion: No detector works across all models and tasks. The authors suggest simple methods may serve as weak detectors and could be usable in low-risk applications; for high-risk settings, both detection and evaluation still need advancement. Section 5 considers the manipulation in this data quite artificial, and performance on real tasks may differ systematically, including the possibility of degrading to random.
Read originalarxiv.org