Skip to content

Support per-layer MTP configuration - #48264

Open
eladsegal wants to merge 5 commits into
huggingface:mainfrom
eladsegal:per-layer-config-mtp
Open

Support per-layer MTP configuration#48264
eladsegal wants to merge 5 commits into
huggingface:mainfrom
eladsegal:per-layer-config-mtp

Conversation

@eladsegal

@eladsegal eladsegal commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

CPU CI GPU run-slow

What does this PR do?

Adds independent per-layer configuration for MTP layers.

Previously, get_mtp_config() retained the main model's per_layer_config. This could apply the main-model overrides to MTP layers unintentionally.

With this PR, MTP layers discard the main model's per-layer overrides by default and can define their own through mtp_per_layer_config. MTP masks are created from the corresponding layer config, preserving per-layer settings such as sliding_window.

This also fixes MTP attention-mask selection for Inkling. Previously, mask creation looked for layer_type on the generic MtpLayer wrapper, which does not define it, and therefore always fell back to full attention. As a result, Inkling did not use the correct masks for its hybrid and hybrid_sliding MTP layers. Mask creation now selects the pattern from layer_types in the MTP config.

Who can review?

@ArthurZucker
@Cyrilvallez

@github-actions

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 33315068459:2
Result: success | Jobs: 16 | Tests: 169,679 | Failures: 0 | Duration: 15h 1m

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.

1 participant