Skip to content

fix(mps): error on a degenerated QR factor in SRC fixed mode - #497

Merged
ultimatile merged 2 commits into
mainfrom
fix/485-src-fixed-canonical-label
Jul 25, 2026
Merged

fix(mps): error on a degenerated QR factor in SRC fixed mode#497
ultimatile merged 2 commits into
mainfrom
fix/485-src-fixed-canonical-label

Conversation

@ultimatile

Copy link
Copy Markdown
Owner

Summary

Fixed-rank successive randomized compression (SRC, arXiv:2504.06475) tolerated a QR append whose diagonal came back non-finite, and could return a state whose site tensors were silently wrong. The tolerance rested on the premise that such a result is usable but uncertified.

Measurement does not support it. The sweep guards its output with elementwise non-finite scans — one per growth round's sketch panel, one over every assembled site tensor — and the basis a degenerated append yields passes both: on the native backend it comes back elementwise finite and column-orthonormal, so the Mixed { center: 0 } label, which claims only that sites 1..n are right-isometric, stays true as well. What is wrong is the subspace it spans, because the overflowed column collapses onto an axis vector, and no scan over elements can see that.

Both stopping modes now surface the degenerated factor as ApplyError::NonFinite. The guard keys on the append's own outcome and fires before the basis accessor is called, so the fix does not depend on which backend produced the factor — only the fixtures pinning the regime do.

Closes #485

Changes

  • crates/ariadnetor-mps/src/apply/successive_randomized.rs — drop the adaptive && conjunct on the append-outcome check, and rewrite the module doc, the # Errors section, and the two comments that described the fixed-mode tolerance.
  • crates/ariadnetor-mps/src/types.rs — widen ApplyMethod::SuccessiveRandomized's # Errors section and the ApplyError::NonFinite variant and field docs from "adaptive mode additionally errors" to both modes.
  • crates/ariadnetor-mps/src/dispatch.rs, crates/ariadnetor-mps/src/dispatch/entries.rs — four entry-point docs enumerated the scanned quantities as a closed list that omitted the degenerated-factor path; the enumeration now covers it.
  • crates/ariadnetor-linalg/src/incremental_qr.rsinto_orthonormal_q's doc pointed at the compression sweep as the model for consumers that keep a degenerated basis. That consumer no longer keeps one, so the pointer is replaced by the fact a consumer actually needs: an elementwise-finite basis returned after a degenerated append carries no span claim, and screening it by scanning elements proves nothing.

Impact

apply_sum_successive_randomized_dense is the only function whose body changes. apply_successive_randomized_dense wraps it and Mps::round_successive_randomized calls that wrapper, so all three gain an error return in fixed mode where they previously returned Ok, with no signature change. Adaptive mode's behavior and detection locus are unchanged. No consumer in the workspace relied on the tolerance: the only non-test caller is crates/ariadnetor-algorithms/benches/mpo_mps_apply.rs, whose operands are drawn in [-0.5, 0.5] and never approach the overflow regime.

Test plan

Invariant: a sweep that observed a degenerated append never returns Ok, in either mode.

A note on the vocabulary below: a panel is the block of sketch columns handed to the incremental QR at one site, and a fixture's window is the amplitude interval, found by sweeping the amplitude, over which that fixture reaches a given check. Each extreme-magnitude fixture records its window in a comment with a re-tuning note, which is the convention the pre-existing tests in this area already follow.

  • The non-finite surfacing tests move out of crates/ariadnetor-mps/tests/mps/apply_successive_randomized.rs into a new crates/ariadnetor-mps/tests/mps/apply_src_non_finite.rs, split along that file's existing Non-finite surfacing section boundary so the extreme-magnitude fixtures read as one unit.
  • src_fixed_mode_surfaces_degenerated_qr_factor_as_error replaces src_fixed_mode_tolerates_degenerated_qr_factor, which pinned the old behavior; the fixture is unchanged and the detection locus moves from the assembled-sites scan to the panel's own site.
  • src_fixed_mode_rejects_span_collapsed_basis is the regression test proper. Its fixture returned Ok before this change, with the last site coming back as [1, 0] where the true direction is the normalization of [1, 1.1]. The replaced test never demonstrated that, because its own overflow tripped a scan first.
  • src_fixed_mode_surfaces_assembled_site_overflow_as_error restores the deterministic exercise of the assembled-sites scan, which the locus move would otherwise have left untested. The same fixture reaches either check depending only on its amplitude.
  • src_sum_surfaces_degenerated_qr_factor_as_error and src_round_surfaces_degenerated_qr_factor_as_error cover the two sibling entry points whose docs this PR widened; the second also checks that the chain is left unmodified on the error path.
  • overflow_norm_basis_is_finite_and_orthonormal_but_spans_elsewhere in crates/ariadnetor-linalg/src/incremental_qr/tests.rs pins the property the prose above rests on: the degenerated basis is finite, orthonormal, and collapsed onto an axis vector.

