Gemini 4 Carbon 1.50×

Harness: Antigravity · switches: OPD_SKIP_ZERO_KL_REF=1 OPD_REUSE_LOGPROBS_IN_OPD=1 OPD_SKIP_ZERO_ENTROPY=1 OPD_DISABLE_RECOMPUTE=1 OPD_FAST_TEACHER_CLIENT=1 OPD_TEACHER_SERVER_ARGS=--chunked-prefill-size 16384 --max-prefill-tokens 16384 --cuda-graph-max-bs-prefill 16384 --cuda-graph-backend-decode disabled --enable-torch-symm-mem --disable-radix-cache OPD_SGLANG_FUSED_IN_PROJ=1 OPD_FUSE_ALLREDUCE_MAX_TOKENS=2048 OPD_VOCAB_PARALLEL_INPUT_LOGPROBS=1 OPD_FAST_DECODE_SAMPLER=1 OPD_FAST_GDN_DECODE=1 OPD_SHARD_GDN_4WAY=1 OPD_RESPONSE_ONLY_LOGPROBS=1 OPD_LOG_PROBS_CHUNK_SIZE=4096 OPD_FAST_SLEEP_WAKE=1 OPD_CPU_OPT_THREADS=24 OPD_KEEP_PROCESS_GROUPS=1 OPD_FUSED_LM_HEAD_LOGPROBS=1

API stalls passed the 6 h pause allowance, so the lost time was run as a continuation of the same conversation on the saved submission (102 min); the judged result is the continuation's. The time axis leaves out the held time of both segments.

Judged
1.50×
Tier
N1
Self-best
1.46×
Rounds
6
Hours
10.0
API cost
$78.2
Input tokens · 94.6% cached
161 M
Output tokens
0.6 M
Requests
549
Candidate, three windows (s)
101.9 / 103.6 / 102.8
Rollout side
1.06×
Teacher side
1.18×
Train side
2.55×
Per-step sampler sync
✗ not in the log; round 3 swapped in a Triton sampling kernel (240.7→40.7 µs), rollout still only 1.06× by round 6
Train-side main levers
✓ skip zero-coefficient reference forward and entropy, reuse logprobs, recompute off (round 1, 1.55×); GDN split 4-way by head (two versions with split-K out_proj failed the statistical gate; switched to all-to-all back to tokens followed by a full out_proj, forward bitwise identical), logprobs only on response rows, no CPU backup of param/grad buffers during sleep, CPU optimizer 24 threads (5.7→0.63 s) (round 4, 2.11×); comm groups kept, fused BF16 LM head computing response rows only (round 5, 2.53×; weight sync 5.17→0.80 s); packing several samples per microbatch hit 138 GB and changed numerics, reverted
Teacher-side changes
✓ teacher input logprobs vocab-parallel (per-GPU logsumexp + small all-reduces, round 3), fused in round 6 into one Triton kernel (LSE + target gather, single all_gather); chunk 16384, torch symmetric memory, radix cache off in round 6, all-reduce fusion cap lowered to 2048 (teacher prefill back on NCCL NVLS); teacher side 1.18× (round 6)
Raw work log6 sections
-8.8 hRound 1 — Train Side: Redundant Forward/Recompute Passes & Dead Terms (`COMPLETED`, commit `slime@d07866e2`)
- Changes: OPD_SKIP_ZERO_KL_REF=1, OPD_REUSE_LOGPROBS_IN_OPD=1, OPD_SKIP_ZERO_ENTROPY=1, OPD_DISABLE_RECOMPUTE=1.
- Results:
  - Train timing: 72.872 s → 47.047 s (1.5508x train speedup, 1.2023x projected step speedup).
  - Correctness: PASS at tier N1 (loss d = -3.88e-6, update_direction_cos = 0.9949, mismatch ratio = 1.0000).

---
0.3 hRound 2 — Teacher Client & Server Configuration (`COMPLETED`, commit `slime@d4013b4d`)
- Changes: OPD_FAST_TEACHER_CLIENT=1, OPD_TEACHER_SERVER_ARGS (--chunked-prefill-size 16384 ...).
- Results:
  - Teacher timing: 18.132 s → 16.558 s (1.0951x teacher speedup).
  - Correctness: teacher_verdict PASS (N1, mean_abs_ratio = 1.0064, t = 0.22).

