Single-Rollout Asynchronous Optimization (SAO) for Long-Horizon AI Agent Reinforcement Learning

    This article explains Single-rollout Asynchronous Optimization (SAO), a reinforcement learning method that samples one trajectory per task instead of a group. It covers the cost and off-policy problems of group sampling, the algorithmic and system changes SAO requires, its failure conditions and the metrics to monitor, context compression and Router scheduling, how to judge throughput claims, and the infrastructure that supports it.

    1. The Cost and Off-Policy Problems of Group Sampling

    Group sampling, represented by Group Relative Policy Optimization (GRPO), generates multiple complete trajectories for each input task. It then updates the model using advantages computed relative to the group. This approach works well in early model alignment. Long-horizon agent tasks, however, expose two clear costs.

    First, sampling cost grows linearly with group size. A single long-horizon trajectory already requires substantial compute and time, so each additional trajectory in the group adds another full unit of compute cost.

    Second, off-policy error grows as trajectories get longer. The policy used for sampling and the policy used for updating are separated by a time gap. The longer the trajectory, the more the policy changes during that gap, and the larger the mismatch between the old data and the current policy.

    2. The Core Idea of SAO

    SAO (Single-rollout Asynchronous Optimization) replaces group sampling with single-rollout sampling. It generates one trajectory per input task, and each trajectory enters the training queue as soon as it finishes. This shortens the time window between sampling and updating, which makes the gap between the old and new policies easier to control.

    The change affects both the algorithm and the system. At the algorithm level, SAO no longer compares multiple trajectories from the same task within a group, so the advantage must be estimated another way. This is the key factor in whether SAO trains stably. At the system level, sampling and training run asynchronously, so the training side does not wait for a full batch of data.

    The pseudocode below only illustrates the difference between the two data flows. It is illustrative and cannot be run directly:

    1. # Traditional group sampling (illustrative)
    2. for task in tasks:
    3. rollouts = [generate_rollout(policy_model, task) for _ in range(GROUP_SIZE)]
    4. advantages = calculate_group_relative_advantage(rollouts)
    5. train_step(policy_model, rollouts, advantages)
    6. # SAO: single-rollout asynchronous optimization (illustrative)
    7. for task in tasks:
    8. rollout = generate_rollout(policy_model, task) # Generate one rollout per task
    9. advantage = estimate_advantage(rollout, baseline) # Requires a separate baseline or value estimate
    10. async_queue.put((rollout, advantage, policy_version)) # Record the policy version at generation time

    In this code, estimate_advantage is a placeholder function. A single trajectory has no group to compare against, so a real implementation must supply a baseline. Options include a value network, a moving average of rewards, or another validated estimation method. policy_version tracks the staleness of the data. The training side can use it to decide whether to discard data that is too old.

    3. Boundaries and Failure Conditions of SAO

    SAO does not outperform group sampling in every scenario. The following conditions require particular attention.

    1. Sparse rewards. Long-horizon tasks often give a reward only when the final result appears. The reward for a single trajectory may be all 0s or all 1s, which makes it hard to tell good trajectories from bad ones. The variance of the advantage estimate increases.
    2. Overly long asynchronous queues. The more trajectories that accumulate in the queue, the further the training data falls behind the current policy. Without a staleness limit, off-policy error builds up again.
    3. Policy drift. During training, a rapid drop in policy entropy, oscillating return curves, or a KL divergence that keeps rising can all signal that the policy is diverging.
    4. Replay inconsistency. If a trajectory’s context, sampling parameters, or tool return values differ at training time from generation time, the gradients may point in the wrong direction.

    Therefore, teams that enable SAO should monitor at least the following metrics: the distribution of data staleness, policy entropy, KL divergence, the mean and variance of returns, training queue length, and wait time on training nodes.

    4. Context Compression and Router Scheduling

    The context in long-horizon agent tasks can be very long, and GPU memory usage can become a bottleneck. One approach compresses historical content during trajectory generation. Examples include evicting part of the KV-Cache based on attention scores, or generating summaries of earlier multi-turn interactions. The goal of compression is to reduce memory usage while preserving as much decision-relevant information as possible. Compression inevitably loses some information, so its effect on task success rate must be validated on the specific tasks involved.

    The Router is the scheduling component that assigns sampling requests to sampling nodes. In SAO, sampling nodes push trajectories asynchronously into the training queue. The Router needs to track the load on each node and assign new tasks to idle nodes so that the queue keeps receiving enough data. If a node takes a long time because its task is complex, the Router should avoid making the training side wait for long periods. The benefit of this scheduling depends on cluster size and task distribution, so it should be evaluated using real load data.

    5. What a Performance Evaluation Should Include

    Throughput claims for SAO often lack a complete measurement basis. Before interpreting any performance figure, readers should confirm the following information:

    Item What to specify
    Base model Parameter count, active parameters, and whether the model uses a Mixture-of-Experts (MoE) architecture
    Task type For example, long-horizon code generation and debugging, with average sequence length and maximum number of turns
    Hardware configuration GPU model, number of GPUs, and network bandwidth
    Baseline algorithm Which group sampling setup is the comparison, and the group size
    Throughput definition Tokens processed per second, trajectories processed per second, or completed training steps
    Training steps The number of iterations used in the evaluation and the convergence status
    Stability Whether policy divergence was monitored and whether training crashes occurred

    A throughput multiple is meaningful only when this information is complete. A multiple without a baseline and a clear measurement definition should be treated as an unreliable conclusion. Results also vary with model size, sequence length, hardware, and batch configuration. No fixed multiple holds across all scenarios.

    6. The Role of Cloud-Native Infrastructure

    Asynchronous reinforcement learning places high demands on infrastructure. The capabilities below can help support SAO deployment, but they do not guarantee results for any specific product. Cloud platforms such as Baidu AI Cloud typically offer capabilities in the following areas:

    1. Elastic scheduling: Use a container platform to scale sampling nodes up or down dynamically. Add sampling resources when long-horizon tasks arrive in bursts, and shift resources toward training nodes during compute-intensive training phases.
    2. Data flow: Use object storage to cache long-horizon trajectory data, and use message queues to decouple the sampling side from the training side.
    3. Observability: Collect metrics such as GPU utilization, network bandwidth, Router scheduling latency, and training throughput to locate bottlenecks. For example, you can identify a node where context compression takes too long.

    When choosing a platform, base the decision on actual latency, cost, operational complexity, and compliance requirements. Test on your own workload before committing.

    7. Summary

    Single-rollout Asynchronous Optimization (SAO) replaces group sampling with single-trajectory sampling. Its goals are to reduce sampling cost, reduce off-policy error, and improve throughput for long-horizon agent training. SAO requires supporting components, including baseline estimation, staleness control, and system scheduling. Changing the sampling method alone is not enough.

    Before adopting SAO, teams should first determine whether their tasks involve sparse rewards, set a staleness limit for the queue, and continuously monitor policy entropy, KL divergence, and return stability. Performance gains should be judged against a complete baseline and a clear measurement definition, not taken from a single multiple.