-
Notifications
You must be signed in to change notification settings - Fork 120
FourOverSix #776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
FourOverSix #776
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -224,6 +224,17 @@ class QuantizationArgs(BaseModel, use_enum_values=True): | |
| "Observers constructor excluding quantization range or symmetry" | ||
| ), | ||
| ) | ||
| four_over_six: bool = Field( | ||
| default=False, | ||
| exclude=True, | ||
| description=( | ||
| "Enable Four Over Six (4/6) adaptive block scaling for NVFP4 " | ||
| "quantization. For each group of values, tries scaling to both 4 " | ||
| "and 6, selecting the scale with lower MSE. Reduces quantization " | ||
| "error for near-maximal values in FP4. Only applies to FP4 " | ||
| "quantization (num_bits=4, type=float)." | ||
| ), | ||
| ) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check whether four_over_six is expected to survive serialization and be consumed at runtime for activations
rg -nP 'exclude=True' src/compressed_tensors/quantization/quant_args.py -C1
rg -nP 'four_over_six' -C2 src/
# How dynamic/LOCAL activations flow into the forward quantize-dequantize path
rg -nP '_quantize_dequantize|forward_quantize|maybe_calibrate_or_quantize' src/compressed_tensors/quantization/lifecycle -C2Repository: vllm-project/compressed-tensors Length of output: 11776 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Inspect how QuantizationArgs are serialized and reloaded
ast-grep outline src/compressed_tensors/quantization/quant_args.py --view expanded || true
rg -n "model_dump|dict\(|json|serialize|deserialize|exclude=.*four_over_six|exclude=True" src/compressed_tensors -C 2
# Inspect the quantization config / scheme load-save path
rg -n "QuantizationArgs|QuantizationScheme|quant_scheme|from_dict|to_dict|from_json|save.*quant|load.*quant|model_validate" src/compressed_tensors -C 2
# Inspect how forward quantization consumes the flag for activations
sed -n '1,260p' src/compressed_tensors/quantization/lifecycle/forward_helpers.pyRepository: vllm-project/compressed-tensors Length of output: 50390 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Read the relevant serialization and runtime paths with line numbers
sed -n '180,260p' src/compressed_tensors/quantization/quant_args.py
sed -n '150,240p' src/compressed_tensors/quantization/quant_config.py
sed -n '1,170p' src/compressed_tensors/quantization/lifecycle/forward_helpers.py
sed -n '240,330p' src/compressed_tensors/quantization/lifecycle/forward.py
sed -n '190,240p' src/compressed_tensors/compressors/model_compressors/model_compressor.pyRepository: vllm-project/compressed-tensors Length of output: 17632 Persist
🤖 Prompt for AI Agents |
||
|
|
||
| @field_serializer("zp_dtype") | ||
| def serialize_dtype(self, dtype: torch.dtype): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: vllm-project/compressed-tensors
Length of output: 3541
🏁 Script executed:
Repository: vllm-project/compressed-tensors
Length of output: 11525
🏁 Script executed:
Repository: vllm-project/compressed-tensors
Length of output: 50387
🏁 Script executed (no clone):
Length of output: 247
Reduce the MSE over the group axis here
_process_group()passesxandscale.unsqueeze(-1)at the same rank, sogroup_dimsis empty in this helper.mean(dim=())collapses each candidate to a single scalar, andtorch.wherethen applies one branch to the entire tensor instead of one decision per group. Use the actual group dimension afterunflatten().🤖 Prompt for AI Agents