Part II / Reinforcement Learning
Agent RL is a distributed system
An algorithm paper can write "sample trajectories." An engineering system must create thousands of reproducible worlds, run tools safely, move model versions, grade traces, survive partial failure, and know which data is still on-policy.
Prompt -> sandbox -> rollout -> reward -> training batch.
Versions, scheduling, provenance, retries, and release state.
Fast invalid experience that trains efficiently.
A factory whose product is experience
Traditional data engineering moves records through extraction, validation, transformation, and storage. Agent RL manufactures records by running a policy inside a world. Each resulting trajectory carries the generating policy, environment version, tool interactions, timing, termination, feedback, and provenance.
A rollout worker is an inference server attached to an environment. A grader is a data-quality system attached to the trajectory. The trainer is downstream of both.
One batch of ambiguous incidents
The task sampler chooses 1,000 incident seeds from the development split. Eight policy attempts per seed create 8,000 episodes. Each episode may execute six model turns, four tools, and one judge. A "batch of 1,000 prompts" can therefore mean tens of thousands of inference requests plus sandbox work.
The scenario service materializes topology, faults, telemetry, distractors, and an oracle from an immutable generator version and seed. The sandbox exposes only legal observations and tools. A rollout worker loads policy version 18, receives a task, and acts until termination. A trajectory writer records tokens, log-probabilities, tool I/O, timing, and policy/environment identifiers.
Grading may combine deterministic oracle checks, a process-rubric service, a judge model, and hard validity gates. Only valid trajectories enter the optimizer's batch. Diagnostics and rejected traces remain available for analysis. The trainer produces policy version 19 and a report. A release service evaluates that candidate against a validation suite and a tightly controlled holdout before any deployment.
| Component | Owns | Must version |
|---|---|---|
| Task sampler | Distribution and curriculum | Dataset snapshot, split, weights |
| Sandbox | State, transitions, observations, tools | Image, schema, seed, fixtures |
| Rollout worker | Policy inference and action parsing | Weights, runtime, decoding config |
| Reward system | Oracle, rubric, judge, hard gates | Every evaluator and weight |
| Trainer | Batch construction and update | Code, hyperparameters, optimizer state |
Synchronous versus asynchronous
In synchronous RL, rollout workers generate a batch from one policy version, pause, the trainer updates, and workers load the new policy. The data contract is clean, but GPUs may idle at barriers and long episodes create stragglers. In asynchronous RL, rollout and training overlap. Utilization improves, but workers may finish trajectories from older policies while the trainer advances.
Policy staleness is the distance between the behavior policy that generated data and the target policy being updated. It can be measured by version lag, elapsed updates, or divergence such as KL. AReaL studies asynchronous language-reasoning RL and mechanisms for controlling staleness.[source] Staleness changes the statistical assumptions of the update, so version lag has mathematical as well as operational consequences.
Weight transfer is also physical. Large checkpoints take time to serialize, move, and load. Colocating rollout and training can reduce transfer but creates GPU-memory contention and phase interference. Disaggregating them improves independent scaling but adds network and orchestration cost. Frameworks such as HybridFlow/verl and OpenRLHF explore flexible mappings of policy, reference, reward, critic, rollout, and trainer roles onto distributed resources.[source][source]
Environment fidelity is part of generalization
A sandbox must be reproducible enough for comparison and varied enough to prevent memorization. It should model realistic tool errors, permissions, latency, partial results, and consequence boundaries. Exact production replication is impossible and sometimes unsafe. Build for fidelity to the structure that changes decisions.
Train-test mismatch can hide in small details. Training tools may return normalized JSON while production returns prose. Training may expose a direct database query unavailable in deployment. Graders may access hidden state through metadata the policy can also see. Seed formats may correlate with fault type. Treat the environment as an attack surface and run leak tests before trusting reward curves.
Rollouts are bursty: sandboxes consume CPU and memory, inference consumes accelerators, tool services create I/O, and grading fans out. Elastic infrastructure can match those phases, but autoscaling delay and cold starts become part of experiment time.
Failures need semantic retries
A network retry is not always behavior-preserving. Retrying a deterministic topology query may be safe. Retrying a state-changing remediation may execute it twice. Regenerating a model response after a timeout samples a different action and changes the trajectory. The system must classify infrastructure failure, environment outcome, invalid action, and policy-chosen retry.
Do not silently drop failed episodes. Failure rates by tool, policy version, task family, and trajectory length are training diagnostics. If only successful infrastructure paths reach the trainer, the data distribution becomes optimistically biased. Mark incomplete trajectories and decide explicitly whether they train, grade as failures, or remain operational evidence only.
Only if the added trajectories are valid, sufficiently fresh, informative, and gradeable. Duplicate easy prompts, stale policies, leaked environments, or saturated rewards can increase tokens per second while contributing almost no learning signal.
Release is a separate system
Training reward should not decide release alone. Compare the candidate with the incumbent on untouched scenarios, behavior gates, negative tests, cost, latency, tool safety, and capability regressions. Use enough independent episodes to report uncertainty rather than only a mean. Protect the final holdout from repeated tuning; every look spends information.
A complete run manifest connects code commit, model parent, data snapshot, environment image, policy and decoding config, reward versions, optimizer settings, and evaluation results. Without that manifest, the score cannot be reproduced or audited.
References
- HybridFlow/verl, OpenRLHF, and AReaL support the distributed RL systems discussion.
- Modal's applied RL essay is a first-party account of rollout, evaluation, sandbox, and elastic-compute concerns.