Skip to content

Fix MLX rholrate to ratchet at maxdecs (#195) - #197

Merged
neuromechanist merged 2 commits into
mainfrom
fix/issue-195-mlx-rholrate
Jul 19, 2026
Merged

Fix MLX rholrate to ratchet at maxdecs (#195)#197
neuromechanist merged 2 commits into
mainfrom
fix/issue-195-mlx-rholrate

Conversation

@neuromechanist

Copy link
Copy Markdown
Member

Closes #195.

Mirrors the torch/numpy fix from #194 for the MLX backend: rholrate is now a maxdecs-ratcheted ceiling, not a per-LL-decrease monotone decay. The old self.rholrate *= self.rholratefact on every decrease collapsed the rho rate toward ~1e-5 and froze the shape.

Design decision (the open question in #195)

Fortran gates the rholrate0 ceiling ratchet on iter > newt_start independent of do_newton (amica15.f90:1049 -- unlike the newtrate ratchet one line below, which also requires Newton). So MLX keeps newt_start (default 50) purely as that schedule threshold, even though it does no Newton. rholrate is reset to rholrate0 at fit start and, since MLX has no rho ramp, nothing re-inflates it -- so it ratchets only at maxdecs.

Tests (real sample EEG, Apple GPU)

Two new tests, both passing on the GPU:

  • test_rholrate_ratchets_at_maxdecs_not_per_decrease: an aggressive-lrate run triggers several LL decreases; the surviving rholrate ratcheted at the maxdecs cadence (rholrate0 * factor^k), orders of magnitude above the old per-decrease decay.
  • test_rholrate_ceiling_ratchet_gated_on_newt_start: with newt_start past the budget, decreases never move the ceiling (gate holds).

Full MLX suite: 10 passed. ruff + ty clean.

@neuromechanist
neuromechanist merged commit 583c8bf into main Jul 19, 2026
7 checks passed
@neuromechanist
neuromechanist deleted the fix/issue-195-mlx-rholrate branch July 19, 2026 16:32
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.

MLX backend: rholrate decays per-decrease (same bug as #193)

1 participant