Skip to content

Fix do_approx_sphere regression and data-inadequate headline parity dataset #144

Closed

Description

@neuromechanist

Background

An independent paper-review pass (checking whether prior reviewer feedback was
actually resolved, not just reworded) caught that the documented reproduction
command for the JOSS paper's Table 1 (uv run python validate_implementations.py)
does not reproduce the claimed headline number (0.997 Hungarian-matched
correlation). Verified firsthand, this uncovered two separate, compounding
issues.

Issue 1: do_approx_sphere regression in sample_data/sample_params.json (fixed)

sample_params.json had "do_approx_sphere": false, but AMICATorchNG's own
default is true, and its source comment (pyAMICA/torch_impl/core.py:663-673)
says false "is a different, non-symmetric transform that breaks activation
parity." Git blame shows it flipped from true to false in commit bc34fb9
(2025-01-19), an exploratory "run through the CLI" commit, and was never
reverted. validate_implementations.py::run_pytorch_amica forwards every
JSON key with an AMICATorchNG equivalent straight into the constructor, so
this silently overrode the safe default -- but the existing regression test
(test_end_to_end_correlation_vs_fortran) never caught it, because it builds
AMICATorchNG from hand-picked kwargs that never touch this flag.

Fixed: do_approx_sphere restored to true; verified firsthand (mean
correlation 0.49 -> 0.99 on a quick rerun). Added
test_end_to_end_correlation_vs_fortran_from_sample_params_json, which
builds the model via the actual documented path (run_pytorch_amica loading
the real JSON), so a future regression here cannot hide behind hand-picked
kwargs again.

Issue 2: the bundled sample EEG is data-inadequate for a 32-channel single-model claim

Even with the flag fixed, correlation on the bundled eeglab_data.fdt
(32 channels, 30504 samples) does not reliably reach 0.997. Five independent
2000-iteration reruns (Fortran's RNG is system_clock-seeded and not
controllable via the harness's seed argument, so each run is a genuinely
independent draw) gave: 0.930, 0.968, 0.868, 0.958, 0.960 -- mean 0.937,
2 of 5 below the project's own >0.95 gate, none reaching 0.997.

Root cause: data adequacy. This dataset's k-factor (k = frames / channels^2)
is 30504/32^2 = 29.8, and the project's own prior k-sweep
(.context/issue-90/ksweep_findings.md) already found equivalence is
under-determined below k~60 and plateaus around k>=60 (0.98+, native-Fortran
vs CUDA-f64 specifically at 0.995). The bundled recording is simply too short
for a well-determined 32-channel decomposition; 0.997 was very likely a
favorable historical draw, not a typical outcome.

Fix in progress: switch the single-model correctness harness to a
data-adequate real recording. Using OpenNeuro ds002718 sub-002
(Wakeman-Henson, already used for benchmarks, not bundled -- requires the
existing download recipe in benchmarks/README_dimsweep.md), first 32 of the
first 70 EEG channels, first 147,000 frames (k=144, exactly the configuration
already validated at 0.974 in the Phase 3 k-sweep, .context/issue-84/):
4 independent draws at 300 iterations gave mean 0.989 (range 0.979-0.996),
consistent with the original 0.997 claim. Confirmatory runs at the full
2000-iteration budget in progress.

Remaining work

  • Fix do_approx_sphere in sample_data/sample_params.json
  • Add a regression test exercising the real JSON config
  • Fix stale max_iter 200 in sample_data/input.param (should be 2000,
    matching the documented convention; only bites someone bypassing the
    harness and running the binary directly)
  • Reconcile min_grad_norm mismatch between the two config files
    (harmless today since AMICATorchNG ignores the key, but confusing)
  • Remove dead, misleadingly-named create_fortran_params in
    validate_implementations.py
  • Finalize the k-adequate ds002718 single-model comparison at 2000
    iterations and decide how it's exposed (new script/doc section)
  • Update paper.md Table 1, docs/guides/validation.md, AGENTS.md, and
    README.md's single-model correlation claims to the verified numbers
    and correct data source
  • Update the paper's "no external download" framing for the correctness
    harness, since the new headline dataset requires one (same download the
    benchmark section already documents)

Activity

  1. added
    bug
    on Jul 14, 2026
  2. neuromechanist commented on Aug 9, 2026

    @neuromechanist
    MemberAuthor

    Decision on what "reproducible" should mean here, since it shapes the remaining work.

    Verification of this kind is inherently expensive, and the right response is to state the cost plainly rather than to invent a cheaper proxy. A reduced-budget or low-k tier would reproduce a noisier number than the headline, and below k around 60 the decomposition is genuinely under-determined, so backends diverge for legitimate reasons rather than because either is wrong. Publishing a cheap tier would therefore invite exactly the misreading this issue exists to prevent. High-k testing stays the protocol precisely because it is what reduces the uncertainty.

    Work

    • Make .context/issue-144-parity-data-adequacy/run_5seed_newton0.sh portable. It currently hardcodes cd ~/pamica-issue144, /tmp output paths, a 24-thread count, and assumes CUDA is present. The data fetch itself is already public and documented (benchmarks/README_dimsweep.md:27-36, S3, no credentials, ~224 MB).
    • Document the real cost next to the protocol: hardware assumed, wall-clock, download size, and what varies without a GPU. Someone deciding whether to verify should be able to see the price before starting.
    • Reconcile the paper with the docs. paper.md currently says "The harness, sample data, and reproduction commands ship with the package, so a third party can re-run Table 1", while docs/guides/validation.md:415-419 says validate_implementations.py's defaults "do not reproduce either row directly" and the headline script "is not yet a portable one-command reproduction". Both cannot stand. The paper sentence should say what ships and what running it costs.
    • Keep the bundled-sample rows reproducible cheaply, since those genuinely are, and label clearly which rows in Table 1 need the external recording and which do not.

    Blocked on #212 landing first, since that PR is revising numbers in docs/guides/validation.md and both would otherwise edit the same file.

  3. added a commit that references this issue on Aug 10, 2026
    263f1bd
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions