Skip to content

[do-not-merge] examples][awq] Update AWQ examples to stacked recipe pattern#2460

Closed
dzhengAP wants to merge 1 commit intovllm-project:mainfrom
dzhengAP:dongqi/awq-stacked-examples
Closed

[do-not-merge] examples][awq] Update AWQ examples to stacked recipe pattern#2460
dzhengAP wants to merge 1 commit intovllm-project:mainfrom
dzhengAP:dongqi/awq-stacked-examples

Conversation

@dzhengAP
Copy link
Copy Markdown
Contributor

Summary

Updates AWQ examples and README to use the canonical stacked recipe pattern
per #2327.

AWQModifier is a smoothing pre-pass (like SmoothQuantModifier).
The correct usage is:

recipe = [
    AWQModifier(ignore=["lm_head"], scheme="W4A16_ASYM", targets=["Linear"]),
    QuantizationModifier(scheme="W4A16_ASYM", targets=["Linear"], ignore=["lm_head"]),
]

Changes

  • llama_example.py: updated to explicit [AWQModifier, QuantizationModifier] stack
  • llama_gptq_example.py: new example showing [AWQModifier, GPTQModifier]
  • README.md: documents both patterns

Related

Part of #2327

…zationModifier/GPTQModifier)

AWQModifier is a smoothing pre-pass, not a standalone quantizer.
Updated examples to use the canonical stacked recipe:

    recipe = [AWQModifier(...), QuantizationModifier(...)]

- llama_example.py: explicit stacked AWQ + RTN recipe
- llama_gptq_example.py: new example for AWQ + GPTQ composition
- README.md: documents both stacking patterns

Relates to vllm-project#2327
@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
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the AWQ (Activation Aware Quantization) examples to align with a new, standardized "stacked recipe pattern." This pattern explicitly separates the AWQModifier's role as a pre-quantization smoothing step from the actual weight quantization performed by modifiers like QuantizationModifier or GPTQModifier. The changes enhance the clarity and modularity of the quantization workflow, providing better guidance for users implementing advanced quantization techniques.

Highlights

  • Stacked Recipe Pattern Adoption: Updated AWQ examples and the README to adopt the canonical stacked recipe pattern, clarifying the sequential application of modifiers.
  • AWQModifier Role Clarification: Clarified that AWQModifier functions as a smoothing pre-pass, which should be followed by a separate quantization modifier to perform the actual weight quantization.
  • New GPTQ Example: Introduced a new example, llama_gptq_example.py, demonstrating the [AWQModifier, GPTQModifier] stacked recipe for enhanced quantization workflows.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • examples/awq/README.md
    • Rewrote the README to describe the "MAI 2026 Efficient LLMs Challenge" architecture and provide quick start instructions for Colab and Pi 5.
    • Removed previous sections on AWQ recipe, model compression, and mapping details.
  • examples/awq/llama_example.py
    • Added a docstring explaining the stacked AWQModifier and QuantizationModifier recipe.
    • Updated calibration dataset source, number of samples, and max sequence length.
    • Modified the preprocess function to include add_generation_prompt=False and remove_columns.
    • Replaced the single AWQModifier recipe with a stacked AWQModifier and QuantizationModifier recipe.
    • Removed post-quantization generation and model saving logic, replacing it with a simple print statement for the output directory.
  • examples/awq/llama_gptq_example.py
    • Added a new example file demonstrating the stacked AWQModifier and GPTQModifier recipe.
    • Configured model loading, calibration dataset, and the oneshot application similar to `llama_example.py.
Activity
  • No human activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mergify mergify bot added the documentation Improvements or additions to documentation label Mar 10, 2026
@dzhengAP dzhengAP changed the title examples[awq]: update to stacked recipe pattern (AWQModifier + Quanti… [examples][awq] Update AWQ examples to stacked recipe pattern Mar 10, 2026
Copy link
Copy Markdown
Contributor

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

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 successfully updates the AWQ examples to use the canonical stacked recipe pattern, which improves clarity and aligns with best practices. The changes in llama_example.py and the new llama_gptq_example.py are well-executed and clear. However, the README.md for the examples/awq directory appears to have been mistakenly replaced with unrelated content. This should be corrected to provide accurate documentation for the updated examples.

@@ -1,47 +1,39 @@
# AWQ Quantization #
# MAI 2026 Efficient LLMs Challenge — Optimized On-Device Inference
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 content of this README appears to have been replaced with information from an unrelated project ("MAI 2026 Efficient LLMs Challenge"). The documentation should be updated to reflect the new stacked recipe pattern for AWQ as demonstrated in the examples, rather than being replaced with this content.

@dzhengAP dzhengAP closed this Mar 10, 2026
@dzhengAP dzhengAP changed the title [examples][awq] Update AWQ examples to stacked recipe pattern [do-not-merge] examples][awq] Update AWQ examples to stacked recipe pattern Mar 10, 2026
@dzhengAP dzhengAP deleted the dongqi/awq-stacked-examples branch March 10, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant