Track IX · Frontier RL: Algorithms & Stability · 06/10

비동기 RL과 stalenessAsynchronous RL and staleness

동기 RL이 왜 GPU를 놀리는지 길이 꼬리로 계산하고, one-step-off·완전 비동기·partial/interruptible rollout을 하나의 시뮬레이터로 비교한다. 낡은 샘플이 gradient에 넣는 두 가지 bias(정책 bias와 길이·선택 bias)를 유도하고, decoupled PPO, staleness 상한 τ, 토큰 단위 freshness, 스케줄링 규칙이 각각 어디를 막는지 프론티어 랩의 공개 선택과 함께 본다.Compute from the length tail why synchronous RL leaves GPUs idle, then compare one-step-off, fully asynchronous and partial/interruptible rollout in one simulator. Derive the two biases a stale sample adds to the gradient (policy bias and length/selection bias), and see which part decoupled PPO, a staleness bound τ, token-level freshness and scheduling rules each address, alongside the frontier labs' published choices.

In LLM RL the expensive part is not the gradient step. It is generation. OLMo 3’s 32B Think run used 8 H100 nodes for training and 20 for inference, and the learner spent 75% of its time waiting for data; in a representative run a step took about 1,000 seconds, of which training was 125 (OLMo 3 review). And generation is slow in a particular way: a batch of responses has a heavy length tail, and an agent rollout adds tool latency on top (Agent RL showed this with a scheduling toy). Everything in this lesson is a way to keep GPUs busy despite that tail, and the price each way pays in staleness — training on samples from a policy that is no longer the current one.

The agent RL lesson introduced the trade-off, and the training–inference mismatch lesson introduced importance sampling and the decomposition πθ/μ=(πθ/πold)(πold/μ)\pi_\theta/\mu = (\pi_\theta/\pi_{\text{old}})(\pi_{\text{old}}/\mu). Here we go one level down: the pipeline designs labs actually published, the exact staleness rules, and the two different biases staleness introduces. The numerical engine mismatch at equal weights is the next lesson; the clip and mask objectives themselves are in clipping and IS.

Why a synchronous step idles

A synchronous colocated step generates a batch of BB responses, waits for all of them, then trains. If the response lengths LiL_i are i.i.d. and decoding runs at a roughly constant per-sequence speed (decode is memory-bound, so a sequence’s speed barely depends on its neighbours), the fraction of slot-time doing useful work during generation is

Ugen=∑iLiB max⁡iLi ≈ E[L]E[max⁡i≤BLi].U_{\text{gen}}=\frac{\sum_i L_i}{B\,\max_i L_i}\ \approx\ \frac{\mathbb{E}[L]}{\mathbb{E}[\max_{i\le B}L_i]} .

For a log-normal length log⁡L∼N(−σ2/2,σ2)\log L\sim\mathcal{N}(-\sigma^2/2,\sigma^2) (mean 1), the maximum of BB samples sits near exp⁡(−σ2/2+σzB)\exp(-\sigma^2/2+\sigma z_B) with zB≈E[max⁡i≤BZi]z_B\approx\mathbb{E}[\max_{i\le B}Z_i], about 2.4 for B=64B=64. With σ=0.9\sigma=0.9 that is e−0.41+2.16≈5.8e^{-0.41+2.16}\approx5.8: the slots are busy only about 17% of the generation phase, and the waste grows without bound as the tail gets heavier, while the mean stays at 1. OLMo 3 quotes the same quantity for static batching, (Lmax⁡−Lˉ)/Lmax⁡(L_{\max}-\bar L)/L_{\max}: with 32K generation and an average of 14,628 tokens, up to 54% of the slot-time is wasted.

Colocation adds a second loss: while the batch trains, no GPU generates, and while it generates, no GPU trains. So every design below attacks one of two things — the tail inside a batch (waiting for the slowest) or the phase barrier between generation and training.

Four pipeline families

PipelineWhat overlapsStaleness of a trained samplePublished examples
Synchronous, colocatednothing; the same GPUs alternate0 (plus mini-batch epochs)k1.5 (Megatron and vLLM as sidecars on the same GPUs; under a minute to switch to inference, about 10 s back), slime for reasoning RL (GLM-4.5), MiMo-7B
One-step-offgeneration of batch n+1n{+}1 with training on batch nnexactly 1Asynchronous RLHF (Noukhovitch et al.), Nemotron 3 Super/Ultra (inference may lag training by up to one step)
Fully asynchronous, boundedeverything; generation never stops0…τ0\ldots\tau, set by a boundAReaL (η\eta), GLM-5 (τ\tau), MAI-Base-2 (drop beyond 8 updates), OLMo 3 (max asynchrony 8 for 32B), ScaleRL/PipelineRL (k=8k=8), MiMo-V2.6 (staleness 4)
Partial / interruptiblelong rollouts span iterationsgrows with lengthk1.5 partial rollout, K3 (pause at fraction λ\lambda), AReaL interruptible rollout, PipelineRL in-flight updates

One-step-off is the smallest change. Noukhovitch et al. separate generation and learning so new samples are produced while the learner trains on the previous ones, and report a LLaMA 3.1 8B instruction-following run about 40% faster than synchronous at matched final performance (about 70% for a 1B model on GSM8K); among the objectives they compare, online DPO was the most robust to off-policy data, and robustness grew with model scale. Every sample is exactly one version old, so the off-policy correction is a fixed, small problem. But notice what it does not fix: generation of a batch still waits for its slowest member.

Fully asynchronous pipelines put rollout and training on separate GPU pools and let generation run continuously. A staleness bound keeps the pools from drifting apart. AReaL’s rollout controller rejects a new generation request unless

⌊Nr−1B⌋ ≤ i+η,\Big\lfloor\frac{N_r-1}{B}\Big\rfloor\ \le\ i+\eta ,

where NrN_r is the number of trajectories generated so far, BB the training batch size and ii the current policy version: generation may run at most η\eta batches ahead of training. Its defaults are η=4\eta=4 for code and η=8\eta=8 for maths, and it prefers older trajectories when forming a batch. GLM-5 enforces the bound on the consumer side instead: each trajectory carries the list of weight versions it was generated with, (w0,…,wk)(w_0,\dots,w_k), and is dropped if w′−w0>τw'-w_0>\tau for the current version w′w'; the trainer pushes weights every KK updates and resets the optimizer at each push, because the rollout policy — and therefore the optimisation problem — changes (k1.5 resets its optimizer every iteration for the same reason). MAI-Base-2 updates the inference model every 5 gradient steps and discards rollouts more than 8 updates (40 gradient steps) stale, and lowers the learning rate at long lengths precisely because longer rollouts are staler (MAI-Base-2 review).

Partial and interruptible rollout attack the tail directly. k1.5 gives each iteration a token budget; trajectories that do not finish are saved and continued in the next iteration (k1.5 review). K3 pauses generation once a fraction λ\lambda of the N×KN\times K responses has finished, trains, and resumes the paused ones first, together with their sandbox state (K3 review). AReaL interrupts in-flight generations when new weights arrive, discards the KV cache computed with old weights, recomputes it with the new ones, and continues decoding. PipelineRL and OLMo 3’s inflight updates swap weights mid-generation without recomputing the KV cache — faster (OLMo 3: 881 → 2,949 tokens/s together with continuous batching and threading, the largest single gain being inflight updates), at the cost of a sequence whose early and late parts, and even its cached keys and values, come from different policies. Nemotron 3 makes the same choice (no KV recomputation) and masks tokens whose train/inference log-prob ratio diverges too far.

LLM RL에서 비싼 것은 gradient step이 아니라 생성이다. OLMo 3의 32B Think 실행은 학습에 H100 8노드, 추론에 20노드를 썼고 learner는 시간의 75%를 데이터를 기다리며 보냈다. 대표적인 실행에서 한 step이 평균 약 1,000초였고 그중 학습은 125초였다(OLMo 3 리뷰). 그리고 생성은 특유의 방식으로 느리다. 한 배치의 응답 길이는 꼬리가 두껍고, agent rollout에는 tool 지연이 더해진다(Agent RL에서 스케줄링 장난감으로 봤다). 이 레슨의 모든 내용은 그 꼬리에도 불구하고 GPU를 바쁘게 유지하는 방법들이고, 각 방법이 치르는 대가인 staleness — 더 이상 현재 정책이 아닌 정책의 샘플로 학습하는 것 — 이다.

Agent RL 레슨은 이 trade-off를 소개했고, 학습–추론 불일치 레슨은 importance sampling과 분해 πθ/μ=(πθ/πold)(πold/μ)\pi_\theta/\mu = (\pi_\theta/\pi_{\text{old}})(\pi_{\text{old}}/\mu)를 소개했다. 여기서는 한 단계 더 들어간다. 랩들이 실제로 공개한 파이프라인 설계, 정확한 staleness 규칙, 그리고 staleness가 만드는 두 종류의 bias다. 같은 weight에서의 수치적 엔진 불일치는 다음 레슨에서, clip·mask 목적함수 자체는 clipping과 IS에서 다룬다.

동기 step이 노는 이유

동기 colocated step은 응답 BB개를 생성하고, 모두 끝나기를 기다린 뒤 학습한다. 응답 길이 LiL_i가 i.i.d.이고 시퀀스당 decode 속도가 대략 일정하다면(decode는 memory-bound라 이웃 시퀀스가 속도를 거의 바꾸지 않는다), 생성 단계에서 slot 시간 중 유용한 일을 하는 비율은

Ugen=∑iLiB max⁡iLi ≈ E[L]E[max⁡i≤BLi]U_{\text{gen}}=\frac{\sum_i L_i}{B\,\max_i L_i}\ \approx\ \frac{\mathbb{E}[L]}{\mathbb{E}[\max_{i\le B}L_i]}

이다. 평균 1인 로그정규 길이 log⁡L∼N(−σ2/2,σ2)\log L\sim\mathcal{N}(-\sigma^2/2,\sigma^2)라면 BB개 중 최댓값은 exp⁡(−σ2/2+σzB)\exp(-\sigma^2/2+\sigma z_B) 근처에 있고, zB≈E[max⁡i≤BZi]z_B\approx\mathbb{E}[\max_{i\le B}Z_i]는 B=64B=64에서 약 2.4다. σ=0.9\sigma=0.9면 e−0.41+2.16≈5.8e^{-0.41+2.16}\approx5.8, 즉 생성 단계의 약 17%만 slot이 일한다. 평균은 1로 둔 채 꼬리만 두꺼워져도 낭비는 한없이 커진다. OLMo 3는 static batching에 대해 같은 양 (Lmax⁡−Lˉ)/Lmax⁡(L_{\max}-\bar L)/L_{\max}를 인용한다. 32K 생성에 평균 14,628 토큰이면 slot 시간의 최대 54%가 버려진다.