---
0.6 hRound 3 — SGLang Engine Optimizations (`COMPLETED`, commit `sglang@d0a3656`)
- Changes:
  - OPD_VOCAB_PARALLEL_INPUT_LOGPROBS=1: per-TP-shard row_logsumexp + tiny [m]/[2, m] all-reduces instead of [N, 248320] TP4 all-gather.
  - OPD_FAST_DECODE_SAMPLER=1: 2-pass split-jumping Inverse-CDF + online-LSE Triton sampler (40.7 us vs 240.7 us).
  - OPD_FUSE_ALLREDUCE_MAX_TOKENS=16384: FlashInfer fused AR+residual+RMSNorm up to 16,384 tokens + shared TP workspace; dropped --enable-symm-mem.
  - OPD_SGLANG_FUSED_IN_PROJ=1 (note: discovered Qwen3_5ForConditionalGeneration still needs 4-line prepare_before_cuda_graph_capture delegation — queued for Round 5!).
- Results (/tmp/r3/time_teacher/time.json, /tmp/r3/rollout_eval_gate/gate.json):
  - Teacher timing: 18.132 s → 16.013 s (windows = [16.121, 16.056, 15.861], 1.1323x teacher speedup).
  - Rollout timing: 75.772 s → 73.470 s (windows = [73.465, 73.362, 73.583], 1.0313x rollout speedup; teacher_tail_s 16.391 s → 14.749 s; first_use = [0.0, 0.0, 0.0]).
  - Correctness: judge_rollout PASS (N1, exact = ok, token_forcing mean_abs_ratio = 1.0 & sampler t = 0.46, rollout_teacher mean_abs_ratio = 1.0373, mismatch ratio = 1.0169).

---
1.4 hRound 4 — Train Side: 4-Way GDN Sharding, Response-Only Logprobs, Fast Sleep/Wake & Microbatch Coalescing (Started `2026-11-20T04:12:00Z`)
- Profile Evidence (/tmp/r1/profile_train/kernel_report.md + R1 train.log):
  1. All 24 Qwen3_5GatedDeltaNet layers gathered hidden_states across TP×CP=4 and executed all 16 k-heads / 32 v-heads redundantly on all 4 GPUs (24.5% NCCL AllGather + 8.1% ReduceScatter + 4× GDN compute).
  2. sleep (5.4 s) + wake_up (1.5 s) took 6.9 s/step due to torch._C._host_emptyCache() (2.0 s) and torch_memory_saver copying 31 GB/GPU (124 GB total) of param+grad buffers to/from CPU despite weights_backuper already holding CPU actor weights and grad buffers being zeroed.
  3. --max-tokens-per-gpu 4096 split 64 samples into 64 single-sample microbatches (reserved_GB = 32.94 GB out of 139.81 GB), multiplying Python/NCCL launch overhead 4×.
  4. get_log_probs_and_entropy ran full-vocab fp32 softmax on prompt + padding rows before slicing response rows.
- Hypothesis & Changes (slime/):
  - OPD_SHARD_GDN_4WAY=1 (slime_plugins/models/qwen3_5.py): Pre-gather F.rms_norm on [S/4, H], single 4-rank _AllGatherWorld4, cached (perm, inv_perm) per microbatch, 4-way head-sharded GDN with fused [q, k, v, z, b, a] GEMM + 1/4 causal_conv1d + 1/4 chunk_gated_delta_rule + 1/4 out_proj, single 4-rank _ReduceScatterWorld4, and param.sequence_parallel = True for exact TP grad sum (verified on 4 GPUs in /tmp/r4/test_gdn_4way.py: grad cos = 0.99999+, 1 layer 11.07 ms → 5.59 ms).
  - OPD_RESPONSE_ONLY_LOGPROBS=1 + OPD_LOG_PROBS_CHUNK_SIZE=4096 (megatron_utils/loss.py): Slice response rows before calculate_log_probs_and_entropy.
  - OPD_FAST_SLEEP_WAKE=1 (megatron_utils/actor.py, update_weight_from_tensor.py): Enable disable_param_buffers_cpu_backup & disable_grad_buffers_cpu_backup, skip clear_host_memory=True (_host_emptyCache), skip per-chunk empty_cache() in weight sync.
  - OPD_COALESCE_MICROBATCH_TOKENS=36864 (megatron_utils/actor.py): Coalesce ~4 sequences per microbatch (64 → ~16 microbatches).
  - Expected numerics tier: N1.