cargo test --workspace passes, as do cargo fmt --check, the workspace clippy gate with warnings denied, and cargo doc with rustdoc warnings denied.

Notes

The overflow can be avoided rather than reported: Householder QR is scale-equivariant, so prescaling each appended block by a power of two would keep the factorization in range and return the correct subspace instead of an error. That is deferred to #496, which records the obstacle — the scaling propagates into the factors the adaptive stopping rule reads, so their consistency with the sketch norm the sweep accumulates separately has to be re-derived first. Erroring is a strict improvement over returning a wrong state in the meantime, and stays correct for whatever the prescaling still cannot factorize.

The extreme-magnitude fixtures pin amplitudes and seeds tied to the random stream and to the native backend's QR behavior, so a change to either may require re-tuning them.

Fixed-rank successive randomized compression tolerated a QR append whose
diagonal came back non-finite, on the grounds that fixed mode never
claims the adaptive stopping rule's cutoff guarantee and that erroring
there would discard usable results.

Measurement does not support that premise. The basis such an append
yields comes back elementwise finite and column-orthonormal — so every
result-boundary scan passes and the Mixed { center: 0 } label is honest
— while spanning an arbitrary subspace, because the overflowed column
collapses onto an axis vector. The sweep therefore returned a state
whose site tensors were silently wrong, with no signal to the caller.

Both stopping modes now surface the degenerated factor as
ApplyError::NonFinite, so no such factor reaches the basis accessor on
any backend. Splits the non-finite surfacing tests into their own
module, pins the collapse property in the incremental-QR unit tests so
the prose describing it rests on an assertion, and covers the
assembled-sites scan, whose only deterministic exercise moved when the
fixed-mode detection locus did.

Closes #485

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens the successive randomized compression (SRC) MPO·MPS apply path so that a degenerated incremental-QR append (non-finite R diagonal caused by norm overflow, even with elementwise-finite inputs) is surfaced as ApplyError::NonFinite in both adaptive and fixed-rank stopping modes, preventing silently wrong site tensors.

Changes:

  • Make fixed-rank SRC error out on QrAppendOutcome::NonFinite (previously tolerated), aligning both stopping modes.
  • Update public docs (ApplyMethod, ApplyError, dispatch entrypoints, and IncrementalQr::into_orthonormal_q) to reflect the stronger contract and why elementwise scans are insufficient.
  • Restructure and extend tests: split non-finite surfacing into a dedicated module and add regression coverage for span-collapsed-but-finite/orthonormal bases.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/ariadnetor-mps/src/apply/successive_randomized.rs Errors on degenerated QR append outcome in both stopping modes; updates module/docs/comments accordingly.
crates/ariadnetor-mps/src/types.rs Broadens # Errors docs to state NonFinite can arise in both modes due to boundary poison or degenerated QR.
crates/ariadnetor-mps/src/dispatch.rs Updates docs for SRC entrypoints to include degenerated-factor error semantics.
crates/ariadnetor-mps/src/dispatch/entries.rs Updates apply_with_method / sum entry docs to include degenerated-factor error path.
crates/ariadnetor-mps/tests/mps/helpers.rs Adds a shared helper for fixed-rank SRC params; tightens apply_ok expectation text.
crates/ariadnetor-mps/tests/mps/apply_successive_randomized.rs Refactors fixed-rank method construction; removes inlined non-finite section now moved to its own module.
crates/ariadnetor-mps/tests/mps/apply_src_sum.rs Switches to the shared fixed-rank SRC params helper.
crates/ariadnetor-mps/tests/mps/apply_src_non_finite.rs New dedicated test module covering non-finite surfacing and degenerated-factor regression across entrypoints.
crates/ariadnetor-mps/tests/mps.rs Registers the new apply_src_non_finite test module.
crates/ariadnetor-mps/tests/authority.rs Updates helper docs/expect text to acknowledge “finite but extreme” can still error in SRC.
crates/ariadnetor-linalg/src/incremental_qr.rs Updates into_orthonormal_q docs to warn that finite/orthonormal output after NonFinite append makes no span claim.
crates/ariadnetor-linalg/src/incremental_qr/tests.rs Adds a test pinning backend behavior: basis can be finite+orthonormal yet span-collapsed after overflowed append.
crates/ariadnetor-algorithms/benches/mpo_mps_apply.rs Updates bench helper docs/expect text to acknowledge the new failure mode at extreme magnitudes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/ariadnetor-mps/tests/mps/helpers.rs Outdated
`max_dim = None` does not disable the per-bond cap — the sweep computes
one from the operand bond dimensions — so describing the default as
leaving `max_dim` unbounded misstated why `output_dim: usize::MAX`
lands on the exactly representable rank.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

@ultimatile
ultimatile merged commit 8a100a8 into main Jul 25, 2026
1 check passed
@ultimatile
ultimatile deleted the fix/485-src-fixed-canonical-label branch July 26, 2026 15:14
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.

SRC fixed mode keeps a right-orthogonality label a degenerated QR factor may violate

2 participants