Skip to content

RL infrastructure: verl, OpenRLHF and AReaL

TL;DR. An RL step for an LLM has two very different workloads: generation (memory-bound, served best by an inference engine such as vLLM or SGLang) and training (compute-bound, served by FSDP, DeepSpeed or Megatron). The open frameworks differ mainly in where they put these two workloads and whether they let them run at the same time. verl colocates them by default and is the most common starting point; OpenRLHF uses Ray to place each model on its own GPUs (or colocate them); AReaL runs generation and training fully asynchronously.

verlOpenRLHFAReaL
PaperHybridFlowOpenRLHFAReaL
Codeverl-project/verlOpenRLHF/OpenRLHFareal-project/AReaL
Orchestrationsingle controller over Ray worker groupsRayown launcher; local or Ray scheduler
Training backendFSDP, FSDP2, Megatron-LMDeepSpeedFSDP, Megatron, Archon
Rollout enginevLLM, SGLang or HF TransformersvLLMSGLang by default, vLLM optional
Default placementcolocated (hybrid engine)separate GPUs per model, or hybrid enginerollout and training on separate GPUs
Off-policy / asyncsynchronous by default; one-step-off-policy and fully async recipesasync mode since v0.8.0fully async by design; staleness bound (0 = synchronous)
AlgorithmsPPO, GRPO and many variantsPPO, REINFORCE++ (and -baseline), GRPO, RLOOGRPO, GSPO, PPO, DAPO, RLOO, REINFORCE++ and others
Agentsmulti-turn agent loop with tool calling; search-tool exampleagent function hookagentic RL examples and an agent service

Feature lists come from each project’s README and documentation and change quickly, so check the current version before you rely on a row. A fourth design worth knowing is PipelineRL: it updates weights during generation, so one sequence can be produced by several policy versions. ScaleRL adopted this approach.

This is an illustrative quickstart, not a pinned, tested experiment: it clones the moving main branch and does not fix package, driver or model versions. Follow the current official verl installation guide and pin a release or commit before running it.

The verl quickstart trains Qwen2.5-0.5B-Instruct with PPO on GSM8K on a single GPU with at least 24 GB of memory. The reward is rule-based: the number after ”####” in the answer must match the reference.

Terminal window
git clone https://github.com/verl-project/verl && cd verl
pip install -e . # see the verl install guide for vLLM/SGLang extras
python3 examples/data_preprocess/gsm8k.py --local_save_dir ~/data/gsm8k
PYTHONUNBUFFERED=1 python3 -m verl.trainer.main_ppo \
data.train_files=$HOME/data/gsm8k/train.parquet \
data.val_files=$HOME/data/gsm8k/test.parquet \
data.train_batch_size=256 \
data.max_prompt_length=512 \
data.max_response_length=512 \
actor_rollout_ref.model.path=Qwen/Qwen2.5-0.5B-Instruct \
actor_rollout_ref.actor.optim.lr=1e-6 \
actor_rollout_ref.actor.ppo_mini_batch_size=64 \
actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=4 \
actor_rollout_ref.rollout.name=vllm \
actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=8 \
actor_rollout_ref.rollout.tensor_model_parallel_size=1 \
actor_rollout_ref.rollout.gpu_memory_utilization=0.4 \
actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=4 \
critic.optim.lr=1e-5 \
critic.model.path=Qwen/Qwen2.5-0.5B-Instruct \
critic.ppo_micro_batch_size_per_gpu=4 \
algorithm.kl_ctrl.kl_coef=0.001 \
trainer.logger=console \
trainer.val_before_train=False \
trainer.n_gpus_per_node=1 \
trainer.nnodes=1 \
trainer.save_freq=10 \
trainer.test_freq=10 \
trainer.total_epochs=15 2>&1 | tee verl_demo.log

Watch val/test_score/openai/gsm8k, which is logged every trainer.test_freq steps. If you have less than 32 GB of GPU memory, the quickstart suggests lowering the micro-batch sizes (to 1 if needed).

Switching to GRPO. Following verl’s GRPO documentation, remove the two critic.* model and optimiser lines, then add:

Terminal window
algorithm.adv_estimator=grpo \
actor_rollout_ref.rollout.n=8 \
actor_rollout_ref.actor.use_kl_loss=True \
actor_rollout_ref.actor.kl_loss_coef=0.001 \
actor_rollout_ref.actor.kl_loss_type=low_var_kl \

