[QwixGptqEinsum] Add einsum to GptqCalibrationProvider and support attention layer weight GPTQ.#201
Merged
copybara-service[bot] merged 1 commit intomainfrom Jan 29, 2026
Merged
Conversation
3d4772c to
935e58f
Compare
…t attention layer weight GPTQ. The new einsum method intercepts `jax.numpy.einsum` ops, which are usually used in the attention layer(whereas the `jax.lax.dot_general` ops are usually used in the dense layer). This allows Qwix users to apply GPTQ to attention layer weights in addition to dense layer weights. When GPTQ is enabled for the current operation and there are exactly two operands, it injects the GPTQ interceptor's dot_general method as the _dot_general argument to jax.numpy.einsum. This ensures that the underlying dot products within the einsum are processed by the GPTQ-aware dot_general. This change improves the robustness of `GptqCalibrationProvider` by returning the original unquantized result instead of raising errors when encountering unsupported dimension configurations or operations without identifiable model parameters. This allows calibration to proceed successfully on models with a mix of supported and unsupported layers. PiperOrigin-RevId: 862474667
935e58f to
da6d5c9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[QwixGptqEinsum] Add
einsumtoGptqCalibrationProviderand support attention layer weight GPTQ.The new einsum method intercepts
jax.numpy.einsumops, which are usually used in the attention layer(whereas thejax.lax.dot_generalops are usually used in the dense layer). This allows Qwix users to apply GPTQ to attention layer weights in addition to dense layer weights.When GPTQ is enabled for the current operation and there are exactly two operands, it injects the GPTQ interceptor's dot_general method as the _dot_general argument to jax.numpy.einsum. This ensures that the underlying dot products within the einsum are processed by the GPTQ-aware dot_general.
This change improves the robustness of
GptqCalibrationProviderby returning the original unquantized result instead of raising errors when encountering unsupported dimension configurations or operations without identifiable model parameters. This allows calibration to proceed successfully on models with a mix of supported and unsupported layers.