Skip to content

fix: raise on non-finite qparams during pack-quantized compression - #854

Open
rishabhsinha17 wants to merge 1 commit into
vllm-project:mainfrom
rishabhsinha17:fix/fail-loud-nonfinite-scales
Open

fix: raise on non-finite qparams during pack-quantized compression#854
rishabhsinha17 wants to merge 1 commit into
vllm-project:mainfrom
rishabhsinha17:fix/fail-loud-nonfinite-scales

Conversation

@rishabhsinha17

Copy link
Copy Markdown
Contributor

Summary

Hardening for #832. initialize_qparams registers scales with torch.empty and nothing zero-fills them, so a module that is targeted for quantization but never written by calibration carries uninitialized memory in weight_scale. Compression currently quantizes and packs with those scales without complaint, and the result is hard to spot after the fact: measured on 0.18.0 (CPU), every NaN-scale element quantizes to 0 and packs to the constant word 0x88888888, while whole-tensor stats of weight_packed still look well distributed. Details and isolation matrix in this comment.

This makes pack-quantized compression fail loudly at compress time instead of serializing garbage.

Changes

  • PackedQuantizationCompressor.compress validates weight_scale (and weight_zero_point when floating point) before quantizing and raises ValueError with the non-finite count. The check sits after the meta-device early return, so the distributed meta pass is unaffected.
  • ModelCompressor.compress_model keeps module names when collecting modules and wraps per-module ValueError with the module path, so the error names the offending module.
  • Test: non-finite scale on a tiny pack-quantized model raises with module name and count; existing tests cover the finite path unchanged.

Validation

CPU, torch 2.13.0, Python 3.11:

$ pytest tests/test_compressors/test_pack_quant.py tests/test_compressors/model_compressors/test_model_compressor.py -q
150 passed, 2 skipped, 1 warning in 0.98s

Full tests/test_compressors/ failure set is identical to main on this machine (75 pre-existing environment-specific failures, all CUDA/MPS related, zero introduced). make quality passes.

Uncalibrated modules keep their torch.empty initialized scales; compressing
them serializes garbage silently. Validate weight_scale and any float
weight_zero_point before packing and raise a ValueError naming the module
and tensor with non-finite counts.

Related: vllm-project#832
Signed-off-by: Rishabh Sinha <rsinha17@terpmail.umd.edu>
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 775ea2b0-eb71-432f-be1d-0bc178f478c9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mergify

mergify Bot commented Aug 25, 2026

Copy link
Copy Markdown

Merge Protections

🔴 1 of 1 protections blocking · waiting on 👀 reviews

Protection Waiting on
🔴 Require one maintainer review 👀 reviews

🔴 Require one maintainer review

Waiting for any of

  • approved-reviews-by=HDCharles
  • approved-reviews-by=brian-dellabetta
  • approved-reviews-by=dsikka
  • approved-reviews-by=kylesayrs
This rule is failing.

All PRs must have at least one approving review from a maintainer before merging.

  • any of:
    • approved-reviews-by=HDCharles
    • approved-reviews-by=brian-dellabetta
    • approved-reviews-by=dsikka
    • approved-reviews-by=kylesayrs
  • #changes-requested-reviews-by = 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant