Skip to content

Fix gradients through Mistral4 and MiniMax indices - #1930

Merged
michalk8 merged 2 commits into
ml-explore:mainfrom
enoquefcd:fix/mistral4-minimax-routing-gradients
Sep 30, 2026
Merged

michalk8 merged 2 commits into
ml-explore:mainfrom
enoquefcd:fix/mistral4-minimax-routing-gradients

Conversation

@enoquefcd

Copy link
Copy Markdown
Contributor

Summary

The missing stop_gradient fixed in mlx-lm#1856 also affects Mistral4 and MiniMax M3, which were added afterward in mlx-lm#1012 and mlx-lm#1398, respectively.

This adds it to:

  • Mistral4 expert routing
  • MiniMax M3 expert routing
  • MiniMax M3 sparse-attention block selection

The sparse-attention case follows the existing fix in mlx-lm#1452.

Tests

Tests cover both Mistral4 routing branches and a small MiniMax M3 decoder layer with MoE routing and sparse attention.

AI usage disclosure

Claude helped analyse the issue.

Codex helped with the implementation and tests.

@michalk8
michalk8 self-requested a review September 30, 2026 08:07

@michalk8 michalk8 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.

LGTM, thanks!

@michalk8
michalk8 merged commit a9bd8af into ml-explore:main Sep 30, 2026
2 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.

2 participants