Skip to content

Alice 0.3.2

Choose a tag to compare

@changkai-zhang changkai-zhang released this 23 Oct 16:21
· 349 commits to stable since this release

Alice 0.3.2 — Truncation Scale and Kept-Space Projection

Release Date: October 24, 2026

Version 0.3.2 is a correctness release on two of the pieces v0.3.0 and v0.3.1 built.
The controlled bond expansion in DMRG and XTRG projected the center end of a bond with
the center tensor itself, for which M M† is not a projector, so part of the space the
bond already carried leaked back into the complement it was supposed to be orthogonal
to. XTRG's trunc_thresh and z_tol were absolute numbers compared against a quantity
that shrinks like d^{-L/2}, which made the cutoff exponentially more aggressive with
every site added and the fit-convergence test satisfied before the fit had done
anything. Both are now measured against the scale they live on. init_mps also stops
handing back a random MPS with every bond empty, and the four TDVP example scripts
accept '1sp'. One behavioral change to note: trunc_thresh is now read relatively, and
its default moves from 1e-15 to 1e-12.

🎯 The Kept-Space Projection

  • The complement search in both alice.algorithm.dmrg.complement and
    alice.algorithm.xtrg.complement builds a doubly-discarded tensor by projecting the
    kept space out of each half-contraction. P = M M† is a projector only for an
    isometry. The neighbor end of the bond is one; the center end carries the singular
    values and is not, so the projection there left a kept-space component behind.
  • New _center_isometry_forward / _center_isometry_backward in each module return the
    isometric factor of a 1-site split of the center tensor, which spans exactly what the
    center tensor spans. The bond tensor the split also produces is discarded — it is the
    non-orthonormal part that made the center tensor unusable here. The internal bond gets
    its own itag (_CENTER_ITAG), distinct from the connector itags, so a projection can
    carry both at once.
  • The isometric factor of Θ will not serve in its place, orthonormal though it is:
    decomp keeps every sector at full dimension regardless of rank, so that factor can
    span the whole (bond, physical) space and annihilate the complement entirely. The
    split of the center tensor cannot overreach, its internal bond being the bond itself.
    This is the same trap alice.algorithm.tdvp.complement already documented; TDVP was
    the one implementation that had it right, and its docstring's aside about DMRG getting
    away with the raw site tensor is gone, no longer describing the code.
  • DMRG: converged energies are unchanged, still matching the 2-site scheme to twelve
    digits, and the sweeps now reach them one sweep earlier.
  • XTRG: the expansion grows the bond more conservatively, which costs a little
    accuracy at a fixed expansion budget — the spinless L = 10 run ends at 1.2e-06
    relative error in log Z rather than 1.1e-07, both far below the 1.6e-03 of the
    plain 1-site scheme, and a smaller trunc_thresh recovers it. The spinful L = 10
    run is unaffected at 2.3e-08, and no longer depends on the expansion budget at all.
  • The projector helpers take their second argument as A / B after the role it plays,
    and their docstrings now state the isometry each one satisfies rather than describing
    it as the original site tensor, approximately isometric.

📏 A Relative Truncation Threshold for XTRG

  • xtrg.Options.trunc_thresh is now a relative cutoff: a singular value is
    discarded when it falls below trunc_thresh × ‖C‖, where ‖C‖ is the Frobenius norm
    of the tensor being decomposed. The same value now means the same thing at every chain
    length and every temperature.
  • The squaring step fits C ≈ A·B on the unit-norm internal tensors of two NormalMPO
    factors, so the object being truncated has a norm of roughly d^{-L/2} while the run
    is hot, climbing toward 1 as it cools. Handed straight to Nicole's thresh mode,
    which compares bare singular values, a fixed cutoff therefore grew exponentially more
    aggressive with every site added, and too permissive late in the run.
  • New _Truncation in alice.algorithm.xtrg.sweep carries the relative threshold
    through a half-sweep and turns it into the absolute number Nicole expects by measuring
    the norm of the first tensor it decomposes. One measurement is enough: ‖C‖ grows by
    well under a factor of two over a sweep as the variational fit tightens, and the first
    tensor carries the smallest norm, so the cutoff errs on the side of keeping.
  • Resolution is deferred to the first at() call rather than done at construction,
    because on the opening half-sweep of a fit mpo_c is still the unit-norm copy of
    mpo_a it was initialized from; only after the first local update does it sit on the
    ‖A·B‖ scale the cutoff has to track.
  • A zero or non-finite norm leaves no scale to measure against, so the threshold is
    dropped rather than compared against a bare spectrum, and max_bond alone limits the
    bond. A trunc_thresh of 0.0 needs no resolution and is passed through untouched.
  • The backward 2-site half-sweep now shares one resolved set of options between the
    trial SVD and the real split, so the reported discarded weight is the weight actually
    discarded.
  • The compact() calls in _fit_mpo are the one place the relative number can be used
    as it stands, and a comment now says why: compact() extracts the Frobenius norm into
    log_scale and normalizes the site tensors before its truncating sweep, so its
    cutoff already acts on a unit-scale spectrum.
  • The default moves from 1e-15 to 1e-12. Read relatively, 1e-15 asks for far
    more precision than the rest of the cooling delivers: on a free-fermion chain with no
    bond cap it kept 599 states where 1e-12 kept 377, both landing on the same accuracy
    floor of about 1e-10 in the per-site log Z.
  • run() labels both thresholds (relative) in its startup block.

