Skip to content

Alice 0.5.0

Choose a tag to compare

@changkai-zhang changkai-zhang released this 22 Nov 03:11
· 23 commits to stable since this release

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} obeys dρ/dβ = -Hρ. Restricting ρ to the MPO manifold turns that into
    the projected flow dρ/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_i on a site tensor going
    forward, and S_i(β+τ) = e^{+τ H⁽⁰⁾} S_i on 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.
  • H acts 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.tgtrg package exporting Options, Summary, Artifact, and
    run, with tgtrg added to the alice.algorithm and top-level alice namespaces.
  • tgtrg.run(state, mpo, opts) returns a (Summary, Artifact) pair. The Hamiltonian MPO
    is a positional argument, the one signature difference from xtrg.run: XTRG needs H
    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 an Artifact at step=0 is the caller's job, as in
    XTRG, and thermal_mpo does it.
  • n_steps is the absolute step index to stop at, counted from the Taylor state, not a
    number of additional steps to perform. Handing run() a state already at n_steps is
    the no-op it looks like; handing it one past n_steps raises.
  • The checkpoint layout is XTRG's: the shared thermal.ckpt for the latest Summary, the
    algorithm-named tgtrg.ckpt for the latest Artifact while running (removed on
    success), and artifacts/ archives thinned by Options.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 an Artifact loaded from tgtrg.ckpt or any archived
    step, the matching history recovered from thermal.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 Environment the other
    four algorithms carry, with the same env_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 under max_bond / trunc_thresh and 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 route max_bond has to it: the initial state is compacted
    to the cap before the first step. The resulting error floor on log Z is
    τ-independent, and well above what '2s' reaches on the same grid.
  • trunc_thresh is relative to ‖Θ‖, and the cooling sweeps hold ‖Θ‖ at 1: 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 by Options for forward compatibility
    and rejected by run() with NotImplementedError, as VUMPS's was in 0.4.0. Scheme
    aliases ('2-site', 'two-site', …) resolve in Options.__post_init__, matching the
    other four algorithms.
  • order=1 is one forward half-sweep, O(τ²) per step; order=2 is 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.grid selects '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 two run() calls, the second resuming from the first's Artifact.
  • 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.taus records 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 by exp(τ Δ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 default n_steps stops the exponential
    phase at β = 2, where that handover belongs.

Observables

  • log Z(β) comes from NormalMPO.log_trace() at every step — never log(trace()), so it
    stays finite when Z(β) 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, and S are finite differences of log Z on 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_V least of all, and worst across a junction where the spacing jumps.
  • Options.obs_exact adds a direct measurement of u = Tr[ρH] / (Tr[ρ] L) at each step,
    free of discretization error. It defaults to False so that the cooling pays for nothing
    irrelevant to itself; switched on, the gap between energies and exact_energies is
    the discretization error, the cheapest way to decide whether a grid is fine enough.

🔢 The Krylov Exponential

  • New krylov.py with lanczos_expv, an imaginary-time Lanczos exponential. The projected
    matrix is real symmetric, so exp(-τT) is formed through eigh instead of a general
    matrix exponential.
  • The contract is exp(-τH) v = exp(log_scale) · w with ‖w‖ = ‖v‖ exactly: all of the
    magnitude is factored into log_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 τ ΔE in 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.py carrying free-fermion Hamiltonians, thermal states, and the analytic
    grand-canonical references.
  • The exponential is pinned against a dense eigh reference, the norm contract, and the
    scale factoring at step sizes where a naive assembly underflows. The environment blocks
    are validated against an independent NormalMPO-based Tr[ρ̂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.py pins the half-sweeps against thermal_mpo at β + τ, 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.py covers 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 exact log Z, f, u, and c_V.

📚 Documentation

  • New docs/algorithms/tgtrg/ section — overview, Options, Summary, Artifact,
    Lessons, and run — 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 which Summary columns to trust.
  • docs/algorithms/tgtrg/lessons.md is 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_bond first; why the propagator scale is measured on every call instead of
    precomputed from ‖H‖, with timings showing there is nothing to save; and that run()
    cools in place, so one Artifact serves one continuation.
  • New docs/examples/tgtrg/ walkthroughs: the spinless chain against the exact log Z,
    u, c_V, and S, and the Hubbard chain with Z(2)×SU(2) symmetry against twice the
    spinless log Z at U = 0, reading max_bonds and discarded_weights alongside the
    error to separate the two regimes a capped run passes through.
  • The algorithms index, examples index, mkdocs.yml navigation, 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, printing log Z, f, u, c_V, and S beside 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 = 0 and run at any U, with --obs-exact as 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.