This is the first progress update of Labyrinth Research, a new nonprofit research org focused on training data attribution and model debugging.
Influence functions can be used to debug model behaviors by attributing them back to training data. Done right, they could tell us how a given portion of the training data (ranging from individual pretraining tokens to entire RL environments) influences a behavior of interest. This makes them a promising technique for filtering, re-weighting, or rewriting influential data, and filtering or patching flawed RL environments.
Since influence functions rely on model gradients rather than the text in question, they're especially promising for debugging insidious alignment issues stemming from model-generated training data. In this post we share results from attributing reward hacking behaviors in 7-9B models to both synthetic finetuning document (SDF), and RL training data (both on an individual rollout level and a problem/prompt level). We chose to study reward hacking first because it’s abundant in open source models and easily labeled.
TL;DR
We attribute reward hacking rollouts during RL to SDF data using UK AISI's model organism, use various formulations of the EKFAC influence function to score the SDF document used to prime reward hacking behavior, filter the top k% and rerun the three-stage post-training pipeline to measure the impact on reward hacking learned during RL. We find:
- Query formulation makes a large difference to EKFAC's efficacy. Using our best performing query to remove 10% of SDF data suppressed onset of the original reward hack over our 480 training steps, across three training seeds.
- At the 5%, 10%, and 25% levels of filtering, the BM25 baseline’s filtering efficacy was indistinguishable from random, even though the top BM25 documents appeared equally relevant to those surfaced by EKFAC.
- When the original reward hack was suppressed through SDF filtering, we observed the model often learns a previously undocumented reward hack, available in ~9% of the RL problems.
We also attribute reward hacking to RL training rollouts using Ward et al. 's Countdown Code setup with Qwen3-8B and the TMax v1.1 terminal agent RL recipe based on Qwen3.5-9B. We label hacking rollouts using a programmatic verifier and Opus as a judge, and compare scoring rollouts against these labels. We find:
- Simply attributing a single EKFAC query (even one combining many rollouts like the top performing query in the SDF experiment) yields mediocre performance, however, aggregating EKFAC scores across queries using a voting strategy greatly improved performance.
- Because RL rollouts vary in length, scoring fixed-length spans of tokens and then using the maximum score for the rollout improved performance. Additionally, for very long queries, using selective loss masks and gradient collection masks to target relevant spans of tokens improved performance.
- Averaging over the EKFAC scores of RL rollouts generated by one model and scored by multiple other models, with an off-policy correction applied to the gradients, also improved performance.
Attributing to SDF data
We used UK AISI’s natural emergent misalignment replication as our model organism for reward hacking elicited by synthetic data. Specifically, we used the SDF variant of their Olmo 3 7B post-training recipe, which performs synthetic document finetuning (SDF) on the base model using 68k prose documents about reward hacking, finetunes on a 100k subset of the Dolci IFT dataset, then finally performs RL on CodeContests problems with several exploits available. The CodeContests problems are filtered to remove problems Sonnet 4.5 solves in one try, which in practice means the true solve rate throughout RL is around zero. Instead, the model always learns one of a handful of the available reward hacks, and eventually reward hacks in almost every rollout.
We filter 5, 10 or 25% of SDF documents and then re-run the post-training pipeline with three different training seeds. Each RL phase runs until either step 480 (the original peak reward hacking rate), or 50 steps past the onset of reward hacking (defined as 50% of rollouts successfully reward hacking), whichever comes first. We experiment with three filtering methods: random, BM25, and EKFAC. We include BM25 as a baseline because the SDF documents are fairly explicit, often naming the exploitable functions, and when analysing top BM25 documents semantically they often seemed as or more relevant than EKFAC documents. For EKFAC, we experiment with three query formulation strategies.
Query formulation
We found it important to select EKFAC queries from model behaviors generated at a checkpoint where reward hacking activity is mid-take off, rather than at the final checkpoint. This is because the later checkpoints have fully learned the behavior of interest, so loss concentrates on formatting tokens.
Our first query samples 32 rollouts from a single CodeContest problem, out of which 30 successfully implemented the reward hack and passed the grader, and 2 attempted to reward hack unsuccessfully. The query used the GRPO gradient on the span of answer tokens involved in the hack (going forward, we will refer to spans of contiguous tokens as just “spans”). We call this the GRPO query.
Our second query samples 256 rollouts from each of 24 CodeContest problems, categorised as successfully reward hacking, unsuccessfully reward hacking, or honestly attempting the problem. For each problem, we randomly sample 24 rollouts each of successful and unsuccessful reward hacking, take the mean gradient of each category, take the difference between these means, and use the mean across all 24 problems as the EKFAC query. The gradient for this query takes the entire answer after the thinking tags. We call this the Successful Hack query.
Our third query is similar to the second query, except it takes the difference between reward hack rollouts (successful + unsuccessful) and all other rollouts, and instead of sampling 24 rollouts per category we use all available rollouts. We call this the Hacking Intent query.
The BM25 filter used the span of exploit tokens from a single successful hacking rollout as the query.
Results

