Repository navigation
Alice 0.3.2
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.complementand
alice.algorithm.xtrg.complementbuilds 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_backwardin 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:
decompkeeps 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 trapalice.algorithm.tdvp.complementalready 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 spinlessL = 10run ends at1.2e-06
relative error in log Z rather than1.1e-07, both far below the1.6e-03of the
plain 1-site scheme, and a smallertrunc_threshrecovers it. The spinfulL = 10
run is unaffected at2.3e-08, and no longer depends on the expansion budget at all. - The projector helpers take their second argument as
A/Bafter 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_threshis now a relative cutoff: a singular value is
discarded when it falls belowtrunc_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·Bon the unit-norm internal tensors of twoNormalMPO
factors, so the object being truncated has a norm of roughlyd^{-L/2}while the run
is hot, climbing toward1as it cools. Handed straight to Nicole'sthreshmode,
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
_Truncationinalice.algorithm.xtrg.sweepcarries 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 fitmpo_cis still the unit-norm copy of
mpo_ait 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, andmax_bondalone limits the
bond. Atrunc_threshof0.0needs 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_mpoare 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_scaleand normalizes the site tensors before its truncating sweep, so its
cutoff already acts on a unit-scale spectrum. - The default moves from
1e-15to1e-12. Read relatively,1e-15asks for far
more precision than the rest of the cooling delivers: on a free-fermion chain with no
bond cap it kept 599 states where1e-12kept 377, both landing on the same accuracy
floor of about1e-10in the per-site log Z. run()labels both thresholds(relative)in its startup block.
🎚️ Relative Fit Convergence
z_tolnow stops the inner variational fit when
|‖C‖ − ‖C_prev‖| < z_tol × ‖C_prev‖, for the same reasontrunc_threshis
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_normcannot 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.0still means "never stop early" and runs the fulln_sweepsbudget.
🌱 Random MPS Initialization
init_mpswithbond_dim > 1draws 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_mpsreturned 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
raisesValueError, namingbond_dim,target_qn, andL, and pointing at the two
routes that do work:bond_dim=1with an explicitconfig=, orscheme='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 withLandbond_dimand 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.pyall acceptscheme='1sp'and exposeexpand_kand
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 whatevermax_bondsays, 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.pyandxtrg_spinful.pyfollow the newtrunc_threshdefault and
describe the option as relative.
📚 Documentation
docs/algorithms/xtrg/lessons.mdis 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 forz_tol, and an admonition that relative is not an error bound. The
practical guidance to scaletrunc_threshdown when moving to a longer chain is gone,
the mechanism it worked around having been removed.docs/examples/tdvp/free-fermion.mdgains a three-scheme table; the 2-site advantage
it shows is the local step, not extra bond dimension.docs/examples/tdvp/domain-wall.mdgains 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 from0.47to the
measured0.421for the parameters the page actually uses.docs/examples/tdvp/hubbard.mdgains a section on bond expansion under a non-Abelian
group, whereexpand_kcounts 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.mdidentifies 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 to6.7e-14at zero discarded weight —
since neither energy conservation nor cross-group agreement would report the failure.
🧪 Tests
- New
TestCenterIsometryintests/algorithm/dmrg/test_scheme_1sp.pyand 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 defaultalpha=2the left half contracts to a norm of order
1e-11on that fixture and every assertion about it would hold vacuously. - New
TestTruncationintests/algorithm/xtrg/test_sweep.pycovers_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
TestTruncationScalescales 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 bymax_bondalone. - New
TestChainLengthPortabilityintests/algorithm/xtrg/test_xtrg.pycools 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 newtrunc_threshdefault is pinned in the options test. - New
TestInitMpsEmptyBondsintests/network/test_automps.pycovers 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=1builds it at unit norm, and a target the random mode can realize is
untouched by the guard.test_norm_is_oneasserts 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_threshis read as a relative cutoff, and its default changes from
1e-15to1e-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_tolis read relative to‖C_prev‖. Long-chain runs that stopped after
one sweep per squaring step will now use more of theirn_sweepsbudget, and take
correspondingly longer.- DMRG and XTRG
'1sp'runs expand bonds more conservatively at a fixedexpand_k.
DMRG energies are unchanged; an XTRG run that wants the old accuracy needs a smaller
trunc_thresh. init_mps(..., bond_dim=N)withN > 1raisesValueErrorfor atarget_qnwhose
charge path strays from the center-bond sector, instead of returning an MPS with every
bond at dimension zero.bond_dim=1reaches those sectors and is unaffected.init_mps(..., mode='random')returns a normalized MPS. Code reading the norm of the
returned state will see1.0rather 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.