Skip to content

Prototype U,V/Q-guided multi-peak JAX marginalization - #270

Merged
oshaughnessy-junior merged 4 commits into
rift_O4dfrom
codex/jax-uvq-multipeak
Sep 7, 2026
Merged

oshaughnessy-junior merged 4 commits into
rift_O4dfrom
codex/jax-uvq-multipeak

Conversation

@oshaughnessy-junior

Copy link
Copy Markdown
Owner

Scope

Adds an opt-in diagnostic seam for genuinely local joint marginalization over reflected time, two angles, and inverse distance. It does not change production likelihood dispatch.

  • ranks distance-following U,V/Q structural starts, reduces sampled symmetry aliases before the cap, then expands each verified group action exactly once
  • refines every retained start with bounded sequential JAX Newton/polish steps and a strict stationary gate
  • integrates the union of finite full-Hessian affine cells with a full Gaussian-mixture overlap partition
  • runs a richer enrichment tier and accepts only when both local diagnostics pass and the log integrals agree within the configured budget
  • invokes a lazy finite dense/exact reserve on any decline; planner failure never becomes -inf or point deletion
  • retains the failed deterministic global cover only as a frozen optional diagnostic, outside the runtime decision

Adversarial fixes

  • symmetry aliases no longer consume representative capacity; the odd targeting-grid phase is preserved because forcing group alignment falsified strict SNR160 convergence
  • time endpoints require one-sided local-maximum comparisons
  • ordinary affine-cell overlap is partitioned, not blanket-rejected
  • a failing reserve is invoked once and is not relabeled as a planner exception
  • explicit-array memory telemetry is more conservative and explicitly excludes backend allocator/compiler/AD high-water memory

Real-table gate (1e-3 nat policy)

row decision local / oracle error modes explicit-array model
22, SNR 40 dense reserve 0 after fallback 4 4.9 MB
22, SNR 160 local accept -4.3e-6 nat 4 4.9 MB
Lmax=4 HM51 local accept -7.1e-5 nat 2 19.1 MB

The HM regression preserves the relevant second mode: sampled proxy rank 15 at -37.14 nat, refined contribution at -11.671 nat. No sampled-height pruning is used before refinement.

Validation

  • 15 passed in 56.09s in the focused CPU JAX suite, including full real-table 22 low/high-SNR and HM integrals, symmetry-cap, overlap, endpoint, finite-reserve, and frozen-cover regressions
  • py_compile, flake8 --ignore=E501,W503, and diff checks pass

GPU device high-water validation remains infrastructure-blocked: the available CUDA/JAX container aborts while creating its client thread under current host thread pressure. The result field therefore labels only modeled explicit arrays, not measured GPU RSS.

@oshaughnessy-junior
oshaughnessy-junior deployed to private-review-dispatch-rift September 6, 2026 22:05 — with GitHub Actions Active
@oshaughnessy-junior
oshaughnessy-junior deployed to private-review-dispatch-rift September 6, 2026 22:18 — with GitHub Actions Active

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent automated review completed at the recorded exact commit. Detailed findings were withheld from public output by the private-context egress policy and require private human declassification.

@oshaughnessy-junior
oshaughnessy-junior deployed to private-review-dispatch-rift September 7, 2026 00:14 — with GitHub Actions Active
@oshaughnessy-junior
oshaughnessy-junior deployed to private-review-dispatch-rift September 7, 2026 07:17 — with GitHub Actions Active
@oshaughnessy-junior
oshaughnessy-junior merged commit 750ca04 into rift_O4d Sep 7, 2026
31 checks passed
@oshaughnessy-junior
oshaughnessy-junior deployed to private-review-dispatch-rift September 7, 2026 07:48 — with GitHub Actions Active
oshaughnessy-junior pushed a commit that referenced this pull request Sep 7, 2026
…rder branch

Only .travis/test-jax.sh conflicted, in the two places its own comments predict.