colocation은 두 번째 손실을 더한다. 배치가 학습하는 동안 어떤 GPU도 생성하지 않고, 생성하는 동안 어떤 GPU도 학습하지 않는다. 그래서 아래의 모든 설계는 둘 중 하나를 공격한다. 배치 안의 꼬리(가장 느린 것 기다리기)이거나, 생성과 학습 사이의 단계 장벽이다.

파이프라인의 네 갈래

파이프라인무엇이 겹치나학습 샘플의 staleness공개된 예
동기, colocated없음. 같은 GPU가 번갈아 한다0 (mini-batch epoch 제외)k1.5(Megatron과 vLLM을 같은 GPU의 sidecar로. 추론 전환 1분 이내, 되돌아오는 데 약 10초), reasoning RL용 slime(GLM-4.5), MiMo-7B
One-step-off배치 n+1n{+}1 생성과 배치 nn 학습정확히 1Asynchronous RLHF(Noukhovitch et al.), Nemotron 3 Super/Ultra(추론이 학습보다 최대 1 step 늦을 수 있다)
완전 비동기, 상한 있음전부. 생성이 멈추지 않는다상한으로 정한 0…τ0\ldots\tauAReaL(η\eta), GLM-5(τ\tau), MAI-Base-2(8 업데이트 넘으면 버림), OLMo 3(32B 최대 비동기 8), ScaleRL/PipelineRL(k=8k=8), MiMo-V2.6(staleness 4)
Partial / interruptible긴 rollout이 iteration을 넘나든다길이에 따라 커진다k1.5 partial rollout, K3(비율 λ\lambda에서 멈춤), AReaL interruptible rollout, PipelineRL in-flight update

One-step-off는 가장 작은 변경이다. Noukhovitch et al.은 생성과 학습을 분리해 learner가 이전 샘플로 학습하는 동안 새 샘플을 만들게 하고, LLaMA 3.1 8B instruction-following 실행이 동기 대비 약 40% 빨랐다고 보고한다(최종 성능은 같다. GSM8K의 1B 모델은 약 70%). 비교한 목적함수 중 online DPO가 off-policy 데이터에 가장 강건했고, 강건성은 모델 크기와 함께 커졌다. 모든 샘플이 정확히 한 버전 낡았으니 off-policy 보정은 고정된 작은 문제다. 하지만 고치지 않는 것도 보자. 한 배치의 생성은 여전히 가장 느린 구성원을 기다린다.

완전 비동기 파이프라인은 rollout과 학습을 서로 다른 GPU pool에 두고 생성을 계속 돌린다. staleness 상한이 두 pool이 멀어지지 않게 묶는다. AReaL의 rollout controller는 새 생성 요청을

⌊Nr−1B⌋ ≤ i+η\Big\lfloor\frac{N_r-1}{B}\Big\rfloor\ \le\ i+\eta

일 때만 받는다. NrN_r은 지금까지 생성한 trajectory 수, BB는 학습 배치 크기, ii는 현재 정책 버전이다. 생성은 학습보다 최대 η\eta 배치까지만 앞서 갈 수 있다. 기본값은 코드 η=4\eta=4, 수학 η=8\eta=8이고, 배치를 만들 때 오래된 trajectory를 우선한다. GLM-5는 상한을 소비자 쪽에서 건다. trajectory마다 생성에 쓰인 weight 버전 목록 (w0,…,wk)(w_0,\dots,w_k)를 달고, 현재 버전 w′w'에 대해 w′−w0>τw'-w_0>\tau면 버린다. trainer는 KK 업데이트마다 weight를 push하고 push할 때마다 optimizer를 초기화한다. rollout 정책이, 따라서 최적화 문제가 바뀌기 때문이다(k1.5도 같은 이유로 매 iteration optimizer를 초기화한다). MAI-Base-2는 5 gradient step마다 추론 모델을 갱신하고 8 업데이트(40 gradient step)보다 낡은 rollout을 버리며, 긴 rollout일수록 더 낡기 때문에 긴 길이에서 learning rate를 낮춘다(MAI-Base-2 리뷰).

Partial·interruptible rollout은 꼬리를 직접 공격한다. k1.5는 iteration마다 토큰 예산을 주고, 끝나지 않은 trajectory는 저장했다가 다음 iteration에 이어 쓴다(k1.5 리뷰). K3는 N×KN\times K 응답 중 비율 λ\lambda가 끝나면 생성을 멈추고 학습한 뒤, 멈춘 것을 sandbox 상태와 함께 먼저 재개한다(K3 리뷰). AReaL은 새 weight가 오면 진행 중인 생성을 중단하고 옛 weight로 계산한 KV cache를 버리고 새 weight로 다시 계산한 뒤 decode를 이어 간다. PipelineRL과 OLMo 3의 inflight update는 KV cache를 다시 계산하지 않고 생성 도중 weight를 바꾼다. 더 빠르지만(OLMo 3: continuous batching·threading과 합쳐 881 → 2,949 tokens/s, 가장 큰 단일 이득이 inflight update), 앞부분과 뒷부분, 심지어 cache된 key·value까지 서로 다른 정책에서 온 시퀀스가 생긴다. Nemotron 3도 같은 선택(KV 재계산 없음)을 하고, 학습·추론 log-prob 비가 너무 벌어진 토큰을 mask한다.

GPU 활용률GPU util – rollout / trainer – 처리량 (동기 대비)throughput (× sync) – staleness 평균mean – 버림dropped – 길이 biaslength bias –
A toy of 16 GPUs (4 rollout slots each), batch B = 64 sequences, lengths log-normal with mean 1 and tail σ. Top: the first 16 rollout slots over time; each bar is one sequence, coloured by how many policy versions old it is when trained (0, 1, 2, 3+, grey = dropped as too stale); the violet row (and violet shading in colocated modes) is the trainer. Bottom left: staleness histogram of trained sequences with their mean length on top. Bottom right: length distribution of everything generated (grey) vs what was trained (blue). Switch from synchronous to fully async and the idle grey gaps disappear; lower τ to 1–2 and long sequences start being dropped, so the trained distribution loses its tail (negative length bias). Move the GPU split until neither pool idles. GPU 16개(각 rollout slot 4개), 배치 B = 64 시퀀스, 길이는 평균 1, 꼬리 σ의 로그정규인 장난감이다. 위: 처음 16개 rollout slot의 시간축. 막대 하나가 시퀀스 하나이고, 색은 학습될 때 몇 버전 낡았는지다(0, 1, 2, 3+, 회색 = 너무 낡아 버림). 보라 행(colocated 모드에서는 보라 음영)이 trainer다. 왼쪽 아래: 학습된 시퀀스의 staleness 히스토그램과 그 위의 평균 길이. 오른쪽 아래: 생성된 전체(회색)와 실제 학습된 것(파랑)의 길이 분포. 동기에서 완전 비동기로 바꾸면 빈 구간이 사라지고, τ를 1–2로 낮추면 긴 시퀀스부터 버려져 학습 분포의 꼬리가 잘린다(음의 길이 bias). 어느 쪽 pool도 놀지 않도록 GPU 분할을 옮겨 보자.

Things to try (toy units, not a calibrated cluster model):

  1. Synchronous at σ = 0.9: the rollout rows are mostly empty — each batch waits for its longest member, then the violet training block stalls everyone. Raise σ to 1.4 and utilisation drops further while the mean length stays 1.
  2. One-step-off: staleness is exactly 1 for every sample, the trainer now runs in parallel, but the gaps inside each generation wave remain. It removes the phase barrier, not the tail.
  3. Fully async, τ = 8: no gaps, throughput several times the synchronous one, staleness spread over 0–2 with occasional larger values. Now lower τ to 1: utilisation stays high, but grey bars (dropped) appear — almost all of them long — and the trained length distribution loses its tail. That is the length bias the next sections derive.
  4. Move the GPU split. With too few trainer GPUs the trainer row is solid violet and samples queue up to the staleness bound (mean staleness rises toward τ). With too few rollout GPUs the trainer idles. The best split balances the two rates, R⋅m/E[L]≈(G−R)/(c E[L])R\cdot m/\mathbb{E}[L]\approx(G-R)/(c\,\mathbb{E}[L]) in the toy’s units.
  5. Partial rollout with λ = 0.75: colocated like the synchronous mode, yet far fewer gaps, because the iteration ends before the tail finishes. The staleness histogram now has a long tail, and the mean length per staleness bin grows with staleness — the long sequences are the ones spanning versions.

What a stale sample does to the gradient

Let the sample come from the behaviour policy πbehav=πθn−k\pi_{\text{behav}}=\pi_{\theta_{n-k}}, kk versions old, while we take the gradient at θ\theta. The naive estimator treats it as on-policy:

g^naive=Ey∼πbehav[A^(y) ∇θlog⁡πθ(y)] ≠ ∇θJ(θ)=Ey∼πθ[A(y) ∇θlog⁡πθ(y)].\hat g_{\text{naive}}=\mathbb{E}_{y\sim\pi_{\text{behav}}}\big[\hat A(y)\,\nabla_\theta\log\pi_\theta(y)\big] \ \ne\ \nabla_\theta J(\theta)=\mathbb{E}_{y\sim\pi_\theta}\big[A(y)\,\nabla_\theta\log\pi_\theta(y)\big].

The difference is the policy bias of staleness. It is not noise: it points systematically toward what the old policy did. The importance weight πθ/πbehav\pi_\theta/\pi_{\text{behav}} removes it, and that weight factors exactly as

πθπbehav=πθπprox⏟ut: this update⋅πproxπbehav⏟wt: staleness,\frac{\pi_\theta}{\pi_{\text{behav}}}=\underbrace{\frac{\pi_\theta}{\pi_{\text{prox}}}}_{u_t:\ \text{this update}}\cdot\underbrace{\frac{\pi_{\text{prox}}}{\pi_{\text{behav}}}}_{w_t:\ \text{staleness}} ,

for any intermediate policy πprox\pi_{\text{prox}}. Hilton, Cobbe and Schulman’s point (2021) is that PPO uses its ratio for two jobs — the off-policy correction and the trust region that limits each update — and these should use different denominators. The trust region should be centred on a recent policy (the proximal policy), the correction on the policy that actually sampled (the behaviour policy). AReaL’s decoupled objective (Eq. 5) takes πprox\pi_{\text{prox}} to be the parameters before the current update step:

Jdec(θ)=Ey∼πbehav[∑tsg⁡[wt]⋅min⁡(utA^t, clip⁡(ut,1−ε,1+ε)A^t)].J_{\text{dec}}(\theta)=\mathbb{E}_{y\sim\pi_{\text{behav}}}\Big[\sum_t \operatorname{sg}[w_t]\cdot\min\big(u_t\hat A_t,\ \operatorname{clip}(u_t,1-\varepsilon,1+\varepsilon)\hat A_t\big)\Big].