🎚️ Relative Fit Convergence

  • z_tol now stops the inner variational fit when
    |‖C‖ − ‖C_prev‖| < z_tol × ‖C_prev‖, for the same reason trunc_thresh is
    relative: ‖C‖ is itself exponentially small in the chain length, so an absolute
    tolerance was satisfied trivially on a long chain and stopped the fit after its very
    first sweep.
  • A vanishing prev_norm cannot happen for a physical ρ but would make the test
    vacuous, so it never stops early. The debug line now reports Δ‖C‖/‖C‖.
  • z_tol = 0.0 still means "never stop early" and runs the full n_sweeps budget.

🌱 Random MPS Initialization

  • init_mps with bond_dim > 1 draws its bond sectors from a depth-2 breadth-first
    search around the center-bond charge alone. A charge path that strays further than two
    fusion steps from it leaves the bonds near the boundaries with no allowed sector, and
    the canonicalization then empties the whole chain. _random_mps returned that object
    — no blocks, zero norm, and a usable MPS to every caller that asked — so the failure
    surfaced far from its cause, as a zero-norm Davidson guess several frames deep. It now
    raises ValueError, naming bond_dim, target_qn, and L, and pointing at the two
    routes that do work: bond_dim=1 with an explicit config=, or scheme='1sp' to
    grow the bond dimension from a product state. The target sector is not at fault.
  • The random MPS is now normalized before it is returned. The two modes of the same
    function disagreed on the scale of what they hand back: the product-state path
    normalizes, while the random path returned whatever norm its blocks happened to have,
    which grows with L and bond_dim and reached the thousands at ordinary sizes.
    Nothing downstream depended on it, since the solvers normalize what they are given,
    but an initial state is a vector in a Hilbert space and there is one obvious length
    for it.

📝 Examples

  • tdvp_freefermion.py, tdvp_domainwall.py, tdvp_hubbard.py, and
    tdvp_hubbard_quench.py all accept scheme='1sp' and expose expand_k and
    expand_alpha, on the scan modes as well as the main drivers.
  • The domain-wall bond-dimension scan now refuses '1s', whose bonds stay at dimension
    1 whatever max_bond says, which would make every row of the table identical.
  • The free-fermion example is the one worth running after touching the expansion: a
    single-particle state already carries the bond dimension the exact solution needs, the
    reference is closed form, and nothing is truncated, so '1sp' reproduces '1s' to
    every digit at a bond dimension that never leaves 2 — and an expansion that leaked
    error would have nowhere to hide.
  • xtrg_spinless.py and xtrg_spinful.py follow the new trunc_thresh default and
    describe the option as relative.

📚 Documentation

  • docs/algorithms/xtrg/lessons.md is rewritten around the relative cutoff: what the
    threshold is now compared against, where the conversion happens and why one
    measurement per half-sweep suffices, why the scale needs converting at all, the same
    reasoning for z_tol, and an admonition that relative is not an error bound. The
    practical guidance to scale trunc_thresh down when moving to a longer chain is gone,
    the mechanism it worked around having been removed.
  • docs/examples/tdvp/free-fermion.md gains a three-scheme table; the 2-site advantage
    it shows is the local step, not extra bond dimension.
  • docs/examples/tdvp/domain-wall.md gains a tip beside the existing frozen-'1s'
    warning, that trap now having a direct answer: '1sp' matches the 2-site occupation
    error on a smaller bond profile, at an entropy error roughly twice as large. The
    frozen-'1s' occupation error quoted on the page is corrected from 0.47 to the
    measured 0.421 for the parameters the page actually uses.
  • docs/examples/tdvp/hubbard.md gains a section on bond expansion under a non-Abelian
    group, where expand_k counts multiplets. The Abelian against non-Abelian comparison
    is looser under the expansion than under the 2-site update, which the page explains as
    expected rather than a defect: the complement directions a bond receives depend on the
    basis the state is carried in.
  • docs/examples/tdvp/hubbard-quench.md identifies the eigenstate limit as the check
    that matters for the expansion — widening a bond and truncating it back must leave an
    eigenvector exactly where it was, confirmed to 6.7e-14 at zero discarded weight —
    since neither energy conservation nor cross-group agreement would report the failure.

