Single-Trajectory Asynchronous Reinforcement Learning: How SAO Works and How to Put It into Practice

    Single-Trajectory Asynchronous Optimization (SAO) is a reinforcement learning framework designed for long-horizon agent training, where each input task generates only one trainable rollout instead of a group of candidates. This article explains why group-based sampling breaks down in asynchronous long-trajectory settings, how SAO addresses it through double-sided importance sampling, a strengthened value model, action-level advantage propagation, and context compression, and what engineering practices—joint scheduling and load balancing—make it stable at scale, achieving over 2.3x end-to-end throughput gains.

    Single-Trajectory Asynchronous Reinforcement Learning: How SAO Works and How to Put It into Practice

    Why Long-Horizon Agent Training Is Hard

    As large models move from single-turn question answering to multi-turn agent tasks, reinforcement learning (RL) post-training faces a growing tension: task trajectories are getting longer, while training throughput and stability are hard to maintain at the same time. In agent coding and multi-step reasoning scenarios, a single task may involve dozens of tool calls and environment interactions, with trajectories easily reaching tens of thousands of tokens.

    Group-based sampling methods—typical PPO-style approaches that generate multiple candidate rollouts for the same input and compare them within the group—offer low-variance advantage estimates, but they become extremely costly for ultra-long trajectories: the same prompt must be fully inferred multiple times, sampling compute multiplies, and in asynchronous pipelines severe off-policy bias easily accumulates.

    SAO (Single-rollout Asynchronous Optimization) was proposed against this backdrop. Its core idea: for each input task, generate only one trajectory that can be used for training immediately, replacing group-based sampling with single-trajectory sampling, reducing off-policy impact at the source and improving generalization. Combined with context compression, this approach allows RL-driven capability gains to persist across longer agent execution trajectories. It has been deployed and validated in an agentic RL pipeline on a very large mixture-of-experts (MoE) model, sustaining stable training for over a thousand steps.

    Why Single-Trajectory Sampling Works

    The Hidden Costs of Group-Based Sampling

    Group-based advantage estimation relies on “comparing multiple trajectories of the same task,” which is reasonable for short trajectories under synchronous training. But in asynchronous, long-horizon training it introduces three problems:

    • Sampling waiting: advantages can only be computed after all trajectories for a task are generated, so long-tail trajectories drag down overall throughput;
    • Off-policy drift: in asynchronous systems, the policy that generated a trajectory differs from the policy being updated, and multiple trajectories per group further amplify the gap between old and new policies;
    • Limited generalization: the model repeatedly learns from comparisons among a few variants of the same task, overfitting to relative rankings within the group rather than the true task distribution.

    How Single Trajectories Address This

    Single-trajectory sampling shifts the variance-control burden from “within-group comparison” to a value model (critic): each task samples one trajectory, the critic estimates the baseline, and policy gradients are computed against that baseline. The benefit is that training can start as soon as any single trajectory completes—naturally fitting asynchronous pipelines and minimizing the off-policy window. Meanwhile, the model explores a broader task distribution once each, improving generalization. The trade-off is stricter variance control—which is exactly what SAO’s accompanying mechanisms are for.

    Key Technical Mechanisms

    Direct Double-Sided Importance Sampling (DIS)

    In asynchronous training, distribution mismatch between the behavior policy and the target policy is unavoidable. SAO uses direct double-sided importance sampling (DIS) to correct this bias: the importance weight is clamped on both the upper and lower sides, suppressing gradient explosion caused by overly large probability ratios while avoiding the information waste of dropping samples whose ratios are too small. Schematically, the weighting can be written as:

    1. ratio = pi_theta(a_t) / pi_behavior(a_t)
    2. weight = clamp(ratio, lower=1 - eps_low, upper=1 + eps_high)
    3. advantage_contribution = weight * advantage_t

    Double-sided clipping keeps bias controlled while significantly reducing the estimation variance introduced by asynchronous updates—a prerequisite for stable single-trajectory training.

    Strengthened Value Model Training

    With a single trajectory, the advantage signal depends almost entirely on the critic’s quality. SAO strengthens the critic along three dimensions:

    1. Higher update frequency: the value model is updated twice for every policy update, so the baseline keeps pace with policy drift and training variance stays low;
    2. Frozen attention modules: only the projection parameters of the MoE layers are optimized while attention components are frozen, reducing representation drift during critic training and preventing the critic’s own oscillations from propagating to the policy side;
    3. Larger pretraining data: the value model is pretrained on a larger and more diverse dataset, making its return estimates for intermediate states of long trajectories more robust.

    Action-Level Advantage Propagation: GAE That Skips Observation Tokens

    Agent trajectories mix two kinds of tokens: model-generated “action” tokens (thinking, tool-call arguments) and environment-returned “observation” tokens (execution results, file contents). Standard generalized advantage estimation (GAE) propagates advantage tokens across the whole sequence, but observation tokens are not products of the model’s decisions—assigning them advantage is both meaningless and dilutive of the effective signal. SAO skips observation tokens and propagates advantage only between model-generated action tokens, aligning credit assignment precisely with the decision points the model actually controls. This design matters most for long-horizon tasks: the longer the trajectory, the higher the proportion of observation tokens and the greater the accumulated damage from misallocated credit.

    Context Compression for Long-Trajectory Retention

    In long-horizon agent tasks, the context window is a scarce resource. SAO supports context compression, condensing historical interactions irrelevant to the training objective so that RL capability gains extend to longer execution trajectories instead of being truncated when the context overflows. This preserves distributional consistency between “the policies learned during training” and “the trajectory lengths seen at inference time.”

    System-Side Optimization: Asynchronous Pipelines and Load Balancing

    Beyond the algorithm, SAO’s engineering value depends on co-evolution of the training system. In the asynchronous RL architecture, the inference cluster (trajectory generation) and the training cluster (parameter updates) run decoupled, with a scheduler in between handling task dispatch and load balancing. Because agent trajectories vary enormously in length, the system was upgraded in two directions:

    • Joint scheduling: the inference-side routing component coordinates with the training side to dynamically queue tasks by trajectory length and priority, avoiding starvation of long tasks or idling on short ones;
    • Load balancing: generation requests are assigned based on the real-time memory and compute status of each inference node, smoothing peaks and raising overall cluster utilization.

    On long-horizon coding RL tasks, this joint algorithm-and-system optimization delivered more than a 2.3x improvement in end-to-end training throughput and sustained stable training for over a thousand steps. Experimentally, the single-trajectory approach consistently outperformed group-based sampling baselines and their variants on public agentic coding and mathematical reasoning benchmarks, validating the “single trajectory + strong value model” route.

    Practical Takeaways

    For teams looking to adopt this approach, a few engineering lessons stand out:

    • Assess your off-policy tolerance first: the benefits of single-trajectory training scale with the degree of asynchrony—the more asynchronous your pipeline, the more double-sided importance sampling pays off;
    • Critic first: invest more compute and data budget in the value model’s pretraining and high-frequency updates; critic quality sets the floor for single-trajectory training;
    • Distinguish actions from observations: in any agentic RL implementation, explicitly tag token origins so that advantage propagation covers only model decision segments;
    • Scheduling is part of the algorithm: the bottleneck of asynchronous RL often lies in scheduling rather than the model; joint design of routing and the training system should be treated as part of the algorithm itself.

    Conclusion

    By combining single-trajectory sampling, double-sided importance sampling, a strengthened value model, and action-level advantage propagation, SAO pushes both the stability and throughput of asynchronous RL for long-horizon agent tasks to a new level; together with joint scheduling optimization across the inference and training systems, it achieves over 2.3x end-to-end throughput gains. The methodological lesson: when sampling costs are high, it is better to fight variance with a stronger baseline model and more precise credit assignment than with more sampling—a principle broadly relevant to post-training of large models.