Skip to content

fix(rcwa): a kernel-flag split for traced two-chain clusters - #256

Draft
yonghakim wants to merge 2 commits into
mainfrom
claude/ep-chain-flag-split
Draft

yonghakim wants to merge 2 commits into
mainfrom
claude/ep-chain-flag-split

Conversation

@yonghakim

Copy link
Copy Markdown
Member

What and why

tests/rcwa/test_third_order_exceptional_point.py::test_traced_answers_at_two_coincident_chains_are_exact[*-six modes] depends on the machine:

Cause (measured):

  • Under a trace, _rebuild_defective_clusters marks a cluster that fails its check, and the answer becomes NaN by design.
  • On that machine the traced wide family's best split read cond(X) · dropped / tau = 1.166 (cond 93). The eager run reads 0.001.
  • This is not a bad candidate choice. On slot matrices equal to rounding (eigenvalues agree within the 1e-6 a length-3 chain spreads by), eigenvector-based three-level splits read cond(X) from 1.3 to 112. The eigenvectors of a Jordan chain are nearly parallel, so which side of the threshold a machine lands on is rounding.

Change

_chain_split_traced_wide also forms, for each layout, a split from the members' nested null spaces about their mean (_flag_columns):

  • level 2 is the leading right singular vectors of N**2;
  • level 1 is those of N on the rest;
  • level 0 is the remainder, with padded lanes handled as before.

N is the slot less the members' mean, on member lanes. The levels are orthonormal and come from singular vectors, so this split stays well conditioned at the chain.

Selection is unchanged: the candidate the check reads least of wins. So no slot takes a worse split, and slots that never reach the wide family keep their bits. No threshold or tolerance changes.

Measured

  • Captured traced slots: the candidate reads cond(X) 1.2–1.4 and 0.002 of the threshold, where the eigenvector candidates read 93–189 and 1.17–1.7.
  • 160 synthetic two-chain slots (couplings 1e-7–1e-3, perturbations 0–1e-14, ten bases each):
    • never worse than before;
    • the worst slot reads 7.9e-3 of the threshold;
    • before, 3 slots read 6.2–8.2 and failed.
  • The two-chain test: all four variants (including the slow beside a seventh) pass on the machine where six modes was NaN, covering values within 1e-12 and the JAX derivative against its oracle.

Checks

  • New test test_the_traced_two_chain_split_reads_the_check_far_below_its_threshold, NumPy and JAX, 3 slots: passes here, and on main fails 4 of 6 cases (cond 108–308).
  • Exceptional-point suites (test_2d_exceptional_point, test_exceptional_point_clusters, test_exceptional_points_off, test_first_order_exceptional_point, test_third_order_exceptional_point, -n 3):
    • 993 passed;
    • 3 xdist workers crashed for memory (three heavy exceptional-point workers at once); those 3 tests pass alone on this branch and on main.
  • ruff check . is clean, tests/api/test_docs_contract.py passes (176), and sphinx -W passes in English and Korean.
  • Not run locally: the full CI suite. The traced digests of layers without a chain should be unchanged, since only the wide family gains a candidate; that is not separately re-measured here.

Docs

docs/theory/rcwa/rayleigh-points.md: a dated paragraph on the cause, the construction and the measurements, mirrored in the Korean overlay.


Generated by Claude Code

…ototype)

Under jax.jit the two-chain cluster of
tests/rcwa/test_third_order_exceptional_point.py
(test_traced_answers_at_two_coincident_chains_are_exact, six modes) failed
the cluster check on one Linux machine and the solver returned NaN by design.

Measured there:
- cond(X) * dropped / tau was 1.166 (cond 93).
- The eager run passed at 0.001.
- Eigenvector-based three-level splits read cond(X) from 1.3 to 112 on slot
  matrices equal to rounding. The eigenvectors of a Jordan chain are nearly
  parallel, so which side of the threshold a machine lands on is rounding.

_chain_split_traced_wide now also forms, for each layout, the split from the
members' nested null spaces about their mean (_flag_columns): singular vectors
of N**2 and N, orthonormal levels, no eigenvectors of the defective block. The
existing selection keeps whichever candidate the check reads least of, so a
slot never takes a worse split than before. On the captured matrices it reads
cond 1.2 to 1.4 and a miss of 0.002 where the eigenvector candidates read 93
to 189 and 1.17 to 1.7.

Prototype: the target test and the exceptional-point suites are still being
run; no tolerance is changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKzHy7n4Z9ie7zix3xWWeV
Three synthetic two-chain slots, one coupling (1e-3), seeded bases, and
perturbations of 0 or 1e-16. On these, the eigenvector-only wide family
read the cluster check at 6.2, 8.2 and 6.3 of its threshold, so it failed
and the traced answer was NaN by design.

With the kernel-flag candidate the split reads cond(X) < 3 and under 1e-2
of the threshold, under NumPy and JAX. On main the test fails in 4 of its 6
cases (cond 108 to 308).

Over 160 such slots (couplings 1e-7 to 1e-3, perturbations 0 to 1e-14) the
candidate was never worse than the eigenvector ones, and read at most
7.9e-3.

The exceptional-point theory page records the cause, the construction and
these measurements, in English and in the Korean overlay.

Exceptional-point suites (5 files, -n 3): 993 passed. Three xdist workers
crashed for memory with three heavy exceptional-point workers at once; those
three tests pass alone on this branch and on main. The two-chain test passes
in all four variants on the machine where `six modes` was NaN on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKzHy7n4Z9ie7zix3xWWeV

This branch has not been deployed

No deployments
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