Agent RL 프레임워크Agent RL Frameworks
verl·slime·AReaL 등 오픈 RL 프레임워크의 구조, 학습 스텝의 배치 단위, Megatron 병렬화, 비동기 rollout과 agent loop 동시성을 직접 계산해 본다.How open RL frameworks such as verl, slime and AReaL are built: the batch units of a training step, Megatron parallelism, async rollouts and agent-loop concurrency — computed hands-on.
- Agent RL 프레임워크 지형도The landscape of agent RL frameworks35 분min
verl, slime, AReaL, OpenRLHF, TRL, ROLL, SkyRL, prime-rl, NeMo-RL을 네 개의 축 — GPU 배치(colocated vs 분리), 동기화(동기·one-step-off·fully async), rollout 엔진, 학습 backend — 으로 정리한다. 2026-12-03에 각 공식 저장소에서 확인한 버전과 손잡이 이름으로 비교표를 만들고, 긴 꼬리 응답 길이가 왜 설계를 비동기로 밀어내는지 장난감 시뮬레이션과 NumPy로 확인한다.Organises verl, slime, AReaL, OpenRLHF, TRL, ROLL, SkyRL, prime-rl and NeMo-RL along four axes — GPU placement (colocated vs disaggregated), synchronisation (sync, one-step-off, fully async), rollout engine and training backend — with a comparison matrix built from each official repository as of 2026-12-03, and checks with a toy simulation and NumPy why long-tailed response lengths push designs toward asynchrony.
- 학습 step 해부 — rollout, mini-batch, micro-batchAnatomy of a training step — rollout, mini-batch, micro-batch40 분min
train_batch_size, rollout.n, ppo_mini_batch_size, ppo_epochs, micro-batch 크기, use_dynamic_bsz와 ppo_max_token_len_per_gpu가 어떻게 맞물려 rollout 하나를 optimizer step 여러 개와 forward/backward 여러 번으로 바꾸는지 유도한다. rollout당 갱신 횟수가 만드는 정책 지연, 기울기 누적에서 token-mean을 정확히 지키는 정규화, 고정 micro-batch와 토큰 예산 동적 배치의 차이를 그림과 NumPy로 확인한다.Derives how train_batch_size, rollout.n, ppo_mini_batch_size, ppo_epochs, the micro-batch size, use_dynamic_bsz and ppo_max_token_len_per_gpu fit together to turn one rollout into several optimizer steps and many forward/backward passes. Checks, with figures and NumPy, the policy lag created by several updates per rollout, the normalisation that keeps token-mean exact under gradient accumulation, and fixed micro-batches versus token-budget dynamic batching.
- 학습 병렬화 — TP, PP, EP, CP, DP와 ZeRO·FSDPTraining parallelism — TP, PP, EP, CP, DP with ZeRO and FSDP45 분min
RL trainer가 모델을 GPU 여러 장에 나누는 다섯 가지 축 — 데이터(DP, ZeRO, FSDP), 층 내부(Megatron TP), 층의 순서(PP와 그 스케줄), expert(EP), 토큰(CP, Ulysses) — 을 메모리 식과 통신량 식으로 유도하고, column→row 분할이 dense matmul과 같다는 것, pipeline bubble 공식, ring attention이 full attention과 같다는 것을 NumPy로 확인한다.Derives, with memory and communication formulas, the five axes along which an RL trainer splits a model over GPUs — data (DP, ZeRO, FSDP), inside a layer (Megatron TP), the layer sequence (PP and its schedules), experts (EP) and tokens (CP, Ulysses) — and checks in NumPy that the column→row split equals the dense matmul, that pipeline bubbles follow their formulas, and that ring attention equals full attention.
- verl 오늘 — single controller, hybrid engine, agent loop, 비동기 trainerverl today — single controller, hybrid engine, agent loop, async trainers45 분min
2026-12 기준 verl(main 4525109, 릴리스 v0.9.1)의 구조를 정리한다. HybridFlow single controller와 worker group, TransferQueue 데이터 평면, hybrid engine의 sleep/wake와 checkpoint engine, 서버형 rollout과 AgentLoop, 핵심 설정의 정확한 이름과 의미, V1 trainer의 sync·colocate_async·separate_async 모드와 verl-recipe로 옮겨진 fully_async_policy의 손잡이를 짝지어 보고, 동시에 몇 개의 agent loop(와 환경 pod)가 뜨는지 계산한다.The structure of verl as of December 2026 (main 4525109, release v0.9.1) — the HybridFlow single controller and worker groups, the TransferQueue data plane, the hybrid engine's sleep/wake and checkpoint engines, server-based rollout and the AgentLoop, the exact names and semantics of the key settings, the V1 trainer's sync, colocate_async and separate_async modes matched against the knobs of the fully_async_policy recipe that moved to verl-recipe — and a calculator for how many agent loops (and environment pods) run at once.
- verl rollout correction — 세 정책과 각 옵션의 수식verl rollout correction — three policies and the equation behind every option50 분min
verl의 algorithm.rollout_correction이 하는 일을 코드 그대로 수식으로 옮긴다. π_rollout·π_old·π_θ 세 정책, decoupled와 bypass 모드(ppo_clip·reinforce), 토큰·시퀀스 IS와 TIS·IcePop, 11가지 rejection 규칙(k1/k2/k3 × token/seq_sum/seq_mean/seq_max, Geo-RS 포함)을 하나씩 유도하고, length trap과 bias–variance를 그림과 NumPy로 확인한다.What verl's algorithm.rollout_correction actually computes, translated from the code into equations. The three policies π_rollout, π_old and π_θ; decoupled vs bypass mode (ppo_clip and reinforce); token- and sequence-level IS with TIS or an IcePop band; and all eleven rejection rules (k1/k2/k3 × token/seq_sum/seq_mean/seq_max, including Geo-RS). We check the length trap and the bias–variance trade-off with figures and NumPy.
- 비동기 RL 시스템 비교 — staleness, 가중치 동기화, partial rolloutAsynchronous RL systems compared — staleness, weight sync, partial rollouts50 분min
동기 RL이 긴 꼬리 때문에 GPU를 놀리는 이유를 수식과 이산 사건 시뮬레이터로 보이고, one-step-off·fully async(staleness 상한)·partial rollout을 같은 GPU 예산에서 비교한다. 이어서 verl(V1 async trainer와 fully_async 레시피), AReaL, slime, prime-rl, SkyRL, OpenRLHF, ROLL이 staleness를 어떻게 묶고 가중치를 어떻게 동기화하는지 현재 코드 기준으로 정리한다.Why synchronous RL idles its GPUs on the long tail, shown with equations and a discrete-event simulator; one-step-off, fully async with a staleness bound, and partial rollouts compared on one GPU budget. Then how verl (V1 async trainer and the fully_async recipe), AReaL, slime, prime-rl, SkyRL, OpenRLHF and ROLL bound staleness and sync weights, checked against their current code.
- Agent loop과 환경 — 동시성, sandbox, 병목Agent loops and environments — concurrency, sandboxes, bottlenecks45 분min
verl의 agent loop이 실제로 어떻게 도는지(AgentLoopWorker, LLM 서버 클라이언트의 load balancing과 sticky session, token-in-token-out, ToolAgentLoop 상태 기계, tool 출력 masking)를 코드 기준으로 따라가고, 설정값에서 동시에 살아 있는 agent loop 수, 필요한 sandbox/pod 수, 그리고 병목이 LLM 토큰/s인지 환경 지연인지를 계산하는 법을 Little's law로 유도한다.How a verl agent loop actually runs (AgentLoopWorker, the LLM-server client's load balancing and sticky sessions, token-in/token-out, the ToolAgentLoop state machine, tool-output masking), traced through the code; then, from the config, how many agent loops are alive at once, how many sandboxes/pods they need, and whether LLM tokens/s or environment latency is the bottleneck — derived with Little's law.