mixle.models.optimizer_routing module¶
Stable, executable per-parameter optimizer routing for Torch modules.
The statistical runtime can describe richer update contracts, but stable model code cannot depend on
mixle.experimental. This module is the small common execution layer: it accepts either its own
shape/name-derived plan or the experimental runtime’s structurally compatible plan and executes the
selected update for each parameter. AdamW is available as an explicit route, not the automatic
default.
- class NeuralOptimizerPlan(routes, sign_stable=None)[source]
Bases:
objectInspectable non-Adam-first routes for a Torch module.
- class NeuralOptimizerRoute(name, family, reason, shape)[source]
Bases:
objectOne named parameter’s executable update family and selection reason.
- class RoutedNeuralOptimizer(groups, defaults, plan, *, precondition_frequency, muon_backend, muon_steps, fisher_provider, projection_provider)[source]
Bases:
objectCheckpointable mixed-family optimizer with one validated route per trainable parameter.
- build_auto_optimizer(module, *, lr=1.0e-3, sign_stable=True, **kwargs)[source]
Plan and build the default non-Adam-first optimizer for
module.
- build_routed_optimizer(module, plan, *, lr=1.0e-3, betas=(0.9, 0.999), eps=1.0e-8, weight_decay=0.0, precondition_frequency=10, muon_backend='newton_schulz', muon_steps=7, fisher_provider=None, projection_provider=None)[source]
Build a Torch optimizer from stable or experimental structurally compatible routes.
- plan_neural_optimizer(module, *, matrix_min_elements=4_096, sign_stable=True)[source]
Plan update families from parameter role and shape without importing Torch at module import time.
- resolve_neural_optimizer(module, optimizer=None, *, lr=1.0e-3, sign_stable=True)[source]
Resolve automatic, named, planned, or callable neural optimizers with an audit receipt.
- shard_safe_neural_optimizer_plan(plan)[source]
Localize routes whose geometry is not invariant under parameter sharding.
Muon/Kronecker/natural-gradient directions require a global matrix. Applying them independently to rectangular shards is a different algorithm. Until a backend declares and executes the required gather/factor reductions, use momentum for those blocks and record the reason in the plan.
- Parameters:
plan (NeuralOptimizerPlan)
- Return type:
NeuralOptimizerPlan