Why not simply clip rt=πθ/πbehavr_t=\pi_\theta/\pi_{\text{behav}}, which is what you get if you use the rollout’s log-probs as πold\pi_{\text{old}}? Because log⁡rt=log⁡ut+log⁡wt\log r_t=\log u_t+\log w_t, and log⁡wt\log w_t is the sum of kk per-version moves. If each version moves a token’s log-prob by an increment with standard deviation ss, the spread of log⁡wt\log w_t grows like sks\sqrt{k} when the moves are uncorrelated and like s ks\,k when the policy keeps moving in the same direction — which is exactly what a learning policy does. Once ∣log⁡wt∣|\log w_t| exceeds the clip width, the coupled clip silences a token before the current update has moved it at all. Worse, the silenced tokens are not random: for A^>0\hat A>0 they are the good tokens whose probability has already risen since sampling. Clipping them removes signal in a direction-dependent way, so the bias does not average out. The decoupled form clips only utu_t, whose spread does not depend on kk, and pays for staleness through the variance of wtw_t instead.

AReaL’s ablation (Table 2; a 1.5B model on maths, 250 steps) shows both effects. Without the decoupled objective, AIME24 falls from 42.0 (synchronous, η=0\eta=0) to 35.7 at η=8\eta=8 and 34.0 with unbounded staleness (with an outlier of 23.3 at η=4\eta=4); with it, the scores are 42.1, 41.8, 42.2, 41.0 and 38.7 for η=1,2,4,8,16\eta=1,2,4,8,16 and 36.9 unbounded. The authors conclude that moderate staleness (η≤8\eta\le8) has minimal impact with the decoupled objective, which accelerates training by more than 2×. ScaleRL reached the same kind of conclusion from the systems side: PipelineRL with up to 8 steps of off-policyness was the best setting in its sweep and matched the asymptote of PPO-style off-policy updates at much better compute efficiency.

해 볼 것(장난감 단위다. 실제 클러스터를 보정한 모델이 아니다):

  1. σ = 0.9에서 동기: rollout 행이 대부분 비어 있다. 배치마다 가장 긴 것을 기다리고, 그다음 보라색 학습 구간이 모두를 멈춘다. σ를 1.4로 올리면 평균 길이는 1 그대로인데 활용률이 더 떨어진다.
  2. One-step-off: 모든 샘플의 staleness가 정확히 1이고 trainer가 병렬로 돌지만, 각 생성 묶음 안의 빈틈은 남는다. 단계 장벽을 없앨 뿐 꼬리를 없애지는 않는다.
  3. 완전 비동기, τ = 8: 빈틈이 없고 처리량이 동기의 몇 배다. staleness는 0–2에 퍼지고 가끔 더 크다. 이제 τ를 1로 낮추자. 활용률은 높은 채로인데 회색 막대(버림)가 나타나고 — 거의 모두 긴 것이다 — 학습된 길이 분포의 꼬리가 사라진다. 다음 절에서 유도할 길이 bias다.
  4. GPU 분할을 옮겨 보자. trainer GPU가 너무 적으면 trainer 행이 보라색으로 꽉 차고 샘플이 staleness 상한까지 줄을 선다(평균 staleness가 τ 쪽으로 오른다). rollout GPU가 너무 적으면 trainer가 논다. 최적 분할은 두 속도를 맞춘다. 장난감 단위로 R⋅m/E[L]≈(G−R)/(c E[L])R\cdot m/\mathbb{E}[L]\approx(G-R)/(c\,\mathbb{E}[L])이다.
  5. λ = 0.75의 partial rollout: 동기 모드처럼 colocated인데 빈틈이 훨씬 적다. 꼬리가 끝나기 전에 iteration을 끝내기 때문이다. staleness 히스토그램에 긴 꼬리가 생기고, staleness 칸마다의 평균 길이가 staleness와 함께 커진다. 여러 버전에 걸친 것이 긴 시퀀스다.

낡은 샘플이 gradient에 하는 일

샘플이 kk 버전 전의 behaviour policy πbehav=πθn−k\pi_{\text{behav}}=\pi_{\theta_{n-k}}에서 왔고 gradient는 θ\theta에서 구한다고 하자. 순진한 추정량은 이것을 on-policy로 취급한다.

g^naive=Ey∼πbehav[A^(y) ∇θlog⁡πθ(y)] ≠ ∇θJ(θ)=Ey∼πθ[A(y) ∇θlog⁡πθ(y)].\hat g_{\text{naive}}=\mathbb{E}_{y\sim\pi_{\text{behav}}}\big[\hat A(y)\,\nabla_\theta\log\pi_\theta(y)\big] \ \ne\ \nabla_\theta J(\theta)=\mathbb{E}_{y\sim\pi_\theta}\big[A(y)\,\nabla_\theta\log\pi_\theta(y)\big].

이 차이가 staleness의 정책 bias다. 잡음이 아니다. 옛 정책이 하던 쪽으로 체계적으로 기운다. importance weight πθ/πbehav\pi_\theta/\pi_{\text{behav}}가 이것을 없애고, 그 weight는 임의의 중간 정책 πprox\pi_{\text{prox}}에 대해 정확히

πθπbehav=πθπprox⏟ut: 이번 업데이트⋅πproxπbehav⏟wt: staleness\frac{\pi_\theta}{\pi_{\text{behav}}}=\underbrace{\frac{\pi_\theta}{\pi_{\text{prox}}}}_{u_t:\ \text{이번 업데이트}}\cdot\underbrace{\frac{\pi_{\text{prox}}}{\pi_{\text{behav}}}}_{w_t:\ \text{staleness}}

로 쪼개진다. Hilton, Cobbe, Schulman(2021)의 요점은 PPO가 ratio를 두 가지 일에 쓴다는 것이다. off-policy 보정과, 각 업데이트의 크기를 묶는 trust region이다. 둘은 분모가 달라야 한다. trust region은 최근 정책(proximal policy)에, 보정은 실제로 샘플한 정책(behaviour policy)에 중심을 둬야 한다. AReaL의 decoupled 목적함수(Eq. 5)는 πprox\pi_{\text{prox}}를 현재 업데이트 step 직전의 매개변수로 잡는다.

Jdec(θ)=Ey∼πbehav[∑tsg⁡[wt]⋅min⁡(utA^t, clip⁡(ut,1−ε,1+ε)A^t)].J_{\text{dec}}(\theta)=\mathbb{E}_{y\sim\pi_{\text{behav}}}\Big[\sum_t \operatorname{sg}[w_t]\cdot\min\big(u_t\hat A_t,\ \operatorname{clip}(u_t,1-\varepsilon,1+\varepsilon)\hat A_t\big)\Big].

rollout의 log-prob를 πold\pi_{\text{old}}로 쓸 때 얻는 rt=πθ/πbehavr_t=\pi_\theta/\pi_{\text{behav}}를 그냥 clip하면 왜 안 될까? log⁡rt=log⁡ut+log⁡wt\log r_t=\log u_t+\log w_t이고, log⁡wt\log w_t는 버전별 이동 kk개의 합이다. 버전마다 토큰의 log-prob가 표준편차 ss의 증분으로 움직인다면, log⁡wt\log w_t의 폭은 이동이 무상관일 때 sks\sqrt{k}로, 정책이 같은 방향으로 계속 움직이면 s ks\,k로 자란다. 학습 중인 정책은 바로 그렇게 움직인다. ∣log⁡wt∣|\log w_t|가 clip 폭을 넘으면 결합된(coupled) clip은 이번 업데이트가 그 토큰을 전혀 움직이기 전에 침묵시킨다. 더 나쁜 것은 침묵하는 토큰이 무작위가 아니라는 점이다. A^>0\hat A>0이면 샘플 이후 확률이 이미 오른 좋은 토큰들이다. 이들을 clip하면 방향에 따라 신호가 지워지므로 bias가 평균으로 상쇄되지 않는다. decoupled 형태는 kk와 무관한 utu_t만 clip하고, staleness의 값은 wtw_t의 분산으로 치른다.

AReaL의 ablation(Table 2, 수학의 1.5B 모델, 250 step)은 두 효과를 모두 보여 준다. decoupled 목적함수가 없으면 AIME24가 42.0(동기, η=0\eta=0)에서 η=8\eta=8의 35.7, 상한 없음의 34.0으로 떨어진다(η=4\eta=4에 23.3이라는 튀는 값도 있다). 있으면 η=1,2,4,8,16\eta=1,2,4,8,16에서 42.1, 41.8, 42.2, 41.0, 38.7, 상한 없음 36.9다. 저자들은 decoupled 목적함수와 함께라면 적당한 staleness(η≤8\eta\le8)의 영향은 작고 학습이 2배 넘게 빨라진다고 결론짓는다. ScaleRL은 시스템 쪽에서 같은 결론에 닿았다. 최대 8 step off-policy인 PipelineRL이 sweep에서 가장 좋았고, PPO식 off-policy 업데이트와 같은 점근 성능을 훨씬 좋은 compute 효율로 냈다.

gradient 유지tokens with gradient: PPO(πbehav) – 양방향 maskdouble-sided mask – decoupled – ESS/n (πprox/πbehav) –
Left: per-token log-ratio at staleness k. Red = log(πθ/πbehav), the ratio a PPO clip sees if the rollout log-probs are used as πold; blue = log(πθ/πprox), the ratio the decoupled objective clips. Dashed lines: the clip band [0.8, 1.28]. Right: fraction of tokens that still carry gradient as staleness grows — standard PPO clip against πbehav (red), a double-sided mask on the same ratio (amber, GLM-5 style), decoupled PPO (blue, AReaL) — and the ESS of the decoupled importance weight (dashed). Below the grey line ESS/n = ½ (DLC resynchronises there). Drag k: the red histogram widens like a random walk (√k) when ρ = 0 and linearly (k) when ρ = 1, while blue does not move. 왼쪽: staleness k에서 토큰별 log-ratio. 빨강 = log(πθ/πbehav), rollout log-prob를 πold로 쓰면 PPO clip이 보는 ratio. 파랑 = log(πθ/πprox), decoupled 목적함수가 clip하는 ratio. 점선은 clip 밴드 [0.8, 1.28]. 오른쪽: staleness가 커질 때 gradient가 남는 토큰 비율 — πbehav 기준 PPO clip(빨강), 같은 ratio에 양방향 mask(주황, GLM-5 방식), decoupled PPO(파랑, AReaL) — 과 decoupled IS 가중치의 ESS(점선). 회색 선 ESS/n = ½ 아래에서 DLC는 재동기화한다. k를 끌어 보면 ρ = 0일 때 빨강 히스토그램은 random walk처럼 √k로, ρ = 1이면 k에 비례해 넓어지고, 파랑은 움직이지 않는다.
  1. At k = 0 the red and blue histograms coincide and all three objectives keep almost every token.
  2. Drag k to 8 with ρ = 0.6: the red histogram (the ratio a coupled clip sees) is now much wider than the band; the red and amber curves fall while the blue curve stays flat. The double-sided mask (amber) loses more than PPO’s clip (red) because it zeros both sides for both signs of A^\hat A.
  3. The price of decoupling is the dashed ESS of wtw_t. Set s = 0.1 and drag k: ESS/n crosses ½ around the point where the coupled objectives have lost most of their tokens. DLC resynchronises the sampler at exactly this threshold.
  4. Set ρ = 0 (random-walk drift): everything degrades much more slowly. Real policies under RL drift persistently, so the s ks\,k regime is the relevant one.

Where the labs land

The choices differ in which ratio they constrain and whether they recompute πprox\pi_{\text{prox}}.

  • Decoupled with recomputation (AReaL): one extra forward pass for πprox\pi_{\text{prox}}; clip only the current update; weight by πprox/πbehav\pi_{\text{prox}}/\pi_{\text{behav}}.
  • One ratio against the rollout (GLM-5’s agentic RL): a trajectory may span several versions, so GLM-5 drops πold\pi_{\text{old}} entirely and uses rt=exp⁡(log⁡πθ−log⁡πrollout)r_t=\exp(\log\pi_\theta-\log\pi_{\text{rollout}}) with a double-sided mask that zeros tokens outside (1−εℓ,1+εh)(1-\varepsilon_\ell,1+\varepsilon_h) for either sign of the advantage. One ratio now carries engine mismatch, staleness and the current update together, so the band must be tight (GLM-5 review). The values of εℓ,εh,τ,K\varepsilon_\ell,\varepsilon_h,\tau,K are not published.
  • Masks plus a quadratic pull (K2.5/K3): a mask zeroing tokens whose log-ratio leaves an interval, plus τ(log⁡πθ/πold)2\tau(\log\pi_\theta/\pi_{\text{old}})^2; the report claims this tolerates trajectories that span several iterations.
  • An outer clip for the open branch (MAI-Base-2): PPO’s clip leaves A^<0, ρ>1+ε\hat A<0,\ \rho>1+\varepsilon unbounded; with stale rollouts ρ\rho reached tens and produced gradient-norm spikes, so MAI caps ρ≤rmax⁡=50\rho\le r_{\max}=50 on every branch.
  • Staleness-aware truncated IS for partial rollouts (MiMo-V2-Flash), and staleness 4 with fully asynchronous partial rollout in V2.6 (MiMo-V2 review).

The objective details live in clipping and IS; what matters here is the denominator each one uses.

Lag is not the same as engine noise

DLC (Li et al., 2026) runs the trainer once more with the sampler’s weights and splits the per-token gap into

δt=log⁡pθ−log⁡pθold⏟ℓt: lag+log⁡pθold−log⁡q⏟et: discrepancy.\delta_t=\underbrace{\log p_\theta-\log p_{\theta_{\text{old}}}}_{\ell_t:\ \text{lag}}+\underbrace{\log p_{\theta_{\text{old}}}-\log q}_{e_t:\ \text{discrepancy}} .

In their small-model experiments the discrepancy of an FP8 sampler stayed roughly constant (about 0.02 nats per token), while with a stale sampler the discrepancy was below 10−310^{-3} and the lag two orders of magnitude larger — and the lag amplifies itself, because a policy trained on biased gradients drifts further from its sampler. With plain IS on a stale Qwen3-1.7B sampler the lag ratio’s ESS dropped below ½ at step 11 and accuracy collapsed to 0.5% by step 30; adding resynchronisation when ESS fell below ½ kept it at 36.6%, and their full method at 51.9% (on-policy 57.6%). In a continuously asynchronous setting (maximum version gap 4, mean lag 2.85) the gap to on-policy was small (DLC 55.9%, IS 52.9%, on-policy 56.8%; a single run). Two practical rules follow: track the ESS of the staleness weight, not just its mean, and treat a collapsing ESS as a signal to resynchronise or drop data rather than to correct harder. The evidence is from 0.6B–8B dense models on one task, so treat the threshold as a starting point. Why a constant discrepancy still needs a fix of its own — it adds a drift toward the sampler that the online loop compounds — and why the centring that removes it should be composed with IS once the lag is large, is the subject of score centering.

The second bias: which samples survive

The policy bias is about how a stale sample is weighted. A second bias is about which samples reach the trainer at all, and no importance weight fixes it, because the dropped samples are simply missing.

Length and staleness are coupled. A sequence of length LL that starts at version v0v_0 finishes around v0+L/Δtstepv_0+L/\Delta t_{\text{step}}, so long sequences are systematically the stale ones. Any rule that drops stale samples — GLM-5’s w′−w0>τw'-w_0>\tau, MAI’s 8-update limit — therefore drops long samples preferentially, and the trained distribution is shorter than the policy’s. If correct answers tend to be longer (or shorter), this becomes a reward bias too. In the figure’s toy at τ = 1 about a tenth of the early-started sequences are dropped and the trained mean length is a quarter lower. GLM-5 adds a group-level twist: after the staleness filter and environment-crash removal, a group is used only if more than half of it survives (it is then padded by repeating survivors); one long, stale trajectory can push a group under that line and remove it entirely — long-horizon prompts are the ones most at risk.

Token-level freshness instead of trajectory-level. Solar Open 2 (§4.2.1) records the policy version of every token. A token is fresh if its staleness (updates since it was generated) is at most smax⁡s_{\max}; a trajectory is admitted only if its fresh-token fraction reaches ρ\rho, and its stale prefix is masked out of the loss, so no over-stale token contributes gradient. This keeps the expensive tail of a long rollout instead of throwing the whole rollout away because its first tokens are old. (The report gives no values for smax⁡s_{\max} or ρ\rho.)

Scheduling order is a sampling distribution. MiniMax’s Forge names the two failure modes: strict FIFO preserves the distribution but one long rollout at the head blocks everyone; greedy (take whatever finishes first) maximises throughput but makes early batches short and easy and later ones long and hard, so the gradient oscillates. Its windowed FIFO lets the trainer take any finished trajectory among the next WW in generation order, with W=0.3NW=0.3N (MiniMax review). MiMo-7B stays synchronous but changes when it stops generating: once enough valid samples exist it aborts the rest only when every task started before the selected samples has finished, because aborting blindly would drop long responses (Table 2 of its report: 2.29× overall speed-up over naive dynamic sampling, GPU idle ratio from 69.3% to 27.7%; MiMo-7B review). DeepSeek-V4 states the same principle for fault tolerance: requests interrupted by preemption are resumed from a token-level write-ahead log and the saved KV cache, never regenerated from scratch, because short responses are more likely to have finished before the interruption and resampling would bias toward them.

Removing the bubble without adding staleness

Not every fix trades staleness for throughput. Several systems shrink idle time at fixed staleness:

  • Weight distribution off the critical path. Laminar (arXiv 2510.12633) puts a tier of relay workers between trainer and rollouts as a distributed parameter service, so a rollout can pull the latest weights whenever it is ready without stalling training or interrupting other requests; it also repacks long-tail trajectories onto a few dedicated workers (up to 5.48× training throughput on a 1,024-GPU cluster).
  • Elastic use of trainer GPUs. One published scheduler for fully asynchronous training (verl’s dynamic resource scheduling) pairs always-on rollout replicas with “hybrid” replicas on the trainer’s GPUs, which generate only while the trainer would idle and are offloaded before each update (reported about 15% faster end-to-end than fixed splits on one benchmark, with an identical reward curve).
  • Streaming data plane. AsyncFlow (arXiv 2507.01663) and its TransferQueue buffer stream samples between producers and consumers at sample granularity instead of whole batches, so stages overlap automatically (AsyncFlow reports 1.59× average throughput over its baseline).
  • Tail-latency work inside the engine — multi-node inference with DP-attention so requests never queue, MTP for small-batch stragglers, prefill–decode disaggregation so long multi-turn prefills do not stall decodes (GLM-5’s slime), and DP-aware routing that keeps every turn of an agent on the same KV cache. The engine side is in inference for RL.

The mechanics of particular frameworks (batch-size knobs, worker APIs) are covered in a separate frameworks track.

→ Go deeper: Asynchronous RL systems compared — how real frameworks implement admission rules, partial rollouts and weight sync. The same staleness question for a distillation teacher (a top-k teacher run one or two steps off) is in distillation and synthetic data.

Implementing it

The simulator core of the figure in NumPy: synchronous colocated, one-step-off and fully asynchronous with AReaL-style admission control and a GLM-5-style staleness filter. A dropped sample frees its admission slot, so generation never deadlocks.

NumPy Pipeline simulator: utilisation, staleness and length bias
import numpy as np, heapq
G, M, B, C, TEND, LCAP = 16, 4, 64, 0.12, 240.0, 10.0   # GPUs, slots per GPU, batch, train cost per token, horizon, length cap

def simulate(mode, sigma=0.9, R=10, tau=2, seed=0):
    """mode: 'sync' (colocated), 'off1' (one-step-off), 'async' (bounded staleness tau).
    Rollout GPUs R, trainer GPUs G-R (ignored for 'sync'). Toy units: mean length 1, decode speed 1."""
    rng = np.random.default_rng(seed)
    pool = np.minimum(LCAP, np.exp(-sigma**2 / 2 + sigma * rng.standard_normal(20000)))
    it = iter(pool)
    seqs = []                       # [L, v0, t_start, t_done, v_train (-1 = not trained), dropped]
    busy_roll = busy_train = 0.0
    if mode == 'sync':
        t, v = 0.0, 0
        while t < TEND:
            batch = [[next(it), v, t, 0.0, v, False] for _ in range(B)]   # B <= G*M slots: all start together
            for s in batch: s[3] = t + s[0]
            gen = max(s[0] for s in batch)                                 # wait for the slowest
            tok = sum(s[0] for s in batch)
            busy_roll += tok / M; seqs += batch
            dur = C * tok / G; busy_train += dur * G
            t += gen + dur; v += 1
        Rg = Tg = G
    elif mode == 'off1':
        S, T = R * M, G - R
        gen_end, train_end, n = [], [], 0
        while True:
            ready = 0.0 if n < 2 else train_end[n - 2]                     # weights of version n-1 ready
            tg = max(gen_end[-1] if gen_end else 0.0, ready)
            if tg > TEND: break
            free = [tg] * S; batch = []
            for _ in range(B):                                             # list scheduling on S slots
                st = heapq.heappop(free); L = next(it)
                batch.append([L, max(0, n - 1), st, st + L, n, False]); heapq.heappush(free, st + L)
            gen_end.append(max(s[3] for s in batch))
            ts = max(gen_end[-1], train_end[-1] if train_end else 0.0)
            dur = C * sum(s[0] for s in batch) / T
            train_end.append(ts + dur); busy_train += min(dur, max(0.0, TEND - ts)) * T
            seqs += batch; n += 1
        for s in seqs: busy_roll += max(0.0, min(s[3], TEND) - s[2]) / M
        for s in seqs:
            if train_end[s[4]] > TEND: s[4] = -1
        Rg, Tg = R, T
    else:   # fully asynchronous: AReaL-style admission control + GLM-5-style staleness filter
        S, T = R * M, G - R
        ev, buf, idle = [], [], S
        st = dict(v=0, started=0, training=False, busy=0.0)
        def try_start(t):
            nonlocal idle
            while idle and st['started'] < (st['v'] + tau + 1) * B:
                idle -= 1; L = next(it); s = [L, st['v'], t, t + L, -1, False]
                seqs.append(s); st['started'] += 1
                heapq.heappush(ev, (t + L, 0, len(seqs), s))
        def try_train(t):
            nonlocal buf
            if st['training']: return
            for s in buf:
                if st['v'] - s[1] > tau:                                  # too stale: drop it and
                    s[5] = True; st['started'] -= 1                         # free its admission slot
            buf = [s for s in buf if not s[5]]
            if len(buf) >= B:
                buf.sort(key=lambda s: (s[1], s[3]))                      # oldest version first
                batch, buf = buf[:B], buf[B:]
                for s in batch: s[4] = st['v']
                dur = C * sum(s[0] for s in batch) / T
                st['training'] = True; st['busy'] += min(dur, max(0.0, TEND - t)) * T
                heapq.heappush(ev, (t + dur, 1, 0, None))
        try_start(0.0)
        while ev:
            t, kind, _, s = heapq.heappop(ev)
            if t > TEND: break
            if kind == 1: st['v'] += 1; st['training'] = False             # push new weights (in flight)
            else: buf.append(s); idle += 1
            try_start(t); try_train(t)
        busy_train = st['busy']
        for s in seqs: busy_roll += max(0.0, min(s[3], TEND) - s[2]) / M
        Rg, Tg = R, T
    a = np.array(seqs, dtype=float)
    trained = a[:, 4] >= 0
    pop = a[:, 2] < 0.6 * TEND                                           # started early enough to finish
    stale = (a[trained, 4] - a[trained, 1]).astype(np.intp)
    return dict(util=(busy_roll + busy_train) / (G * TEND), roll=busy_roll / (Rg * TEND),
                train=busy_train / (Tg * TEND), thr=a[trained & (a[:, 3] < TEND), 0].sum() / TEND,
                stale=stale, drop=a[pop, 5].mean(), bias=a[pop & trained, 0].mean() / a[pop, 0].mean() - 1)

base = simulate('sync')['thr']
print("pipeline        GPU util  rollout  trainer  thrpt/sync  staleness mean/max  dropped  length bias")
for mode, kw in [('sync', {}), ('off1', {}), ('async', dict(tau=0)), ('async', dict(tau=1)),
                 ('async', dict(tau=2)), ('async', dict(tau=8))]:
    r = simulate(mode, **kw)
    name = mode + (f" tau={kw['tau']}" if 'tau' in kw else '')
    print(f"{name:14s} {r['util']:8.2f} {r['roll']:8.2f} {r['train']:8.2f} {r['thr']/base:10.2f}"
          f"      {r['stale'].mean():5.2f} / {r['stale'].max():2d}     {r['drop']:6.1%}   {r['bias']:+7.1%}")
 

Read the rows top to bottom. Synchronous colocated uses a quarter of the GPU-time. One-step-off barely helps here, because each batch still waits for its slowest sequence. Fully asynchronous with τ = 0 is worse than synchronous — split pools with a synchronous barrier get the drawbacks of both. With τ = 1 and 2 throughput jumps (2.3× and 2.9×) but the staleness filter drops about 11% and 5% of the sequences, almost all long, so the trained mean length is 28% and 17% below the generated one. At τ = 8 nothing is dropped and throughput is 3.7×: once the bound is loose enough that no sequence outlives it, the admission controller alone keeps staleness low (mean 1.4). The lesson of the toy is not a specific τ but the shape: a tight drop filter buys little staleness and costs a lot of length bias; bounding generation at admission is cheaper.

Next, the policy bias itself. A softmax policy over 64 actions follows exact natural-gradient steps; we build the surrogate gradient from samples of a policy kk versions old, in exact expectation, and compare it with the true gradient at the current parameters.

NumPy Coupled vs decoupled PPO on stale samples (exact expectations)
import numpy as np

# A softmax policy over V actions; we compare surrogate gradients built from STALE samples (pi_behav = policy k
# versions ago) with the true on-policy gradient at the current parameters. Expectations are exact (no sampling).
V, ETA, EPS_L, EPS_H = 64, 0.6, 0.2, 0.28
rng = np.random.default_rng(1)
r = rng.random(V) ** 3                                   # reward per action (few good actions)
softmax = lambda z: np.exp(z - z.max()) / np.exp(z - z.max()).sum()

def pg(theta):                                           # exact policy gradient of E_pi[r] w.r.t. logits
    p = softmax(theta); return p * (r - p @ r)

thetas = [rng.normal(0, 1.0, V)]                         # a trajectory of policy versions
for _ in range(20):
    p = softmax(thetas[-1]); thetas.append(thetas[-1] + ETA * (r - p @ r))   # natural-gradient step on the logits

def surrogate_grad(theta, prox, behav, kind):
    """Gradient of the per-token surrogate, in expectation over a ~ behav, w.r.t. logits theta.
    Per action the contribution is mu(a) * coef(a) * (e_a - pi), coef = d surrogate / d log pi(a)."""
    pi, mu, px = softmax(theta), softmax(behav), softmax(prox)
    A = r - mu @ r                                       # group-mean baseline, estimated on stale samples
    if kind == 'naive':                                  # treat stale samples as on-policy
        coef = A
    elif kind == 'coupled':                              # PPO clip with pi_old := pi_behav
        rho = pi / mu
        clipped = ((A > 0) & (rho > 1 + EPS_H)) | ((A < 0) & (rho < 1 - EPS_L))
        coef = np.where(clipped, 0.0, rho * A)
    elif kind == 'decoupled':                            # AReaL: weight pi_prox/pi_behav, clip pi/pi_prox
        u, w = pi / px, px / mu
        clipped = ((A > 0) & (u > 1 + EPS_H)) | ((A < 0) & (u < 1 - EPS_L))
        coef = np.where(clipped, 0.0, w * u * A)
    g = mu * coef
    return g - pi * g.sum()                              # sum_a g_a (e_a - pi)

cos = lambda a, b: a @ b / (np.linalg.norm(a) * np.linalg.norm(b) + 1e-12)
n = 20                                                   # current version
prox = thetas[n]
theta = prox + 0.5 * ETA * (r - softmax(prox) @ r)       # mid-update: half a step past prox
true = pg(theta)
print("staleness k | cos(naive) | cos(coupled) frac-clipped | cos(decoupled) | ESS/n of w = pi_prox/pi_behav")
for k in [0, 1, 2, 4, 8, 16]:
    behav = thetas[n - k]
    mu, px, pi = softmax(behav), softmax(prox), softmax(theta)
    rho = pi / mu; A = r - mu @ r
    frac = mu @ (((A > 0) & (rho > 1 + EPS_H)) | ((A < 0) & (rho < 1 - EPS_L)))
    w = px / mu; ess = (mu @ w) ** 2 / (mu @ w**2)
    gs = {k_: surrogate_grad(theta, prox, behav, k_) for k_ in ['naive', 'coupled', 'decoupled']}
    print(f"{k:11d} | {cos(gs['naive'], true):10.3f} | {cos(gs['coupled'], true):12.3f} {frac:12.1%} |"
          f" {cos(gs['decoupled'], true):14.3f} | {ess:8.3f}")
 

The naive estimator degrades smoothly (cosine 0.82 at k = 8, 0.07 at k = 16). The coupled clip is worse than naive from k = 2 on and points the wrong way at k = 8 (cosine −0.49) with 73% of the probability mass clipped: the clipped actions are exactly the good ones whose probability rose since sampling, so what remains is dominated by pushing down bad actions in a way that, relative to the current policy, is mis-scaled. The decoupled objective recovers the true direction at every kk (here exactly, because we use exact expectations and an untruncated weight); the price shows in the last column, the ESS of ww, which falls to 0.23 at k = 16. With finite samples that is the variance you pay.

Finally, the pieces in PyTorch: the decoupled loss, a GLM-5-style staleness filter with group padding, and the optimizer reset at each weight push.

PyTorch PyTorch: decoupled PPO, staleness filter, group padding, optimizer reset 로컬에서 실행run locally (pip install torch)
import torch

def decoupled_ppo_loss(logp, prox_logp, behav_logp, adv, mask, eps_low=0.2, eps_high=0.28, w_cap=None):
    """Decoupled PPO (Hilton et al. 2021; AReaL Eq. 5). All tensors (N, T) over sampled tokens.
    logp:       log pi_theta of the sampled tokens (requires grad)
    prox_logp:  log pi_prox, recomputed by the trainer with the weights from before this update (no grad)
    behav_logp: log pi_behav as returned by the rollout engine; may span several weight versions (no grad)"""
    u = torch.exp(logp - prox_logp)                                  # trust region centred on pi_prox
    surr = torch.minimum(u * adv, u.clamp(1 - eps_low, 1 + eps_high) * adv)
    w = torch.exp((prox_logp - behav_logp).clamp(-20.0, 20.0))       # staleness correction pi_prox / pi_behav
    if w_cap is not None:
        w = w.clamp(max=w_cap)                                       # optional truncation (not part of Eq. 5)
    m = mask.float()
    return -(w.detach() * surr * m).sum() / m.sum().clamp(min=1)

def staleness_filter_and_pad(groups, version_now, tau):
    """groups: list of groups; each sample is a dict with 'v0' (oldest weight version used) and 'env_ok'.
    Drop stale (version_now - v0 > tau) or crashed samples; keep a group only if more than half survives,
    then pad it back to its size by repeating survivors (GLM-5 §4.1.2 style). Compute advantages afterwards."""
    out = []
    for g in groups:
        keep = [s for s in g if s["env_ok"] and version_now - s["v0"] <= tau]
        if 2 * len(keep) <= len(g):
            continue                                                 # too few survivors: drop the whole group
        out.append(keep + [keep[i % len(keep)] for i in range(len(g) - len(keep))])
    return out

def push_weights(optimizer, publish_fn):
    """After publishing new weights to the rollout engines, start a fresh optimisation problem."""
    publish_fn()                                                     # in-flight update; engines keep generating
    optimizer.state.clear()                                          # GLM-5 resets the optimizer at each push
 
확인 문제Check yourself

A fully asynchronous run drops every trajectory whose oldest token is more than τ = 2 versions old. Training reward looks healthy, but evaluation responses are getting shorter and the model starts failing hard problems that need long reasoning. What is the most likely cause?

Long trajectories take longer to generate, so they are the ones that cross the staleness bound. A drop filter therefore removes them preferentially — a selection bias that no importance weight can correct, because the dropped samples never reach the loss. If long trajectories are also the ones that solve hard problems, the policy is trained on a distribution that underweights exactly that behaviour. Remedies: bound staleness at admission instead of dropping at training time, use token-level freshness (mask the stale prefix but keep the rest, as in Solar Open 2), lower the learning rate for long lengths (MAI), and log generated vs trained length distributions.

확인 문제Check yourself

Why does the decoupled PPO objective clip π_θ/π_prox instead of π_θ/π_behav?

The ratio πθ/πbehav=utwt\pi_\theta/\pi_{\text{behav}}=u_t w_t mixes two things. Clipping it means tokens that moved during the kk versions since sampling — and with a persistently learning policy these are disproportionately the good ones — lose their gradient before the current update has touched them. Clipping only ut=πθ/πproxu_t=\pi_\theta/\pi_{\text{prox}} keeps the trust-region role local to this update; the staleness enters through wtw_t, whose cost is variance (watch its ESS). It costs one extra forward pass to compute πprox\pi_{\text{prox}}; GLM-5’s agentic RL skips that pass and uses a single tight double-sided band on πθ/πrollout\pi_\theta/\pi_{\text{rollout}} instead.

Summary

  • Synchronous RL wastes GPU-time in two places: inside a batch (waiting for the longest sequence, U≈E[L]/E[max⁡L]U\approx\mathbb{E}[L]/\mathbb{E}[\max L]) and at the barrier between generation and training. One-step-off removes the barrier; fully asynchronous and partial/interruptible rollout also remove the tail.
  • Staleness adds a policy bias (samples from πθ−k\pi_{\theta-k}). The ratio factors as ut wtu_t\,w_t; decoupled PPO clips only the current update utu_t and corrects staleness with wtw_t, whose ESS is the cost to monitor (DLC resynchronises below ½). A coupled clip against the rollout policy silences tokens that already moved — preferentially the good ones.
  • Staleness also adds a selection bias: long sequences are the stale ones, so drop filters, greedy consumption and blind early termination all shorten the trained distribution. Bound staleness at admission, use token-level freshness, preserve FIFO order within a window, and resume rather than regenerate interrupted requests.
  • Published settings: AReaL η = 4–8 with a decoupled objective; GLM-5 τ-filter + optimizer reset at each push + group padding + double-sided mask; MAI 5 steps per push and an 8-update cut-off with an outer clip at 50; OLMo 3 and ScaleRL up to 8 steps with in-flight updates; Nemotron 3 one step; MiMo-V2.6 staleness 4.
  • Systems work can shrink idle time without adding staleness: relay workers for weights, elastic use of trainer GPUs, streaming data planes, and tail-latency work in the engine.
  1. k = 0에서는 빨강과 파랑 히스토그램이 겹치고 세 목적함수 모두 거의 모든 토큰을 쓴다.
  2. ρ = 0.6에서 k를 8로 끌면 빨강 히스토그램(결합 clip이 보는 ratio)이 밴드보다 훨씬 넓어진다. 빨강·주황 곡선은 떨어지고 파랑 곡선은 평평하다. 양방향 mask(주황)는 A^\hat A의 부호와 상관없이 양쪽을 모두 0으로 만들기 때문에 PPO clip(빨강)보다 더 잃는다.
  3. decoupling의 값은 점선인 wtw_t의 ESS다. s = 0.1로 두고 k를 끌어 보면 결합 목적함수들이 토큰 대부분을 잃는 지점 근처에서 ESS/n이 ½을 지난다. DLC는 바로 이 문턱에서 sampler를 재동기화한다.
  4. ρ = 0(random-walk drift)으로 두면 모든 것이 훨씬 천천히 나빠진다. RL 중인 실제 정책은 지속적으로 drift하므로 s ks\,k 영역이 현실이다.

랩들의 선택

선택은 어떤 ratio를 묶는지, πprox\pi_{\text{prox}}를 다시 계산하는지에서 갈린다.

  • 재계산 + decoupled(AReaL): πprox\pi_{\text{prox}}를 위해 forward를 한 번 더 한다. 현재 업데이트만 clip하고 πprox/πbehav\pi_{\text{prox}}/\pi_{\text{behav}}로 가중한다.
  • rollout 기준 ratio 하나(GLM-5의 agentic RL): trajectory가 여러 버전에 걸칠 수 있으므로 πold\pi_{\text{old}}를 아예 버리고 rt=exp⁡(log⁡πθ−log⁡πrollout)r_t=\exp(\log\pi_\theta-\log\pi_{\text{rollout}})에 양방향 mask를 건다. advantage 부호와 상관없이 (1−εℓ,1+εh)(1-\varepsilon_\ell,1+\varepsilon_h) 밖의 토큰을 0으로 만든다. 이제 ratio 하나가 엔진 불일치, staleness, 현재 업데이트를 함께 실으므로 밴드가 좁아야 한다(GLM-5 리뷰). εℓ,εh,τ,K\varepsilon_\ell,\varepsilon_h,\tau,K 값은 공개되지 않았다.
  • mask + 이차 당김(K2.5/K3): log-ratio가 구간을 벗어난 토큰을 0으로 만드는 mask에 τ(log⁡πθ/πold)2\tau(\log\pi_\theta/\pi_{\text{old}})^2를 더한다. 보고서는 이것이 여러 iteration에 걸친 trajectory를 견딘다고 주장한다.
  • 열린 가지에 바깥 clip(MAI-Base-2): PPO clip은 A^<0, ρ>1+ε\hat A<0,\ \rho>1+\varepsilon을 묶지 않는다. 낡은 rollout에서 ρ\rho가 수십에 이르러 gradient norm spike를 만들었기에, MAI는 모든 가지에 ρ≤rmax⁡=50\rho\le r_{\max}=50을 건다.
  • partial rollout용 staleness를 고려한 truncated IS(MiMo-V2-Flash), V2.6의 완전 비동기 partial rollout에서 staleness 4(MiMo-V2 리뷰).

목적함수 세부는 clipping과 IS에 있다. 여기서 중요한 것은 각각이 쓰는 분모다.

lag는 엔진 잡음과 다르다

DLC(Li et al., 2026)는 trainer를 sampler의 weight로 한 번 더 돌려 토큰별 차이를

δt=log⁡pθ−log⁡pθold⏟ℓt: lag+log⁡pθold−log⁡q⏟et: discrepancy\delta_t=\underbrace{\log p_\theta-\log p_{\theta_{\text{old}}}}_{\ell_t:\ \text{lag}}+\underbrace{\log p_{\theta_{\text{old}}}-\log q}_{e_t:\ \text{discrepancy}}

로 나눈다. 작은 모델 실험에서 FP8 sampler의 discrepancy는 대략 일정했고(토큰당 약 0.02 nats), 낡은 sampler에서는 discrepancy가 10−310^{-3} 아래인 반면 lag가 두 자릿수 더 컸다. 그리고 lag는 스스로 커진다. bias된 gradient로 학습한 정책은 sampler에서 더 멀어지기 때문이다. 낡은 Qwen3-1.7B sampler에 평범한 IS를 쓰면 lag ratio의 ESS가 step 11에 ½ 아래로 떨어졌고 step 30에 정확도가 0.5%로 무너졌다. ESS가 ½ 아래일 때 재동기화를 더하면 36.6%, 그들의 전체 방법은 51.9%를 지켰다(on-policy 57.6%). 연속 비동기 설정(최대 버전 차 4, 평균 lag 2.85)에서는 on-policy와의 차이가 작았다(DLC 55.9%, IS 52.9%, on-policy 56.8%, 단일 실행). 실무 규칙 두 가지가 나온다. staleness weight의 평균만 말고 ESS를 추적하라, 그리고 ESS 붕괴를 더 세게 보정하라는 신호가 아니라 재동기화하거나 데이터를 버리라는 신호로 다뤄라. 근거는 한 과제의 0.6B–8B dense 모델이므로 문턱값은 출발점으로만 보자. 거의 일정한 discrepancy도 따로 처방이 필요한 이유 — sampler 쪽으로 가는 drift를 더하고 online 루프가 그것을 복리로 키운다 — 와, lag가 크면 그것을 지우는 중심화를 IS와 결합해야 하는 이유는 score centering에서 다룬다.

두 번째 bias: 어떤 샘플이 살아남나

정책 bias는 낡은 샘플에 어떻게 가중하느냐의 문제다. 두 번째 bias는 어떤 샘플이 trainer에 닿기라도 하느냐의 문제이고, 버려진 샘플은 그냥 없으므로 어떤 importance weight로도 고칠 수 없다.

길이와 staleness는 묶여 있다. 버전 v0v_0에서 시작한 길이 LL의 시퀀스는 대략 v0+L/Δtstepv_0+L/\Delta t_{\text{step}}에 끝나므로, 긴 시퀀스가 체계적으로 낡은 시퀀스다. 낡은 샘플을 버리는 어떤 규칙도 — GLM-5의 w′−w0>τw'-w_0>\tau, MAI의 8 업데이트 제한 — 그래서 긴 샘플을 우선 버리고, 학습 분포는 정책의 분포보다 짧아진다. 정답이 더 길거나 짧은 경향이 있다면 이것은 보상 bias도 된다. 그림의 장난감에서 τ = 1이면 일찍 시작한 시퀀스의 약 10분의 1이 버려지고 학습된 평균 길이가 4분의 1 줄어든다. GLM-5에는 group 단위 반전이 더 있다. staleness 필터와 환경 crash 제거 뒤 group의 절반 넘게 살아남아야 쓰고(그다음 생존자를 반복해 채운다), 길고 낡은 trajectory 하나가 group을 그 선 아래로 밀면 group 전체가 사라진다. long-horizon 프롬프트가 가장 위험하다.

trajectory 단위 대신 토큰 단위 freshness. Solar Open 2(§4.2.1)는 모든 토큰의 정책 버전을 기록한다. staleness(생성 이후 업데이트 수)가 smax⁡s_{\max} 이하인 토큰이 fresh하고, fresh 토큰 비율이 ρ\rho에 닿는 trajectory만 받아들이며, 그 낡은 앞부분은 loss에서 mask하므로 지나치게 낡은 토큰은 gradient를 내지 않는다. 첫 토큰들이 낡았다는 이유로 긴 rollout 전체를 버리는 대신 비싼 꼬리를 지킨다. (보고서는 smax⁡s_{\max}나 ρ\rho의 값을 주지 않는다.)

스케줄 순서는 샘플링 분포다. MiniMax의 Forge는 두 실패 모드를 이름 붙인다. 엄격한 FIFO는 분포를 지키지만 맨 앞의 긴 rollout 하나가 모두를 막는다. greedy(먼저 끝난 것부터)는 처리량을 최대화하지만 초반 배치는 짧고 쉬운 것, 후반 배치는 길고 어려운 것이 되어 gradient가 진동한다. windowed FIFO는 생성 순서상 다음 WW개 안에서 끝난 trajectory는 아무것이나 가져가게 하고 W=0.3NW=0.3N을 쓴다(MiniMax 리뷰). MiMo-7B는 동기를 유지하되 생성을 멈추는 시점을 바꾼다. 유효 샘플이 충분해지면 나머지를 중단하는데, 선택된 샘플보다 먼저 시작한 작업이 모두 끝났을 때만 그렇게 한다. 무작정 중단하면 긴 응답이 버려지기 때문이다(보고서 Table 2: naive dynamic sampling 대비 전체 2.29배, GPU 유휴 비율 69.3% → 27.7%. MiMo-7B 리뷰). DeepSeek-V4는 장애 복구에서 같은 원칙을 말한다. 선점으로 끊긴 요청은 토큰 단위 write-ahead log와 저장된 KV cache에서 재개하고 처음부터 다시 생성하지 않는다. 짧은 응답이 중단 전에 끝났을 가능성이 높으므로 재샘플링은 짧은 쪽으로 bias를 만들기 때문이다.

