Skip to content

Document that min_nd is unreachable on small datasets in all three implementations #218

Closed

Description

@neuromechanist

Split out of #212, which fixed the two scale bugs that made min_dll and min_nd dead in numpy_impl. Fixing the scales does not make min_nd usable, and that is worth stating rather than leaving as a surprise.

The finding

min_nd defaults to 1e-7 in Fortran (amica15_header.f90:74) and in both Python backends. On the bundled 32-channel sample it is not reachable by any of the three.

A matched-config run of the reference binary to completion shows its own gradient norm oscillating rather than shrinking:

iter Fortran nd
1000 4.7e-5
1300 2.8e-5
1500 3.1e-5
1700 3.2e-5
2000 2.5e-5

and plateauing at 1.0-1.65e-5 out to iteration 5073 without ever stopping. The threshold sits roughly two orders of magnitude below Fortran's own floor. Both Python backends plateau about two orders higher again, which is near-fixed-point amplification: dAk tends to zero at convergence, so the norm measures a near-total cancellation and small floating-point and BLAS-order differences dominate the residual.

Why this is not a bug to fix

This is primarily a property of the data. 30504 samples is small relative to the free parameters (1024 in A alone, plus mixture parameters), so the natural-gradient residual has a finite-sample noise floor. Fortran ships the same default and has the same behaviour, so lowering or retuning the threshold would be changing a Fortran-faithful default to produce a desired outcome, which is exactly the move this project treats as illegitimate elsewhere.

Work

  • Document in docs/guides/ that use_grad_norm/min_nd is not a useful stop on small recordings, with the Fortran floor above as evidence, so users do not conclude the criterion is broken.
  • State what data size would make it meaningful, if that can be determined, or say plainly that it has not been characterized.
  • Note that min_dll is the criterion that actually fires in practice (measured at 326-1076 iterations depending on BLAS, see Add Fortran convergence criteria to AMICATorchNG #213).

Activity

  1. neuromechanist commented on Aug 22, 2026

    @neuromechanist
    MemberAuthor

    Verified on dev: docs/guides/validation.md's "Which convergence criterion actually stops a fit" section (merged in #244) documents min_nd's unreachability with a three-column Fortran/NumPy/PyTorch table plus the Fortran gradient-norm trace, and both backends' docstrings cross-reference it (torch_impl/core.py:387,392; numpy_impl/core.py:243,247-248). All three checklist items are covered. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions