Skip to content

[Bugfix] Improve pipeline inference#2131

Open
kylesayrs wants to merge 3 commits intomainfrom
kylesayrs/update-registry-infer
Open

[Bugfix] Improve pipeline inference#2131
kylesayrs wants to merge 3 commits intomainfrom
kylesayrs/update-registry-infer

Conversation

@kylesayrs
Copy link
Collaborator

Purpose

  • Automatically infer "data_free" pipeline for recipes containing transform modifiers

Changes

  • Remove hardcoding around number of modifiers: Only use sequential pipeline if any of the modifiers require data

Testing

  • Added tests

Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
@github-actions
Copy link

👋 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
Contributor

Summary of Changes

Hello @kylesayrs, 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 core logic responsible for automatically determining the appropriate execution pipeline (either sequential, which typically requires data, or data-free) based on the set of applied model optimization modifiers. The goal is to make the pipeline selection more intelligent and adaptable, moving beyond simple, hardcoded checks to support more complex and varied optimization recipes. This ensures that the system correctly identifies when calibration data is needed for a given set of modifiers, improving the reliability and flexibility of the compression framework.

Highlights

  • Improved Pipeline Inference: The logic for inferring the correct pipeline type (sequential or data-free) in CalibrationPipeline has been significantly enhanced to handle multiple modifier types more robustly.
  • Flexible Modifier Handling: The previous hardcoded check for a single QuantizationModifier has been replaced with a more general approach that evaluates all active modifiers to determine if a sequential (data-requiring) pipeline is necessary.
  • Expanded Modifier Support: The inference now explicitly considers SmoothQuantModifier and SparsityModifierBase when deciding the pipeline type, ensuring these modifiers correctly trigger a sequential pipeline.
  • Comprehensive Testing: A new, parameterized test file has been added to thoroughly validate the pipeline inference logic across a wide range of modifier types and combinations, including various quantization, pruning, and transform modifiers.
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.

Copy link
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 refactors the pipeline inference logic to be more generic, which is a great improvement. It correctly infers data-free pipelines for transform modifiers. However, the implementation has a few critical flaws that lead to incorrect pipeline selection for quantization-related modifiers. The logic for QuantizationModifier appears to be inverted, and other modifiers like GPTQModifier and AWQModifier are not handled, causing them to be incorrectly classified as data-free. I've provided a detailed comment with a suggested fix to address these issues. The new tests are comprehensive and will be very helpful once the implementation is corrected.

Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
@kylesayrs kylesayrs marked this pull request as ready for review December 15, 2025 19:49
@kylesayrs kylesayrs added the ready When a PR is ready for review label Dec 15, 2025
Copy link
Collaborator

@brian-dellabetta brian-dellabetta left a comment

Choose a reason for hiding this comment

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

good stuff!

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

Labels

ready When a PR is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments