Repository navigation
NVFP4-CSF: expand the next layer's scales during its attention - #978
Conversation
Layers of an NVFP4-CSF model share one scale scratch, and every eager prefill call expanded its experts' scales into it serially before its MoE (4% of a GLM-5.3 glm53-tp2 A4 prefill, with nothing overlapping). After a layer's MoE the method now expands the following layer's scales on a side stream, ordered after that MoE, and the following layer waits for it and binds with scales_expanded=True (b12x expand_scales). Only eager steps that expand - A4 prefill rows or A16 calls above the stage-read limit - prefetch; CUDA graph capture, decode-only steps and other forward passes are untouched, and any pending expansion is waited for before the scratch is used. VLLM_B12X_CSF_SCALE_PREFETCH=0 turns it off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
TP4 check (glm53-flash profile, stored QAD CSF checkpoint, A16 prefill as in the profile default, four RTX PRO 6000 Max-Q, two runs each): 8K/32K prefill 11,335/11,969 and 11,233/11,881 tok/s with |
Layers of an NVFP4-CSF model share one scale scratch. Every eager prefill call expanded its experts' scales into it serially, right before its MoE. In a GLM-5.3-Flash
glm53-tp2A4 prefill trace this took 4.1% of the GPU time, with nothing overlapping it.After a layer's MoE,
Nvfp4CsfMoEMethodnow expands the following layer's scales on a side stream, ordered after that MoE. The following layer waits for it and binds withscales_expanded=True(b12xexpand_scales, local-inference-lab/b12x#477). The expansion therefore overlaps the following layer's attention instead of delaying its MoE. Scope and safety:VLLM_B12X_CSF_SCALE_PREFETCH=0turns it off. It applies to W4A16 NVFP4-CSF layers (GLM-5.3-Flash).Evidence
glm53-tp2(stored QAD CSF checkpoint, TP2/DCP2 MTP3, DMA all-reduce) on two RTX PRO 6000 Max-Q, prefetch off vs on (two runs each):Decode is unchanged (C1/C8 171/542 → 177/518 with A4 and 169/526 → 171/540 with A16, within acceptance noise). Needle-checksum with the prefetch, 3 salted runs each: A4 495, 490, 492 (492, 492, 490 before); A16 498, 495, 497.
Tests
tests/quantization/test_nvfp4_csf.py,tests/kernels/moe/test_b12x_a4_prefill.py: 25 passed (beta image with this branch overlaid, one RTX PRO 6000). Newtest_scale_prefetch_expands_the_next_layer_for_this_forward_only, with real CUDA streams, checks that:ruff check/ruff format --check: clean. No other PR changes this path. AI assistance (Claude) was used; the change was reviewed and tested as described.🤖 Generated with Claude Code