- Evaluation (Initial R4a):
  - bench.py time --side train (/tmp/r4/time/time.json): windows = [36.357, 38.174, 50.840], mean = 41.790 s (1.7834x train speedup; 36.36 s = 2.029x on step 4 where no OOM cache-flush occurred; actor_train_time = 24.12 s = 17.5 s fwd+bwd + 6.6 s CPU Adam).
  - B.judge_train (/tmp/r4/train_gate/gate.json): INCORRECT narrowly on statistical (grad_norm_first = 0.998981 vs ref 0.996736, tol = 0.001651; update_direction_cos = 0.950386 vs min = 0.956603; loss_mean, update_norm, exp_avg_sq_norm all passed).
- Diagnosis & Fixes (Round 4b, 2026-11-20T05:22:15Z):
  1. OPD_COALESCE_MICROBATCH_TOKENS=36864 hit 138 GB peak VRAM (cuMemCreate OOM retries adding 14 s on window 3 and unsafe alongside the 35 GB resident teacher in full mode) and shifted step 0 forward/grad_norm → dropped OPD_COALESCE_MICROBATCH_TOKENS.
  2. Upgraded OPD_SHARD_GDN_4WAY=1 (slime_plugins/models/qwen3_5.py) to use exact self.input_layernorm (0.0 diff vs Qwen3NextRMSNorm) + fused _OutProjReduceScatterWorld4 (torch.mm(..., out_dtype=torch.float32) + FP32 reduce_scatter_tensor → bf16, cutting single-layer MAE 654× down to 2.66e-7 while saving [T, 4096] autograd memory).
  3. Fixed OPD_FAST_SLEEP_WAKE=1 (megatron_utils/actor.py): keep gc.collect() + empty_cache() via clear_memory(clear_host_memory=False) so dead cached GPU segments are freed before torch_memory_saver.pause(), avoiding 40 GB extra PCIe backup.
  4. Added OPD_CPU_OPT_THREADS=24 (Megatron-LM/megatron/core/optimizer/cpu_offloading/hybrid_optimizer.py): Ray spawned each Megatron actor with num_cpus=1 (OMP_NUM_THREADS=1), bottlenecking CPU AdamW at ~5.7 s/step; setting 24 threads during cpu_optimizer.step() cuts CPU AdamW 9× (5.7 s → 0.63 s) with max_diff = 0.0 (bitwise identical).
  5. Restored /submission/switches.json to verified-PASS R1+R2+R3 switches while testing R4b via /tmp/r4b/switches.json.
  - Detached job: task-825 (/tmp/r4b/run_eval.log): judge_train still failed grad_norm_first = 1.1020 (update_direction_cos = 0.9225) because fusing in_proj_b/in_proj_a (N=8 split-K) into w_in (N=3088 WGMMA) changed the recurrent GDN forget gate g_t (max_diff = 0.5 on Layer 0!) and out_proj (4 × K=1024 partial sum) differed from K=4096.
