RL Training Notes (1): A Practical Guide to Reading Trajectories
Reading trajectories is one of the most easily underestimated yet essential day-to-day activities in RL training. Metrics tell us when something goes wrong; trajectories help us understand why. And as agents become more capable, we are moving beyond reading trajectories ourselves toward directing agents to analyze them.
Contents
One of the most easily underestimated yet important day-to-day activities in RL training is reading training trajectories. Training metrics can tell us how a model's performance changes, but they rarely explain the reasons behind those changes. Why has the model stopped improving? Why has the reward suddenly dropped? Why does the reward keep increasing while the model's actual behavior becomes increasingly inefficient?
To answer these questions, we often need to go back to the trajectories themselves.
Drawing on my RL post-training experience during internships at frontier AI labs, this article shares a set of trajectory analysis practices that I have gradually developed. The process starts with metric monitoring, identifies anomalous trajectories worth investigating, and then examines the model's actual behavior to understand training issues and find potential solutions. Finally, I discuss how agents can participate in this process, turning trajectory analysis from a largely manual, experience-driven activity into an assisted and reusable workflow.
1Background: How Different Is Industrial-Scale Post-Training from Post-Training in Research Papers?
There are more and more papers on RL and post-training, each seemingly introducing a new trick, method, or training technique. However, when we compare the experiments in these papers with real-world, industrial-scale training, we find that the problems they focus on are not always the same.
Academic research typically operates in relatively controlled experimental environments. It proposes algorithms or methods to address specific problems and validates their effectiveness through benchmarks and experimental results. Industrial-scale post-training, on the other hand, involves a much more complex system. Data quality, environment design, reward reliability, rollout infrastructure, and the constantly evolving behavior of models throughout training all require continuous attention.
In practice, the algorithm itself is certainly important, but a substantial amount of time is also spent on tasks that may seem less glamorous: building environments, preparing data, launching training jobs, monitoring metrics, inspecting trajectories, diagnosing problems, adjusting data and training configurations, and then running another round of experiments.
Take coding and agentic RL as examples. These tasks often have relatively clear verification mechanisms and make it easier to generate training signals at scale, making them important research directions today. At the same time, they introduce new challenges: models must not only complete the final task but also learn to interact effectively with their environments under limited token, runtime, and tool-call budgets.
Therefore, what ultimately determines training effectiveness is not just which algorithm we use, but also whether we can identify problems in the data, environment, and model behavior in a timely manner.
Here is one important observation: reward curves can tell us what changed in the outcome, but they cannot fully reveal what the model actually did during training.
If we want to understand why a model stops improving, starts exploiting the reward signal, or suddenly collapses, looking at metrics alone is not enough. We need to inspect the trajectories.
This article focuses on three questions:
- Why do we need to inspect trajectories?
- How should we inspect trajectories?
- Once we identify a problem, how can we trace its root cause and find a solution?
The following sections mainly document observations and practical experience I have accumulated through real-world RL post-training work.
2Why Does RL Need Trajectory Inspection? Are Metrics Enough?
In RLVR (Reinforcement Learning with Verifiable Rewards), rewards are often sparse.
Take a coding agent as an example. A single trajectory may contain hundreds of steps, including dozens of tool calls, reading numerous files, modifying code, and running tests. If the final tests pass, the reward is 1; otherwise, it is 0.
But what strategy did the model actually follow along the way? Did it efficiently locate the problem, or did it repeatedly search and experiment through trial and error? The reward itself does not tell us.
Consider a simple example:
One agent performs 100 searches before finding the relevant file, while another completes the same task with only 10 searches. Assuming both eventually pass the tests, they receive exactly the same reward.
Clearly, however, the second behavior is much more efficient. The additional 90 searches provide no extra benefit; they simply consume compute resources and token budget.
This is one of the limitations of reward-only training: as long as the final outcome satisfies the reward criteria, the efficiency and quality of the intermediate behavior are not necessarily constrained.
I frequently encounter similar situations in practical training. For example, a model may repeatedly search for information, make redundant tool calls, or get stuck reconsidering the same question during its reasoning process. Looking only at the final reward makes it difficult to determine whether these behaviors are reasonable.
Some anomalies become visible when resources are exhausted. For example, a model may exceed its maximum token budget (typically set to 16k or 32k tokens) or run beyond the sandbox's execution time limit, resulting in a timeout error. However, these signals only capture a subset of severe anomalies. Many inefficient behaviors never trigger an explicit error.
Therefore, reward curves and trajectories provide information at two different levels:
- Reward reflects the final outcome.
- Trajectory reveals the process through which the model achieves that outcome.
The former helps us detect changes in performance, while the latter helps us understand the behaviors behind those changes.
This is why RL training should not focus exclusively on whether reward is increasing. When reward stops improving, we need to inspect trajectories to identify bottlenecks. When reward increases, we should also examine what behaviors actually led to the improvement.
3How to Inspect Trajectories: Start with Metrics, Then Examine Individual Trajectories
In practice, I usually divide trajectory inspection into two levels.
The first level is automated metric monitoring. Its primary purpose is not to directly diagnose problems, but to continuously monitor the training process and help us determine when a closer inspection of trajectories is necessary.
I typically pay attention to the following categories of metrics:
| Category | Metrics | What to Look For |
|---|---|---|
| Length | Token length, number of steps, total trajectory length | Whether the trajectory length distribution is expanding abnormally |
| Reward | Total reward, format reward, and other performance metrics | Whether reward is increasing, plateauing, or suddenly dropping |
| Error | Timeout, token budget exceeded, and various runtime errors | Whether the number and proportion of errors are increasing |
| Thinking | Think-token ratio and repetitive patterns in reasoning | Whether the model exhibits abnormal behaviors such as reasoning loops |
For example, a sudden increase in average token length may indicate that the model is exploring more, but it could also suggest repetitive searches or unproductive reasoning. A reward plateau may indicate a capability bottleneck, but it could also result from problems with the data, environment, or training configuration.
These metrics do not provide definitive answers on their own, but they help narrow down the scope of investigation.
The second level is the actual inspection of trajectories.
One important habit is not to inspect trajectories only when reward stops increasing. During training, reward increases, plateaus, and sudden drops can all correspond to different changes in model behavior.
For example:
- Reward increases: Has the model genuinely learned a new problem-solving strategy, or has it achieved a higher score through some shortcut?
- Reward stagnates: Is the model failing to explore effectively, or is it repeating existing behaviors without discovering new solutions?
- Reward decreases: Has the model's behavior regressed, or have there been changes in the environment, data, or infrastructure?
Rather than sampling and reading all trajectories uniformly, I usually prioritize samples that are more likely to expose underlying problems:
| Trajectory Type | What to Examine | Purpose |
|---|---|---|
| Error trajectories | Trajectories containing errors such as timeout or token budget exceeded | Determine whether the task is too difficult, exploration is excessive, or the runtime environment has problems |
| Abnormally long trajectories | Trajectories whose token length significantly exceeds the normal distribution | Determine whether additional token consumption comes from useful exploration or repetitive behavior |
| Trajectories during reward plateaus | Compare changes in reward and trajectory length | Determine whether the model is consuming more budget without achieving corresponding performance gains |
| Trajectories where reward changes from 0 to 1 | Compare the problem-solving processes for the same task across different checkpoints | Determine whether the model has genuinely learned a new problem-solving strategy |
One particularly useful approach is to examine how the model behaves on the same task across different checkpoints.
For example, an earlier checkpoint may fail to complete a task, while a later checkpoint succeeds. Rather than simply recording that the reward changed from 0 to 1, it is worth examining what actually changed in the model's behavior: Did it locate the relevant files more quickly? Did it reduce unnecessary searches? Did it develop a more effective workflow for making and verifying modifications?
Of course, when making such comparisons, we should try to control the task distribution and sampling conditions to avoid mistaking changes in task difficulty or rollout configuration for improvements in model capability.
Ultimately, when reading trajectories, I focus on two questions:
- Why did the reward increase, or why did it fail to increase? — Understand the reasons behind changes in performance.
- Did the model exhibit any abnormal behaviors while solving the task? — Identify problems that cannot be directly observed from aggregate metrics.
Metrics help us identify where to look; trajectories help us understand what the model is actually doing.
4The Problem-Solving Process in Coding Agents: Four Stages and Their Typical Bad Patterns
When a trajectory contains hundreds of steps, reading it sequentially from beginning to end often makes it difficult to identify the most important details quickly.
One practice I have developed is to first break down the coding agent's problem-solving process into several major stages based on its behavior, and then examine the corresponding behavioral patterns at each stage.
Broadly, these can be divided into four categories:
Search / Localization → Planning → Execution → Verification
It is worth noting that this is not a strictly linear process. A model may return to searching during execution, or replan after verification fails. These four stages are primarily intended to help us analyze trajectories by categorizing different types of behavior.
4.1 Search / Localization: Unbounded Exploration
The primary goal of this stage is to locate the problem and understand the codebase. Common actions include grep, reading files, inspecting the directory structure, and checking git log.
A common bad pattern is searching without a clear objective or scope.
For example:
step 41: grep -r "parse_config" src/
→ 12 files matched
step 42: grep -r "parse_config" src/
→ same 12 files, nothing new
step 43: grep -r "parse_config" .
→ wider scope, same result
step 44: read src/config/parser.py
→ finally hits the key file
step 45: grep -r "parse_config" src/config/
→ identical to step 41
The problem is not that every individual search is incorrect. Rather, the model lacks a clear search hypothesis and fails to make effective use of information obtained from previous searches.
When a search produces no new clues, the model should adjust its search direction based on the information already available, rather than repeatedly performing similar operations.
If this behavior persists, the model may consume substantial amounts of tokens and runtime during localization, potentially exhausting its budget before completing the task.
4.2 Planning: Incomplete High-Level Solutions
The core of the planning stage is to formulate a reasonably comprehensive solution after sufficiently understanding the task. The model needs to identify the key issues, break them down into subproblems, establish necessary assumptions, and plan how to validate those assumptions through reasoning, tool calls, or experiments.
A capable model can usually develop a relatively comprehensive plan. It considers not only the most straightforward solution path but also potential edge cases, dependencies, and possible failure scenarios. It understands which issues remain unresolved and leaves room for subsequent verification.
Less capable models, however, may formulate an incomplete or even misguided solution from the outset. For example, they may commit prematurely to a particular explanation while overlooking other possibilities. They may also fail to account for important constraints or edge cases, causing subsequent execution to revolve around a fundamentally flawed approach.
This problem is particularly evident in complex coding or science tasks. A model may overlook a critical assumption, an important experimental condition, or an unresolved subproblem. Even if its subsequent reasoning and execution appear coherent, it may never actually address the core problem.
For example, when facing a complex coding issue, a model may immediately conclude that the problem is caused by caching and design its modifications around that assumption, without considering other possibilities such as cache invalidation, concurrent access, or state synchronization. Even after repeated modifications and tests, it may never reach the actual root cause.
think: "The issue is probably caused by caching.
I'll update the cache key and add a test."
→ modifies the cache key
→ runs the test, still fails
think: "Maybe the cache key is still incorrect.
I'll try another implementation."
→ modifies the cache key again
→ runs the same test, still fails
The issue here is not simply whether the model takes action. Its initial solution may already be insufficiently comprehensive. Although subsequent execution appears to make progress, the model never revisits its original assumptions or incorporates new evidence into its overall problem analysis.
Therefore, when analyzing the planning stage, I typically focus on several aspects:
- Problem decomposition: Has the model identified and broken down the key subproblems in the task?
- Assumptions: Has it explicitly considered the necessary assumptions, constraints, and edge cases?
- Solution coverage: Does the current approach cover the major possibilities, or has it overlooked critical factors?
- Validation strategy: Has it designed a reasonable validation strategy, and can it revise its original plan based on the results?
For complex tasks, good planning does not mean producing a perfect answer from the outset. It means developing a reasonable, comprehensive, and verifiable initial plan, and continuously refining it as new information becomes available.
4.3 Execution: An Imbalanced Distribution of Actions
The execution stage primarily involves modifying code, calling tools, and carrying out operations.
One phenomenon worth noting is that a healthy coding trajectory does not necessarily require a large number of edits. The model needs to understand the problem and locate the relevant code before deciding what to modify. Therefore, having a relatively large number of read, search, and planning steps is not necessarily a bad sign.
What we should really watch out for are repetitive operations that provide no information gain.
For example:
edit(file, old="x=1") → fails
edit(file, old="x = 1") → fails
edit(file, old="x= 1") → fails
edit(file, old="x =1") → fails
The model keeps adjusting whitespace and parameters, trying different variations, but fails to change its strategy based on feedback from previous failures.
The problem is that the model keeps taking actions without actually making progress toward completing the task.
Therefore, evaluating whether the execution stage is healthy should not be based solely on the number of edits. More importantly, we need to examine whether each operation has a clear purpose and whether the model can use feedback to make meaningful adjustments after a failure.
4.4 Verification: Passing Tests Does Not Mean the Task Is Truly Complete
The verification stage is responsible for checking whether the modifications satisfy the task requirements.
A typical problem occurs when the model passes its own test cases and immediately concludes that the task is complete.
However, the tests written by the model itself may not cover the actual problem.
For example, the original bug may occur under a particular edge case, while the model only constructs happy-path tests for normal inputs. Passing all these tests does not mean the implementation is actually correct.
This leads to an important distinction: completing the verification that the model believes is sufficient does not necessarily mean that the task has been correctly completed in the real environment.
Therefore, when analyzing this stage, we need to examine whether the model has validated its key assumptions, whether the tests cover the actual problem, and whether the verifier can reliably distinguish correct implementations from incorrect ones.
Overall, these four stages help us understand coding agent behavior from different perspectives. They are not intended to assign a label to every individual step, but rather to help us quickly identify the parts of a trajectory that deserve closer attention.
5Analyzing Bad Patterns: Loops
In practical training, I have observed a relatively common and noteworthy abnormal behavior: models beginning to exhibit extensive looping.
Based on how they manifest, these behaviors can be broadly divided into two categories.
5.1 Token-Level Loops
A token-level loop occurs when a model repeatedly generates the same tokens, phrases, or code snippets at the text-generation level.
For example:
think: "The bug must be in the parser.
The bug must be in the parser.
The bug must be in the parser.
The bug must be in the parser.
Okay, let me actually open parser.py...
Wait, parser.py... parser.py..."
These behaviors are relatively easy to observe from the generated text, but their underlying mechanisms are not necessarily the same.
One possible explanation is that the model gradually develops repetitive generation patterns in a particular context, causing the generation probabilities of certain tokens to become increasingly concentrated, which allows the repetition to persist.
However, it is important to note that textual repetition does not directly imply entropy collapse. To determine whether entropy is actually decreasing, we need to further examine token-level entropy and changes in the generation distribution.
5.2 Tool-Level Loops
Tool-level loops are more subtle.
Rather than simply generating the same text repeatedly, the agent repeatedly invokes the same tools and performs similar or even identical operations.
For example:
step 52: grep -r "TODO" src/
→ 3 hits
step 53: grep -r "TODO" src/
→ same 3 hits, nothing new
step 54: grep -r "todo" src/
→ try different casing
step 55: grep -rn "TODO" src/
→ add a flag and retry
step 56: read src/a.py
→ finished reading, forgot what it was looking for
Such behavior may persist for dozens of steps without making any meaningful progress toward the task.
Compared with token-level loops, tool-level loops are more difficult to identify from individual steps. Each tool call may appear reasonable when examined in isolation. However, when we examine the entire trajectory, it becomes clear that the model has been going around in circles.
5.3 Why Are Loops Worth Paying Attention To?
Loops do more than waste tokens and runtime. They may also affect RL training itself.
I believe there are three main aspects worth paying attention to.
First, intermediate behaviors are insufficiently constrained.
Under a reward setting that focuses exclusively on the final outcome, as long as the final result is the same, the model may not receive any signal from the reward function that distinguishes efficient from inefficient problem-solving processes.
Consequently, even if the model repeatedly searches for information or makes redundant tool calls, it may not receive any direct penalty.
Second, they may reduce the amount of effective training signal.
Consider GRPO, which uses within-group reward normalization. If all rollouts for the same prompt fall into the same loop and ultimately receive exactly the same reward, their within-group advantages may approach zero.
This means these rollouts may provide very little effective policy-gradient learning signal.
Third, repetitive behaviors may gradually develop into self-reinforcing patterns.
If the model becomes increasingly inclined to repeat certain tokens or tool-call patterns during training, these behaviors may continue to appear in subsequent rollouts.
Whether this is accompanied by entropy collapse needs to be further verified using actual entropy measurements and repetition statistics.
However, one important point needs to be emphasized: not all loops indicate that the model has a serious problem.
In practical training, a moderate amount of repeated attempts may simply be part of normal exploration. What really matters is whether the proportion of loops continues to increase during training, and whether they begin to consume a significant amount of token budget, reduce the proportion of effective rollouts, or even affect final task performance.
Therefore, determining whether loops are harmful requires more than checking whether they exist. We also need to consider their frequency, duration, information gain, and trends throughout training.
6Root-Cause Analysis and Solutions
The ultimate purpose of reading trajectories is not merely to identify bad patterns, but to understand the problems behind the observed behaviors and determine how training can be improved.
I usually divide this process into two steps: first, identifying the root cause; then, selecting appropriate interventions.
6.1 Root-Cause Analysis: Where Does the Problem Actually Come From?
The same symptom — stagnant reward — can have completely different underlying causes.
For example:
| Observed Behavior in Trajectories | Possible Cause | Primary Area to Investigate |
|---|---|---|
| The reasoning is largely correct, but the model repeatedly makes mistakes and produces low-quality edits | Insufficient model capability or inadequate training | Training |
| A large number of timeout errors | Tasks are too difficult, exploration is excessive, or runtime resources are insufficient | Data / Infrastructure |
| Tests pass, but the implementation is actually incorrect | Insufficient verifier coverage | Environment / Verifier |
| Search patterns remain fixed, with repeated reads of the same files | Problems with search strategies or tool usage | Policy / Prompt / Tool |
| Long reasoning processes without meaningful actions | Disconnect between reasoning and action | Training / Prompt |
| Abnormal errors appear across a large number of trajectories simultaneously | Insufficient runtime resources or problems with inference infrastructure | Infrastructure |
One important point is that these mappings indicate possible directions for investigation, rather than definitive causal conclusions.
For example, a large number of timeouts may result from tasks being too difficult, repetitive exploration by the model, or problems with the KV cache, concurrency configuration, or inference engine.
Therefore, after observing an anomaly, we still need to validate the hypothesis using the actual trajectories and runtime logs.
Insufficient model capability and environment problems may look exactly the same on a reward curve, but they can require completely different solutions.
For example, if the model repeatedly fails on a particular category of edge cases, we can consider adding targeted training data, performing SFT cold-start training, or applying curriculum learning. If the actual problem is that the verifier fails to catch certain errors, fixing the verifier may lead to an entirely different evaluation of the same model behavior.
The purpose of root-cause analysis is therefore not simply to assign a label to a problem, but to help us decide where to invest our resources next.
6.2 Solutions: Choosing Interventions Based on Root-Cause Analysis
Once we have identified the likely source of a problem, we can select appropriate interventions based on the diagnosis.
If the problem primarily comes from model capability:
We can address it from the training side by adjusting the learning rate, batch size, or training algorithm configuration. We can also construct additional data targeting the model's weak capabilities, using SFT cold-start training or curriculum learning to help the model first acquire basic problem-solving strategies before further optimizing them through RL.
If the problem primarily comes from data or the environment:
We need to examine whether the tasks themselves are reasonable, whether the reward and verifier are reliable, and whether the prompts and tool interfaces provide the model with sufficient information.
For example, if we discover that the model can obtain rewards through a particular shortcut, we can fix the verifier and add the necessary test conditions. If the model consistently engages in unproductive exploration during the search stage, we can consider improving the prompt or tool feedback mechanism.
If the problem primarily comes from infrastructure:
We need to investigate the rollout and inference systems.
For example, an excessively high abort-request rate may be related to KV cache configuration, the number of concurrent requests, or resource scheduling. An excessive number of sub-agents may also overload the inference engine, causing numerous anomalies during rollout.
These problems may manifest in trajectories as frequent failures or timeouts, but their root causes do not necessarily lie in the model itself.
It is important to emphasize that identifying a potential solution does not mean the problem has been resolved. After making modifications, we need to run new rollouts under the same or a comparable task distribution, observe whether the original abnormal behaviors have decreased, and check whether the success rate, token consumption, and error rate have improved.
Sometimes, an intervention that reduces repetitive searches may also cause the model to stop exploring too early on difficult tasks. Therefore, in addition to monitoring the target metrics, we also need to watch for newly introduced problems.
Overall, trajectory analysis should ultimately form a closed loop:
Metric Monitoring → Trajectory Inspection → Root-Cause Analysis → Intervention → Verification
Metrics help us detect problems, trajectories help us understand them, root-cause analysis helps us choose solutions, and new rollouts help us verify whether those solutions actually work.
7Discussion: Limitations and Agent Collaboration
Of course, manually reading trajectories also has clear limitations.
First, manual analysis is inherently subjective. Different people may focus on different details when reading the same trajectory and may arrive at different conclusions.
Second, manual sampling makes it difficult to cover all long-tail problems. Even after inspecting a large number of trajectories, we cannot guarantee that every abnormal behavior has been identified. This is why automated metric monitoring remains important: it allows us to continuously track the overall training process and trigger further investigation when anomalies occur.
Recently, I have also been thinking about whether we can let agents participate in trajectory analysis itself. (Perhaps this is also a form of RSI.)
One straightforward approach is to give an agent an explicit diagnostic task along with the corresponding trajectory files. For example, we can ask the agent to focus on checking:
- Whether there are repeated tool calls.
- Whether edit operations actually make progress.
- Whether the reasoning process contains obvious repetition or gets stuck in unproductive loops.
- Whether there is potential reward hacking.
- How the model's behavioral patterns change across different checkpoints.
In this setup, agents can help us quickly browse large numbers of trajectories, identify suspicious segments, and provide supporting evidence.
However, this approach also has a potential problem: if the prompt already contains explicit prior hypotheses, the agent may only look for the problems we expect to find, overlooking other anomalies that were not specified in advance.
Therefore, in addition to hypothesis-driven auditing, I believe we should also retain open-ended auditing, allowing agents to proactively compare different trajectories and identify behavioral changes worth investigating without being given predefined bad patterns.
Throughout this process, I do not think the role of humans disappears. On the contrary, domain expertise remains extremely important.
An experienced RL researcher can often formulate useful hypotheses based on observed training behaviors. For example, are loops related to reward design? Are timeouts caused by unproductive exploration? Does an implementation that passes tests but remains incorrect indicate a vulnerability in the verifier?
This experience can help agents analyze trajectories in a more targeted way. However, the final root-cause analysis still needs to be grounded in concrete evidence rather than simply accepting the agent's explanation.
I prefer to think of this collaboration as follows: humans are responsible for asking the right questions, evaluating evidence, and deciding what to do next, while agents help expand the scope of inspection, organize information, and identify potential anomalies.
Looking back, the challenges of post-training are not only about how to run RL, but also about how to understand what is actually happening to a model throughout the training process.
Reward curves tell us about model performance, while trajectories allow us to examine model behavior in greater detail. Whether we are identifying repetitive exploration, locating reward hacking, or understanding performance degradation during training, these details can all affect the final training outcome.
And as models and agents begin participating in trajectory analysis itself, we may be able to further transform traditional training diagnostics: moving from manually reading trajectories one by one toward an automated analytical workflow in which humans and agents work together.
The next step beyond knowing how to read data is knowing how to direct agents to read it.
This is also an issue I have been exploring in research such as on-policy distillation (TCoD): data quality depends not only on the data itself, but also on how we understand, analyze, and utilize the data generated throughout the training process.