Repository navigation
Quantize exact GLM Spark projections and MTP experts on load - #965
Conversation
Add strict projection coverage, NVFP4 W4A16 draft quantization, bounded weight staging and model-owned FP4 scale policy. Preserve source checkpoints and record TP2 memory, decode, prefill and deterministic quality evidence. Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: Martin Vit <martin@voipmonitor.org>
|
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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 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 |
Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: Martin Vit <martin@voipmonitor.org>
Recommend a 3072-token scheduler budget for GLM-5.3-Flash online MXFP8. Record paired BF16, online MXFP8 and serialized Spark measurements, profiler call counts and MTP validation. Both MXFP8 loading paths reproduce the slowdown with a 1024-token budget; no encoder or B12X runtime change is required. Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: Martin Vit <martin@voipmonitor.org>
Record byte-verified Spark compositions with QAD expert weights or activation scales, fixed-prompt TP2 comparisons, cache contracts and telemetry. Weight replacement reproduces no five-percent regression; activation-scale replacement reproduces most of the measured Spark/QAD gap. Preserve the research-only performance and unqualified hybrid-quality limits. No serving implementation or source checkpoint changes. Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: Martin Vit <martin@voipmonitor.org>
Provide a complete TP2 beta-container command, exact configuration generation and cache/MTP controls. Explain preservation of QAD expert weights and activation scales, online MXFP8 memory savings and in-memory conversion semantics. Validate shell syntax and exact parity with the qualified target configurations. Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: Martin Vit <martin@voipmonitor.org>
…e-weights Quantize exact GLM Spark projections and MTP experts on load Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GLM's NVFP4
mtp-bf16checkpoint contains BF16 attention/shared projections and BF16 MTP routed experts. This adds an opt-in loading recipe that selects exactly the 531 projections in the pinned Spark checkpoint, converts them to MXFP8, and converts only the MTP routed experts to NVFP4 W4A16. Source checkpoint files are unchanged.Strict target coverage checks the constructed model before loading. Draft quantization preserves target recurrent-state planning, loader ownership releases replaced BF16 weights before backend packing, and the NVFP4 encoder writes directly into preallocated outputs. Each MoE retains its own scale-compression policy across deferred preparation; the example inherits main-model CSF and shares its reconstruction buffers with MTP.
Compatibility
Existing target matching remains permissive unless
strict_targets=true.nvfp4_a16requires BF16 activations and a supported W4A16 backend. Existingnvfp4_per_tokenretains its SM100 restriction; its encoded values can change because the encoder now avoids an intermediate BF16/FP16 rounding. The packed format is unchanged. MXFP8 scale compression is not enabled, and no B12X source change is required.Implementation and qualification
The pinned public image is
ghcr.io/local-inference-lab/vllm@sha256:2230db60afb4fd06dc2ef2b7f7f27dc7f78d7a50be70a08461b4df9fa5e90732, with explicit frozen Python overlays, vLLM base93dabce32fd4d5355662608296e64d720711cdccand unchanged B12Xa77b3f85e5e2a81315ff4a90088912f187708005. This does not claim the unmodified image already contains the feature.Measurements
TP2, 600 W limits, FP8 KV, 3 GiB KV per rank, 16,365 MHz loaded memory clocks and dynamic graphics clocks:
The serving example recommends
--max-num-batched-tokens 3072. A 1024-token budget amplifies per-chunk work and cannot enter the existing B12X large-prefill regime, which requires at least 2048 rows. Serialized Spark reproduces the same approximately 6K tok/s slowdown at 1024 and measures 13360 tok/s at 3072. This isolates the scheduler-budget effect from online weight preparation; no encoder or B12X source change is required. The two source checkpoints have different weight values, so their remaining throughput difference is not an isolated offline-versus-online encoding comparison.Quality uses deterministic MoE reduction: same-model repeat KL is exactly zero for both models. The normal fast path has nondeterministic MoE accumulation and is used for the performance measurements. The measured KL includes the MXFP8 backend's activation arithmetic; it is against the mixed NVFP4 source checkpoint, not a fully BF16 model. MTP acceptance is 52.59%; a BF16-draft quality comparison is not claimed.
The validation report records conditions, limits, artifacts and rejected measurements. Machine-readable results include all accepted repetitions and SHA256 identities. The serving guide provides a complete command.
QAD preservation and activation
The TP2 Docker recipe loads the QAD
mtp-bf16source, preserving its main expert weights, router weights and expert-specific activation calibration. Exactly the Spark projection selection is converted to MXFP8 in memory; MTP experts become NVFP4 W4A16. It does not export another on-disk checkpoint or substitute saved Spark calibration. The guide provides the complete beta-container command, 3072-token prefill budget, fixed KV allocation, MTP controls and generated strict target configurations. Both shell levels parse successfully, and generated JSON matches the qualified recipe exactly.Controlled Spark/QAD compositions distinguish activation calibration from weight encoding. Replacing only main NVFP4 expert weights and weight scales gives a paired 32K throughput change of -0.015%. Replacing only input activation scales gives -1.191%, versus -1.599% for complete online QAD, on fixed token inputs with bracketing Spark controls. The preceding generated-prompt benchmark gives approximately -3.4% and -4.2%, respectively. Uniform Spark activation scales permit shared input quantization; QAD uses per-expert calibration and distinct legal MoE configurations. These are bounded performance measurements; hybrid model quality is unqualified. The linked report contains source identities, code contracts, raw result objects and limits.
Tests
All pre-commit hooks passed, including Ruff, mypy, Markdown and configuration checks. The final combined source check passed 29 cases; the deferred-policy reproducer fails six of eight cases before the correction and passes all eight afterwards. Four activation/encoder/kernel-reuse tests also pass. Broader overlapping checks cover 32 loader unit tests, 43 online/configuration tests and TP-consistent NVFP4 encoding.
Pytest selections executed in the pinned development environment (repository paths shown relative to the checkout):
Duplicate-work review: #964 concerns compression of existing native FP4 expert scales, and #957 concerns native MXFP8 MTP MoE weights. This PR adds BF16 online conversion, strict Spark projection coverage and the separate NVFP4 W4A16 draft recipe; it does not replace those PRs or modify the deferred MXFP8-CSF prototype.
AI assistance: implemented and tested with OpenAI Codex.