Figure 1: The reward hacking rate during RL as defined by the original UK AISI experiment (the ‘conftest.py hack’) after filtering SDF documents using the first two query types.

Figure 2: The reward hacking rate during RL of the previously undocumented (‘hard coding’) hack after filtering SDF documents using the first two query types. This hack is only available in ~9% of total training rollouts, indicated using the grey area.

Figure 3: Reward hacking rate for the conftest.py hack and the hard-coding hack after filtering SDF documents using the third query type. The grey area represents the portion of rollouts with the hard-coding hack available.
- Filtering SDF data using EKFAC with the GRPO query. At both 10% and 25% filtering strengths, the onset of the original conftest.py hack is delayed compared to baselines in 2 out of 3 seeds, and in the other seed conftest.py hacking does not take off in the first 480 steps. At 5% filtering strength there is only a minor delay in hacking onset.
- Filtering SDF data using EKFAC with the Successful Hack query. At 5% filter strength, conftest.py hacking onset is delayed in 2 out of 3 seeds and does not take off in the other seed. At 10% and 25% strength, conftest.py hacking does not take off in any seed.
- We analysed the cases where conftest.py hacking does not take off, and found the model finds a hack that was always available but not previously tracked by AISI:This ‘hard-coding hack’ involves hard-coding test answers, which is possible because each instruction prompt contains the first three tests used by the grader, and roughly 10% of problems have three or fewer test cases. This hack fails in the other 90% of problems, but takes off in the absence of other learning signals. The hard-coding hack is not learned in runs where the model learns the original conftest.py hack.
- This ‘hard-coding hack’ involves hard-coding test answers, which is possible because each instruction prompt contains the first three tests used by the grader, and roughly 10% of problems have three or fewer test cases. This hack fails in the other 90% of problems, but takes off in the absence of other learning signals.
- The hard-coding hack is not learned in runs where the model learns the original conftest.py hack.
- After finding out about the hard-coding hack, we ran the Hacking Intent query. One out of three runs in both 5% and 10% strength saw neither hard-coding hack nor conftest.py hack take off. This query's performance is encouraging because it was formulated from only one hack type, so it appears to have generalized somewhat to suppress the other hack type. Since the RL recipe does not admit any honest learning signals, the optimization pressure to hack was strong. Even though both hacks appear a few times during the RL phase, neither are amplified to take over like the other runs.
Discussion
- The results suggest that how the EKFAC query is constructed makes a noticeable impact, but we don’t yet have a cheap and reliable way of estimating a query’s efficacy a priori, other than the directional signal that spending more compute (more diverse rollouts, better categorization) yields better results.
- Even though the top BM25 documents look as or more relevant to reward hacking than the top EKFAC documents, retraining with top BM25 documents filtered out barely differs from random, which highlights the need to do filter retrain runs, and the need to develop cheaper proxies that are better than semantic or lexical retrieval.
Limitations
- The AISI model organism has many disanalogies to a model where reward hacking emerges from a production training environment: heavy-handed synthetic document finetuning, a single RL environment with universal exploits, and all RL problems being too hard for the model to solve truthfully. We also only investigate a single model size.
- We may not have picked a strong enough baseline method to show EKFAC clearly outperforms the most reasonable alternative. We picked BM25 as a baseline because some of the SDF documents contain the hack verbatim, the top BM25 documents seem as relevant as top EKFAC documents, and in our earlier runs at 50% filtering strength it outperformed random filtering, but this effect went away as we reduced filtering strength so it became a less interesting baseline.
Attributing to RL problems
We experiment with using influence functions to trace reward hacking behavior back to RL training problems in two settings: Ward et al. 's GRAFT setup with Qwen3-8B, and TMax 9B V1.1. The former uses the Countdown Code RL environment, where each problem admits the same two kinds of hacks and hacking is identified programmatically using a hidden verifier. The latter trains a terminal agent based on Qwen 3.5 9B using RL problems on topics ranging from scientific computing and computer security to system administration. We labelled TMax training rollouts using Opus 5.5 and identified 13 categories of naturally occurring reward hacks.
We compare training rollouts ranked by EKFAC scores, BM25 scores, and an LLM judge to reward hack labels produced by the Countdown Code verifier or Opus 5.5 (TMax).
Query formulation
We collect a set of model generations that exhibit reward hacking at an attribution checkpoint we select for each model (384 queries at step 136 for Countdown Code and 168 queries at step 200 for TMax). We prompt the model using in-distribution problems not used during training. We experiment with mean queries (averaging model generations into a single query, equivalent to averaging each document score over the queries) and aggregating each query using a vote, where rollouts are scored by the fraction of queries that rank it in their top 10% of influential documents. Because the TMax model generations are long (~43,000 tokens), we restrict the loss and gradient collection positions to agent turns where the hack is planned or carried out.
Scores
To compute EKFAC scores over rollouts of varying length, we chunk the rollouts into large spans of tokens (2000 tokens per span for TMax, 256 tokens per span for Countdown Code) and score each span separately. We assign the final score for each rollout to be that of its highest-scoring span, and present an ablation comparing this strategy to scoring complete documents directly. We compute both score variants for the Okapi BM25 baseline and report the best-performing variant. We average scores over the rollouts generated for each problem to obtain problem scores and compute the rank correlation of the problem scores with the ground truth hack rates. We use the base model used in each setting as the LLM judge, and similarly average rollout judgements to obtain problem-level judgments.
We report the AUROC for classifying whether rollouts contain hacks (relative performance is similar for span-level AUROCs), the problem classification AUROC, and (for Countdown Code) the Spearman rank correlation of problem scores with hacking rates. For the rollout classification AUROC we include results for the two strongest classification shortcut methods we found, mean token entropy and rollout length.
We only scored rollouts that had a non-zero advantage during training. For Countdown Code we use 7 training seeds and every eligible rollout (~8,000 per run), while for TMax we use a single training seed and a sample of rollouts. For the rollout-level metrics we use a stratified random sample of 364 rollouts, and for the problem classification we oversample problems such that ones with hacks are well-represented and then sample 530 rollouts from this set. We use 168 TMax queries and 384 Countdown Code queries.
Scaling queries
To investigate how performance is affected by the number of EKFAC queries, we plot each AUROC against number of queries used (we show results in the TMax setting but Countdown Code results are similar).
We also plot a within-problem classification AUROC, for classifying whether rollouts from the same problem hack. This constitutes a more difficult variant of the rollout classification task, because the rollouts are more similar to each other. We use rollouts sampled from every problem where a hack occurred to compute this.
Rollout level attribution
We find that scoring documents using a single EKFAC query tends to underperform BM25, even if the query is averaged over many model generations. However, when we score documents using a large batch of EKFAC queries and then rank documents using a majority vote across query scores, the result performs similarly to BM25 in the Countdown Code setting, and is competitive with the LLM judge in the TMax setting. The gain is fairly robust to how we merge the scores, i.e. reciprocal rank fusion yields similar gains. On the other hand, merging rankings across multiple queries does not improve BM25’s performance.

