Skip to content

Preserve convolution shapes and scaling in Muon updates - #8552

Open
vineethsaivs wants to merge 1 commit into
deepspeedai:masterfrom
vineethsaivs:fix-muon-convolution-shape-20260916
Open

vineethsaivs wants to merge 1 commit into
deepspeedai:masterfrom
vineethsaivs:fix-muon-convolution-shape-20260916

Conversation

@vineethsaivs

Copy link
Copy Markdown
Contributor

Muon crashes when updating convolution weights with four-dimensional gradients.

The overflow guard combines a flattened update with the original four-dimensional gradient. The aspect-ratio correction also reads the kernel dimensions instead of the flattened matrix. Restore the original shape before the overflow guard and derive the scale from the matrix being orthogonalized.

Test: TORCHDYNAMO_DISABLE=1 DS_ACCELERATOR=cpu PYTHONPATH=. python -m pytest tests/unit/v1/ops/muon/test_muon_overflow.py -k 'convolution or overflowed_gradient or finite_gradient' -q. Four convolution regressions fail before. Six CPU tests pass after, including two Conv2d training steps with both Newton-Schulz methods and overflow checks. Changed-file pre-commit passes. Executed on Apple M2 Pro CPU; no CUDA or distributed training run.

Restore the original shape before the overflow guard and derive the scale from the matrix being orthogonalized.

Signed-off-by: Vineeth Sai <vineethsai4444@gmail.com>
@vineethsaivs

Copy link
Copy Markdown
Contributor Author

Could you approve the CI run? The six CPU tests and changed-file pre-commit checks pass.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this a good place for the new test?

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