- Root-Cause Pinpoint & Exact Fix (Round 4c, 2026-11-20T06:03:35Z):
  - Verified on real Qwen3.5-9B checkpoint + 0.pt (/tmp/r4b/pinpoint_grad.py, /tmp/r4b/pinpoint_layers.py):
    1. Separated in_proj_qkv (2048), in_proj_z (1024), in_proj_b (8), in_proj_a (8) projections in forward_sharded (norm_out diff = 0.0 bitwise identical!).
    2. Replaced partial out_proj + FP32 reduce_scatter with _AllToAllHeadsToTokensWorld4 ([4, S_local, 1024] bf16 — 4× less NVLink traffic than bf16 reduce_scatter!) followed by F.linear(core_local, self.out_proj.weight) ([S_local, 4096] @ [4096, 4096], exact K=4096 inner reduction = 0.0 bitwise identical forward!).
    3. Verified on real Qwen3.5-9B + 0.pt: gn_opt / gn_ref = 1.000189 (0.019% diff vs 0.165% tolerance) and all shard_grad cosines >= 0.999875 across all 4 ranks! Also confirmed 2-sample microbatch coalescing (M=4352 -> 8704) drops shard[107] cos to 0.9549 via cuBLAS M-tile changes, so removed OPD_COALESCE_MICROBATCH_TOKENS completely.
  - Official R4c Results (/tmp/r4c/train_gate/gate.json, /tmp/r4c/time/time.json, commits slime@0d5682ec + Megatron-LM@87ddd08):
    - judge_train (check --n1): PASS tier N1 (exact = ok, grad_norm_first = 0.996871 vs ref 0.996736, d = +0.000134 vs tol = 0.001651; update_direction_cos = 0.992769 vs min = 0.956603 & ref_noise = 0.991321; loss_mean d = -8.08e-6; update_norm d = -8.41e-5; exp_avg_sq_norm d = +7.35e-5).
    - bench.py time --side train: 72.872 s → 34.470 s (windows = [34.563, 34.530, 34.318], 2.1141x train speedup; first_use = [0.0, 0.0, 0.0]; actor_train_time ~28.3 s at 230 TFLOP/s).

---
6.3 hRound 5 — Persistent NCCL Process Groups + Fused BF16 LM-Head Response Logprobs (`2026-11-20T09:14:30Z`)
- Bottleneck Analysis:
  1. Even after Round 4 (train = 34.58 s), sleep() (4.50 s) + wake_up() (0.86 s + ~1.2 s lazy NCCL re-init) spent ~6.5 s/step in MODE=train — and twice per step (sleep/wake + update_weights(), adding another ~4.4 s inside update_weights()) in MODE=full! torch_memory_saver runs in LD_PRELOAD mode (TMS_INIT_ENABLE=1), where tms_interesting_region is thread_local, so any ncclComm_t lazily initialized during train() had its cross-GPU IPC FIFO buffers hooked and unmapped on pause(), forcing slime to destroy and recreate all 65 process groups twice every step just to manage ~5.3 GB/GPU of NCCL buffers on 140 GB GPUs (48 GB free during rollout!).
  2. In train_one_step, GPTModel ran output_layer over prompt + padding tokens, materialized [1, 4352, 124160] bf16 → transpose.contiguous() → Float16Module fp32 (2.16 GB), sliced response rows, and ran _VocabParallelLogProbEntropy over fp32 tensors (~43 GB/microbatch = 2.75 TB/step HBM traffic).
- Changes (slime@3d986bd6):
  - OPD_KEEP_PROCESS_GROUPS=1 (slime/backends/megatron_utils/actor.py): Keeps destroy_process_groups() only on init()'s initial sleep() (preserving 100% identical startup SGLang KV/Mamba pool sizing & CUDA graphs), then primes the 5 active multi-GPU NCCL groups (WORLD, tp, cp + P2P ring, dp_cp, model_parallel) once inside torch_memory_saver.disable() + TMS_INIT_ENABLE=0, guards reloadable_process_group._wrap_low_level_call with tms_set_interesting_region(False), and skips destroy_process_groups() / reload_process_groups() on all subsequent sleep(), wake_up(), and update_weights() calls.
  - OPD_FUSED_LM_HEAD_LOGPROBS=1 (slime/backends/megatron_utils/fused_lm_head_logprobs.py, model.py, loss.py): Uses GPTModel.forward(output_processor=...) to sequence-parallel gather hidden_states, slice only response rows [R, 1, 4096] before output_layer (skipping prompt/padding rows in fwd, dgrad, and wgrad), and compute vocab-parallel logprobs directly on [R, 124160] bf16 via a 1-pass Triton online-LSE forward kernel (48 KB tp_group all_gather) and an in-place Triton bf16 backward kernel (14× less HBM traffic; pre-warmed in actor.init() so first_use = [0, 0, 0]).