staleness를 늘리지 않고 빈틈 없애기

모든 처방이 staleness를 처리량과 바꾸는 것은 아니다. staleness를 그대로 둔 채 유휴 시간을 줄이는 시스템도 있다.

  • weight 배포를 critical path 밖으로. Laminar(arXiv 2510.12633)는 trainer와 rollout 사이에 relay worker 계층을 분산 parameter service로 두어, rollout이 준비될 때마다 학습을 멈추거나 다른 요청을 끊지 않고 최신 weight를 가져가게 한다. 긴 꼬리 trajectory를 소수의 전용 worker로 다시 모으기도 한다(1,024-GPU 클러스터에서 학습 처리량 최대 5.48배).
  • trainer GPU의 탄력적 사용. 완전 비동기 학습용으로 공개된 한 스케줄러(verl의 dynamic resource scheduling)는 상시 rollout replica와 trainer GPU 위의 “hybrid” replica를 짝짓는다. hybrid replica는 trainer가 놀 때만 생성하고 각 업데이트 전에 내려간다(한 벤치마크에서 고정 분할보다 end-to-end 약 15% 빠르고 보상 곡선은 같다고 보고).
  • 스트리밍 데이터 평면. AsyncFlow(arXiv 2507.01663)와 그 TransferQueue 버퍼는 배치 전체가 아니라 샘플 단위로 생산자와 소비자 사이를 흘려 단계들이 자동으로 겹치게 한다(AsyncFlow는 기준선 대비 평균 처리량 1.59배를 보고).
  • 엔진 안의 꼬리 지연 작업 — 요청이 줄 서지 않게 하는 DP-attention 다중 노드 추론, 작은 배치의 낙오자를 위한 MTP, 긴 멀티턴 prefill이 decode를 멈추지 않게 하는 prefill–decode 분리(GLM-5의 slime), agent의 모든 턴을 같은 KV cache로 보내는 DP-aware routing. 엔진 쪽은 RL을 위한 추론에 있다.

특정 프레임워크의 메커니즘(배치 크기 설정, worker API)은 별도의 프레임워크 트랙에서 다룬다.

→ 더 깊이: 비동기 RL 시스템 비교 — 실제 프레임워크가 입장 규칙, partial rollout, 가중치 동기화를 어떻게 구현하는지. 증류 교사에서 생기는 같은 staleness 문제(top-k 교사를 one/two-step-off로 비동기 실행)는 증류와 합성 데이터.

구현해 보기

그림의 시뮬레이터 핵심을 NumPy로: 동기 colocated, one-step-off, AReaL식 admission control과 GLM-5식 staleness 필터를 단 완전 비동기. 버려진 샘플은 자기 admission 자리를 돌려주므로 생성이 교착되지 않는다.

NumPy 파이프라인 시뮬레이터: 활용률, staleness, 길이 bias
import numpy as np, heapq
G, M, B, C, TEND, LCAP = 16, 4, 64, 0.12, 240.0, 10.0   # GPU 수, GPU당 slot, 배치, 토큰당 학습 비용, 시간 범위, 길이 상한

def simulate(mode, sigma=0.9, R=10, tau=2, seed=0):
    """mode: 'sync'(colocated), 'off1'(one-step-off), 'async'(staleness 상한 tau).
    rollout GPU R개, trainer GPU G-R개('sync'에서는 무시). 장난감 단위: 평균 길이 1, decode 속도 1."""
    rng = np.random.default_rng(seed)
    pool = np.minimum(LCAP, np.exp(-sigma**2 / 2 + sigma * rng.standard_normal(20000)))
    it = iter(pool)
    seqs = []                       # [L, v0, t_start, t_done, v_train (-1 = 학습 안 됨), dropped]
    busy_roll = busy_train = 0.0
    if mode == 'sync':
        t, v = 0.0, 0
        while t < TEND:
            batch = [[next(it), v, t, 0.0, v, False] for _ in range(B)]   # B <= G*M slot: 동시에 시작
            for s in batch: s[3] = t + s[0]
            gen = max(s[0] for s in batch)                                 # 가장 느린 것을 기다린다
            tok = sum(s[0] for s in batch)
            busy_roll += tok / M; seqs += batch
            dur = C * tok / G; busy_train += dur * G
            t += gen + dur; v += 1
        Rg = Tg = G
    elif mode == 'off1':
        S, T = R * M, G - R
        gen_end, train_end, n = [], [], 0
        while True:
            ready = 0.0 if n < 2 else train_end[n - 2]                     # 버전 n-1 weight 준비
            tg = max(gen_end[-1] if gen_end else 0.0, ready)
            if tg > TEND: break
            free = [tg] * S; batch = []
            for _ in range(B):                                             # S개 slot에 list scheduling
                st = heapq.heappop(free); L = next(it)
                batch.append([L, max(0, n - 1), st, st + L, n, False]); heapq.heappush(free, st + L)
            gen_end.append(max(s[3] for s in batch))
            ts = max(gen_end[-1], train_end[-1] if train_end else 0.0)
            dur = C * sum(s[0] for s in batch) / T
            train_end.append(ts + dur); busy_train += min(dur, max(0.0, TEND - ts)) * T
            seqs += batch; n += 1
        for s in seqs: busy_roll += max(0.0, min(s[3], TEND) - s[2]) / M
        for s in seqs:
            if train_end[s[4]] > TEND: s[4] = -1
        Rg, Tg = R, T
    else:   # 완전 비동기: AReaL식 admission control + GLM-5식 staleness 필터
        S, T = R * M, G - R
        ev, buf, idle = [], [], S
        st = dict(v=0, started=0, training=False, busy=0.0)
        def try_start(t):
            nonlocal idle
            while idle and st['started'] < (st['v'] + tau + 1) * B:
                idle -= 1; L = next(it); s = [L, st['v'], t, t + L, -1, False]
                seqs.append(s); st['started'] += 1
                heapq.heappush(ev, (t + L, 0, len(seqs), s))
        def try_train(t):
            nonlocal buf
            if st['training']: return
            for s in buf:
                if st['v'] - s[1] > tau:                                  # 너무 낡음: 버리고
                    s[5] = True; st['started'] -= 1                         # admission 자리를 돌려준다
            buf = [s for s in buf if not s[5]]
            if len(buf) >= B:
                buf.sort(key=lambda s: (s[1], s[3]))                      # 오래된 버전부터
                batch, buf = buf[:B], buf[B:]
                for s in batch: s[4] = st['v']
                dur = C * sum(s[0] for s in batch) / T
                st['training'] = True; st['busy'] += min(dur, max(0.0, TEND - t)) * T
                heapq.heappush(ev, (t + dur, 1, 0, None))
        try_start(0.0)
        while ev:
            t, kind, _, s = heapq.heappop(ev)
            if t > TEND: break
            if kind == 1: st['v'] += 1; st['training'] = False             # 새 weight push (in flight)
            else: buf.append(s); idle += 1
            try_start(t); try_train(t)
        busy_train = st['busy']
        for s in seqs: busy_roll += max(0.0, min(s[3], TEND) - s[2]) / M
        Rg, Tg = R, T
    a = np.array(seqs, dtype=float)
    trained = a[:, 4] >= 0
    pop = a[:, 2] < 0.6 * TEND                                           # 끝날 만큼 일찍 시작한 것
    stale = (a[trained, 4] - a[trained, 1]).astype(np.intp)
    return dict(util=(busy_roll + busy_train) / (G * TEND), roll=busy_roll / (Rg * TEND),
                train=busy_train / (Tg * TEND), thr=a[trained & (a[:, 3] < TEND), 0].sum() / TEND,
                stale=stale, drop=a[pop, 5].mean(), bias=a[pop & trained, 0].mean() / a[pop, 0].mean() - 1)

base = simulate('sync')['thr']
print("pipeline        GPU util  rollout  trainer  thrpt/sync  staleness mean/max  dropped  length bias")
for mode, kw in [('sync', {}), ('off1', {}), ('async', dict(tau=0)), ('async', dict(tau=1)),
                 ('async', dict(tau=2)), ('async', dict(tau=8))]:
    r = simulate(mode, **kw)
    name = mode + (f" tau={kw['tau']}" if 'tau' in kw else '')
    print(f"{name:14s} {r['util']:8.2f} {r['roll']:8.2f} {r['train']:8.2f} {r['thr']/base:10.2f}"
          f"      {r['stale'].mean():5.2f} / {r['stale'].max():2d}     {r['drop']:6.1%}   {r['bias']:+7.1%}")
 

위에서 아래로 읽자. 동기 colocated는 GPU 시간의 4분의 1을 쓴다. 여기서 one-step-off는 거의 도움이 안 된다. 배치마다 여전히 가장 느린 시퀀스를 기다리기 때문이다. τ = 0인 완전 비동기는 동기보다 나쁘다. 동기 장벽을 가진 분리 pool은 둘의 단점을 모두 갖는다. τ = 1과 2에서는 처리량이 뛰지만(2.3배, 2.9배) staleness 필터가 시퀀스의 약 11%와 5%를 버리고, 거의 모두 긴 것이라 학습된 평균 길이가 생성된 것보다 28%, 17% 짧다. τ = 8에서는 아무것도 버려지지 않고 처리량이 3.7배다. 어떤 시퀀스도 상한보다 오래 살지 않을 만큼 상한이 느슨해지면 admission controller만으로 staleness가 낮게 유지된다(평균 1.4). 장난감의 교훈은 특정 τ가 아니라 모양이다. 좁은 drop 필터는 staleness를 조금 사는 대신 길이 bias를 크게 치른다. 생성을 admission에서 묶는 편이 싸다.

다음은 정책 bias 자체다. 행동 64개의 softmax 정책이 정확한 natural-gradient step을 따른다. kk 버전 전 정책의 샘플로 surrogate gradient를 정확한 기댓값으로 만들고, 현재 매개변수의 참 gradient와 비교한다.

NumPy 낡은 샘플에서 결합 vs decoupled PPO (정확한 기댓값)
import numpy as np

# 행동 V개의 softmax 정책. 낡은 샘플(pi_behav = k 버전 전 정책)로 만든 surrogate gradient를
# 현재 매개변수의 참 on-policy gradient와 비교한다. 기댓값은 정확하다(샘플링 없음).
V, ETA, EPS_L, EPS_H = 64, 0.6, 0.2, 0.28
rng = np.random.default_rng(1)
r = rng.random(V) ** 3                                   # 행동별 보상 (좋은 행동은 소수)
softmax = lambda z: np.exp(z - z.max()) / np.exp(z - z.max()).sum()

