[Qwen3.5] Make linear attention INT8 quantization opt-in via extra_options - #2094
[Qwen3.5] Make linear attention INT8 quantization opt-in via extra_options#2094Jianhui Dai (daijh) wants to merge 2 commits into
Conversation
Change Qwen3.5 mixed-precision quantization for linear attention layers from always-on to opt-in. Users can enable INT8 promotion of linear attention nodes by passing linear_attention_int8=true in extra_options.
There was a problem hiding this comment.
Pull request overview
This PR makes Qwen3.5’s mixed-precision quantization behavior for linear-attention layers opt-in, so INT8 promotion for selected MatMul weights is only applied when users request it via extra_options.
Changes:
- Gates the linear-attention INT8 weight promotion behind
extra_options["linear_attention_int8"]. - Updates the inline comment to describe the feature as optional and explain the rationale.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Fix #2095 |
| else: | ||
| algo_config = RTNWeightOnlyQuantConfig(customized_weight_config=int8_nodes) | ||
| self.quant_attrs["int4"]["algo_config"] = algo_config | ||
| linear_attention_int8 = extra_options.get("linear_attention_int8", False) |
There was a problem hiding this comment.
Add linear_attention_int8 to the bools list in check_extra_options in builder.py, then just simplify this to
if extra_options.get("linear_attention_int8", False)
|
Since this is just affecting the MatMuls, can we instead introduce a new int4 algo config or use an existing one? In the future, there could be another op instead of linear attention and we wouldn't want to change the extra options for that new op then. The algo config change would be a more generic solution. onnxruntime-genai/src/python/py/models/builder.py Lines 403 to 410 in 2a2ef8c |
Thank you. I’m going to close this PR for now, as PR #2100 has been created as a draft for this purpose. |
Change Qwen3.5 mixed-precision quantization for linear attention layers from always-on to opt-in. Users can enable INT8 promotion of linear attention nodes by passing linear_attention_int8=true in extra_options.