Implement mlx.optimizers.Muon() with Newton-Schulz orthogonalization#572
Conversation
- Expose matmul operation in TypeScript layer - Implement Muon optimizer class with Newton-Schulz orthogonalization - Add comprehensive tests for Muon optimizer - Export Muon from optimizers module Co-authored-by: sydneyrenee <188732394+sydneyrenee@users.noreply.github.com>
Co-authored-by: sydneyrenee <188732394+sydneyrenee@users.noreply.github.com>
Co-authored-by: sydneyrenee <188732394+sydneyrenee@users.noreply.github.com>
|
@copilot Help me with the merge markers and merging this. |
- Resolved conflicts in README.md by including both Adagrad and Muon - Resolved conflicts in test file by including tests for both optimizers - Updated imports to include both Adagrad and Muon - index.ts automatically merged to export both optimizers Co-authored-by: sydneyrenee <188732394+sydneyrenee@users.noreply.github.com>
I've resolved all merge conflicts and successfully merged the main branch. The PR now includes both the Muon optimizer (from this PR) and the Adagrad optimizer (from main). Changes made in commit 28ba6e3:
The branch is now ready to merge into main with no conflicts. |
|
@copilot One more check - I still found merge markers. |
I've thoroughly checked the repository and found no merge conflict markers. I searched: ✅ All TypeScript and JavaScript files in node/src and node/test All files are clean with no |
Proposed changes
Implements the Muon (MomentUm Orthogonalized by Newton-schulz) optimizer for training neural networks. Muon is optimized for 2D+ weight matrices and convolutional filters, using Newton-Schulz iterations to orthogonalize momentum updates for better conditioning.
This PR also merges the main branch which includes the Adagrad optimizer, so both Adagrad and Muon are now available in the optimizers module.
Implementation
matmuloperation: Added TypeScript wrapper for existing C++ matmul implementation in core opssqrt(max(1, rows/cols))sqrt(sum(square(Y)))avoiding linalg dependencyTests
Added 10 test cases for Muon covering constructor options, state initialization, and property accessors. Tests for Adagrad optimizer (from main branch) are also included.
Usage
Checklist
pre-commit run --all-filesto format my code / installed pre-commit prior to committing changesOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.