Skip to content

MLX linalg failure aborts the process instead of raising #274

Closed

Description

@neuromechanist

Found while verifying PR #271's W finiteness guard: when AMICAMLXNG's _update_unmixing_matrices hits a genuinely singular A, MLX 0.32's CPU-stream mx.linalg.inv does not raise a Python exception — LAPACK LU failure terminates the whole process (libc++abi: [Inverse::eval_cpu] LU factorization failed), and a try/except around fit() cannot catch it. The torch backend raises a catchable error in the same situation. Attempts to reach a float32 inf overflow via near-singular A instead hit this abort first, so the new W/_logdet_W finiteness guard is defense-in-depth rather than a reachable-overflow catch (documented in the PR).

Scope: decide a containment for the MLX backend — e.g. a cheap host-side conditioning check (finite slogdet magnitude, or np.linalg.cond on the small per-model matrix) before calling mx.linalg.inv, failing with a Python RuntimeError naming the model and iteration; or track upstream MLX behavior and document the limitation in docs/guides/amica-differences.md. Pre-existing behavior, not introduced by #264/#271.

Related: #264, epic #260.

Activity

  1. added 3 commits that reference this issue on Aug 23, 2026
    8fcd973
    b6551c6
    e7fda36
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