With rollout.n=8, each prompt gets a group of 8 samples whose rewards are normalised within the group, and the KL penalty moves from the reward into the loss. Generation is now 8× larger, so lower data.train_batch_size if you run out of memory. The AReaL equivalent is a single command, python3 examples/math/gsm8k_rl.py --config examples/math/gsm8k_grpo.yaml scheduler.type=local, after uv sync --extra cuda.

What to check in the first hour. The validation score should rise within a few test intervals. Response length should not collapse to a handful of tokens or hit max_response_length on most samples. Rewards that are all 0 or all 1 within a group give zero GRPO advantage, so log the fraction of such groups. For retrieval agents, verl’s search-tool example is the natural next step.

Questions to think through

These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.

  1. Derive / compute

    In the GRPO version of the one-GPU quickstart below, a rollout batch has 256 prompts with 8 samples each, the PPO mini-batch is 64 prompts, the per-GPU micro-batch is 4 responses and there is one PPO epoch. How many responses are generated per step, how many optimiser updates happen per rollout batch, how many forward/backward micro-batches make up one update, and which updates are not on-policy?

    What a strong answer covers
    • Responses per rollout batch: 256 × 8 = 2,048. verl counts the mini-batch in prompts, so one mini-batch is 64 × 8 = 512 responses.
    • Updates per rollout batch: 256 / 64 = 4 optimiser steps with one epoch.
    • Micro-batches per update on one GPU: 512 / 4 = 128 gradient-accumulation passes.
    • Only the first update uses data from the current weights; updates 2–4 use data generated by a policy that is one to three steps old, which is why the PPO ratio and clipping (computed against stored old log-probs) matter even in a "synchronous" framework.
  2. Mechanism

    Compare colocated (hybrid-engine), disaggregated and fully asynchronous placement of the trainer and the rollout engine. What idle time does each remove, and what does each cost in memory, weight-sync traffic or policy staleness?

    What a strong answer covers
    • Colocated: training and generation share the same GPUs and switch phases (verl's default, OpenRLHF's hybrid engine). No GPU sits idle waiting for another model, but the engine must free or offload memory at each switch and generation still waits for training.
    • Disaggregated: separate GPU pools for actor, critic, reward and vLLM engines (OpenRLHF's Ray placement). Phases can overlap and pools can be sized independently, at the price of weight broadcasts after each update and idle pools if they are mis-sized.
    • Fully asynchronous: generators never wait for training and stream samples into a buffer (AReaL; OpenRLHF's async mode; verl's async recipes). Long-tail rollouts no longer block the batch, but samples can be several versions stale, so the loss needs a staleness bound and an off-policy correction.
    • AReaL bounds staleness with a maximum off-policyness setting (0 recovers synchronous training) and uses a decoupled PPO objective; see the AReaL and Missing Old Logits pages.
  3. Critique

    A framework README claims "2.5× faster than verl". List what you would need to know before believing that the speed-up carries over to your multi-turn search-agent workload.

    What a strong answer covers
    • Hardware, model size, sequence lengths and number of GPUs used for each system, and whether both used tuned configurations.
    • Whether "faster" is throughput (tokens or samples per second) or time to a target accuracy; asynchronous systems train on stale data, so throughput gains can be partly offset by lower sample efficiency.
    • The response-length distribution: async systems gain most when rollout lengths have a long tail, which is true for reasoning and tool use but depends on the task.
    • For agents, tool and retrieval latency often dominate rollout time; framework speed-ups that only measure GPU generation may not transfer.
  4. Design

    You want to reproduce a small Search-R1-style experiment (a model that issues queries to a BM25 or dense index during RL) on 4 GPUs. Choose a framework, sketch the components, and list the checks you would run before trusting the first learning curve.

    What a strong answer covers
    • Any of the three can work; verl has a documented search-tool example for multi-turn rollouts, OpenRLHF has an agent function hook, and AReaL has agentic RL examples. Choose the one whose multi-turn example matches your tool interface.
    • Components: a retrieval server (BM25 or a dense index) exposed as a tool, a rollout loop that interleaves generation with tool calls, a rule-based reward (exact match or F1), and a loss mask so retrieved text is not trained on.
    • Checks: reproduce the framework's GSM8K example first; verify that tool-output tokens are masked; log the number of tool calls and response length per step; confirm that evaluation queries do not overlap training queries.
    • Start synchronous (or with staleness 0) and switch to asynchronous training only after the synchronous curve is stable, so that any regression can be attributed to staleness.