def pg(theta):                                           # logit에 대한 E_pi[r]의 정확한 정책 경사
    p = softmax(theta); return p * (r - p @ r)

thetas = [rng.normal(0, 1.0, V)]                         # 정책 버전들의 궤적
for _ in range(20):
    p = softmax(thetas[-1]); thetas.append(thetas[-1] + ETA * (r - p @ r))   # logit에 natural-gradient step

def surrogate_grad(theta, prox, behav, kind):
    """a ~ behav에 대한 기댓값으로, 토큰별 surrogate의 logit theta에 대한 gradient.
    행동별 기여는 mu(a) * coef(a) * (e_a - pi), coef = d surrogate / d log pi(a)."""
    pi, mu, px = softmax(theta), softmax(behav), softmax(prox)
    A = r - mu @ r                                       # 낡은 샘플로 추정한 group 평균 baseline
    if kind == 'naive':                                  # 낡은 샘플을 on-policy로 취급
        coef = A
    elif kind == 'coupled':                              # pi_old := pi_behav인 PPO clip
        rho = pi / mu
        clipped = ((A > 0) & (rho > 1 + EPS_H)) | ((A < 0) & (rho < 1 - EPS_L))
        coef = np.where(clipped, 0.0, rho * A)
    elif kind == 'decoupled':                            # AReaL: pi_prox/pi_behav로 가중, pi/pi_prox를 clip
        u, w = pi / px, px / mu
        clipped = ((A > 0) & (u > 1 + EPS_H)) | ((A < 0) & (u < 1 - EPS_L))
        coef = np.where(clipped, 0.0, w * u * A)
    g = mu * coef
    return g - pi * g.sum()                              # sum_a g_a (e_a - pi)

cos = lambda a, b: a @ b / (np.linalg.norm(a) * np.linalg.norm(b) + 1e-12)
n = 20                                                   # 현재 버전
prox = thetas[n]
theta = prox + 0.5 * ETA * (r - softmax(prox) @ r)       # 업데이트 도중: prox에서 반 step 지난 곳
true = pg(theta)
print("staleness k | cos(naive) | cos(coupled) frac-clipped | cos(decoupled) | ESS/n of w = pi_prox/pi_behav")
for k in [0, 1, 2, 4, 8, 16]:
    behav = thetas[n - k]
    mu, px, pi = softmax(behav), softmax(prox), softmax(theta)
    rho = pi / mu; A = r - mu @ r
    frac = mu @ (((A > 0) & (rho > 1 + EPS_H)) | ((A < 0) & (rho < 1 - EPS_L)))
    w = px / mu; ess = (mu @ w) ** 2 / (mu @ w**2)
    gs = {k_: surrogate_grad(theta, prox, behav, k_) for k_ in ['naive', 'coupled', 'decoupled']}
    print(f"{k:11d} | {cos(gs['naive'], true):10.3f} | {cos(gs['coupled'], true):12.3f} {frac:12.1%} |"
          f" {cos(gs['decoupled'], true):14.3f} | {ess:8.3f}")
 

순진한 추정량은 부드럽게 나빠진다(k = 8에서 cosine 0.82, k = 16에서 0.07). 결합 clip은 k = 2부터 순진한 것보다 나쁘고, k = 8에서는 확률 질량의 73%가 clip된 채 반대 방향을 가리킨다(cosine −0.49). clip된 행동이 바로 샘플 이후 확률이 오른 좋은 행동들이라, 남은 것은 현재 정책 기준으로 크기가 어긋난 “나쁜 행동 누르기”가 지배한다. decoupled 목적함수는 모든 kk에서 참 방향을 되찾는다(정확한 기댓값과 자르지 않은 weight를 썼으므로 여기서는 정확히). 값은 마지막 열 ww의 ESS에 보인다. k = 16에서 0.23으로 떨어진다. 유한 샘플에서는 그것이 치르는 분산이다.

마지막으로 PyTorch 조각들이다. decoupled loss, group padding을 단 GLM-5식 staleness 필터, weight push마다의 optimizer 초기화.

PyTorch PyTorch: decoupled PPO, staleness 필터, group padding, optimizer 초기화 로컬에서 실행run locally (pip install torch)
import torch

def decoupled_ppo_loss(logp, prox_logp, behav_logp, adv, mask, eps_low=0.2, eps_high=0.28, w_cap=None):
    """Decoupled PPO (Hilton et al. 2021; AReaL Eq. 5). 모든 텐서는 샘플된 토큰에 대한 (N, T).
    logp:       샘플된 토큰의 log pi_theta (grad 필요)
    prox_logp:  이번 업데이트 전 weight로 trainer가 다시 계산한 log pi_prox (grad 없음)
    behav_logp: rollout 엔진이 돌려준 log pi_behav. 여러 weight 버전에 걸칠 수 있다 (grad 없음)"""
    u = torch.exp(logp - prox_logp)                                  # pi_prox에 중심을 둔 trust region
    surr = torch.minimum(u * adv, u.clamp(1 - eps_low, 1 + eps_high) * adv)
    w = torch.exp((prox_logp - behav_logp).clamp(-20.0, 20.0))       # staleness 보정 pi_prox / pi_behav
    if w_cap is not None:
        w = w.clamp(max=w_cap)                                       # 선택적 truncation (Eq. 5에는 없음)
    m = mask.float()
    return -(w.detach() * surr * m).sum() / m.sum().clamp(min=1)

def staleness_filter_and_pad(groups, version_now, tau):
    """groups: group의 리스트. 샘플은 'v0'(쓰인 가장 오래된 weight 버전)와 'env_ok'를 가진 dict.
    낡았거나(version_now - v0 > tau) crash난 샘플을 버리고, 절반 넘게 살아남은 group만 남겨
    생존자를 반복해 원래 크기로 채운다(GLM-5 §4.1.2 방식). advantage는 그 뒤에 계산한다."""
    out = []
    for g in groups:
        keep = [s for s in g if s["env_ok"] and version_now - s["v0"] <= tau]
        if 2 * len(keep) <= len(g):
            continue                                                 # 생존자가 적다: group 전체를 버린다
        out.append(keep + [keep[i % len(keep)] for i in range(len(g) - len(keep))])
    return out

def push_weights(optimizer, publish_fn):
    """rollout 엔진에 새 weight를 내보낸 뒤 새 최적화 문제를 시작한다."""
    publish_fn()                                                     # in-flight update. 엔진은 생성을 계속한다
    optimizer.state.clear()                                          # GLM-5는 push마다 optimizer를 초기화한다
 
확인 문제Check yourself

완전 비동기 실행에서 가장 오래된 토큰이 τ = 2 버전보다 낡은 trajectory를 모두 버린다. 학습 보상은 건강해 보이는데, 평가 응답이 점점 짧아지고 긴 추론이 필요한 어려운 문제를 틀리기 시작한다. 가장 그럴듯한 원인은?

긴 trajectory는 생성에 오래 걸리므로 staleness 상한을 넘는 것은 바로 그것들이다. 그래서 drop 필터는 그것들을 우선 제거한다. 버려진 샘플은 loss에 닿지도 않으니 어떤 importance weight도 고칠 수 없는 선택 bias다. 긴 trajectory가 어려운 문제를 푸는 것이기도 하다면, 정책은 바로 그 행동을 덜 반영한 분포로 학습한다. 처방: 학습 시점에 버리지 말고 admission에서 staleness를 묶기, 토큰 단위 freshness(Solar Open 2처럼 낡은 앞부분만 mask하고 나머지는 지키기), 긴 길이에서 learning rate 낮추기(MAI), 생성된 길이 분포와 학습된 길이 분포를 함께 기록하기.

확인 문제Check yourself

decoupled PPO 목적함수는 왜 π_θ/π_behav 대신 π_θ/π_prox를 clip하나?

ratio πθ/πbehav=utwt\pi_\theta/\pi_{\text{behav}}=u_t w_t는 두 가지를 섞는다. 이것을 clip하면 샘플 이후 kk 버전 동안 움직인 토큰 — 지속적으로 학습하는 정책에서는 좋은 토큰이 불균형하게 많다 — 이 현재 업데이트가 손대기도 전에 gradient를 잃는다. ut=πθ/πproxu_t=\pi_\theta/\pi_{\text{prox}}만 clip하면 trust region 역할이 이번 업데이트에 국한되고, staleness는 wtw_t로 들어와 분산이라는 비용을 낸다(ESS를 보자). πprox\pi_{\text{prox}}를 위해 forward를 한 번 더 해야 한다. GLM-5의 agentic RL은 그 계산을 건너뛰고 대신 πθ/πrollout\pi_\theta/\pi_{\text{rollout}}에 좁은 양방향 밴드 하나를 쓴다.

정리

  • 동기 RL은 GPU 시간을 두 곳에서 버린다. 배치 안(가장 긴 시퀀스 기다리기, U≈E[L]/E[max⁡L]U\approx\mathbb{E}[L]/\mathbb{E}[\max L])과 생성·학습 사이의 장벽이다. one-step-off는 장벽을 없애고, 완전 비동기와 partial·interruptible rollout은 꼬리까지 없앤다.
  • staleness는 정책 bias(샘플이 πθ−k\pi_{\theta-k}에서 옴)를 더한다. ratio는 ut wtu_t\,w_t로 쪼개지고, decoupled PPO는 현재 업데이트 utu_t만 clip하며 staleness는 wtw_t로 보정한다. 지켜볼 비용은 그 ESS다(DLC는 ½ 아래에서 재동기화). rollout 정책 기준의 결합 clip은 이미 움직인 토큰 — 주로 좋은 토큰 — 을 침묵시킨다.
  • staleness는 선택 bias도 더한다. 긴 시퀀스가 낡은 시퀀스라서, drop 필터·greedy 소비·무작정 조기 종료 모두 학습 분포를 짧게 만든다. admission에서 staleness를 묶고, 토큰 단위 freshness를 쓰고, window 안에서 FIFO 순서를 지키고, 중단된 요청은 다시 생성하지 말고 재개하자.
  • 공개된 설정: AReaL η = 4–8 + decoupled 목적함수, GLM-5 τ 필터 + push마다 optimizer 초기화 + group padding + 양방향 mask, MAI push당 5 step·8 업데이트 제한·바깥 clip 50, OLMo 3와 ScaleRL은 in-flight update로 최대 8 step, Nemotron 3 한 step, MiMo-V2.6 staleness 4.
  • 시스템 작업은 staleness를 늘리지 않고 유휴 시간을 줄일 수 있다. weight용 relay worker, trainer GPU의 탄력적 사용, 스트리밍 데이터 평면, 엔진 안의 꼬리 지연 작업이다.

더 읽을거리Further reading