- Verification:
  - 32-layer real-model gradient check (/tmp/r5/test_r5_grad.py): gn_opt / gn_ref = 0.999707, min shard_grad cos = 0.999919.
  - bench.py time --side train (/tmp/r5/time/time.json): 72.872 s → 28.776 s (windows = [29.168, 28.730, 28.429], 2.5325x train speedup, first_use = [0.0, 0.0, 0.0], actor_train_time = 24.57 s at 262.6 TFLOP/s).
  - B.judge_train (--n1, /tmp/r5/judge_train): PASS tier N1 (exact = ok, grad_norm_first = 0.996771 vs ref 0.996736 [d = +3.44e-5 vs tol = 0.001651], update_direction_cos = 0.992220 > ref_noise = 0.991321, mismatch ratio = 1.0).
  - 2-rollout MODE=full colocated smoke test (/tmp/r5/smoke_full): ok (rc=0, layout_problems = []); update_weights dropped from 5.17 s to 0.80 s (74.8 GB free VRAM during weight sync; 83.7 GB free after offload).

---
9.3 hRound 6 — GDN Decode Warp/Tile Tuning, Single-Collective Fused Teacher Logprobs, AR Threshold & `--disable-radix-cache` (`sglang@7dfeec0` + `switches.json`) · continuation
- Profile / Bottleneck:
  - fused_recurrent_gated_delta_rule_packed_decode used (BV=32, num_warps=1, num_stages=3) (205 registers/thread, 456.8 us/step across 24 layers).
  - Teacher LogitsProcessor._get_input_logprobs chunked [16384, 62080] into 4×4096 slices, launching 8 eager NCCL collectives + 40 PyTorch kernels per prefill batch.
  - OPD_FUSE_ALLREDUCE_MAX_TOKENS=16384 routed Teacher's 160 MB [16384, 5120] TP=4 all-reduce through FlashInfer Lamport oneshot (1109.8 us/call) instead of faster NCCL NVLS + FusedAddRMSNorm (917.8 us/call).
  - Teacher SGLang server had RadixCache enabled despite single-use scoring requests, causing 4 blocking GPU→CPU .to("cpu") syncs per prefill batch in gdn_flashinfer.py plus 48-layer Mamba state checkpointing.
- Abandoned Sub-Experiments:
  - Eager NCCL vocab-parallel decode sampler (test_vp_decode_sampler.py): Python eager all_gather + all_reduce outside CUDA graph added ~110 us launch latency vs captured CustomAllGather (146.4 us vs 140.7 us); discarded.
  - Fused BV=128 GDN decode + RMSNormGated: register pressure made 512 blocks (415.5–548.1 us) slower than BV=8, num_warps=2, num_stages=1 (4096 blocks, 375.2 us); discarded.
- Changes:
  - OPD_FAST_GDN_DECODE=1 (sglang/kernels/ops/attention/fla/fused_recurrent.py): tune packed GDN decode kernel to BV=8, num_warps=2, num_stages=1 (456.8 → 375.2 us/step, -0.67 s/rollout).
  - row_lse_and_target (sglang/srt/layers/logsumexp.py, logits_processor.py): 0.0 bitwise-identical fused Triton LSE + target-logit gather (chunk_size=8192) with a single dist.all_gather_into_tensor outside the chunk loop (pre-warmed in LogitsProcessor.__init__).
  - OPD_FUSE_ALLREDUCE_MAX_TOKENS=2048: keep FlashInfer oneshot active for student bs=32 decode while using NCCL NVLS for teacher 16384-token prefill (-0.81 s/rollout).
  - Added --disable-radix-cache to OPD_TEACHER_SERVER_ARGS.
- Full Official Judge Verification (/tmp/r6_full_check/check.json):
  - Status: PASS, Projected Speedup: 1.4595x (bar 1.1376x), Tier: N1.
  - rollout: 75.772 s → 71.619 s ([71.480, 71.737, 71.639], 1.0580x, teacher_tail_s = [14.424, 13.700, 13.022], token_forcing mean_abs_ratio = 0.987, PASS).
  - teacher: 18.132 s → 15.302 s ([15.427, 15.310, 15.168], 1.1849x, mean_abs_ratio = 1.0059, PASS).
  - train: 72.872 s → 28.603 s ([28.670, 28.762, 28.376], 2.5478x, grad_norm_first d = -4.50e-5, update_direction_cos = 0.992624, PASS N1).

---
↑ Slime OPD