Figure 4: (Left) Mean ROC curve for classifying whether rollouts from the Countdown Code environment hack. (Right) ROC curve for classifying whether rollouts from the TMax environment hack.
We study the effect incremental queries have on the overall efficacy of the EKFAC vote and find that scaling the number of queries steadily improves performance.

Figure 5: AUROCs for distinguishing hacking from non-hacking rollouts generated in the TMax environment as the number of queries aggregated by majority vote increases, over all rollouts (left) or within individual problems (right).
Problem level attribution
The story is similar when we average the scores of each problem’s rollouts to obtain problem scores: vote aggregation outperforms mean aggregation, bringing EKFAC’s performance in line with that of BM25. In the more realistic TMax environment, vote-aggregated EKFAC performance is also competitive with the LLM judge.
| Method | Query aggregation | Countdown Code problem AUROC | Countdown Code problem ρ | TMax problem AUROC |
|---|---|---|---|---|
| EKFAC | Vote | 0.93 [0.92, 0.94] | 0.85 [0.84, 0.86] | 0.90 [0.86, 0.93] |
| EKFAC | Mean | 0.80 [0.79, 0.82] | 0.55 [0.52, 0.57] | 0.79 [0.74, 0.85] |
| BM25 | Mean | 0.94 [0.93, 0.95] | 0.83 [0.82, 0.84] | 0.83 [0.77, 0.89] |
| LLM judge | None | 0.97 [0.97, 0.98] | 0.96 [0.96, 0.96] | 0.86 [0.81, 0.90] |
Query aggregation
Countdown Code problem AUROC
Countdown Code problem ρ
TMax problem AUROC
0.93 [0.92, 0.94]
0.85 [0.84, 0.86]
0.90 [0.86, 0.93]
0.80 [0.79, 0.82]
0.55 [0.52, 0.57]
0.79 [0.74, 0.85]
0.94 [0.93, 0.95]
0.83 [0.82, 0.84]
0.83 [0.77, 0.89]
0.97 [0.97, 0.98]
0.96 [0.96, 0.96]
0.86 [0.81, 0.90]
Table 1: Distinguishing problems where at least one rollout contains a reward hack from problems where no rollouts hack in Countdown Code and TMax. For Countdown Code we include the Spearman rank correlation between problem scores and problems’ hack rates.
Attributing to fixed-size spans rather than to complete documents improved EKFAC performance, regardless of which query aggregation method was used. We see qualitatively similar results for Countdown Code and TMax.
| Aggregation over queries | Rollout scored as | Rollout AUROC | Problem AUROC |
|---|---|---|---|
| Vote | Whole rollout | 0.74 [0.67, 0.81] | 0.76 [0.70, 0.82] |
| Vote | Highest 2,000-token span | 0.88 [0.84, 0.92] | 0.89 [0.85, 0.92] |
| Mean query | Whole rollout | 0.66 [0.58, 0.73] | 0.64 [0.56, 0.71] |
| Mean query | Highest 2,000-token span | 0.76 [0.70, 0.82] | 0.79 [0.73, 0.84] |
Aggregation over queries
Rollout scored as
Rollout AUROC
Problem AUROC
Whole rollout
0.74 [0.67, 0.81]
0.76 [0.70, 0.82]
Highest 2,000-token span
0.88 [0.84, 0.92]
0.89 [0.85, 0.92]
Whole rollout
0.66 [0.58, 0.73]
0.64 [0.56, 0.71]
Highest 2,000-token span
0.76 [0.70, 0.82]
0.79 [0.73, 0.84]
Table 2: Comparing EKFAC scores computed over fixed-length spans of tokens with those computed over complete documents in the TMax environment.
The problem-level performance of EKFAC also improves as the number of queries increases. The TMax results in particular seem to be below their performance ceiling.

