pub struct Muon { /* private fields */ }Expand description
Muon optimizer with Nesterov momentum and rank-two NS5 orthogonalization.
Rank-two parameters use the donor Muon matrix pipeline. Other ranks use its fused momentum update; OA never silently delegates them to AdamW.
Implementations§
Source§impl Muon
impl Muon
Sourcepub fn new(
parameters: impl IntoIterator<Item = Parameter>,
learning_rate: f32,
) -> Result<Self>
pub fn new( parameters: impl IntoIterator<Item = Parameter>, learning_rate: f32, ) -> Result<Self>
Bind Muon to a nonempty FP32 parameter set using OA defaults.
§Errors
Returns an error for invalid ownership, duplicate parameters, or momentum allocation failure.
Sourcepub fn new_with_hyperparameters(
parameters: impl IntoIterator<Item = Parameter>,
learning_rate: f32,
beta: f32,
weight_decay: f32,
epsilon: f32,
ns5_iterations: u32,
) -> Result<Self>
pub fn new_with_hyperparameters( parameters: impl IntoIterator<Item = Parameter>, learning_rate: f32, beta: f32, weight_decay: f32, epsilon: f32, ns5_iterations: u32, ) -> Result<Self>
Bind Muon with explicit donor scalar policy.
Zero NS5 iterations selects the fused vector update for every parameter.
§Errors
Returns an error for invalid scalars, an empty or duplicate parameter set, non-F32 parameters, mixed-runtime ownership, or momentum allocation failure.
Sourcepub fn step(&mut self) -> Result<()>
pub fn step(&mut self) -> Result<()>
Record one Muon update for each parameter carrying a gradient.
§Errors
Returns an error when the step counter is exhausted, a parameter contract changed, or runtime recording/allocation fails.
Sourcepub const fn learning_rate(&self) -> f32
pub const fn learning_rate(&self) -> f32
Return the learning rate used by the next step.
Sourcepub fn set_learning_rate(&mut self, learning_rate: f32) -> Result<()>
pub fn set_learning_rate(&mut self, learning_rate: f32) -> Result<()>
Set the learning rate used by subsequent steps.
§Errors
Returns an error unless the value is finite and non-negative.
Sourcepub const fn step_count(&self) -> u64
pub const fn step_count(&self) -> u64
Return the number of completed logical steps.
Trait Implementations§
Source§impl Optimizer for Muon
impl Optimizer for Muon
Source§fn learning_rate(&self) -> f32
fn learning_rate(&self) -> f32
Source§fn set_learning_rate(&mut self, learning_rate: f32) -> Result<()>
fn set_learning_rate(&mut self, learning_rate: f32) -> Result<()>
Source§fn step_count(&self) -> u64
fn step_count(&self) -> u64
Source§fn belongs_to(&self, runtime: &Runtime) -> bool
fn belongs_to(&self, runtime: &Runtime) -> bool
runtime.