Wink Pings

Reward went up—the trajectory may be sounding an alarm

An RL post-training note: reward only tells you the result changed; the trajectory shows how the model got there. From two-layer auditing to the four-stage bad pattern, then loop attribution and agent collaboration.

The reward curve only tells you that the score changed. Why the model isn't improving, why it's gaming the score, and why reward rises while efficiency gets worse and worse—you have to go back to the trajectory to see. Xudong Han recommended this RL post-training note by Jiaqi Wang, and the topic is very concrete: how to read training trajectories.

Tweet image

Original post link: https://kokolerk.github.io/blog/rl-trajectory-audit/

Reward is only the result; the trajectory is the process

In RLVR, reward is often sparse. A single coding-agent trajectory may have hundreds of steps, call tools dozens of times, read files, edit code, and run tests. If the final test passes, reward is 1; if not, it's 0. Whether the middle was efficient localization or repeated searching—reward doesn't answer that.

The author gives a simple comparison: one agent uses 100 searches to find the key file, while another completes the same task in 10. Both pass the final test, so the reward is the same. The extra 90 searches only consume tokens and runtime. If you look only at the final reward, it's hard to constrain the efficiency and quality of the intermediate behavior.

Some anomalies show up as timeouts or token budget exceeded; more inefficient behaviors won't throw errors. So the reward curve and the trajectory provide two layers of information: the former reflects the result, and the latter reflects how the model achieved it. If reward isn't rising, look at the trajectory; if reward is rising, also look at what behaviors it's rising on.

Look at metrics first, then read trajectories

The author's inspection has two layers. The first layer is automated metric checks, used to decide when to look further into the trajectory. Common metrics include length, reward, error, and thinking: whether token length and step count are abnormally inflated; whether reward is rising, plateauing, or dropping sharply; whether the proportion of timeouts and runtime errors is increasing; and whether think tokens show repeated spinning.

Two-layer audit system: metric monitoring triggers trajectory audit

The second layer is reading the trajectory. The author does not recommend looking only when reward isn't rising, nor does he recommend uniform sampling. Prioritize several types of samples: error trajectories, abnormally long trajectories, trajectories during reward plateaus, and trajectories where reward goes from 0 to 1. In particular, changes in the same problem across different checkpoints can show whether the model finds key files faster, reduces ineffective searching, or develops a more reasonable edit-and-verify process.

A four-stage breakdown for coding agents

A trajectory may have hundreds of steps, and it's hard to grasp the key points by reading it from start to finish. The author breaks the coding agent's problem-solving process into four stages: Search / Localization, Planning, Execution, and Verification. The four stages are not strictly linear; the model may search again during execution, or replan after verification fails. The breakdown is for categorizing behavior, not for labeling every step.

Four-stage trajectory framework and typical bad patterns at each stage

The typical problem in Search / Localization is searching without goals and boundaries. For example, repeatedly grepping parse_config, getting the same 12 files, expanding the scope and searching again, finally reading the key file, and then returning to the same search. Each operation looks reasonable on its own, but taken together there is no information gain.

Planning problems occur earlier. The model may decide from the start that the problem is in caching, keep changing things around the cache key, tests keep failing, but it doesn't re-examine the initial hypothesis. The subsequent execution looks coherent, but the direction itself is off. The author suggests checking problem decomposition, assumptions and constraints, solution coverage, and verification strategy.

In the Execution stage, don't just look at the number of edits. A healthy coding trajectory doesn't necessarily involve many edits; it's normal for reading and searching to take many steps. Be wary of repeated operations with no information gain, such as repeatedly adjusting whitespace and parameters, or not changing strategy based on feedback after a failure.

There's a common trap in the Verification stage: the model thinks the task is complete because it passes test cases it wrote itself. If the original bug is in edge conditions and the model only constructs happy-path tests, all tests may pass while the implementation is still wrong. The model completing verification it believes is correct does not mean the task is correctly completed in the real environment.

Loops deserve separate attention

The author divides loops into two types. Token-level loops are repeated outputs of the same tokens, phrases, or code snippets at the text level. Tool-level loops are more subtle: the agent keeps calling the same tools and performing similar or even identical operations. Each call looks like a reasonable action on its own; only when you connect the whole trajectory do you realize it's going in circles.

There are three reasons loops are worth attention. Intermediate behavior lacks constraints under a reward that only watches the final result; in GRPO with group-relative reward normalization, if all rollouts under the same prompt fall into the same loop and get the same reward, the within-group advantage may approach zero, reducing effective training signal; and repeated behavior may reinforce itself. The author also reminds us that not all loops are serious problems; look at frequency, duration, information gain, and trends during training.

After attribution, choose interventions

When reward isn't rising, the reasons can be completely different. The approach is right but edit quality is poor—this may point to model capability or insufficient training; many timeouts may come from tasks being too hard, exploration being too long, or insufficient runtime; tests pass but the implementation is wrong—this may point to insufficient verifier coverage; a fixed search pattern may be related to search strategy or tool use; many trajectories being abnormal at the same time calls for investigating the inference infrastructure.

These mappings are directions for investigation, not causal conclusions. Insufficient model capability and environment problems sometimes look the same on the reward curve, but the solutions are different. After fixing the verifier, the same model behavior may receive a completely different evaluation.

The solution ultimately forms a closed loop: Metric Monitoring, Trajectory Inspection, Diagnosis, Intervention, Verification. Metrics surface problems, trajectories help understand them, attribution guides where to invest resources, and new rollouts verify whether the intervention is effective. You also need to check whether new problems were introduced—for example, after reducing repeated searching, the model might stop exploring too early on difficult tasks.

Humans read trajectories; next is directing agents to read them

Manual reading has limitations. Different people looking at the same trajectory will focus on different details, and sampling makes it hard to cover the long tail. Automated metric monitoring is still necessary. The author discusses agent collaboration: a human gives the agent a clear diagnostic task and trajectory files, and lets it check for repeated tool calls, whether edits make progress, whether thinking is spinning without progress, whether reward hacking exists, and how behavior changes across checkpoints.

But when the prompt carries explicit prior assumptions, the agent may look only for the expected problems and ignore other anomalies. The author suggests keeping an open-ended audit, letting the agent compare trajectories without presupposed bad patterns. The human role remains: propose hypotheses, judge evidence, and decide the next action. The agent expands the scope of inspection, organizes information, and discovers potential anomalies.

In the comments, someone summarized the note as 'reward curve goes up, trajectories snitch.' Others said they had directly sent it to an agent. This direction will probably become more and more common: the next step after knowing how to look at data is knowing how to direct agents to look at data.

Source: Recommended by Xudong Han; original author Jiaqi Wang; note link https://kokolerk.github.io/blog/rl-trajectory-audit/ ; X link https://x.com/Xudong07452910/status/2129375267168677984 .

发布时间: 2026-12-06 12:27