Skip to content

[lut-b] data-free round-to-nearest example - #3018

Draft
brian-dellabetta wants to merge 1 commit into
mainfrom
bdellabe/lutb-example
Draft

[lut-b] data-free round-to-nearest example#3018
brian-dellabetta wants to merge 1 commit into
mainfrom
bdellabe/lutb-example

Conversation

@brian-dellabetta

@brian-dellabetta brian-dellabetta commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Prerequisite

SUMMARY:
Adds an example for pure round-to-nearest quantization using the LUT-B compressor and QDQ pathway, targeting only MLP layers at the moment.

TODOs:

  • currently disconnected to observers

TEST PLAN:

  • safetensors file looks correct -- weight_packed and weight_codebook tensors for targeted layers
    output of example:
  • reasonable output
    • both in example before save call
    • and after loading up in transformers in a fresh session

<|begin_of_text|>Hello my name is, and I am a
I am a 31-year-old male from the city of New York. I am a software engineer by trade, but I am also a passionate musician and music producer. I am a bit of a perfectionist and I am always striving to improve my skills and knowledge.
I am a bit of a introvert and I prefer to spend my free time alone or with close friends and family. I am also a bit of a homebody and I prefer to stay close to

Signed-off-by: Brian Dellabetta <bdellabe@redhat.com>
@coderabbitai

coderabbitai Bot commented Aug 11, 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: 0536b83d-643c-40d4-8512-88b87aa6bcd1

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.

@github-actions

Copy link
Copy Markdown

👋 Hi! Thank you for contributing to llm-compressor. Please add the ready label when the PR is ready for review.

Note: This is required to complete the testing suite, please only add the label once the PR is code complete and local testing has been performed.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a new example script demonstrating LUTB quantization on Llama 3 and updates the observer initialization logic in calibration.py to prevent errors when observer is None. The review feedback recommends saving the model before dispatching it in the example script to avoid saving incomplete weights, and suggests refining the dynamic quantization check in calibration.py to correctly handle DynamicType.LOCAL and avoid potential AttributeError exceptions.

)

if args is not None and args.dynamic is not True:
if args is not None and args.dynamic is not True and observer is not None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The check args.dynamic is not True does not account for other dynamic quantization types such as DynamicType.LOCAL (which is checked on line 149). If args.dynamic is DynamicType.LOCAL, this check evaluates to True, which incorrectly initializes a static observer for dynamic quantization.

Additionally, note that if args can be None (as implied by the args is not None check), the function would have already raised an AttributeError on line 62 (observer = args.observer) and line 65 (args.observer). It is highly recommended to add an early return if args is None: at the beginning of the function to prevent this potential crash.

Suggested change
if args is not None and args.dynamic is not True and observer is not None:
if args is not None and args.dynamic not in (True, DynamicType.LOCAL) and observer is not None:

Comment thread examples/quantization_lutb/llama3_example.py
@brian-dellabetta

Copy link
Copy Markdown
Collaborator Author

related -- vllm-project/vllm#51880

@mergify

mergify Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

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
  • approved-reviews-by=yiliu30
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
    • approved-reviews-by=yiliu30
  • #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