Datacurve's Qwen3.8-Flash-Next Training Run Broke Five Systems at Once
Datacurve finetuned a 176B MoE model at 256k context on 128 H200s, surfacing seven infra bugs that silently corrupt long-horizon RL.
Takeaways
- Datacurve finetuned Qwen3.8-Flash-Next (176B MoE) at 256k context on 128 H200 GPUs.
- Pass@1 rose from 34% to 42% on held-out repos over 27 RL steps.
- MoE bf16 atomic-add reductions caused 12% per-token probability drift between identical forward passes.
- bf16 LoRA merging silently discarded 78% of adapter updates; switching to fp16 preserved them.
- Rebuilt SGLang sparse-attention top-k selector hit 275 tokens/s decode, 5.5x the exact version.
- A four-mask linearity test exposed fp16 gradient underflow driving long-horizon entropy collapse. Full post.
Datacurve’s attempt to fine-tune Qwen3.8-Flash-Next, a 176-billion-parameter hybrid mixture-of-experts model, exposed failures across scheduling, inference, attention, weight synchronization, and backpropagation. The team trained at a 256,000-token context length on 128 NVIDIA H200 GPUs. Its technical report traces faults that emerged as software-agent episodes stretched across hours, changing token probabilities, erasing adapter updates, selecting incorrect attention blocks, and corrupting gradients.
Group Relative Policy Optimization, or GRPO, estimates each trajectory’s advantage relative to other samples for the same prompt. When every trajectory receives the same reward, including an all-zero group, the centered advantages vanish and the group supplies no policy-gradient signal. Sparse success on long software tasks therefore pushes teams toward more capable models, larger rollout groups, and longer contexts. Those choices increase memory pressure, generation time, and the numerical consequences of small implementation errors.
A 51-Minute Tail Between Updates
Z.ai’s slime framework provided the training foundation, while Modal’s Stitch separated rollout workers from the trainer so each pool could be scheduled independently. Datacurve limited rollout staleness to one update because trajectories generated from older weights increasingly diverge from the policy being optimized.
Serializing generation and training preserved that limit while leaving GPUs idle during the rollout tail. The slowest group generated 99% of its tokens within two hours, then needed another 51 minutes to finish; throughput fell to 25 tokens per second and GPU utilization reached 1.8%. Keeping each episode within its original rollout step avoided additional staleness. As inference workers became free, the scheduler let them begin the next batch while stragglers completed the current one. The overlap removed about 50 minutes from each step and nearly halved the delay between batches.
Atomic Adds Moved the Policy
A deterministic forward implementation should produce identical outputs when weights, tokens, and execution choices remain fixed. Datacurve’s repeated passes did not. At 200,000 tokens, the probability assigned to each recorded token changed by an average of 12% between runs. Pinning expert-routing and sparse-attention selections barely reduced the discrepancy.
Megatron’s mixture-of-experts combine operation used BF16 atomic additions to merge routed expert outputs. GPU scheduling changed the order of those additions, and floating-point addition is order-dependent. About 6% of the combine output values changed across otherwise identical calls. Datacurve stabilized the operation by sorting expert outputs, accumulating them in FP32, rounding the result to BF16, and replacing backward-pass atomic additions with gathers. Repeated forwards then matched bit for bit, with a 0.6% increase in forward-pass time.
BF16 Erased the Adapter Update
Serving unmerged LoRA adapters nearly doubled rollout time in Datacurve’s 30-billion-parameter experiments, so the team merged adapters into the base weights at each synchronization point. The average LoRA increment was 40 times smaller than the gap between adjacent BF16 values at the corresponding base weight. As a result, about 78% of adapter updates left the served weight unchanged. A scalar example shows the quantization:
>>> torch.tensor(1.0, dtype=torch.bfloat16) + 1e-3
tensor(1., dtype=torch.bfloat16)
>>> torch.tensor(1.0, dtype=torch.float16) + 1e-3
tensor(1.0010, dtype=torch.float16)
FP16’s three additional mantissa bits make adjacent values eight times closer near the same exponent, preserving the small merged updates. Its narrower exponent range later allowed activation gradients to underflow during backpropagation.
A Fixed Buffer Chose the Wrong History
SGLang’s fast top-k selector ranks compressed history blocks for sparse attention. At 200,000 tokens, the history expanded to as many as 65,000 blocks, exceeding an internal size assumption. The kernel silently discarded candidates and returned incorrect blocks. Datacurve replaced it with a bufferless, GPU-only masked top-k implementation. At a batch size of eight, the corrected kernel decoded 275 tokens per second, compared with 50 tokens per second for the exact eager implementation.
A Gradient Identity Exposed Underflow
Full-scale runs still suffered policy-entropy collapse over roughly 12 updates after forward passes became repeatable and training and serving probabilities aligned. Datacurve isolated the backward pass with a linearity test derived from the policy-gradient estimator.
Because the estimator is linear in per-trajectory advantages, four disjoint advantage masks that reconstruct the original batch should satisfy g(A) = g(A1) + g(A2) + g(A3) + g(A4) within numerical tolerance. The trainer’s summed partial gradients differed from the full gradient by about 50% on long-horizon batches, revealing an implementation-level numerical error.
Token-count normalization divided the loss before backpropagation, making each token’s contribution extremely small across large batches. Many activation gradients then fell below FP16’s representable range. Long-horizon gradients differed from higher-precision references by 36%, compared with about 10% on the shorter SWE-Gym control workload.
Residual-stream gradients also grew by roughly two orders of magnitude from the final layer to the first, leaving a single global loss scale unable to cover the full range. Datacurve combined a larger loss scale with selective FP32 recomputation and per-layer gradient scaling. The four-mask error fell from 50% to 0.4%.
Learning Followed Existing Strengths
On tasks from unseen repositories, pass@1 increased from 34% to 42% over 27 training steps, a reported gain of 8.1 percentage points. Improvement varied with the base model’s initial success rate. Tasks with a 47% baseline gained 11.8 percentage points, while tasks with an 18% baseline gained 3.4 points.
The uneven gains match evidence from DeepSeekMath and subsequent work: reinforcement learning tends to strengthen behaviors that the base policy can already produce occasionally. Groups need some successful trajectories to create a useful reward difference, so tasks with near-zero baseline success provide little GRPO signal.
During training, models also learned to keep episodes within the context window and to avoid malformed tool calls. End-to-end pass rates therefore combine execution discipline with gains in problem solving. Evaluations should report context overflows, tool-call validity, and solution accuracy separately to identify which behavior changed.
A Preflight for 256K-Token RL
- Replay at target length: Run identical weights and tokens several times, then compare logits or token probabilities bitwise while isolating routing, attention, and expert-combine operations.
- Audit adapter synchronization: Measure each update against the spacing of the destination format and count how many served weights remain unchanged after merging.
- Cross-check sparse kernels: Compare selected blocks with an exact reference at the maximum expected block count, and fail explicitly when internal capacity limits are exceeded.
- Test gradient additivity: Split advantages into disjoint masks, sum the partial gradients, and report their deviation from the full-batch gradient.
- Inspect per-layer ranges: Measure activation gradients after production token normalization, then choose loss scales and FP32 recomputation points from those ranges.
- Track rollout tails: Record median and tail completion times, decode throughput, GPU utilization, and policy staleness before adding asynchronous work.
- Decompose reward gains: Separate context management, tool-call validity, and task completion across buckets of baseline difficulty.
At 256,000 tokens, errors crossed component boundaries: a serving optimization erased updates, a fast attention kernel changed model inputs, and loss normalization distorted backpropagation. Component benchmarks missed failures that appeared only at production sequence lengths, batch sizes, and synchronization paths. End-to-end validation must reproduce those conditions before a training run can support conclusions about the policy or environment.