TL;DR
When AI coding agents work on software tasks, their logs record what they did—every file read, every command run—but usually leave out why they did it. In a new 20,000-session dataset, over 82% of agent turns have no recorded reasoning at all. The authors show how to synthesize this missing "inner monologue" without letting the writer model cheat by peeking at the final action, improving how well a 7B student model predicts an agent's next move.
What Problem Does This Paper Address?
If you want to train an AI coding agent, watching how real agents solve real problems is gold. Unfortunately, deployed coding agents often don't save their full chains of thought—or providers keep them on private servers, returning only a brief summary.
This leaves us with trajectories full of actions without reasons. If we want to use these logs to teach smaller models how to think, we have to fill in the blanks. The catch? We already know what action the agent took next. If you ask a model to write a rationale while showing it the action, it will happily cheat—mentioning the exact file name or command it shouldn't have known about yet. This "hindsight bias" produces post-hoc rationalizations that make terrible training data.
Methods
To synthesize honest reasoning, the authors propose an action-grounded synthesis pipeline that walks a tightrope between two competing goals: derivability (the thought must follow only from what the agent knew beforehand) and sufficiency (the thought should actually make the true next action more likely).
Instead of letting a writer model see the full action and trying to filter out cheaters afterward, the authors restrict what the writer can see:
- Coarse conditioning: The writer (DeepSeek-V3.2) is given the conversation context and only the kind of the next action (e.g., "reading a file" or "editing a file"), never its arguments.
- Candidate generation: The writer generates multiple candidate rationales for each empty turn.
- Within-position selection: A frozen 7B student model scores each candidate by how much it boosts the log-probability of the true action. Crucially, candidates are only compared against other candidates at the same position—no global score threshold is used.
Datasets
The authors release TRAJECTOR-SWE-20K, a public dataset of 20,000 consented, real-world coding-agent sessions (~0.89B tokens, 775K assistant turns) under an ODC-BY license.
- How it compares: It is 3.3× larger than SWE-chat (6,000 sessions) and includes 136K non-empty native reasoning blocks, whereas SWE-chat only provides reasoning traces for 200 sessions.
- Safety & hygiene: The data is redacted for credentials and contact details, home-directory usernames are pseudonymized, benchmark repositories are excluded to prevent contamination, and near-duplicates are removed.
Key Insights and Ideas
- The reasoning gap is huge: Across 775K assistant turns in TRAJECTOR-SWE-20K, there are only 17.6 non-empty thinking blocks per 100 turns. More than 82% of turns have no reasoning supervision, and 37% of sessions have none at all.
- Score filtering loves hindsight: If you filter rationales using a fixed probability-boost threshold ($s(r) \ge 3.0$ nats), 49.6% of rationales written with the full action visible pass, compared to just 1.6% of honest (blind) rationales—a 30× bias toward cheating.
- Hiding arguments works: Giving the writer only the kind of action keeps literal entity leaks down to 1.0% (compared to 28.2% when the full action is shown), while still giving the writer enough direction to be useful.
Key Results
The authors trained a 7B student model with LoRA on a matched 25M-token budget (~140 sessions) across several arms, measuring two proxy metrics on held-out sessions: M1 (perplexity of real thinking, lower is better) and M2 (log-probability of true actions, higher is better).
- Native reasoning matters for style: Keeping the 16% native reasoning (B) drops held-out real-thinking perplexity (M1) by 18.4% compared to stripping all reasoning (B⁻), from 9.490 down to 7.741. Adding synthesized reasoning (R) does not lower M1 further (7.773).
- Synthesized reasoning boosts action prediction: Adding synthesized rationales at empty positions (R) improves held-out action log-probability (M2) by 3.9% on average over native reasoning alone (B), a gain that exceeds seed-to-seed variation.
Limitations and Future Work
- Proxies, not benchmarks: No downstream coding benchmark was run to see if the student model actually solves more tasks; both M1 and M2 are proxy metrics.
- Unisolated components: The selection step wasn't tested on its own against an unselected baseline, and no arm was trained on completely action-blind rationales.
- Subtle leaks: The leak detector only catches named entities (like file paths or identifiers), so a rationale that reasons backward from the action without naming anything specific can still slip through.
- Model mismatch: The synthesized rationales and the original trajectories come from different model families, meaning the synthetic thoughts match the recorded action, not necessarily the original agent's mind.
The authors note that their released code and data are sufficient for future work to test an action-blind arm, isolate the selection step, and run a downstream task-completion benchmark.
Summary updated