Skip to content

Subspace-Iteration CTMRG - #422

Draft
Yue-Zhengyuan wants to merge 16 commits into
QuantumKitHub:mainfrom
Yue-Zhengyuan:si-ctmrg
Draft

Yue-Zhengyuan wants to merge 16 commits into
QuantumKitHub:mainfrom
Yue-Zhengyuan:si-ctmrg

Conversation

@Yue-Zhengyuan

@Yue-Zhengyuan Yue-Zhengyuan commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

This PR adds one more CTMRG projector algorithm SubspaceIterationProjector, introduced in https://arxiv.org/abs/2607.15158.

The basic idea is that, after constructing the full-infinite environment M, one use QR/LQ to obtain "rangefinder" tensors X, Y to project it to Y† M X which lives in a much smaller "oversampling" space. This space is intentionally chosen to be still larger than the target environment space χ. It then greatly reduces the cost to do SVD, resulting in significant speed up especially on GPU.

According to the paper, one can achieve over 100x speedup for D = 6, χ = 144 on GPU. So it appears to be quite a worthwhile addition.

The rangefinders X, Y may be reused during CTMRG iterations, thus a caching mechanism has to be introduced.

@codecov

codecov Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.56213% with 15 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/algorithms/ctmrg/projectors/cache.jl 89.74% 4 Missing ⚠️
src/algorithms/ctmrg/ctmrg.jl 86.66% 2 Missing ⚠️
src/algorithms/ctmrg/projectors/subspaceiter.jl 98.80% 2 Missing ⚠️
src/algorithms/ctmrg/sequential.jl 95.55% 2 Missing ⚠️
src/algorithms/ctmrg/sparse_environments.jl 66.66% 2 Missing ⚠️
...lgorithms/optimization/implicit_differentiation.jl 75.00% 2 Missing ⚠️
src/algorithms/ctmrg/projectors/projectors.jl 96.77% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/Defaults.jl 85.71% <ø> (ø)
src/PEPSKit.jl 100.00% <ø> (ø)
src/algorithms/ctmrg/simultaneous.jl 98.68% <100.00%> (-1.32%) ⬇️
src/algorithms/ctmrg/projectors/projectors.jl 91.93% <96.77%> (+4.43%) ⬆️
src/algorithms/ctmrg/ctmrg.jl 82.35% <86.66%> (+1.24%) ⬆️
src/algorithms/ctmrg/projectors/subspaceiter.jl 98.80% <98.80%> (ø)
src/algorithms/ctmrg/sequential.jl 95.45% <95.55%> (-2.99%) ⬇️
src/algorithms/ctmrg/sparse_environments.jl 78.81% <66.66%> (-0.66%) ⬇️
...lgorithms/optimization/implicit_differentiation.jl 93.41% <75.00%> (+0.16%) ⬆️
src/algorithms/ctmrg/projectors/cache.jl 89.74% <89.74%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leburgel

leburgel commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

I don't really have time to go over this in detail right now, but we should consider the difference between this approach and that of #263, and consider if they are related. Switching to a randomized SVD to compute the same projectors we already support could be a bit cleaner in terms of implementation, so it might be worth it to work this out a bit more before committing here.

Introduce SubspaceIterationProjector with independent,
independent_stabilized, alternating, and alternating_refined range
updates, sharing reduced decompositions and projector construction.

Recycle symmetry-resolved bases with optional rotation and freezing in
simultaneous and sequential CTMRG. Preserve the optimized alternating
contractions and differentiation through recycled sweeps, including
fixed-point gradients with the incoming cache held fixed.

Cover range updates, cache handling, symmetry sectors, sweep integration,
and gradients with focused tests.
@Yue-Zhengyuan

Copy link
Copy Markdown
Member Author

As I continue refining this PR, the essential difference between this and #263 is already outlined in documentation, which I temporarily put at docs/src/man/subspace_iteration.md (#263 is referred to as the "alternating" range-finder update scheme, while the vanilla SI-CTMRG is the "independent" scheme because X, Y are separately updated). It seems that ideas from #263 lead to a slightly more efficient algorithm (by a constant factor, while the complexity scaling remain unchanged).

@leburgel @kshyatt You can now take a look and provide suggestions.

@kshyatt

kshyatt commented Oct 22, 2026

Copy link
Copy Markdown
Member

@Yue-Zhengyuan this PR is wastefully running tests on the GPU despite not actually testing GPU functionality, I'm pretty sure. Can you put a !is_buildkite guard around your tests?

@Yue-Zhengyuan

Copy link
Copy Markdown
Member Author

Sorry! Will do it soon (my agent still hasn't learned to respect the new test suite layout).

@kshyatt

kshyatt commented Oct 22, 2026

Copy link
Copy Markdown
Member

I cancelled the GPU build in the meantime

@kshyatt
kshyatt requested review from kshyatt and leburgel October 22, 2026 12:20
@leburgel

leburgel commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

I've been going through the implementation, and also testing out the prototype directly for PEPS optimization. I still need some time to collect my findings and comments, I hope to get to that tomorrow. In short:

  • I don't know how feasible this would be, but it would be nice if we could implement the subspace-based decompositions at the level of a decomposition algorithm rather than a projector algorithm. This would be more in line with the current IterEigh and IterSVD. At the end of the day, this really computes the same projectors as the dense FullInfiniteProjector algorithm, so it would be convenient if the subspace-based projector computation would fit under the same projector algorithm. Also, it would then give us an easy way of specifying sparse subspace versions of half-infinite and C4v projectors.
  • The implementation here has quite a few issues with gradient accuracy, that exposed a few behaviors of the algorithm that I didn't think of beforehand.
    • With freezing kicking in after a certain point, the contraction converges to the fixed point of the frozen-subspace map, which does not actually coincide with the fixed point of a regular full-infinite CTMRG iteration. It reports convergence even when it's still quite far from an actual element-wise fixed point. This could be fixed by switching off the freezing at the end of the leading_boundary run.
    • This behavior also renders the fixed-point gradient incorrect, in a way that is not entirely straightforward to fix. I'm still working on how to best solve this.
  • Since freezing gives rise to quite a few subtle issues, I wonder if we could achieve similar performance without these tricky issues by using a simpler warm-started block-Krylov approach for the sparse decompositions. This is just something I'm curious about, and could probably be added in at a later point.
  • To go beyond fixed-space truncation for symmetric tensors, we should be able to take inspiration from the SketchedExpand approach that was recently added to MPSKit.jl. This seems to tackle precisely the issues we would also run into here.

I'll post a more detailed review with some actual reproducers of these issues soon.

Preserve SI projector caching while adopting upstream's differentiated global phase correction. Extend the cached boundary helper to AbstractCTMRGEnv for the new C4v environment.
@Yue-Zhengyuan

Copy link
Copy Markdown
Member Author

Latest changes:

  • Rangefinder freezing is entirely dropped, and they are not assumed as constant parameters during fixed point differentiation (since they now part of the fixed point equations). This should fix gradient accuracy issues. We may postpone rangefinder freezing to later work, since this PR is already quite large.
  • Automatic charge selection is added. But gains from SketchedExpand-like oversampling in one CTMRG step may be cancelled by an increase in the number of iterations to reach convergence.

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.

3 participants