The earlier lessons of this track were about objectives: how the loss is aggregated (sequence vs token), which ratio is clipped or masked (clipping and IS), how KL, entropy and length are regularised (regularisation). This lesson is about the run. A frontier RL job runs for weeks, and the reports that disclose their failures tell a consistent story: runs do not fail in a thousand ways but in about eight, and each of them leaves a fingerprint on a specific metric well before the reward curve bends. MiniMax-M1 saw its reward refuse to rise because train/inference probabilities correlated at only 0.9x; VeXact watched a KL monitor stay flat for 700 steps while the model was already degrading; MiMo-V2.6 saw an MoE layer’s load coefficient of variation go from 0.78 to 2.0 in 20 steps. The goal here is a playbook: what to log, how to compute it, which failure each pattern points to, and what the labs did about it.
What to log, and how to compute it
Every metric below is cheap: all come from tensors the trainer already has (rollout log-probs , recomputed , current , advantages, masks, rewards, lengths, router counts). Group them into three tiers.
| Tier | Metric | Definition (per batch) | Healthy | Warning |
|---|---|---|---|---|
| policy | entropy | over response tokens (or full-vocab entropy if logits are kept) | slow decline, or flat | fast fall (collapse) or rise with gibberish |
| policy | KL to reference | k3 of vs , even when | grows smoothly | kinks, acceleration |
| update | clip fraction by side | four cells of (sign ) × (ratio above / below the band) | a few % on the side the update pushes | one side dominates; “opposite” cells non-zero |
| update | ratio stats | mean, p99, max of | max of a few | max in the tens (stale or mismatched samples) |
| update | grad norm | pre-clip global norm | stationary | spikes, rising floor |
| data | length | mean, p95, truncation rate (hit the cap), repetition rate | grows with difficulty | truncation climbs, loops |
| data | reward | train mean and a held-out eval, per domain | rise together | train ↑ while held-out flat |
| data | zero-variance groups | fraction of groups with identical rewards | moderate | most groups degenerate |
| system | mismatch | k3 of , , out-of-band fraction, token ESS | flat, small | trend up, tail grows |
| system | MoE load | per-layer CV of expert counts, max/mean, share of cold experts | stable | CV and cold share climb |
Three details make these numbers trustworthy.
Entropy from samples. For tokens sampled from , , so the mean negative log-prob of sampled tokens is an unbiased estimate of the sampler’s entropy. If what you want is the entropy of the policy being trained from stale samples, weight by the ratio: MAI-Thinking-1 drives its controller with (MAI review). Low entropy is not a failure by itself — a model that has learned the task should be confident — the failure is entropy falling faster than the reward rises.
Clip fraction by side. PPO’s clip only removes gradient on the side where the update would push further: for when , for when (clipping and IS). Logging the single number “clip fraction” hides which constraint binds. The upper-positive cell is the entropy lever (next section). The two “opposite” cells ( and ) cannot be produced by the update itself on the first minibatch; when they are non-zero, the ratio moved for another reason — staleness or engine mismatch. MAI-Thinking-1 added an outer clip exactly because, with stale rollouts, the branch occasionally produced catastrophic grad-norm spikes.
Mismatch, measured in the right direction. Samples come from , so gives the k1 estimate and the k3 estimate of (off-policy mismatch). Log the mean and the tail (, fraction of ratios outside ), broken down by token-probability bin and by turn. Liu, Li et al. found the gap concentrated on tokens with near-zero sampler probability and larger after the first turn of a tool-use trajectory; causes and fixes are the subject of mismatch engineering.
Why entropy moves: the covariance rule
Before the failure catalogue, one derivation, because it explains why so many interventions act on the upper clip bound. Take one state with a softmax policy and entropy . Using ,
Suppose an update changes the logits by (a natural-gradient step on softmax logits, where the logit of each action moves in proportion to its advantage). To first order,
where the last step uses , so the sum is a covariance. Cui et al. (2025) make the same point for LLM policy gradients: entropy falls when high-probability tokens have high advantage (the model is confidently right and sharpens) and rises when low-probability tokens get positive advantage (exploration pays off). Now look at the clip: for the upper bound caps how much a token’s probability can grow per update. A token at cannot reach the cap anyway, a token at hits it immediately — so a tight upper bound removes exactly the negative-covariance contributions (rare tokens with positive advantage) and leaves the positive ones. Entropy then falls faster than learning warrants. That is DAPO’s clip-higher argument, MAI’s choice to steer entropy by moving the upper bound, and MiMo-V2.6’s “widen the positive bounds when entropy is too low”. How those controllers are written as objectives is in regularisation; here we only need the diagnostic consequence: a rising upper-positive clip fraction is the leading indicator of entropy collapse.
A toy run with injectable failures
The simulator below is deliberately a toy: a few coupled state variables (skill, entropy, length, mismatch, an exploit propensity, router imbalance) evolve with noise and emit the dashboard metrics. The couplings are qualitative versions of mechanisms described in this lesson — mismatch amplifies itself (IcePop’s conditional bound ), truncated responses earn zero reward, learning needs both entropy and non-degenerate groups — but none of the numbers are fitted to a real run.
이 트랙의 앞 레슨들은 목적함수에 관한 것이었다. loss를 어떻게 모으는지(sequence vs token), 어떤 ratio를 clip하거나 mask하는지(clipping과 IS), KL·entropy·길이를 어떻게 정규화하는지(정규화). 이 레슨은 실행(run)에 관한 것이다. 프론티어 RL 작업은 몇 주씩 돌고, 실패를 공개한 보고서들은 일관된 이야기를 한다. 실행은 천 가지 방식으로 망가지지 않고 대략 여덟 가지 방식으로 망가지며, 각각은 보상 곡선이 꺾이기 한참 전에 특정 지표에 흔적을 남긴다. MiniMax-M1은 학습·추론 확률의 상관이 0.9x에 머물러 보상이 오르지 않았고, VeXact는 모델이 이미 나빠지는 동안 KL 모니터가 700 step 동안 평평한 것을 보았고, MiMo-V2.6은 한 MoE 층의 load 변동계수가 20 step 만에 0.78에서 2.0으로 뛰는 것을 보았다. 여기서의 목표는 플레이북이다. 무엇을 기록하고, 어떻게 계산하고, 각 패턴이 어떤 고장을 가리키며, lab들이 무엇을 했는가.
무엇을 기록하고 어떻게 계산하나
아래 지표는 모두 싸다. trainer가 이미 가진 텐서(rollout log-prob , 재계산한 , 현재 , advantage, mask, 보상, 길이, router count)에서 나온다. 세 층으로 묶는다.
| 층 | 지표 | 정의(배치당) | 정상 | 경고 |
|---|---|---|---|---|
| 정책 | entropy | 응답 토큰의 (logit을 보관하면 전체 vocab entropy) | 천천히 감소하거나 평평 | 급락(붕괴), 또는 횡설수설과 함께 상승 |
| 정책 | 참조 모델과의 KL | 이어도 대 의 k3 | 매끄럽게 증가 | 꺾임, 가속 |
| 업데이트 | 방향별 clip 비율 | ( 부호) × (ratio가 띠 위/아래)의 네 칸 | 업데이트가 미는 쪽에서 몇 % | 한쪽이 지배; “반대” 칸이 0이 아님 |
| 업데이트 | ratio 통계 | 의 평균·p99·최대 | 최대 몇 배 | 최대 수십 배(낡거나 불일치한 샘플) |
| 업데이트 | grad norm | clip 전 전역 norm | 정상 상태 | spike, 바닥이 올라감 |
| 데이터 | 길이 | 평균, p95, 잘림 비율(한도 도달), 반복 비율 | 난이도와 함께 증가 | 잘림 증가, 루프 |
| 데이터 | 보상 | 학습 평균과 held-out 평가, 도메인별 | 함께 오름 | 학습↑, held-out 제자리 |
| 데이터 | zero-variance 그룹 | 보상이 모두 같은 그룹의 비율 | 중간 | 대부분 퇴화 |
| 시스템 | mismatch | 의 k3, , 띠 밖 비율, token ESS | 평평, 작음 | 상승 추세, 꼬리 증가 |
| 시스템 | MoE load | 층별 expert count의 CV, max/mean, cold expert 비율 | 안정 | CV와 cold 비율 상승 |
이 숫자들을 믿을 수 있게 만드는 세부 세 가지.
샘플로 재는 entropy. 에서 뽑은 토큰에 대해 이므로, 샘플 토큰의 음의 log-prob 평균은 sampler entropy의 비편향 추정량이다. 낡은 샘플로 학습 중인 정책의 entropy가 필요하면 ratio로 가중한다. MAI-Thinking-1은 로 제어기를 돌린다(MAI 리뷰). 낮은 entropy 자체는 고장이 아니다. 과제를 익힌 모델은 확신해야 한다. 고장은 entropy가 보상이 오르는 속도보다 빨리 떨어지는 것이다.
방향별 clip 비율. PPO의 clip은 업데이트가 더 밀려는 쪽에서만 gradient를 없앤다. 이면 일 때, 이면 일 때다(clipping과 IS). “clip 비율” 하나만 기록하면 어느 제약이 걸리는지 감춰진다. 위쪽-양수 칸은 entropy의 지렛대다(다음 절). 두 “반대” 칸(와 )은 첫 minibatch에서는 업데이트 자체로 생길 수 없다. 0이 아니면 ratio가 다른 이유, 즉 staleness나 엔진 불일치로 움직였다는 뜻이다. MAI-Thinking-1이 외곽 clip 을 넣은 것도 낡은 rollout에서 가지가 가끔 파국적인 grad-norm spike를 냈기 때문이다.
올바른 방향으로 잰 mismatch. 샘플은 에서 나왔으므로 로 의 k1 추정 와 k3 추정 를 얻는다(off-policy mismatch). 평균과 꼬리(, ratio가 밖인 비율)를 토큰 확률 구간별·턴별로 나눠 기록한다. Liu, Li 등은 차이가 sampler 확률이 0에 가까운 토큰에 몰리고, tool 사용 trajectory의 첫 턴 이후에 더 크다는 것을 보였다. 원인과 처방은 mismatch 엔지니어링의 주제다.
entropy가 움직이는 이유: 공분산 규칙
고장 목록 전에 유도 하나. 왜 그렇게 많은 처방이 clip의 위쪽 경계를 건드리는지 설명해 준다. softmax 정책 와 entropy 인 한 상태를 보자. 를 쓰면
업데이트가 logit을 만큼 바꾼다고 하자(softmax logit에 대한 natural-gradient step으로, 각 행동의 logit이 advantage에 비례해 움직인다). 1차까지
이다. 마지막 단계는 이어서 합이 공분산이 된다는 것을 쓴다. Cui 등(2025)은 LLM 정책 경사에서 같은 점을 지적한다. 확률이 높은 토큰의 advantage가 높으면 entropy가 떨어지고(확신하며 맞히니 날카로워진다), 확률이 낮은 토큰이 양의 advantage를 받으면 오른다(탐색이 보상받는다). 이제 clip을 보자. 에서 위 경계 는 한 번의 업데이트에서 토큰 확률이 커질 수 있는 정도를 묶는다. 인 토큰은 어차피 그 경계에 닿지 못하고, 인 토큰은 곧바로 닿는다. 그래서 좁은 위 경계는 정확히 음의 공분산 기여(양의 advantage를 받은 드문 토큰)만 지우고 양의 기여는 남긴다. entropy는 학습이 정당화하는 것보다 빨리 떨어진다. 이것이 DAPO의 clip-higher 논리이고, MAI가 위 경계를 움직여 entropy를 조종하는 이유이며, MiMo-V2.6의 “entropy가 너무 낮으면 양수 쪽 경계를 넓힌다”이다. 이 제어기들을 목적함수로 어떻게 쓰는지는 정규화에 있다. 여기서 필요한 것은 진단적 귀결 하나다. 위쪽-양수 clip 비율의 상승은 entropy 붕괴의 선행 지표다.
고장을 주입하는 장난감 실행
아래 시뮬레이터는 일부러 장난감이다. 몇 개의 결합된 상태 변수(실력, entropy, 길이, mismatch, exploit 성향, router 불균형)가 잡음과 함께 진화하며 대시보드 지표를 낸다. 결합 방식은 이 레슨에서 설명하는 메커니즘의 정성적 판본이다. mismatch는 스스로 증폭되고(IcePop의 조건부 경계 ), 잘린 응답은 보상 0을 받고, 학습에는 entropy와 퇴화하지 않은 그룹이 모두 필요하다. 하지만 어떤 숫자도 실제 실행에 맞춘 것이 아니다.
Things to try:
- Mismatch spike with no intervention. The k3 panel fires first, then grad norm a few steps later; the held-out reward moves only after both, and by then it falls off a cliff (the clip fraction and zero-variance panels react later still, once the run is already broken). This ordering is the reason to alarm on system metrics rather than on reward. Tick “IS mask band / routing replay” and the run is indistinguishable from the no-failure baseline (the grey line in the reward panel).
- Entropy collapse. The upper-clip fraction (red) rises at once, entropy falls, and a little later the zero-variance fraction climbs: when the policy stops exploring, groups become all-right or all-wrong and stop carrying signal. Reward does not crash — it plateaus, which is why entropy collapse is easy to miss. The entropy controller holds entropy at its target.
- Reward hacking. Nothing in the system tier moves. Train and held-out rewards separate and the KL to the reference accelerates. Only a held-out signal (or a human reading samples) can see it.
- Router drift. Load CV jumps within ~20 steps (the shape MiMo-V2.6 reported), the reward erodes slowly. Freezing the router prevents it.
- Set interventions to “first alarm + 15 steps”. For the mismatch spike the run recovers but loses ground; for length explosion the damage stops but the lost steps stay lost. Prevention is cheaper than reaction — which is why most labs run their guards from the start (MAI’s controller, V3.2’s Keep Routing, DAPO’s clip-higher are always on).
Failure modes, signatures, interventions
The table condenses what the reports describe. “First signal” is the metric that moves earliest in the cited accounts; the interventions are the ones each lab disclosed.
| Failure | Mechanism | First signal | What labs did |
|---|---|---|---|
| entropy collapse | tight upper clip removes rare-good-token updates; positive Cov(log π, A) dominates | upper-positive clip fraction, then entropy, then zero-variance groups | DAPO clip-higher ; MAI integral controller on the upper bound; MiMo-V2.6 entropy-adaptive asymmetric bounds; GLM-4.5 raises temperature on plateaus; Qwen3 keeps entropy “rising steadily or stable” |
| entropy blow-up / gibberish | too-wide bounds, negative-sample-heavy updates, mismatched tokens | entropy up with language mixing; mismatch k3 | narrow the positive / widen the negative bound (MiMo-V2.6); language-consistency rewards (DeepSeek-R1, MAI, V3.2); temperature decay (K2) |
| length runaway, loops | wrong answers lengthen faster; negative gradient piles up at the ends; loops have large gradients | truncation rate, repetition rate, grad norm | early-stop repetition, sample+token normalisation, lower grad-clip and (MiniMax-M1); length reward after warm-up (k1.5); pass-rate-scaled length penalty (MAI); soft overlong punishment (DAPO); single-stage 64K instead of staged growth (GLM-4.5) |
| multi-turn gradient explosion | tool output pushes the context off-distribution; low-probability tokens compound over turns | grad norm per turn, malformed or empty turns | drop trajectories containing a “void” turn with neither a tool call nor an answer (SimpleTIR); mask tool output; see long-horizon RL |
| train–inference mismatch | kernels, precision, routing, sampling masks differ between engines | k3 and max , then grad norm | FP32 LM head (MiniMax-M1); Keep Routing / Keep Sampling Mask (V3.2); rollout routing replay R3 and vanilla routing replay R2; routing + top-p mask replay (MAI); batch-invariant or bit-exact rollout kernels; IcePop band (GLM-5); score centering; see mismatch engineering |
| staleness | async samples from old weights; in the tens | ratio max, opposite clip cells, ESS | staleness bound (GLM-5 , MAI 8 versions, AReaL ); outer clip (MAI); resync below ESS 1/2 (DLC); token-level freshness filters that keep a trajectory only if enough of its tokens are fresh; see async and staleness |
| MoE router drift | router parameters move faster than experts can follow | per-layer load CV, cold-expert share | router freezing (MiMo-V2.6); a small load-balancing coefficient kept on (MAI ) |
| signal starvation | groups all-correct or all-wrong | zero-variance fraction | zero-variance filtering: dynamic / active sampling (DAPO, OLMo 3, Skywork-OR1); adaptive group size (MAI); difficulty re-filtering (rewards and environments) |
| reward hacking | proxy reward pays for an exploit | train–held-out gap, KL acceleration, behaviour audits | hardened environments and graders, hack audits (rewards and environments, over-optimisation) |
| forgetting / interference | single-domain stages erode other skills | per-domain held-out | PTX loss (K2); mixed-domain RL (V3.2 single stage, OLMo 3); 10% easy pool (MiMo-7B); cross-stage distillation (GLM-5) |
A few entries deserve their numbers.
Entropy collapse
DAPO’s arithmetic is the cleanest statement: with , a token at can rise only to in one update, while a token at never reaches the bound. MAI-Thinking-1 closes the loop: with upper bound , , , , , and reports that an entropy bonus in the loss worked worse. MiMo-V2.6 runs separate bounds for positive and negative advantages, both initialised at and adapted from the entropy. GLM-4.5 attacks the same plateau from the sampler side: when the mean reward stalls, raise the rollout temperature to the largest value whose validation score stays within 1% of the best.
Length runaway and pattern collapse
MiniMax-M1 extended its output budget in stages from 40K to 80K and, late in each stage, saw the ends of responses turn into garbage. Their diagnosis: wrong responses grow longer faster than correct ones, so with token-level aggregation the negative gradient accumulates on the last tokens of long generations. Their fixes were operational — stop generation once 3,000 consecutive tokens all have probability above 0.99 (a loop), combine sample-level loss with token-level normalisation, and lower both the gradient-clip threshold and . The metric that would have caught it first is the truncation rate, not the mean length: means move slowly; the fraction hitting the cap is a threshold phenomenon. GLM-4.5 adds a counter-intuitive lesson: growing the maximum length in stages (16K → 32K → 48K → 64K) made a model that SFT had taught to write 64K answers “unlearn” long outputs, so it trained at 64K from the start. Length penalties as objectives are covered in regularisation.
Mismatch and staleness
What makes mismatch dangerous is that it hides. In VeXact’s runs the K1/K3 mismatch KL with recomputation stayed almost identical to the bit-exact reference for the first 700 steps — the monitor did not catch the early degradation that a validation curve did. Liu, Li et al. report vllm-kl magnitudes of 5e-4–1e-3 on H20, 1e-3–1e-2 on L20 and 1e-2–1 on A100 for the same recipe, and a collapsed L20 run that recovered when resumed on H20 from its step-200 checkpoint. MAI-Thinking-1 saw foreign-language tokens creep into long CoTs, correlated with spikes in the train–inference log-prob gap, and added a language-consistency reward. DLC’s rule for stale samplers is the simplest alarm with an action attached: when falls below 1/2, resynchronise; without it, their Qwen3-1.7B stale run dropped below 1/2 at step 11 and was at 0.5% accuracy by step 30.
MoE router drift
MiMo-V2.6, Pro model, trainable router: in decoder layer 9 (384 experts) the load CV rose from 0.78 to 2.0 within the first 20 steps, max/mean load from 6× to 16×, and the share of cold experts (below 0.1× the mean) from 0.5% to 22%. Restoring only the router parameters of the step-20 checkpoint to their pre-RL values brought the load back with unchanged benchmark scores, so the drift was in the router, not the experts. A frozen-router run stayed at CV ≈ 0.7, max ≈ 5.5×, cold ≈ 1%. This is a different failure from routing mismatch (same weights, different experts in two engines), which Keep Routing and R3 address.
해 볼 것:
- 개입 없이 mismatch spike. k3 패널이 먼저 울리고 몇 step 뒤 grad norm이 울린다. held-out 보상은 그 둘 다 울린 뒤에야 움직이고, 그때는 절벽처럼 떨어진다(clip 비율과 zero-variance 패널은 실행이 이미 망가진 뒤에 더 늦게 반응한다). 보상이 아니라 시스템 지표에 경보를 거는 이유가 이 순서다. “IS mask·routing replay”를 켜면 실행은 고장 없는 기준선(보상 패널의 회색 선)과 구별되지 않는다.
- entropy 붕괴. 위쪽 clip 비율(빨강)이 곧바로 오르고 entropy가 떨어지며, 조금 뒤 zero-variance 비율이 오른다. 정책이 탐색을 멈추면 그룹이 모두 맞히거나 모두 틀려 신호를 잃는다. 보상은 무너지지 않고 정체한다. entropy 붕괴를 놓치기 쉬운 이유다. entropy 제어기는 entropy를 목표값에 붙잡는다.
- reward hacking. 시스템 층은 아무것도 움직이지 않는다. 학습 보상과 held-out 보상이 갈라지고 참조 모델과의 KL이 가속한다. held-out 신호(또는 샘플을 읽는 사람)만 볼 수 있다.
- router 표류. load CV가 20 step 남짓에 뛴다(MiMo-V2.6이 보고한 모양). 보상은 천천히 깎인다. router를 고정하면 막힌다.
- 개입 시점을 “첫 경보 + 15 step”으로 바꾼다. mismatch spike에서는 회복하지만 손해를 본다. 길이 폭주에서는 손상이 멈추지만 잃은 step은 그대로다. 예방이 반응보다 싸다. 그래서 대부분의 lab은 방어 장치를 처음부터 켠다(MAI의 제어기, V3.2의 Keep Routing, DAPO의 clip-higher는 항상 켜져 있다).
고장 유형, 징후, 처방
표는 보고서들이 서술한 것을 압축한 것이다. “첫 신호”는 인용한 서술에서 가장 먼저 움직인 지표이고, 처방은 각 lab이 공개한 것이다.
| 고장 | 메커니즘 | 첫 신호 | lab들이 한 일 |
|---|---|---|---|
| entropy 붕괴 | 좁은 위 clip이 드문 좋은 토큰의 업데이트를 지움; 양의 Cov(log π, A)가 지배 | 위쪽-양수 clip 비율, 그다음 entropy, 그다음 zero-variance 그룹 | DAPO clip-higher ; MAI 위 경계의 적분 제어기; MiMo-V2.6 entropy 적응형 비대칭 경계; GLM-4.5 정체 시 온도 상승; Qwen3 entropy를 “꾸준히 오르거나 안정”하게 유지 |
| entropy 폭주·횡설수설 | 너무 넓은 경계, 음수 샘플 위주 업데이트, 불일치 토큰 | 언어 섞임과 함께 entropy 상승; mismatch k3 | 양수 쪽 좁히고 음수 쪽 넓힘(MiMo-V2.6); 언어 일관성 보상(DeepSeek-R1, MAI, V3.2); 온도 감쇠(K2) |
| 길이 폭주·루프 | 틀린 답이 더 빨리 길어짐; 음의 gradient가 끝에 쌓임; 루프는 gradient가 큼 | 잘림 비율, 반복 비율, grad norm | 반복 조기 중단, sample+token 정규화, grad-clip과 낮춤(MiniMax-M1); warm-up 뒤 길이 보상(k1.5); pass rate 비례 길이 패널티(MAI); soft overlong punishment(DAPO); 단계적 증가 대신 처음부터 64K(GLM-4.5) |
| 멀티턴 gradient 폭발 | tool 출력이 문맥을 분포 밖으로 밀고, 낮은 확률 토큰이 턴마다 누적 | 턴별 grad norm, 잘못되거나 빈 턴 | tool 호출도 답도 없는 “void” 턴을 가진 trajectory를 업데이트에서 제외(SimpleTIR); tool 출력 masking; long-horizon RL 참고 |
| 학습–추론 불일치 | 엔진 간 kernel·정밀도·routing·sampling mask 차이 | k3와 max , 그다음 grad norm | FP32 LM head(MiniMax-M1); Keep Routing / Keep Sampling Mask(V3.2); rollout routing replay R3와 vanilla routing replay R2; routing + top-p mask replay(MAI); batch-invariant·bit-exact rollout kernel; IcePop 띠(GLM-5); score centering; mismatch 엔지니어링 참고 |
| staleness | 옛 가중치에서 나온 비동기 샘플; 가 수십 | ratio 최대, 반대 clip 칸, ESS | staleness 상한(GLM-5 , MAI 8 버전, AReaL ); 외곽 clip (MAI); ESS 1/2 미만이면 재동기화(DLC); 신선한 토큰 비율이 충분한 trajectory만 받는 토큰 단위 freshness 필터; async와 staleness 참고 |
| MoE router 표류 | router 매개변수가 expert가 따라올 수 없을 만큼 빨리 움직임 | 층별 load CV, cold expert 비율 | router 고정(MiMo-V2.6); 작은 load-balancing 계수 유지(MAI ) |
| 신호 고갈 | 그룹이 모두 맞히거나 모두 틀림 | zero-variance 비율 | zero-variance 필터: dynamic·active sampling(DAPO, OLMo 3, Skywork-OR1); 적응형 그룹 크기(MAI); 난이도 재선별(보상과 환경) |
| reward hacking | proxy 보상이 exploit에 값을 치름 | 학습–held-out 격차, KL 가속, 행동 감사 | 환경·채점기 강화, hack 감사(보상과 환경, 과최적화) |
| 망각·간섭 | 단일 도메인 단계가 다른 능력을 깎음 | 도메인별 held-out | PTX loss(K2); 도메인 혼합 RL(V3.2 단일 단계, OLMo 3); 10% easy pool(MiMo-7B); cross-stage 증류(GLM-5) |
몇 항목은 숫자를 볼 만하다.
entropy 붕괴
DAPO의 산수가 가장 깔끔하다. 이면 인 토큰은 한 번의 업데이트로 까지만 오를 수 있고, 인 토큰은 경계에 영영 닿지 않는다. MAI-Thinking-1은 고리를 닫는다. 위 경계 에 대해 , , , , 이고, loss에 entropy bonus를 넣는 것은 더 나빴다고 보고한다. MiMo-V2.6은 양·음 advantage에 별도의 경계를 두고, 둘 다 에서 시작해 entropy에 따라 조정한다. GLM-4.5는 같은 정체를 sampler 쪽에서 공격한다. 평균 보상이 멈추면 rollout 온도를, 검증 점수가 최고치의 1% 안에 머무는 가장 큰 값까지 올린다.
길이 폭주와 pattern collapse
MiniMax-M1은 출력 예산을 40K에서 80K까지 단계적으로 늘렸고, 각 단계 후반에 응답 끝부분이 망가지는 것을 보았다. 진단은 이렇다. 틀린 응답이 맞는 응답보다 더 빨리 길어지므로, 토큰 단위로 모으면 음의 gradient가 긴 생성의 마지막 토큰들에 쌓인다. 처방은 운영적이었다. 3,000개 연속 토큰이 모두 확률 0.99를 넘으면(루프) 생성을 멈추고, sample 단위 loss와 token 단위 정규화를 섞고, gradient-clip 임계값과 를 낮췄다. 이것을 가장 먼저 잡았을 지표는 평균 길이가 아니라 잘림 비율이다. 평균은 천천히 움직이지만, 한도에 닿는 비율은 문턱 현상이다. GLM-4.5는 직관에 반하는 교훈을 더한다. 최대 길이를 단계적으로(16K → 32K → 48K → 64K) 늘리자, SFT가 64K 답을 쓰도록 가르친 모델이 긴 출력을 “잊었다”. 그래서 처음부터 64K로 학습했다. 목적함수로서의 길이 패널티는 정규화에서 다룬다.
mismatch와 staleness
mismatch가 위험한 것은 숨기 때문이다. VeXact의 실행에서 재계산 방식의 K1/K3 mismatch KL은 첫 700 step 동안 bit-exact 기준선과 거의 같았다. 검증 곡선이 잡은 초기 열화를 모니터는 잡지 못했다. Liu, Li 등은 같은 레시피에서 vllm-kl 크기가 H20 5e-4–1e-3, L20 1e-3–1e-2, A100 1e-2–1이었고, 붕괴한 L20 실행을 step 200 체크포인트에서 H20으로 이어 돌리자 회복했다고 보고한다. MAI-Thinking-1은 긴 CoT에 외국어 토큰이 스며드는 것을 보았고, 그것이 학습–추론 log-prob 격차의 spike와 상관되어 언어 일관성 보상을 넣었다. 낡은 sampler에 대한 DLC의 규칙은 행동이 붙은 가장 단순한 경보다. 가 1/2 아래로 떨어지면 재동기화한다. 그 규칙이 없으면 Qwen3-1.7B stale 실행은 step 11에서 1/2 아래로 떨어졌고 step 30에는 정확도 0.5%였다.
MoE router 표류
MiMo-V2.6, Pro 모델, 학습 가능한 router: decoder 9층(expert 384개)에서 load CV가 첫 20 step 안에 0.78에서 2.0으로, max/mean load가 6배에서 16배로, cold expert(평균의 0.1배 미만) 비율이 0.5%에서 22%로 올랐다. step 20 체크포인트의 router 매개변수만 RL 이전 값으로 되돌리자 load가 돌아왔고 벤치마크 점수는 그대로였다. 표류는 expert가 아니라 router에 있었다. router를 고정한 실행은 CV ≈ 0.7, max ≈ 5.5배, cold ≈ 1%에 머물렀다. 이것은 routing 불일치(같은 가중치인데 두 엔진에서 다른 expert)와 다른 고장이고, 그쪽은 Keep Routing과 R3가 다룬다.
Try the two examples. “Collapse on long runs” marks grad-norm spikes and “problems concentrated on long, stale samples” and rules out router imbalance: staleness and mismatch lead, and the next check the figure suggests is the one that separates them (the mismatch k3 at the same weights). “Only train reward rises” with mismatch ruled out puts reward hacking far ahead. The likelihoods are our own reading of the reports, not measurements; the point of the figure is the structure — few symptoms are specific, so pick the next measurement by how much it separates the leading hypotheses.
Optimiser and learning-rate hygiene
Most frontier RL recipes use a constant learning rate around : OLMo 3 (7B) and (32B), MAI-Thinking-1 lowered to at long lengths (longer rollouts are staler), MiMo-7B , MiMo-V2.6 with no warm-up or weight decay. Two less obvious settings recur.
Adam’s . Adam’s per-coordinate step is . On the first step , , so the step is . If it is , as intended; if it is — Adam silently degrades into SGD with learning rate , which for and is a step about of the intended one. MiniMax-M1 measured gradient magnitudes from to , mostly below ; verl’s defaults (, ) failed to converge and they used , . MAI-Thinking-1 uses , . A shorter also lets track the non-stationary gradient scale of RL.
Optimiser resets. k1.5 resets optimiser state at the start of every iteration because the mirror-descent anchor changes, so each iteration is a new problem; GLM-5 resets after every weight push to the inference engines in its asynchronous loop. The moments accumulated against an old behaviour policy point at an objective that no longer exists.
After a collapse
Rolling back is the first instinct and often not enough. MAI-Thinking-1 found that checkpoints from before a collapse frequently already carried the instability, so rolling back did not help; instead it restarted from a model SFT-ed on rollouts collected during RL (self-distillation), which also moved progress onto a fresh base. Liu, Li et al. recovered by changing the hardware (and hence the kernels) under the same checkpoint — a reminder that a collapse caused by the system is fixed in the system. DPPO’s analysis suggests where to look in the logs: the instability came from updates that cut a token’s probability by more than 0.5 on negative samples, which made up 0.5% or less of all updates — invisible in averages, obvious in a histogram of per-token log-prob change split by the sign of .
두 예시를 눌러 보라. “긴 응답에서 붕괴”는 grad-norm spike와 “문제가 길고 낡은 샘플에 집중”을 표시하고 router 불균형을 배제한다. staleness와 mismatch가 앞서고, 그림이 제안하는 다음 확인은 그 둘을 가르는 항목(같은 가중치에서의 mismatch k3)이다. mismatch를 배제한 “학습 보상만 상승”은 reward hacking을 크게 앞세운다. likelihood는 보고서들을 우리가 읽은 결과이지 측정값이 아니다. 그림의 요점은 구조다. 특이적인 증상은 드물다. 그러니 다음 측정은 선두 가설들을 얼마나 가르는지로 고른다.
optimizer와 학습률 위생
대부분의 프론티어 RL 레시피는 근처의 고정 학습률을 쓴다. OLMo 3 (7B)와 (32B), MAI-Thinking-1 에서 긴 길이에서는 (긴 rollout일수록 더 낡으므로), MiMo-7B , MiMo-V2.6은 warm-up과 weight decay 없이 . 덜 뻔한 설정 두 가지가 반복해서 나온다.
Adam의 . Adam의 좌표별 step은 이다. 첫 step에서 , 이므로 step은 다. 이면 의도대로 이고, 이면 이 된다. Adam이 조용히 학습률 의 SGD로 퇴화한다. , 이면 의도한 step의 약 배다. MiniMax-M1은 gradient 크기가 에서 에 걸쳐 있고 대부분 미만임을 측정했다. verl 기본값(, )은 수렴하지 않았고 , 를 썼다. MAI-Thinking-1도 , 다. 짧은 는 가 RL의 비정상적인 gradient 크기를 따라가게도 해 준다.
optimizer 초기화. k1.5는 mirror-descent의 기준점이 바뀌어 매 iteration이 새 문제가 되므로 iteration마다 optimizer 상태를 초기화한다. GLM-5는 비동기 루프에서 추론 엔진에 가중치를 밀어 넣을 때마다 초기화한다. 옛 behaviour 정책에 대해 쌓인 moment는 이제 존재하지 않는 목적함수를 가리킨다.
붕괴한 뒤
되돌리기가 첫 본능이지만 충분하지 않은 경우가 많다. MAI-Thinking-1은 붕괴 이전 체크포인트가 이미 불안정성을 품고 있는 경우가 많아 되돌려도 소용이 없었다고 한다. 대신 RL 중 모은 rollout으로 SFT한 모델(self-distillation)에서 다시 시작했고, 이것으로 진척을 새 base로 옮기기도 했다. Liu, Li 등은 같은 체크포인트 아래의 하드웨어(따라서 kernel)를 바꿔 회복했다. 시스템이 일으킨 붕괴는 시스템에서 고친다는 것을 상기시킨다. DPPO의 분석은 로그의 어디를 볼지 알려 준다. 불안정성은 음수 샘플에서 토큰 확률을 0.5 넘게 깎는 업데이트에서 왔고, 그것은 전체 업데이트의 0.5% 이하였다. 평균에서는 보이지 않고, 의 부호로 나눈 토큰별 log-prob 변화 히스토그램에서는 뚜렷하다.
Computing the dashboard
The NumPy block builds a fake batch with known ground truth — per-position logits for a sampler and a slightly perturbed trainer, with rare large gaps — and checks each estimator against the exact value: sampled-NLL entropy vs true entropy, k1/k3 vs exact , clip fractions by side (including the “opposite” cells produced by drift), zero-variance groups, then the covariance rule and Adam’s .
import numpy as np
rng = np.random.default_rng(0)
P, G, T, V = 64, 8, 48, 40 # prompts, group size, tokens per response, vocab
N = P * G * T
logsm = lambda z: z - z.max(-1, keepdims=True) - np.log(np.exp(z - z.max(-1, keepdims=True)).sum(-1, keepdims=True))
# --- a fake rollout: per-position logits for the sampler (μ) and the trainer (π_old)
z_mu = rng.normal(0, 2.0, (N, V))
noise = rng.normal(0, 0.02, (N, V)) # small kernel noise on every logit
spike = (rng.random(N) < 0.003)[:, None] * rng.normal(0, 1.5, (N, V)) # rare large gaps (e.g. routing flip)
z_old = z_mu + noise + spike
lmu, lold = logsm(z_mu), logsm(z_old)
y = (np.exp(lmu).cumsum(-1) > rng.random((N, 1))).argmax(-1).astype(np.intp) # sample from μ
ar = np.arange(N)
lp_mu, lp_old = lmu[ar, y], lold[ar, y]
# 1) entropy: the sampled-token NLL is an unbiased estimate of the sampler's entropy
H_true = -(np.exp(lmu) * lmu).sum(-1).mean()
H_hat = (-lp_mu).mean()
print(f"entropy true {H_true:.4f} estimate mean(-log μ(y)) {H_hat:.4f}")
# 2) mismatch: k1, k3 estimators of KL(μ‖π_old) vs the exact value
d = lp_old - lp_mu # δ = log π_old − log μ
kl_exact = (np.exp(lmu) * (lmu - lold)).sum(-1).mean()
k1, k3 = (-d).mean(), (np.exp(d) - 1 - d).mean()
r = np.exp(d)
print(f"KL(μ‖π_old) exact {kl_exact:.2e} k1 {k1:.2e} k3 {k3:.2e} max|δ| {np.abs(d).max():.2f}"
f" out of [0.5,2] {np.mean((r < 0.5) | (r > 2)):.2%} token ESS {r.sum()**2 / (r**2).sum() / N:.4f}")
# 3) rewards, zero-variance groups, advantages, clip fractions by side after one update
p_solve = rng.beta(0.6, 0.6, P) # per-prompt pass rate (many near 0 or 1)
R = (rng.random((P, G)) < p_solve[:, None]).astype(float)
zv = np.mean(R.std(1) == 0)
A = np.repeat((R - R.mean(1, keepdims=True)).ravel(), T) # GRPO without std, broadcast to tokens
lp_new = lp_old + 0.15 * np.sign(A) * rng.exponential(1.0, N) # the update pushes each token along sign(A)
lp_new += rng.normal(0, 0.1, N) # plus drift unrelated to A (stale weights)
rho = np.exp(lp_new - lp_old)
el, eh = 0.2, 0.28
up = np.mean((A > 0) & (rho > 1 + eh)); lo = np.mean((A < 0) & (rho < 1 - el))
print(f"zero-variance groups {zv:.2%} clip frac: A>0 & ρ>1+ε_h {up:.2%} A<0 & ρ<1−ε_l {lo:.2%}"
f" ρ max {rho.max():.2f} p99 {np.quantile(rho, 0.99):.2f}")
opp = np.mean((A > 0) & (rho < 1 - el)) + np.mean((A < 0) & (rho > 1 + eh))
print(f"opposite cells (A>0 & ρ<1−ε_l, A<0 & ρ>1+ε_h): {opp:.2%} ← the ratio moved against the update: drift, not learning")
# 4) entropy dynamics: for a natural-gradient step Δz = η·A on softmax logits,
# ΔH ≈ −η Cov_{a~π}(log π(a), A(a))
z = rng.normal(0, 1.5, V); Aa = rng.normal(0, 1, V); eta = 1e-3
H = lambda z: -(np.exp(logsm(z)) * logsm(z)).sum()
pi, lpi = np.exp(logsm(z)), logsm(z)
cov = (pi * (lpi - pi @ lpi) * (Aa - pi @ Aa)).sum()
print(f"ΔH actual {H(z + eta * Aa) - H(z):+.3e} −η·Cov(log π, A) {-eta * cov:+.3e}")
Aa2 = Aa.copy(); Aa2[np.argmax(pi)] += 2.0 # reward the already-likely token more
cov2 = (pi * (lpi - pi @ lpi) * (Aa2 - pi @ Aa2)).sum()
print(f"boost the top token's advantage: Cov {cov:+.3f} → {cov2:+.3f} (positive Cov ⇒ entropy falls)")
# 5) Adam's eps when gradients are tiny (MiniMax-M1: |g| mostly < 1e-14)
g = 1e-14 * rng.standard_normal(1000)
m, v = g, g**2 # first step, bias-corrected moments
for eps in [1e-8, 1e-15]:
step = np.abs(m / (np.sqrt(v) + eps)).mean()
print(f"eps={eps:.0e}: mean |Adam step| / lr = {step:.2e}")What to read off: the sampled-NLL entropy matches the exact entropy to two or three decimals; k1 and k3 both land near the exact KL, with k3 slightly above (it is non-negative per token, k1 is not); the rare logit spikes (0.3% of positions) dominate while barely moving the mean — the reason to log the tail. The opposite clip cells are small but non-zero only because we injected drift unrelated to . The covariance prediction matches the actual entropy change to three digits, and making the most likely token’s advantage larger flips the covariance positive. With the Adam step is about of the intended size.
For a real trainer, the same metrics as one function — call it once per optimiser step on the tensors you already have.
import torch
@torch.no_grad()
def token_entropy(logits):
"""Full-vocabulary entropy per position (call in chunks for long sequences)."""
lp = torch.log_softmax(logits.float(), dim=-1)
return -(lp.exp() * lp).sum(-1)
@torch.no_grad()
def rl_dashboard(logp_new, logp_old, logp_rollout, adv, mask, rewards, group_ids,
resp_len, max_len, ent_full=None, expert_counts=None,
eps_low=0.2, eps_high=0.28, band=(0.5, 2.0)):
"""logp_*/adv/mask/ent_full: (B, T) for sampled tokens; rewards/group_ids/resp_len: (B,).
expert_counts: (layers, experts) tokens routed to each expert in this batch."""
m = mask.bool()
lp_new, lp_old, lp_mu, A = logp_new[m], logp_old[m], logp_rollout[m], adv[m]
rho = torch.exp(lp_new - lp_old)
d = lp_old - lp_mu # δ = log π_old − log μ (samples from μ)
r = torch.exp(d)
out = {
"entropy/sampled_nll": (-lp_mu).mean(),
"clip/high_pos": ((A > 0) & (rho > 1 + eps_high)).float().mean(),
"clip/low_neg": ((A < 0) & (rho < 1 - eps_low)).float().mean(),
"clip/opposite": (((A > 0) & (rho < 1 - eps_low)) | ((A < 0) & (rho > 1 + eps_high))).float().mean(),
"ratio/max": rho.max(),
"ratio/mean": rho.mean(),
"kl_old_new_k3": (rho - 1 - torch.log(rho)).mean(),
"mismatch/k1": (-d).mean(),
"mismatch/k3": (r - 1 - d).mean(),
"mismatch/max_abs_delta": d.abs().max(),
"mismatch/frac_out_band": ((r < band[0]) | (r > band[1])).float().mean(),
"mismatch/token_ess": r.sum() ** 2 / (r ** 2).sum() / r.numel(),
"length/mean": resp_len.float().mean(),
"length/trunc_rate": (resp_len >= max_len).float().mean(),
"reward/mean": rewards.float().mean(),
}
# zero-variance groups: per-group variance of the reward
_, inv = torch.unique(group_ids, return_inverse=True)
k = int(inv.max()) + 1
rw = rewards.float()
n = rw.new_zeros(k).index_add_(0, inv, torch.ones_like(rw))
s1 = rw.new_zeros(k).index_add_(0, inv, rw)
s2 = rw.new_zeros(k).index_add_(0, inv, rw * rw)
var = s2 / n - (s1 / n) ** 2
out["groups/zero_var_frac"] = (var <= 1e-12).float().mean()
if ent_full is not None:
out["entropy/full_vocab"] = ent_full[m].float().mean()
if expert_counts is not None:
load = expert_counts.float()
mean = load.mean(-1, keepdim=True)
out["moe/load_cv_max_layer"] = (load.std(-1) / mean.squeeze(-1)).max()
out["moe/max_over_mean"] = (load / mean).max()
out["moe/cold_frac"] = (load < 0.1 * mean).float().mean()
return {k_: float(v) for k_, v in out.items()}
# grad norm: log the value clip_grad_norm_ returns — it is the norm *before* clipping
# gn = torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=1.0)Your run's reward has been flat for 150 steps. Entropy is falling, the upper clip fraction on positive-advantage tokens has tripled, and the fraction of groups whose rewards are all identical is rising. Mismatch k3 is flat. What is the most direct intervention?
This is the entropy-collapse signature: the upper bound is removing the updates that would raise rare, good tokens (the negative-covariance terms in ), so entropy falls, groups become all-right or all-wrong, and the reward plateaus. Widening (DAPO) or driving the bound with an entropy controller (MAI, MiMo-V2.6) targets the mechanism. Routing replay addresses mismatch, which is flat here; a larger KL to the reference slows learning without restoring exploration; a lower LR slows everything.
Gradient magnitudes in your RL run are mostly around 1e-14 and you use AdamW with eps = 1e-8. What does Adam's update look like?
The first-step update is . With this is : Adam’s normalisation is switched off by . MiniMax-M1 hit exactly this and moved to (and ); MAI-Thinking-1 uses the same .
Summary
- Log in three tiers — policy (entropy, KL to reference), update (clip fraction by side, ratio max, grad norm), data (truncation, held-out reward, zero-variance groups) — plus system (mismatch k3 and its tail, MoE load). Averages hide the failures; tails and splits reveal them.
- Entropy change follows ; a tight upper clip deletes exactly the terms that raise entropy, so the upper-positive clip fraction leads entropy collapse. Controllers on that bound (DAPO, MAI, MiMo-V2.6) are the standard fix.
- Failures announce themselves in a characteristic order: mismatch → grad norm → reward; collapse → zero-variance → plateau; hacking → train/held-out gap with quiet system metrics; router drift → load CV within tens of steps.
- Optimiser hygiene matters: constant LR near , Adam and when gradients are tiny, resets when the behaviour policy changes.
- Prevention beats reaction: the labs keep their guards on from step 0, and after a collapse they fix the system or restart from distilled rollouts rather than simply rolling back.
대시보드 계산하기
NumPy 블록은 정답을 아는 가짜 배치를 만든다. sampler와 약간 교란된 trainer의 위치별 logit에 드문 큰 격차를 섞고, 각 추정량을 정확한 값과 대조한다. 샘플 NLL entropy 대 진짜 entropy, k1/k3 대 정확한 , 방향별 clip 비율(표류가 만든 “반대” 칸 포함), zero-variance 그룹, 그리고 공분산 규칙과 Adam의 이다.
import numpy as np
rng = np.random.default_rng(0)
P, G, T, V = 64, 8, 48, 40 # 프롬프트, 그룹 크기, 응답당 토큰, vocab
N = P * G * T
logsm = lambda z: z - z.max(-1, keepdims=True) - np.log(np.exp(z - z.max(-1, keepdims=True)).sum(-1, keepdims=True))
# --- 가짜 rollout: sampler(μ)와 trainer(π_old)의 위치별 logit
z_mu = rng.normal(0, 2.0, (N, V))
noise = rng.normal(0, 0.02, (N, V)) # 모든 logit에 작은 kernel 잡음
spike = (rng.random(N) < 0.003)[:, None] * rng.normal(0, 1.5, (N, V)) # 드문 큰 격차(예: routing 뒤바뀜)
z_old = z_mu + noise + spike
lmu, lold = logsm(z_mu), logsm(z_old)
y = (np.exp(lmu).cumsum(-1) > rng.random((N, 1))).argmax(-1).astype(np.intp) # μ에서 샘플
ar = np.arange(N)
lp_mu, lp_old = lmu[ar, y], lold[ar, y]
# 1) entropy: 샘플 토큰 NLL은 sampler entropy의 비편향 추정량
H_true = -(np.exp(lmu) * lmu).sum(-1).mean()
H_hat = (-lp_mu).mean()
print(f"entropy true {H_true:.4f} estimate mean(-log μ(y)) {H_hat:.4f}")
# 2) mismatch: KL(μ‖π_old)의 k1, k3 추정 대 정확한 값
d = lp_old - lp_mu # δ = log π_old − log μ
kl_exact = (np.exp(lmu) * (lmu - lold)).sum(-1).mean()
k1, k3 = (-d).mean(), (np.exp(d) - 1 - d).mean()
r = np.exp(d)
print(f"KL(μ‖π_old) exact {kl_exact:.2e} k1 {k1:.2e} k3 {k3:.2e} max|δ| {np.abs(d).max():.2f}"
f" out of [0.5,2] {np.mean((r < 0.5) | (r > 2)):.2%} token ESS {r.sum()**2 / (r**2).sum() / N:.4f}")
# 3) 보상, zero-variance 그룹, advantage, 한 번 업데이트 뒤 방향별 clip 비율
p_solve = rng.beta(0.6, 0.6, P) # 프롬프트별 pass rate(0·1 근처가 많음)
R = (rng.random((P, G)) < p_solve[:, None]).astype(float)
zv = np.mean(R.std(1) == 0)
A = np.repeat((R - R.mean(1, keepdims=True)).ravel(), T) # std 없는 GRPO, 토큰에 broadcast
lp_new = lp_old + 0.15 * np.sign(A) * rng.exponential(1.0, N) # 업데이트는 각 토큰을 sign(A) 방향으로 민다
lp_new += rng.normal(0, 0.1, N) # 여기에 A와 무관한 표류(낡은 가중치)
rho = np.exp(lp_new - lp_old)
el, eh = 0.2, 0.28
up = np.mean((A > 0) & (rho > 1 + eh)); lo = np.mean((A < 0) & (rho < 1 - el))
print(f"zero-variance groups {zv:.2%} clip frac: A>0 & ρ>1+ε_h {up:.2%} A<0 & ρ<1−ε_l {lo:.2%}"
f" ρ max {rho.max():.2f} p99 {np.quantile(rho, 0.99):.2f}")
opp = np.mean((A > 0) & (rho < 1 - el)) + np.mean((A < 0) & (rho > 1 + eh))
print(f"opposite cells (A>0 & ρ<1−ε_l, A<0 & ρ>1+ε_h): {opp:.2%} ← ratio가 업데이트 반대로 움직임: 학습이 아니라 표류")
# 4) entropy 동역학: softmax logit에 대한 natural-gradient step Δz = η·A에서
# ΔH ≈ −η Cov_{a~π}(log π(a), A(a))
z = rng.normal(0, 1.5, V); Aa = rng.normal(0, 1, V); eta = 1e-3
H = lambda z: -(np.exp(logsm(z)) * logsm(z)).sum()
pi, lpi = np.exp(logsm(z)), logsm(z)
cov = (pi * (lpi - pi @ lpi) * (Aa - pi @ Aa)).sum()
print(f"ΔH actual {H(z + eta * Aa) - H(z):+.3e} −η·Cov(log π, A) {-eta * cov:+.3e}")
Aa2 = Aa.copy(); Aa2[np.argmax(pi)] += 2.0 # 이미 가장 그럴듯한 토큰의 advantage를 키움
cov2 = (pi * (lpi - pi @ lpi) * (Aa2 - pi @ Aa2)).sum()
print(f"boost the top token's advantage: Cov {cov:+.3f} → {cov2:+.3f} (양의 Cov ⇒ entropy 감소)")
# 5) gradient가 아주 작을 때 Adam의 eps (MiniMax-M1: |g| 대부분 < 1e-14)
g = 1e-14 * rng.standard_normal(1000)
m, v = g, g**2 # 첫 step, bias 보정된 moment
for eps in [1e-8, 1e-15]:
step = np.abs(m / (np.sqrt(v) + eps)).mean()
print(f"eps={eps:.0e}: mean |Adam step| / lr = {step:.2e}")읽을 것: 샘플 NLL entropy는 정확한 entropy와 소수 둘째·셋째 자리까지 맞는다. k1과 k3는 모두 정확한 KL 근처에 오고 k3가 조금 크다(k3는 토큰마다 음이 아니고 k1은 아니다). 드문 logit spike(위치의 0.3%)는 평균은 거의 움직이지 않으면서 를 지배한다. 꼬리를 기록하는 이유다. 반대 clip 칸은 작지만 0이 아닌데, 와 무관한 표류를 넣었기 때문이다. 공분산 예측은 실제 entropy 변화와 세 자리까지 맞고, 가장 그럴듯한 토큰의 advantage를 키우면 공분산이 양으로 뒤집힌다. 이면 Adam step은 의도한 크기의 약 배다.
실제 trainer에서는 같은 지표를 함수 하나로 — 이미 가진 텐서로 optimizer step마다 한 번 부른다.
import torch
@torch.no_grad()
def token_entropy(logits):
"""위치별 전체 vocab entropy (긴 시퀀스는 chunk로 나눠 호출)."""
lp = torch.log_softmax(logits.float(), dim=-1)
return -(lp.exp() * lp).sum(-1)
@torch.no_grad()
def rl_dashboard(logp_new, logp_old, logp_rollout, adv, mask, rewards, group_ids,
resp_len, max_len, ent_full=None, expert_counts=None,
eps_low=0.2, eps_high=0.28, band=(0.5, 2.0)):
"""logp_*/adv/mask/ent_full: 샘플 토큰의 (B, T); rewards/group_ids/resp_len: (B,).
expert_counts: (layers, experts) 이 배치에서 각 expert로 간 토큰 수."""
m = mask.bool()
lp_new, lp_old, lp_mu, A = logp_new[m], logp_old[m], logp_rollout[m], adv[m]
rho = torch.exp(lp_new - lp_old)
d = lp_old - lp_mu # δ = log π_old − log μ (샘플은 μ에서)
r = torch.exp(d)
out = {
"entropy/sampled_nll": (-lp_mu).mean(),
"clip/high_pos": ((A > 0) & (rho > 1 + eps_high)).float().mean(),
"clip/low_neg": ((A < 0) & (rho < 1 - eps_low)).float().mean(),
"clip/opposite": (((A > 0) & (rho < 1 - eps_low)) | ((A < 0) & (rho > 1 + eps_high))).float().mean(),
"ratio/max": rho.max(),
"ratio/mean": rho.mean(),
"kl_old_new_k3": (rho - 1 - torch.log(rho)).mean(),
"mismatch/k1": (-d).mean(),
"mismatch/k3": (r - 1 - d).mean(),
"mismatch/max_abs_delta": d.abs().max(),
"mismatch/frac_out_band": ((r < band[0]) | (r > band[1])).float().mean(),
"mismatch/token_ess": r.sum() ** 2 / (r ** 2).sum() / r.numel(),
"length/mean": resp_len.float().mean(),
"length/trunc_rate": (resp_len >= max_len).float().mean(),
"reward/mean": rewards.float().mean(),
}
# zero-variance 그룹: 그룹별 보상 분산
_, inv = torch.unique(group_ids, return_inverse=True)
k = int(inv.max()) + 1
rw = rewards.float()
n = rw.new_zeros(k).index_add_(0, inv, torch.ones_like(rw))
s1 = rw.new_zeros(k).index_add_(0, inv, rw)
s2 = rw.new_zeros(k).index_add_(0, inv, rw * rw)
var = s2 / n - (s1 / n) ** 2
out["groups/zero_var_frac"] = (var <= 1e-12).float().mean()
if ent_full is not None:
out["entropy/full_vocab"] = ent_full[m].float().mean()
if expert_counts is not None:
load = expert_counts.float()
mean = load.mean(-1, keepdim=True)
out["moe/load_cv_max_layer"] = (load.std(-1) / mean.squeeze(-1)).max()
out["moe/max_over_mean"] = (load / mean).max()
out["moe/cold_frac"] = (load < 0.1 * mean).float().mean()
return {k_: float(v) for k_, v in out.items()}
# grad norm: clip_grad_norm_이 돌려주는 값을 기록한다 — clip *전의* norm이다
# gn = torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=1.0)실행의 보상이 150 step째 평평하다. entropy는 떨어지고, 양의 advantage 토큰의 위쪽 clip 비율은 세 배가 됐고, 보상이 모두 같은 그룹의 비율이 오른다. mismatch k3는 평평하다. 가장 직접적인 개입은?
entropy 붕괴의 징후다. 위 경계가 드문 좋은 토큰을 올리는 업데이트(의 음의 공분산 항)를 지우고 있어서 entropy가 떨어지고, 그룹이 모두 맞히거나 모두 틀리게 되고, 보상이 정체한다. 를 넓히거나(DAPO) 경계를 entropy 제어기로 움직이는 것(MAI, MiMo-V2.6)이 메커니즘을 겨냥한다. routing replay는 mismatch용인데 여기서는 평평하다. 참조 모델 KL을 키우면 탐색을 되살리지 못한 채 학습만 늦어진다. 학습률을 낮추면 모든 것이 느려진다.
RL 실행의 gradient 크기가 대부분 1e-14 근처이고 AdamW를 eps = 1e-8로 쓴다. Adam의 업데이트는 어떻게 되나?
첫 step의 업데이트는 다. 이면 , 즉 이 Adam의 정규화를 꺼 버린다. MiniMax-M1이 정확히 이것을 겪고 (와 )로 바꿨고, MAI-Thinking-1도 같은 을 쓴다.
정리
- 세 층으로 기록한다. 정책(entropy, 참조 모델 KL), 업데이트(방향별 clip 비율, ratio 최대, grad norm), 데이터(잘림, held-out 보상, zero-variance 그룹), 그리고 시스템(mismatch k3와 그 꼬리, MoE load). 평균은 고장을 감추고 꼬리와 분할이 드러낸다.
- entropy 변화는 를 따른다. 좁은 위 clip은 entropy를 올리는 항만 지우므로, 위쪽-양수 clip 비율이 entropy 붕괴에 앞선다. 그 경계에 거는 제어기(DAPO, MAI, MiMo-V2.6)가 표준 처방이다.
- 고장은 특징적인 순서로 자신을 알린다. mismatch → grad norm → 보상; 붕괴 → zero-variance → 정체; hacking → 학습/held-out 격차와 조용한 시스템 지표; router 표류 → 수십 step 안의 load CV.
- optimizer 위생이 중요하다. 근처의 고정 학습률, gradient가 아주 작으면 Adam 와 , behaviour 정책이 바뀌면 초기화.
- 예방이 반응보다 낫다. lab들은 방어 장치를 step 0부터 켜 두고, 붕괴 뒤에는 단순히 되돌리기보다 시스템을 고치거나 증류한 rollout에서 다시 시작한다.
더 읽을거리Further reading
- Yu et al., DAPO: An Open-Source LLM Reinforcement Learning System at Scale (2025) — clip-higher, dynamic sampling, token-level loss, overlong shaping. entropy 붕괴와 신호 고갈에 대한 표준 처방.Clip-higher, dynamic sampling, token-level loss, overlong shaping — the standard fixes for entropy collapse and signal starvation.
- Cui et al., The Entropy Mechanism of Reinforcement Learning for Reasoning Language Models (2025) — entropy 변화가 log-확률과 logit 변화(정책 경사에서는 advantage)의 공분산으로 결정된다는 분석과 Clip-Cov/KL-Cov.Shows that entropy change is driven by the covariance between log-probability and logit change (the advantage, for policy-gradient methods); proposes Clip-Cov / KL-Cov.
- MiniMax, MiniMax-M1: Scaling Test-Time Compute Efficiently with Lightning Attention (2025) — FP32 LM head, AdamW eps 1e-15, 반복 조기 중단, 길이 확장 중 pattern collapse — 이 레슨의 처방 상당수의 출처.FP32 LM head, AdamW eps 1e-15, early stop of repetition, pattern collapse while extending length — the source of many fixes here.
- The Microsoft AI Team, MAI-Thinking-1: Building a Hill-Climbing Machine (2026) — entropy 적분 제어기, 외곽 ratio clip r_max=50, top-p mask replay, staleness 8 버전 상한, 붕괴 뒤 self-distillation. 사이트의 리뷰는 /study/reports/mai-base-2/.Integral entropy controller, outer ratio clip r_max=50, top-p mask replay, an 8-version staleness bound, self-distillation after collapses. Reviewed at /study/reports/mai-base-2/.
- Ma et al., Stabilizing MoE Reinforcement Learning by Aligning Training and Inference Routers (2025) — MoE의 router 불일치와 R3. collapse step이 표로 나와 있어 "언제 무너지나"를 읽기 좋다.MoE router mismatch and R3, with collapse steps in a table — good for reading "when does it break".
- Zhong et al., Diagnosing Training-Inference Mismatch in LLM RL via a Zero-Mismatch Reference (VeXact, 2026) — KL 모니터가 초기 열화를 놓친다는 것을 bit-exact 기준선으로 보인다.Uses a bit-exact reference to show that a KL monitor misses the early degradation.
- Liu, Li et al., When Speed Kills Stability: Demystifying RL Collapse from the Training-Inference Mismatch (2025, blog) — vllm-kl·fsdp-ppl·grad norm을 함께 보는 진단, 하드웨어별 mismatch 크기, 체크포인트를 다른 하드웨어에서 이어 회복.Diagnostics that track vllm-kl, fsdp-ppl and grad norm together; mismatch size by hardware; recovery by resuming on different hardware.
- Xiaomi LLM-Core, MiMo-V2.6: Scaling Reinforcement Learning Towards Self-Improvement (technical report PDF, 2026) — RL 중 router 표류의 수치와 router만 되돌려 회복한 실험. 사이트의 리뷰는 /study/reports/mimo-v2/.Numbers on router drift during RL and the experiment that recovered by restoring only the router. Reviewed at /study/reports/mimo-v2/.
- Xue et al., SimpleTIR: End-to-End Reinforcement Learning for Multi-Turn Tool-Integrated Reasoning (2025) — tool 피드백이 만든 분포 이동이 낮은 확률 토큰을 낳고 턴마다 누적되어 gradient norm이 폭발한다는 진단과 void turn 필터.Diagnoses multi-turn gradient-norm explosions from tool-feedback distribution drift and low-probability tokens compounding over turns; filters void turns.