Repository navigation
Alice 0.5.0
Alice 0.5.0 — TgTRG: Cooling Along the Tangent Space
Release Date: November 22, 2026
Version 0.5.0 introduces TgTRG (tangent-space Tensor Renormalization Group), Alice's
fifth algorithm and its second route to finite temperature. Where XTRG reaches β by
squaring the density matrix and fitting the product back down, TgTRG projects the
imaginary-time flow dρ/dβ = -Hρ onto the tangent space of the MPO manifold and takes one
sweep per step — the same projector splitting TDVP uses for real time, applied to ρ
read as a super-MPS over the doubled physical space. A sweep costs O(D³) against XTRG's
O(D⁴) fit, and the β grid is no longer forced to double: it can be exponential, as
XTRG's is, or linear, which is where the algorithm earns its keep. Two schemes ship, '1s'
and '2s'. No breaking API changes.
🌡️ What TgTRG Is
ρ(β) = e^{-βH}obeysdρ/dβ = -Hρ. Restrictingρto the MPO manifold turns that into
the projected flowdρ/dβ = -P_{T_ρ} H ρ, and the tangent-space projector splits into a
sum of local terms that are integrated one at a time along a sweep.- Each term is a local propagator:
A_i(β+τ) = e^{-τ H⁽¹⁾} A_ion a site tensor going
forward, andS_i(β+τ) = e^{+τ H⁽⁰⁾} S_ion the bond matrix left behind. The backward
sign is not a typo and not an approximation — it subtracts the double counting that two
overlapping site updates introduce, exactly as in TDVP. Hacts on the density matrix as a super-operator from one side only. Read as a
super-MPS over the doubled physical space,ρhas an incoming and an outgoing physical
index per site; the Hamiltonian contracts the incoming one, and the outgoing one is a
spectator closed from bra to ket. Every environment block therefore carries three
indices,(bra_ρ_bond, H_bond, ket_ρ_bond), as in DMRG — the doubled physical space
shows up in the local tensors, not in the environments.- When the bond dimension is large enough that the manifold is the whole space, the
projector-splitting integrator is exact — at either order, and for any step size.
So the step size is a weaker accuracy knob here than in TDVP. It matters once the rank
is limited, where the projection actually projects, and it matters for the arithmetic
described below.
🧊 The Cooling Driver
tgtrg.run
- New
alice.algorithm.tgtrgpackage exportingOptions,Summary,Artifact, and
run, withtgtrgadded to thealice.algorithmand top-levelalicenamespaces. tgtrg.run(state, mpo, opts)returns a(Summary, Artifact)pair. The Hamiltonian MPO
is a positional argument, the one signature difference fromxtrg.run: XTRG needsH
only to build the Taylor state and never refers back to it, while TgTRG contracts
against it at every step.- Building
ρ(τ₀)and wrapping it as anArtifactatstep=0is the caller's job, as in
XTRG, andthermal_mpodoes it. n_stepsis the absolute step index to stop at, counted from the Taylor state, not a
number of additional steps to perform. Handingrun()a state already atn_stepsis
the no-op it looks like; handing it one pastn_stepsraises.- The checkpoint layout is XTRG's: the shared
thermal.ckptfor the latestSummary, the
algorithm-namedtgtrg.ckptfor the latestArtifactwhile running (removed on
success), andartifacts/archives thinned byOptions.save_artifacts_every, which
always keeps the final step whatever the stride says. - Resuming an interrupted run, and continuing a finished one under new options, are the
same call:run()again with anArtifactloaded fromtgtrg.ckptor any archived
step, the matching history recovered fromthermal.ckpt. Starting from a step before
the end of a recovered history truncates it back to that step, with a warning. - The environment store is the same sliding-window-plus-async-I/O
Environmentthe other
four algorithms carry, with the sameenv_cache_dir/env_async_io/env_window
triple and per-run UUID subdirectory.
Update Schemes
- 2-site (
'2s', the default) evolvesΘ, the contraction of a neighboring pair, then
splits it by SVD undermax_bond/trunc_threshand back-evolves the single site it
advanced onto. It is the only scheme that can change a bond dimension, so it is the one
that letsρgrow as the chain cools. - 1-site (
'1s') evolves each site tensor and each bond matrix in turn, and cannot
change a bond dimension at all. The rank it runs at is the rank of the state it is
handed, which is also the only routemax_bondhas to it: the initial state is compacted
to the cap before the first step. The resulting error floor onlog Zis
τ-independent, and well above what'2s'reaches on the same grid. trunc_threshis relative to‖Θ‖, and the cooling sweeps hold‖Θ‖at1: the local
propagators return their output at the norm of their input exactly, and the center is
renormalized every step.'1sp'(controlled bond expansion) is accepted byOptionsfor forward compatibility
and rejected byrun()withNotImplementedError, as VUMPS's was in 0.4.0. Scheme
aliases ('2-site','two-site', …) resolve inOptions.__post_init__, matching the
other four algorithms.order=1is one forward half-sweep,O(τ²)per step;order=2is the symmetric
forward-then-backward pair,O(τ³). At full rank the two agree exactly, the integrator
being exact and not the orders being close.
📉 The β Grid
Two Modes, Never Both
Options.gridselects'exp'(stepτ = β, soβ_n = 2^n τ₀) or'lin'(step
τ = Options.tau, soβ_n = β₀ + n τ). A run uses one or the other; a schedule needing
both is tworun()calls, the second resuming from the first'sArtifact.- Every grid parameter is a scalar or a string, so a stacked schedule serializes as two
TOML sections and nothing about the grid lives in a callable. Summary.tausrecords the increment each entry was reached with. It tells the phases of
a stacked schedule apart after the fact, and the non-uniform finite differences need it.
How Large a Step Is Too Large
- The backward bond update propagates by
exp(+τ H⁽⁰⁾), which amplifies the high-energy
end of the local spectrum byexp(τ ΔE). Once that factor exceeds the inverse of
float64 resolution, it amplifies roundoff along with the state. The limit is therefore
onτ ΔE, not on β. - Nothing downstream notices. The Krylov expansions converge in the bad step just as in
the good ones, because they solve the local problem they were given correctly; what
drifts is the state they are applied to.run()therefore warns when a schedule
contains a step past a conservative soft limit ofτ = 8— a warning and not a refusal,
since the limit scales with a spectral range the driver cannot know. - The exponential grid walks into this on its own, its step size being
β. So the
schedule to use is the stacked one: exponential out of the high-temperature regime where
the Taylor state lives, linear from there on. The defaultn_stepsstops the exponential
phase atβ = 2, where that handover belongs.
Observables
log Z(β)comes fromNormalMPO.log_trace()at every step — neverlog(trace()), so it
stays finite whenZ(β)itself is far outside float64 range — and the free energy
follows from it directly. Both are accurate to roundoff while the rank suffices.u,c_V, andSare finite differences oflog Zon theβgrid, taken with the
non-uniform three-point formula in the interior and one-sided at the ends, since a
stacked schedule has no uniform spacing to assume. They are only as good as that
spacing,c_Vleast of all, and worst across a junction where the spacing jumps.Options.obs_exactadds a direct measurement ofu = Tr[ρH] / (Tr[ρ] L)at each step,
free of discretization error. It defaults toFalseso that the cooling pays for nothing
irrelevant to itself; switched on, the gap betweenenergiesandexact_energiesis
the discretization error, the cheapest way to decide whether a grid is fine enough.
🔢 The Krylov Exponential
- New
krylov.pywithlanczos_expv, an imaginary-time Lanczos exponential. The projected
matrix is real symmetric, soexp(-τT)is formed througheighinstead of a general
matrix exponential. - The contract is
exp(-τH) v = exp(log_scale) · wwith‖w‖ = ‖v‖exactly: all of the
magnitude is factored intolog_scale, with the propagator column assembled in log space
including the eigenvector overlaps. Shifting by an extremal eigenvalue is not enough.
Imaginary time runs the local spectrum over a range ofτ ΔEin the exponent, so at the
step sizes an exponential grid reaches, coefficients underflow as readily as they
overflow, and an underflowed column arrives as a vector of zero norm that nothing
downstream can normalize. - The returned error estimate is the usual last-coefficient residual, and
Summary
records the largest over each step's local propagators.
🧪 Tests
- Six new modules under
tests/algorithm/tgtrg/—test_krylov.py,test_environ.py,
test_scheme_1s.py,test_scheme_2s.py,test_sweep.py,test_tgtrg.py— plus a
conftest.pycarrying free-fermion Hamiltonians, thermal states, and the analytic
grand-canonical references. - The exponential is pinned against a dense
eighreference, the norm contract, and the
scale factoring at step sizes where a naive assembly underflows. The environment blocks
are validated against an independentNormalMPO-basedTr[ρ̂Hρ̂]in both sweep
directions, along with the window, the disk cache, and a reload after eviction, before
anything is built on top of them. - The scheme modules cover the effective Hamiltonians and their Hermiticity, the local
propagations, the splits and absorptions, the discarded weight, and the exact identities
relating a site update to its bond partner — a site-plus-bond pair realizes
-τ(H⁽¹⁾ - H⁽⁰⁾), not-τH, the fact the back-update exists for. test_sweep.pypins the half-sweeps againstthermal_mpoatβ + τ, and replaces the
convergence-rate tests one would expect with the two statements that are actually true:
a full-rank step is exact, and a rank-limited run has aτ-independent accuracy floor.test_tgtrg.pycovers the options and their TOML round trip, the serialization, the grid
modes and their aliases, resume and artifact stride, the large-step warning, and full
runs on free-fermion and Hubbard chains against the exactlog Z,f,u, andc_V.
📚 Documentation
- New
docs/algorithms/tgtrg/section — overview,Options,Summary,Artifact,
Lessons, andrun— covering the projection and how it relates to TDVP and XTRG, the
two schemes and what'1s'cannot do, the integrator orders and why they agree at full
rank, the two grid modes, and whichSummarycolumns to trust. docs/algorithms/tgtrg/lessons.mdis the measured account of the step size, and
separates its two regimes: a propagator column that stops being representable, closed
off by the log-space assembly, and the one that remains open well earlier inτ, where
the amplification exceeds what float64 can resolve. Varying the hopping so thatΔE
moves while nothing else does places the breakdown at(τ/2) ΔE ≈ log(1/eps), which
makes the soft limit conservative for a spectrum of order a few and silent past it.
Also there: why refiningτunder a rank limit saturates after about three refinements,
the projection error accruing per unit of β and not per step; the resulting tuning order,
max_bondfirst; why the propagator scale is measured on every call instead of
precomputed from‖H‖, with timings showing there is nothing to save; and thatrun()
cools in place, so oneArtifactserves one continuation.- New
docs/examples/tgtrg/walkthroughs: the spinless chain against the exactlog Z,
u,c_V, andS, and the Hubbard chain with Z(2)×SU(2) symmetry against twice the
spinlesslog ZatU = 0, readingmax_bondsanddiscarded_weightsalongside the
error to separate the two regimes a capped run passes through. - The algorithms index, examples index,
mkdocs.ymlnavigation, and README all gain TgTRG
sections, ordered DMRG, VUMPS, TDVP, TgTRG, XTRG — the two finite-temperature algorithms
now adjacent, with the tangent-space one first. The README's "Upcoming" list loses the
TgTRG entry it has carried since 0.1.0.
📝 Examples
examples/examples_tgtrg/tgtrg_spinless.py: the spinless free-fermion chain on the
stacked schedule, printinglog Z,f,u,c_V, andSbeside their analytic values
with the bond dimension and the relative error per step.examples/examples_tgtrg/tgtrg_spinful.py: the Hubbard chain, exactly solvable at
U = 0and run at anyU, with--obs-exactas the way to quote an internal energy
once the bond is capped.- Both scripts expose the full option surface — the grid and its handover flags, the
scheme, the integrator order, the bond cap, the exact-observable switch, and the
checkpoint and environment-cache settings — and both close with a note on which printed
columns carry the grid's error.
📊 Statistics
- 2,057 tests across 53 test modules (up from 1,779 / 47 in v0.4.2).
- 33 files changed, 8,683 insertions, 3 deletions.
- 51 source modules in seven subpackages:
alice.network,alice.physics,
alice.algorithm.dmrg,alice.algorithm.vumps,alice.algorithm.tdvp,
alice.algorithm.tgtrg,alice.algorithm.xtrg.
✅ Compatibility
Breaking Changes: none.
Behavioral Changes: none. TgTRG is additive; the only changes outside its own package
are the two namespace exports and the documentation.
Requirements:
- Python ≥ 3.11
- PyTorch ≥ 2.5
- Nicole ≥ 0.4.2
📝 Notes
TgTRG sits between the two algorithms it borrows from, and takes the shape of each where
it applies. From XTRG come the thermal data structures and everything around the run: the
NormalMPO with its log_scale, thermal_mpo for the initial state, log_trace() for
log Z, the Artifact/Summary split, the checkpoint layout, and the disk-spilling
environment store. From TDVP comes the algorithm itself: the tangent-space projection, the
forward-site and backward-bond propagators, the Krylov exponential, and the symmetric
composition. New here is the pairing — imaginary time on an operator, not real time on a
state — and the two things that pairing changes.
The first is arithmetic. Real-time propagators are unitary, so a TDVP step cannot change
the scale of anything; imaginary-time ones span exp(τ ΔE) in magnitude, and at the step
sizes a doubling grid reaches, that range is wider than float64. Hence a Krylov routine
that factors its entire magnitude into a logarithm, and a driver that warns about steps it
can still technically take.
The second concerns what the step size is for. The projector splitting is exact when the
manifold is the whole space, so a step size is not buying accuracy in the integrator —
it is buying accuracy in the projection, and avoiding the arithmetic above. That is the
case for the stacked schedule, and the reason the grid modes are two separate modes and not
one adaptive rule: the exponential phase exists to get out of the high-temperature
regime in a handful of sweeps, the linear phase to place steps where the physics is, and
the β the handover belongs at is a property of the model's spectrum, not something a
default can know.