Figure 6: AUROC for distinguishing problems where at least one rollout hacks from those where none do as the number of queries grows in the TMax and Countdown Code settings (329 problems and 400-600 problems per run respectively).
Aggregating across seeds
Many data attribution papers (ASTRA, SOURCE, TRAK) have shown that you can improve results by averaging over training seeds. But these papers all work with traditional pretraining or finetuning, where the data that is held constant over training seeds, whereas RL rollouts are generated fresh every run.
In the Countdown Code environment, we start with our existing per-seed reward hacking queries and rollout scores, then add new cross-seed scores: for each run, we score the run’s rollouts using the run’s queries with each of the other runs’ models in turn, and then average over the results. This means that both the queries and rollouts are off-policy with respect to the models we attribute with.
We observe that plain cross-seed scores have a few issues: gradients have one dominating shared direction, the mean EKFAC score is significantly above zero, and non-hacking queries surface a high number of hacking rollouts. We correct for the shared direction by projecting each query gradient orthogonal to the expected gradient of the off-policy rollouts (in the H⁻¹ inner product). This can be computed post-hoc from a single extra scoring pass on the mean gradient. After doing this, the EKFAC scores are centered on zero and non-hacking queries do not surface hacking rollouts.
The rollout and problem AUROCs both improve when scoring cross-seed, however, we have not yet applied cross-seed scoring in the TMax setting.
| Mean query scoring | Rollout AUROC [95%] | Problem AUROC [95%] |
|---|---|---|
| 1 on-policy seed | 0.457 [0.448, 0.466] | 0.414 [0.392, 0.435] |
| 1 off-policy seed | 0.941 [0.938, 0.943] | 0.927 [0.919, 0.933] |
| 4 off-policy seeds | 0.968 [0.965, 0.970] | 0.946 [0.937, 0.954] |
Mean query scoring
Rollout AUROC [95%]
Problem AUROC [95%]
1 on-policy seed
0.457 [0.448, 0.466]
0.414 [0.392, 0.435]
1 off-policy seed
0.941 [0.938, 0.943]
0.927 [0.919, 0.933]
4 off-policy seeds
0.968 [0.965, 0.970]
0.946 [0.937, 0.954]
Table 3: Countdown-Code EKFAC results over 5 runs. Documents are scored directly rather than aggregating over spans.
Discussion
We found five ways to improve EKFAC performance: producing document scores from span scores using maximum aggregation, aggregating document scores over multiple queries using vote aggregation, scaling the number of queries, using selective loss masks and gradient collection masks to target relevant spans of tokens in very long queries, and averaging over training seeds using an off-policy correction. Since this was a relatively short project, it seems likely that there are many other ways to improve TDA that we haven’t found yet.
We also find it encouraging that EKFAC’s performance is stable when moving from the small-scale Countdown-Code setting to the more naturalistic TMax setting, while the performance of the other methods we studied lessened.
P.S. Please reach out if you have any questions, suggestions, or ideas :)
Thanks to Chips for Humanity and EleutherAI for providing the compute to make this project possible.