🧪 Tests

  • New TestCenterIsometry in tests/algorithm/dmrg/test_scheme_1sp.py and in
    tests/algorithm/xtrg/test_scheme_1sp.py: isometry of the factor, the space it spans
    matching the center tensor's, axis order and itags, the center tensor demonstrably not
    an isometry, each projection idempotent (which it was not before), and the discarded
    halves orthogonal to the kept space, with guards that keep those assertions from
    passing on a half that is numerically zero. Building the halves needs the right
    environments while the state is still right-canonical, so the new helpers assemble
    them around a center placed afterwards. The XTRG left-side tests run with
    alpha=None: at the default alpha=2 the left half contracts to a norm of order
    1e-11 on that fixture and every assertion about it would hold vacuously.
  • New TestTruncation in tests/algorithm/xtrg/test_sweep.py covers _Truncation
    directly — the threshold scaled by the measured norm, the scale fixed on first use and
    no norm read afterwards, a zero threshold left alone, and the fallback to the bond cap
    on a zero or non-finite norm.
  • New TestTruncationScale scales the site tensors of a density matrix up and down by
    four orders of magnitude and checks that one full sweep keeps the same bonds and
    reports the same discarded weight in all three schemes, with companion tests
    confirming the threshold does remove states at that setting (so the invariance is not
    vacuous) and that a zero threshold truncates by max_bond alone.
  • New TestChainLengthPortability in tests/algorithm/xtrg/test_xtrg.py cools a
    spinless free-fermion chain at four and at ten sites under identical options and
    compares the per-site log Z against the exact single-particle result. Before the cutoff
    was measured relatively the longer chain lost two orders of magnitude of accuracy and
    ran at a visibly starved bond dimension; the test holds the error flat and forbids the
    bond from falling. The new trunc_thresh default is pinned in the options test.
  • New TestInitMpsEmptyBonds in tests/network/test_automps.py covers the three
    (L, target_qn) pairs that used to come back with every bond at dimension zero, and
    pins both halves of why that deserves an error: the sector is reachable, since
    bond_dim=1 builds it at unit norm, and a target the random mode can realize is
    untouched by the guard. test_norm_is_one asserts the unit norm across the five
    physical spaces the random mode is exercised on, including SU(2), where the norm has
    to be read off the MPS rather than from the blocks because of the CG normalization
    factors.

📊 Statistics

  • 1,357 tests across 38 test modules (up from 1,313 in v0.3.1; no new modules).
  • 30 commits since v0.3.1.
  • 24 files changed, 1,364 insertions, 184 deletions.
  • 35 source modules in five subpackages: alice.network, alice.physics,
    alice.algorithm.dmrg, alice.algorithm.xtrg, alice.algorithm.tdvp (unchanged from
    v0.3.1).

✅ Compatibility

Breaking Changes: none.

Behavioral Changes:

  • xtrg.Options.trunc_thresh is read as a relative cutoff, and its default changes from
    1e-15 to 1e-12. A value tuned against the old absolute meaning will truncate far
    more than it used to; the relative value that reproduces it depends on the chain length
    and temperature it was tuned at. The accuracy floor of a run without a bond cap is
    unchanged at the new default.
  • xtrg.Options.z_tol is read relative to ‖C_prev‖. Long-chain runs that stopped after
    one sweep per squaring step will now use more of their n_sweeps budget, and take
    correspondingly longer.
  • DMRG and XTRG '1sp' runs expand bonds more conservatively at a fixed expand_k.
    DMRG energies are unchanged; an XTRG run that wants the old accuracy needs a smaller
    trunc_thresh.
  • init_mps(..., bond_dim=N) with N > 1 raises ValueError for a target_qn whose
    charge path strays from the center-bond sector, instead of returning an MPS with every
    bond at dimension zero. bond_dim=1 reaches those sectors and is unaffected.
  • init_mps(..., mode='random') returns a normalized MPS. Code reading the norm of the
    returned state will see 1.0 rather than an arbitrary number.

Requirements:

  • Python ≥ 3.11
  • PyTorch ≥ 2.5
  • Nicole ≥ 0.4.2

📝 Notes

Both corrections in this release are the same mistake in two guises: a quantity used as
though it were something it is not. A center tensor is not an isometry, so M M† is not
the projector onto the space it spans, and the complement search that assumed otherwise
kept rediscovering directions the bond already held. An absolute threshold is not a
scale-free cutoff, so a number that was right on a four-site chain was wrong by four
orders of magnitude on a long one — and nothing in a completed run says so. An XTRG run
on a long chain came back faster, at a smaller bond dimension, having stopped each
variational fit after a single sweep, and reported nothing unusual.

What makes the truncation case worth dwelling on is that XTRG is the algorithm where it
could happen. DMRG and TDVP truncate a normalized state, so the spectrum they cut always
sits at unit scale and an absolute cutoff is a relative one by accident. XTRG squares
unit-norm operands against each other, which puts the object being fitted a factor of
roughly d^{-L/2} below unit norm while the run is hot and climbing as it cools, so the
scale is a property of where the run is rather than of anything the user set. The fix is
not a better number but a measurement: read the norm of the tensor about to be
decomposed, once per half-sweep where it is cheapest and most conservative, and let the
threshold mean the same thing everywhere.