Repository navigation
Description
What
pamica/mlx_impl/core.py implements neither convergence stop. Verified by
grep — zero references to any of:
min_dll, use_min_dll, maxincs, min_nd, use_grad_norm, ndtmpsum
Its only stop_reason values are max_iter (:570), lrate_floor (:659) and the
degenerate ones (nan_ll/singular_ll :590, nan_params :634). So an MLX fit
runs the full iteration budget unless the learning rate floors or the fit
degenerates.
The other backends stop on likelihood stagnation (min_dll, on by default at
1e-9) long before max_iter on real data — measured at iteration 326-1076 on
the bundled sample depending on the BLAS build. The same nominal configuration
therefore does materially different work on MLX than on PyTorch/NumPy/Fortran.
Why it matters
Unsupported parameters fail loudly today — the constructor rejects unknown
kwargs with TypeError, and do_newton=True/non-GG pdftype raise
NotImplementedError. But this gap is silent: nothing signals that the fit
had no convergence criterion. A user moving a working config from the PyTorch
backend to MLX for the documented Apple-GPU speedup (~15-25 ms/it, ~7x
torch-CPU, AGENTS.md) gets a fit that quietly ignores stopping and burns the
whole budget.
It also makes MLX unable to participate in convergence-behavior claims. #218
documents that min_nd is unreachable on small recordings "in any of the three
implementations"; MLX cannot be evaluated on that axis at all, because it never
computes the gradient norm.
Scope
min_dll/use_min_dll/maxincs— the consecutive-small-gain rule
(amica15.f90:1060-1072). The likelihood is already computed per iteration, so
this is the cheap half and the one that changes real runs.min_nd/use_grad_norm— requires accumulatingndtmpsum(Fortran
amica15.f90:1731-1743). Note the gradient norm is also a useful diagnostic in
its own right (epic Epic: diagnostic outputs - parity, cost and verification (nd / LLt / MIR) #231), independent of the stop.- Decide whether
lrate_floor's missing.or. (ndtmpsum .le. min_nd)half
(thegrad_norm_floorstop) comes along with (2).
Per .rules/backend_parity.md this should land with cross-backend tests
asserting MLX stops at the same iteration as the PyTorch backend on the same
data and config, within float32 tolerance.
The divergence is documented meanwhile in docs/guides/amica-differences.md.
Activity
Record the MLX convergence-stop divergence
Record the MLX convergence-stop divergence (#249)
docs: fix Fortran citations and MLX doc gaps
Add convergence stops to the MLX backend (#255)