New Dataset Reveals Massive Reasoning Gap in Coding Agent Data
Researchers have identified that over 82% of coding agent trajectories lack reasoning, proposing a new method to synthesize missing logic from actions.
Source: Grafy Research LabLarge-scale datasets used to train coding agents often record what an AI does but fail to capture why it does it. This lack of explicit reasoning in real-world trajectories creates a significant gap in the supervision available for training more intelligent software engineering models.
What is the Trajector-SWE-20K dataset?
In a study by Qin Wang, Afsoun Owji, Hang Yin, and Guangyi Liu, researchers introduced Trajector-SWE-20K, a public dataset containing 20,000 consented coding-agent sessions. According to the authors, this collection represents approximately 0.89 billion tokens of text and includes full transcripts of interactions, such as system prompts, tool definitions, user messages, and assistant actions.
The dataset is notable for its scale, containing roughly 3.3 times as many sessions as previous collections like SWE-chat. To ensure privacy and quality, the researchers redacted credentials and contact details, removed duplicates, and screened for sensitive information. The resulting dataset provides a massive window into how real-world AI agents navigate complex software engineering tasks.
Why is there a reasoning gap in agent data?
While these trajectories are rich in action, they are surprisingly poor in logic. The researchers observed that in a pool of 775,000 assistant turns, there were only 17.6 non-empty reasoning blocks per 100 turns. This means that more than 82% of the turns recorded by the agents carry no explicit reasoning supervision.
This gap exists because many deployed agents do not output their internal thought processes, or the providers only retain a summary of the reasoning rather than the full chain. Consequently, when developers attempt to use this data for post-training, they are left with a sequence of actions—such as reading a file or running a command—without the underlying rationale that guided those decisions. Figure 4 illustrates how this empty-block rate varies depending on the position within the session, noting that earlier turns often have higher rates of missing reasoning.
How can missing reasoning be synthesized?
To address this deficiency, the authors proposed an action-grounded synthesis method. The goal is to create a rationale that is both sufficient (making the subsequent action likely) and derivable (not relying on information the agent would not have had at that moment).
Instead of letting a "writer" model see the full details of the next action, which could lead to cheating, the researchers restricted the writer to seeing only the type of action (e.g., "reading a file") without its specific arguments (e.g., the specific filename). They then generated several candidate rationales and used a frozen student model to select the one that assigned the highest log-probability to the actual action taken.
Figure 2 demonstrates the effectiveness of this selection process by comparing how different types of rationales—honest, hindsight, and real thinking—perform against a threshold. The authors found that this method allows for the creation of high-quality synthetic reasoning that can be used to augment training data.
Does synthesized reasoning actually improve models?
Testing the impact of this synthesized data on model performance showed measurable benefits. In experiments involving a 7B parameter student model, the researchers found that adding synthesized reasoning to the empty positions improved the held-out action log-probability by an average of 3.9% across seed pairs.
Furthermore, the study highlighted the dangers of "hindsight bias" in data synthesis. If a model is allowed to see the actual arguments of an action while writing a rationale, it tends to write explanations that only make sense because the answer is already known. The researchers found that filtering rationales based on their ability to predict the true action favors hindsight rationales about thirty times more often than honest ones. As shown in Figure 3, maintaining native reasoning is crucial, as keeping original thinking lowered held-out real-thinking perplexity by 18.4% compared to models without it.
How can developers apply these findings?
For developers building autonomous agents, this research underscores the importance of capturing "Chain of Thought" or reasoning traces during deployment. If reasoning is not recorded, the value of the data for future fine-tuning is significantly diminished.
While this study focuses on large-scale dataset synthesis, developers working on agentic workflows can explore these concepts within Grafy Code. By observing how models interact with files and terminal commands, developers can better understand the necessity of structured reasoning in complex coding environments. For those researching the underlying mechanics of these models, Grafy Reader provides a way to analyze and question academic papers like this one to extract specific implementation details.
Frequently asked questions
What percentage of coding agent turns lack reasoning?
According to the research, more than 82% of assistant turns in the analyzed trajectories do not contain non-empty reasoning blocks. This means that the vast majority of recorded actions are performed without an accompanying explanation of the logic behind them.
How does the synthesis method prevent hindsight bias?
The method prevents hindsight bias by restricting the writer model's visibility. The writer is provided with the context and the category of the next action, but it is specifically denied access to the actual arguments or specific details of that action, ensuring the rationale is not just a post-hoc justification.
What was the primary benefit of adding synthesized reasoning to training?
Adding synthesized reasoning to the empty positions in the dataset improved the held-out action log-probability by an average of 3.9%. This suggests that filling the reasoning gap with high-quality, action-grounded rationales can enhance a model's ability to predict correct actions in software engineering tasks.
Source: Qin Wang, Afsoun Owji, Hang Yin, Guangyi Liu (arXiv:2612.02919)


