fix(mps): error on a degenerated QR factor in SRC fixed mode - #497
Merged
Conversation
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
There was a problem hiding this comment.
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, andIncrementalQr::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.
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 sites1..nare 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 theadaptive &&conjunct on the append-outcome check, and rewrite the module doc, the# Errorssection, and the two comments that described the fixed-mode tolerance.crates/ariadnetor-mps/src/types.rs— widenApplyMethod::SuccessiveRandomized's# Errorssection and theApplyError::NonFinitevariant 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.rs—into_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_denseis the only function whose body changes.apply_successive_randomized_densewraps it andMps::round_successive_randomizedcalls that wrapper, so all three gain an error return in fixed mode where they previously returnedOk, 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 iscrates/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.
crates/ariadnetor-mps/tests/mps/apply_successive_randomized.rsinto a newcrates/ariadnetor-mps/tests/mps/apply_src_non_finite.rs, split along that file's existingNon-finite surfacingsection boundary so the extreme-magnitude fixtures read as one unit.src_fixed_mode_surfaces_degenerated_qr_factor_as_errorreplacessrc_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_basisis the regression test proper. Its fixture returnedOkbefore 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_errorrestores 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_errorandsrc_round_surfaces_degenerated_qr_factor_as_errorcover 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_elsewhereincrates/ariadnetor-linalg/src/incremental_qr/tests.rspins the property the prose above rests on: the degenerated basis is finite, orthonormal, and collapsed onto an axis vector.cargo test --workspacepasses, as docargo fmt --check, the workspace clippy gate with warnings denied, andcargo docwith 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.