FILES: union, per the rule written in that file -- both test_multipeak_planner.py
and test_jax_phase_marg_mode_order.py.  DESELECTED_TESTS merged cleanly and keeps
all five entries (#270's four real-table regressions plus the GPU stencil leg).

EXPECTED_TESTS: the fourth time this constant has conflicted.  Each side carried a
number the other had already invalidated -- 475 (this branch) vs 472 (#270) -- which
is the exact failure mode that file's comment block describes.  Re-measured after
resolving rather than computed: the script's own line reads "collected 486 tests
from 33 files" with the DESELECT loop applied.  472+14 also gives 486; recorded as a
coincidence to distrust, not as corroboration.

#270 is additive and does not interact with this change: it adds one standalone
module, multipeak_planner.py, which imports nothing from core and references neither
phase_marginalization, _accumulate_unit, nor the packed lms/U/V (verified with a
positive control on the grep).  core.py itself is untouched on that side.

Re-verified on the merged tree, against gh/rift_O4d at 750ca04 as the new base:
the 64-array fingerprint is unchanged, sha256 aa4ff26be9967f333e1da8b12010b90ef483
09695fa7328788fc21e9961cc3fd on both sides, 0 differing arrays.  The 14 mode-order
tests pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@oshaughnessy-junior

Copy link
Copy Markdown
Owner Author

Two notes from testing #273's algebraic phi enumeration against this PR's planner. Neither asks for a change here; the first is a finding in your favour, the second is an availability problem.

1. The U,V/Q lattice is sufficient — a much better start set changes nothing.

At fixed time and distance the exponent x*A - 0.5*x^2*B - 4log x is a 2-D trig polynomial, so the algebraic stationary set applies directly to it (same w = 1 / 2 convention, no adapter). On tables from make_synth -> angle_coefficient_tables at m_max=2 and m_max=4 HM:

case lattice: starts / worst phi miss + algebraic: starts / worst miss delta lnI enum cost
m_max=2 rho~18 8 / 0.686 rad 64 / 0.025 +0.000e+00 0.6 s
m_max=2 rho~90 8 / 0.686 64 / 0.026 +9.1e-13 0.6 s
m_max=2 rho~359 8 / 0.686 64 / 0.026 +0.000e+00 0.7 s
m_max=4 rho~18 13 / 0.184 1618 / 0.015 +5.7e-14 135 s
m_max=4 rho~90 13 / 0.090 1601 / 0.005 +0.000e+00 127 s
m_max=4 rho~359 13 / 0.090 1604 / 0.005 +0.000e+00 135 s

18-27x better coverage of the true phi-maxima, identical retained mode count, identical ok, lnI equal to float noise. Your Newton refinement absorbs the difference. #273 is parked as draft on this basis.

One caveat on how far to take that: select_refined_modes retained 1 mode at m_max=4 and 4 at m_max=2 against 10-32 true phi-maxima on these fixtures. If the mode filter is the binding constraint, the test is partly blind to start quality. Is n=1 at m_max=4 the intended behaviour of contribution_cutoff_nats and the dedup tolerances, or is it tighter than you meant?

2. The real-table regressions cannot run outside your host.

_HM_PACKET = /tmp/hm51_Ctables_incl0.6.npz and the two /tmp/rift-paper-av-ladder/... packets are node-local, so test_hm_second_mode_survives_unsafe_proxy_gap, test_hm_two_tier_integral_matches_overcomplete_oracle and the SNR40/160 tests skip everywhere else — including CI. The three headline rows in the PR description are currently unverifiable by anyone but your session. Moving the packets to $HOME (shared across the interactive nodes) or checking in a reduced fixture would make them reproducible.

oshaughnessy-junior pushed a commit that referenced this pull request Sep 7, 2026
…he Q pregrid branch

Two conflicts, both in .travis/test-jax.sh, both the same recurring one.

FILES array: took the union.  The three test files each side registered are
independent; none replaces another.

EXPECTED_TESTS: each side carried a number the other had already invalidated
(480 on this branch, 486 on rift_O4d).  Resolved by MEASUREMENT, not by adding
the two.  Read off this job's own collection line on the merged tree, with the
DESELECT loop applied: "collected 505 tests from 34 files".

core.py auto-merged and was re-read rather than trusted, because this module has
placed an incoming docstring above a contradicting implementation before.  The
two sides are disjoint by axis: #272 permutes the packed MODE axis of Q/U/V
before the phase-marginalization reduction, this branch rescales indices along
the TIME axis of the stored Q.  In the merged _accumulate_unit the permutation
runs first (mode axis, Q.shape[1]) and _check_stored_q_length then reads
Q.shape[0], which the permutation does not touch.  README.md's new phase-marg
section describes only #272's code and this branch does not touch it.

Also, while re-reading:
  * _check_stored_q_length's docstring lost the end of a sentence ("... and they
    are" ran straight into the next paragraph).  Completed; no code change.
  * test_jax_q_time_pregrid.py had no entry in the per-file manifest comment
    that every other gated file has.  Added.
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.

2 participants