Skip to content

feat: extend moe model check to multimodal ones and add block quantization parameters - #605

Merged
llcnt merged 11 commits into
mainfrom
feat/make_qwen3_5_kernel_tunable
Apr 22, 2026
Merged

feat: extend moe model check to multimodal ones and add block quantization parameters#605
llcnt merged 11 commits into
mainfrom
feat/make_qwen3_5_kernel_tunable

Conversation

@llcnt

@llcnt llcnt commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

Description

Just extend the model check, and the logic inside the moe_kernel_tuner.py, so that one can tune multimodel MoE (eg. model that contains a vision tower and a text model nested, as qwen3.5-32b).
And make the block quant shape (ie the size of the block on which the scales are computed for re-normalization before quantization) usable from the user.

Related Issue

Fixes #(issue number)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactor (no functional change)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Testing

  • I added or updated tests covering my changes
  • Existing tests pass locally (uv run pytest -m "cpu and not slow")

For full setup and testing instructions, see the Contributing Guide.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code, especially for agent-assisted changes
  • I updated the documentation where necessary

@codacy-production

codacy-production Bot commented Mar 31, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 11 complexity · 0 duplication

Metric Results
Complexity 11
Duplication 0

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@llcnt llcnt changed the title feat: extend moe model check to multimodal ones feat: extend moe model check to multimodal ones and add block quantization parameters Apr 1, 2026
@llcnt
llcnt marked this pull request as ready for review April 1, 2026 12:10
@llcnt
llcnt requested review from gsprochette and sharpenb April 1, 2026 12:10

@gsprochette gsprochette left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Cool PR, there a missing behavior when setting one block_quant_shape and not the other, after this and a quick documentation it will be ready to merge :)

Comment thread src/pruna/algorithms/moe_kernel_tuner.py Outdated
Comment thread src/pruna/algorithms/moe_kernel_tuner.py Outdated
Comment thread src/pruna/algorithms/moe_kernel_tuner.py
Comment thread src/pruna/algorithms/moe_kernel_tuner.py Outdated
@llcnt
llcnt requested a review from gsprochette April 10, 2026 09:30

@sharpenb sharpenb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! It looks good. Left a comment to clarify the docs and it is clear for people what to expect :)

Comment thread src/pruna/algorithms/moe_kernel_tuner.py Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 06b5a61. Configure here.

Comment thread src/pruna/engine/model_checks.py

@gsprochette gsprochette left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks a lot about the updates in moe_kernel_tuner, much clearer. I think there's a problem in reduce_noe that was introduced so I'll let you address it before I can approve

config_json[target_name] = smash_config["num_experts_per_token"]
text_config_json[target_name] = smash_config["num_experts_per_token"]
with config_path.open("w", encoding="utf-8") as f:
json.dump(config_json, f, indent=2)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should this be text_config_json instead? I think text_config_json is not being used at all here, have you tested it?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

my bad

@gsprochette
gsprochette self-requested a review April 20, 2026 16:26

@gsprochette gsprochette left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

All good on my side ! Thanks a lot for the clarifications :)

@llcnt
llcnt merged commit 5476674 into main Apr 22, 2026
8 checks passed
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.

3 participants