Repository navigation
feat: support hy4 nvfp4 rtn - #389
Merged
Merged
Conversation
yghstill
approved these changes
Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a unified, two-stage quantization pipeline for the Hy4 model, enabling both vLLM activation calibration and mixed-precision weight quantization using a single YAML configuration. The changes include a new one-click shell script, detailed documentation, and robust support for MTP (Multi-Token Prediction) calibration, along with key refactors and improvements to the calibration Python script. The most important changes are summarized below:
Pipeline & Configuration Unification:
Added a comprehensive YAML template (
Hy4_template.yaml) that drives both the vLLM activation calibration and the mixed-precision NVFP4/FP8 quantization stages, ensuring consistent configuration and path management across both steps.Introduced the
run_hy4_nvfp4_quant.shscript, which orchestrates both pipeline stages, handles CLI overrides, environment setup, and logging, and allows users to skip individual stages as needed.Documentation:
scripts/ptq/README.mdwith a new section detailing the Hy4 pipeline, including prerequisites (vLLM patching, Ray cluster setup), environment variables, YAML/CLI integration, and troubleshooting for MTP calibration.MTP Calibration Improvements:
Added the
--mtp-calib-max-tokensargument totools/run_vllm_calibrate.pyand the YAML template, allowing users to specify a generation length for proper MTP calibration. This ensures the draft model is exercised and valid MTP statistics are collected for NVFP4 quantization. [1] [2] [3]Enhanced logic in
run_vllm_calibrate.pyto warn users if MTP calibration would be ineffective (i.e.,max_tokens=1), and to use the correct token count for MTP runs.Refactoring & Robustness:
Refactored
tools/run_vllm_calibrate.pyto import worker helpers (for activation hooks, stats printing, etc.) in a way that is robust to both patched and unpatched vLLM installations, ensuring compatibility in distributed Ray environments. [1] [2]Replaced lambda-based Ray worker invocations with explicit, importable functions (using
functools.partial), improving serialization safety and maintainability. [1] [2] [3]These changes collectively provide a robust, user-friendly, and maintainable workflow for Hy4 quantization, with special attention to MTP calibration correctness and multi-node distributed execution.
References: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]