Release notes#
The full changelog is reproduced below, newest first; the format follows
Keep a Changelog and versions are YYYY.MINOR.PATCH (a calendar year,
then a minor number that increments with each release of that year). Start with the upgrade notes if
you are moving an existing codebase forward.
Upgrading from 2026.4.0#
The frame stores up and down have swapped names: a name that kept its spelling now means the other store,
and it need not raise. frame.up_ranks was the Tucker factors’ ranks and is now the up cores’ mode legs;
UT3Frame.nU was the padded Tucker width and is now the up store’s. At a minimal frame the two stores agree, so
such code even returns the right numbers there: search for the names below rather than waiting for an error. When
a stale width keyword does raise (a swapped width below the other store’s ranks), the error comes from inside numpy
and does not name the width.
Why. A store is now named for the side of its edge that its cores occupy, as left and right always were.
Draw the TT chain on top and the Tucker factors below it: the up store is the TT-shaped cores above each Tucker
edge (up-orthogonal), the down store the Tucker factors below it (down-orthogonal). The 2026.4.0 words named
where the cores’ edges point, the opposite way, and disagreed with the method names up_orthogonalize_tt_cores and
down_orthogonalize_tucker_cores, which are unchanged. See
Four rank stores.
2026.4.0 |
2026.5.0 |
raises if left? |
|---|---|---|
|
|
no |
|
|
no |
|
swapped |
no |
|
swapped |
no |
|
swapped |
no |
keywords |
swapped |
no |
properties |
|
no |
keywords |
|
no (it need not) |
|
|
yes |
|
|
yes |
keywords |
|
yes |
|
|
yes for a |
Migrate in one pass. Two sed passes undo each other. Swap every name at once, longest first, and only these
(never a *_orthogonalize_* or *_svd* name, whose words are unchanged):
import re
SWAP = {'up_tucker_cores': 'down_tucker_cores', 'down_tt_cores': 'up_tt_cores',
'up_tucker_cores_dot': 'down_tucker_cores_dot', 'down_tt_cores_dot': 'up_tt_cores_dot',
'up_tucker_supercore': 'down_tucker_supercore', 'down_tt_supercore': 'up_tt_supercore',
'up_ranks': 'down_ranks', 'down_ranks': 'up_ranks',
'up_weights': 'down_weights', 'down_weights': 'up_weights',
'up_weight_supercore': 'down_weight_supercore', 'down_weight_supercore': 'up_weight_supercore',
'up_mask': 'down_mask', 'down_mask': 'up_mask',
'variations_up_mask': 'variations_down_mask', 'variations_down_mask': 'variations_up_mask',
'nU': 'nD', 'nD': 'nU'}
pattern = re.compile(r'\b(' + '|'.join(sorted(SWAP, key=len, reverse=True)) + r')\b')
source = pattern.sub(lambda m: SWAP[m.group(1)], source) # then review the nU/nD hits: they may be your own names
\b treats _ as a word character, so up_mask does not match inside variations_up_mask, nor up_tucker_cores
inside up_tucker_cores_dot (hence its own entry). rL and rR are unchanged. Your own nU/nD locals are
swapped along with the keywords, which keeps them consistent.
update needs a hand edit. It takes a tuple of the new store letters, any order: 'D' down, 'U' up, 'L'
left, 'R' right. Swap each old letter ('U' → 'D', 'O' → 'U'; 'L' and 'R' stay) and split: 'ULRO' →
('D', 'U', 'L', 'R') (the default), 'UL' → ('D', 'L'), not ('U', 'L'), which now updates the up store; 'RO'
→ ('U', 'R'). Every str raises:
ValueError: update must be a non-empty tuple of the store letters 'D', 'U', 'L', 'R' without repeats (D down, U up, L left, R right), e.g. ('D', 'L'); got 'ULRO'; that is the 2026.4.0 form, whose 'U' was the Tucker store (now 'D') and 'O' the TT-shaped store (now 'U'): swap each letter and pass a tuple, e.g. 'UL' -> ('D', 'L'), not ('U', 'L'), which now means up and left
A tuple or list of the old letters, which 2026.4.0 also accepted, raises only if it holds 'O': convert it the same
way, or it runs with the new meaning.
What does not change. Positions: T3Frame.data and every rank, mask, weight and uniform tuple keep their order,
which now reads (down, up, left, right), so up, down, left, right = frame.data keeps working (rename the locals
to read right), and so do positional width calls (UT3Frame.from_t3frame(F, N, 7, 5)). Saved files load unchanged.
Every number is bit-identical, seeded starts included. The orthogonalization and SVD method names, every optimizer
keyword and every other public name are unchanged.
Letters. Diagrams, equations and shape comments write D, U, L, R and the widths nD, nU, rL, rR;
a T3’s own cores are B, G; a variation-shaped array is V or H by its shape; the jet shift is sh / shᵀ
and the derivative an upright d. Docs before 2026.5.0 wrote U for the Tucker factor and O for the TT-shaped
core. T4S writes U, O, P, Q for our D, U, L, R; its δU is our V (tucker_variations), its δG our H
(tt_variations).
Also new, and opt-in. newton_cg(timing=True) splits each Newton row’s wall time by phase
(fitting_and_optimization.md §4.13), and newton_cg(hessian='switch') starts with
Gauss-Newton and switches to the exact Hessian (§4.14). Without them, every number a run returns is 2026.4.0’s.
Upgrading from 2026.3.0#
Nothing breaks. Every addition is opt-in, and no default changes: the Newton reference stays 'zero', and a
newton_cg call without the new keywords returns bit-identical stats. What is new, and when to reach for it:
The aligned start after a rank increase. Pass the previous level’s point to
newton_cg(..., padded_from=x_old). Iteration 0 then linearizes at the frame ofx0(that point, zero-padded) whose new directions are aligned with the misfit gradient.padded_max_passes=0gives the cheap hint-free start instead. The otherpadded_*keywords (padded_oversampling,padded_oversampled_passes,padded_tol,padded_alternate,padded_seed) tune the alignment;stats['start_frame']andstats['start_movements']record it.start_frame=Ftakes a frame you built.The cone reference.
g0_reference='cone'(fornewton_cgandgradient_descent) measures‖g₀‖at the zero tensor on the frame aligned with the data gradient there. It is larger than'zero'(20–100× on the measured Darcy fits), so the samegtol_relstops looser; lowergtol_relwith it if you want the old stopping point. Its options are thecone_*keywords, andstats['cone_movements']records the passes.With jax arrays, pass
use_jit=True. The alignment otherwise compiles every operation of each new structure eagerly, which is slow on the first call and can exhaust the process memory-map limit over a long rank continuation.Both need a manifold geometry (
MANIFOLD,UNIFORM_MANIFOLDor a shared wrapper of one). On the uniform layer,padded_frommust be padded tox0’sN:UniformTuckerTensorTrain.from_t3(x_old, N=x0.N).
A rank continuation that adopts both (the pattern of the downstream T3Polynomial ladder):
x_old = None
for level in range(max_levels):
kw = dict(g0_reference='cone', gtol_rel=gtol)
if x_old is not None:
kw['padded_from'] = x_old # align the new directions with the misfit gradient
x, stats = newton_cg(MANIFOLD, kind, sample, data, x, **kw)
new_tucker, new_tt = x.continuation_ranks()
if (new_tucker, new_tt) == (x.tucker_ranks, x.tt_ranks):
break
x_old, x = x, x.resize(x.shape, new_tucker, new_tt)
On the first level there is no previous point, so leave out padded_from and every padded_* option: the
optimizer rejects padded_* options given without padded_from. The new frame functions (T3Frame.padded,
fv_aligned_padded_frame and their uniform twins, T3Tangent.align_padded, backend.optimizers.padded_start)
are for custom optimizers. See aligned_padded_frame.md for the method, the measured
results, and the jit-or-eager costs.
Upgrading from 2026.2.0#
Most code runs unchanged; the exact Hessian is opt-in (newton_cg(..., hessian='exact'), Gauss-Newton stays
the default). What can break, roughly by how likely you are to meet it:
The default Newton reference moved (manifold geometries). newton_cg’s relative stop and CG forcing
term, and gradient_descent’s stop, are now relative to the gradient norm at the zero tensor of x0’s
ranks (g0_reference=None, resolved to 'zero'), not the warm-start ‖g(x0)‖. Every manifold run stops
at a slightly different point – an O(1) factor in the reference, zero starts included. To keep the
2026.2.0 behaviour pass g0_reference='warm_start'; the explicit g0norm_newton / g0norm_cg overrides
still win (and must now be > 0: a non-positive value raises ValueError). Corewise geometries keep the
warm start.
Delete your reference bookkeeping. A continuation loop that carried stats['history'][0]['gnorm'] from
one level into the next level’s g0norm_newton can drop it: the default reference is already per level
and at the level’s own scale. If a loop passed g0norm_newton=None meaning “use the warm start”, that now
gets the zero reference – say g0_reference='warm_start' instead. A cold start at zero
(TuckerTensorTrain.zeros(...) as x0) remains available at every level, in either Hessian mode; its
default reference is the same as the warm start’s at those ranks.
stats['newton'] is gone; read stats['newton_steps'] (the same count: CG solves). Beside it are
stats['newton_accepted'] (steps taken) and stats['stop_reason'].
Two stats['history'] fields read differently under the trust region. A trust-region row
(step_control='trust_region', the default with hessian='exact') has ls_steps = ls_failed = None and
alpha = 1.0, so code that sums ls_steps should filter rows on step_control. cg_truncated no longer
counts a trust-region boundary stop (a Steihaug stop on nonpositive curvature is a boundary step, reported in
the new cg_boundary). With the default line search there is no boundary, so Gauss-Newton runs read both
fields exactly as before.
fitting.GaussNewtonModel is now fitting.LocalModel (and t3toolbox.LocalModel at the root).
It is renamed, not aliased, so the old name raises AttributeError / ImportError; rename it where you
spell it. The six *_model factories, the model’s methods and its fields are unchanged, so code that
only calls the factories needs no change. The new name mirrors the backend class it wraps,
backend.optimizers.LocalModel.
optimizers._setup is gone; use optimizers.least_squares_problem. It takes the same arguments
(geometry, kind, sample, data, x0, order, weight, regularizer, chunk_size, batch, plus hessian) and
returns a named LeastSquaresSetup instead of a 3-tuple, so read its fields rather than unpacking:
setup = optimizers.least_squares_problem(geometry, kind, sample, data, x0, order=order, weight=weight)
lm = setup.problem.local_model(setup.x0_cores) # was: problem, init, rewrap = optimizers._setup(...)
setup.problem.geom is the backend geometry that the private optimizers._geometry_ops(...) used to
give you; _geometry_ops stays private.
optimizers.newton_cg takes explicit keywords only. Every valid call is unchanged; a misspelt option
now raises TypeError at the call instead of failing later inside the backend.
Custom kinds and geometries keep working for Gauss-Newton. To use them with hessian='exact', a
SamplingKind adds the sixth operation corewise_hessian (the derivative of its transpose along raw
core directions), and a geometry the four exact-mode members curvature_precompute, lift,
lift_transpose and tangential_curvature (the Geometry protocol in backend/optimizers.py); without
them an exact model raises a structural error naming what is missing. A geometry may also add
zero_point_frame (optional, looked up duck-typed): without it the default reference is the warm start, as
in 2026.2.0.
Backend callers of the jet kernels (backend.sampling_derivatives): the trs arguments are gone (the
order is read off the jets, or passed as order), compute_dxi_tilde_jets returns only its two read rows,
and binomial_combine_tensor and the dense *_trs kernels are removed. Code that only calls the
transposes, the forwards or the optimizers is unaffected. estimate_chunk_size / max_chunk_size_within
now measure the compiled chunked program, so they return larger chunks and chunk_size='auto' chunks less.
Uniform transposes return exact zeros in their padding. Results that respect “padding is don’t-care” are bit-identical; only code that read the padded slots sees a difference.
The safe-mode gauge check is scaled by the operands. MANIFOLD.norm(a - b) / inner (and the uniform
twins) no longer reject a near-cancelling difference of gauged tangents, such as a finite-difference check
of a Hessian. A tangent built by + / - / scalar * / stack_tangents is checked against its operands’
scale; a tangent computed directly (a projection, a gradient) keeps the self-relative check, so the check
is never stricter than before. Its documented limit: dividing a finite-difference quotient by its step
divides the recorded scale too, so to certify a computed tangent’s gauge, check that tangent itself (see
numerical_contracts.md).
Backend callers of tv_gauge_residual / utv_gauge_residual get the old behaviour bit for bit unless they
pass the new scale=.
Upgrading from 2026.1.0#
The optimization layer’s axis objects became classes. Everything here raises rather than failing silently, and the constructor spellings you already use mostly still work.
Geometries moved and are constructed, not fetched. backend.optimizers.MANIFOLD_OPS becomes
backend.geometry.ManifoldGeometryOps(), COREWISE_OPS becomes CorewiseGeometryOps(), and
shared_geometry_ops(base, groups) becomes base.with_sharing(sharing, shape) (ragged; the uniform twins take
with_sharing(sharing) – they carry their shape already). On the uniform side,
uniform_geometry_ops(name, x0_data, sharing) becomes
UniformManifoldGeometryOps.from_point(x0_data, sharing) (or the Corewise twin). The frontend
geometry singletons – MANIFOLD, COREWISE, UNIFORM_MANIFOLD, UNIFORM_COREWISE,
shared_manifold(...) – are untouched, so ordinary fitting code needs no change.
A custom sampling kind is a subclass now. Building one by copying an existing kind and swapping a
function – dataclasses.replace(APPLY, forward=...) – no longer type-checks. This is deliberate: that
construction copied the kind’s identity along with it, so the variant claimed to be APPLY and jit
handed back APPLY’s compiled program. Subclass ApplyKind (or the relevant base) and override the
operations you need; keep your parameters as dataclass fields and you get correct jit cache
behaviour for free.
A custom backend geometry needs three more members. The 2026.0.0 notes below show a geometry
object with frame / project / retract / inner / precompute = None. The optimizers now also call
stack_shape(x_cores) (returns the frame stack C, used by the stacked-point guard) and
base_point(frame) (the point the frame is attached to, used by the regularizer), and precompute must
be a callable returning None rather than None itself. Adding the three reproduces the old
behaviour exactly. The full surface is the Geometry protocol in backend/optimizers.py.
The six uniform kind builders are gone. uniform_apply_kind(x0_data) and its five siblings become
UniformApplyKind.from_point(x0_data) and theirs; the uniform_sampling_kind(name, x0_data, weight) /
uniform_derivatives_kind(name, x0_data, order, weight, chunk_size) dispatchers are unchanged and are
the easier route. The four ragged constructors (probe_kind, the three *_derivatives_kind) keep
both their positional and their weight= keyword spellings.
fitting.UniformGaussNewtonModel is gone. One GaussNewtonModel (renamed LocalModel in 2026.3.0,
above) now serves both representations,
and the *_model factories still dispatch on x, so fitting.apply_model(UNIFORM_MANIFOLD, ux, ...)
returns what it always did – just of the merged type. If you were checking
isinstance(m, UniformGaussNewtonModel), check the frame instead:
isinstance(m.frame, t3toolbox.UT3Frame).
Stacked points raise in the optimizers. If you were passing a stacked x0 to newton_cg,
gradient_descent, mc_sgd or adam, you were getting a TypeError from inside the loop; you now get
a NotImplementedError at the entry that says what to do. Fit the stack elements separately, or build
the local model and drive your own loop – that path supports stacked points and returns a shape-C
objective. A regularizer on a stacked point raises for a separate reason (see the changelog).
Upgrading from 2026.0.0#
Three changes in this release can break existing code. All three are mechanical, and each raises a clear error rather than failing silently.
The named contraction functions are gone. backend.contractions used to export ~104 functions
whose names spelled their own subscripts (WCa_Caib_WCi_to_WCb and relatives). They are replaced by
one interpreter, contract, and the migration is a direct rewrite — the function name is the
subscripts string:
from t3toolbox.backend.contractions import contract
# before: WCa_Caib_WCi_to_WCb(mu, G, xi, n_probe, n_frame)
# after:
contract('WCa,Caib,WCi->WCb', mu, G, xi, len_W=n_probe, len_C=n_frame)
A trailing n_probe / n_frame argument becomes the keyword len_W= / len_C=, and you only need
to supply one when the subscripts alone cannot pin the split — the error message names exactly which.
The results are numerically identical (each named function was checked against its contract call
before removal). See grouped_contractions.md.
A custom GeometryOps must accept aux. The backend geometry protocol gained an optional
precompute(frame) slot, and project / retract now take a third argument. If you implement your
own geometry, accept and ignore it:
def project(frame, variations, aux=None): ...
def retract(frame, variations, aux=None): ...
precompute = None # or a callable frame -> whatever project/retract need
The slot exists so a geometry with expensive per-frame setup pays for it once per local model instead
of once per Hessian matvec; the built-in geometries pass None. Rationale:
contributor/precompute_and_caching.md.
A custom Regularizer must accept aux. Same shape of change, for the same reason:
gradient(geom, frame, aux=None), hessian(geom, frame, p, aux=None) and
quadratic(geom, frame, p, aux=None) now receive the geometry aux, so a regularizer composed with a
shared-factor geometry reuses the frame companion instead of rebuilding it per matvec. Accept and
ignore the parameter if you do not need it.
One behavior change worth knowing about, which is not a signature break: use_jit=True now
moves your inputs onto jax rather than silently running eager when they are numpy. Runs that
previously reported “jit” timings while executing eagerly will now genuinely compile, return
jax-backed results (float32 unless you enable jax_enable_x64), and, since 2026.2.0, warn
and run eager if jax is not installed. If you were relying on the old behavior you were not
getting jit; see fitting_and_optimization.md §4.5.
[2026.5.0] — 2026-11-15#
Three headlines. The store rename (breaking): the frame stores up and down swap names, so that a store is
named for the side of its edge that its cores occupy, as left and right always were. Some names keep their
spelling and now mean the other store, so stale code need not raise. Every number is bit-identical; names, letters
and messages change. Upgrade notes: docs/release_notes.md, “Upgrading from 2026.4.0”. Phase timing for
newton_cg (timing=True): each row’s wall time split into phases (the local model’s build, the gradient, CG,
the trials, the callback, the rest), with jax’s compile wait beside each, at a cost within the run-to-run noise
(user guide: docs/fitting_and_optimization.md §4.13). Starting with Gauss-Newton and switching to the exact
Hessian (hessian='switch'): newton_cg switches for good once the exact model has predicted the objective
clearly better on consecutive steps (§4.14). Both additions are opt-in; no default changes.
Measured (the switch; A100, the uniform layer under use_jit in x64, gtol_rel=1e-3 on the default 'zero'
reference, at most 300 Newton steps a level, the Darcy rank-continuation ladder of the downstream T3Polynomial
project, 2026-11-14). On 10 points × 100 directions (six levels to rank 24) from the library’s own start frame, the
switch took 223 Newton steps and 6,303 CG iterations in 177 s (net of compile and display), against 267 / 10,751 /
275 s for hessian='exact' and 1,625 / 24,682 / 427 s for Gauss-Newton with the line search (the default), which
stopped at the step cap on 4 of the 6 levels; in Gauss-Newton apply-equivalents at measured cost, 19,794 against
33,309 and 24,682. It switched on every level after 5–8 Gauss-Newton steps, its tracking took 3 % of its time, and
at the level the validation error selected its errors were no worse than Gauss-Newton’s. The same pair on a laptop
CPU agreed: 219 against 277 Newton steps, 13,068 against 16,777 s. It is not a uniform win: restarted from the
aligned frame (padded_from), the exact Hessian took 231 Newton steps to the switch’s 303, and at 20 points × 1000
directions (eleven levels, inner TT rank to 50) the two were even at both starts (switch / exact 287 / 291 Newton
from the library start, 308 / 288 from the aligned), with the same best test error.
Changed — breaking#
The frame stores
upanddownhave swapped names: a name that kept its spelling now means the other store. These are listed first because nothing catches them: they need not raise, and when one does the message does not name the width. Same spelling, other store:up_ranks/down_ranks(T3Frame,T3FrameWeights,UT3Frame,UT3Variations,UT3FrameWeights);T3FrameWeights.up_weights/down_weights,UT3FrameWeights.up_weight_supercore/down_weight_supercore,UT3FrameMasks.up_mask/down_maskandUT3VariationsMasks.variations_up_mask/variations_down_mask(dataclass fields, so also constructor anddataclasses.replacekeywords);the
up_ranks=/down_ranks=keywords ofranks.frame_has_minimal_ranksandufv_masking.ufv_make_frame_masks;the width properties
nU/nD(UT3Frame,UT3Variations,UT3FrameWeights) and the width keywordsnU=/nD=(UT3Frame.from_t3frame,UT3Variations.from_t3variations,UT3FrameWeights.from_t3frameweights,UT3Tangent.from_t3tangent,ufv_conversions.t3frame_to_ut3frame,t3variations_to_ut3variations,t3frameweights_to_ut3frameweights,ufv_masking.ufv_make_frame_masks).nDis now the down store’s width (the Tucker factors’ rows) andnUthe up store’s (the TT-shaped cores’ mode leg).
At a minimal frame both stores have the same ranks, so stale code returns plausible numbers and is wrong only at slack. A stale width keyword pads the other store; it raises only when the swapped width is below that store’s ranks, and then from inside numpy (
index can't contain negative values). The new meaning: the up store is the TT-shaped cores above each Tucker edge (up-orthogonal, built byup_orthogonalize_tt_cores), the down store the orthonormal Tucker factors below it (down-orthogonal,down_orthogonalize_tucker_cores). In 2026.4.0 the two words named the direction the cores’ edges point, which is the other way round and disagreed with those method names. Not aliased, as forGaussNewtonModelin 2026.3.0: a meaning swap cannot be aliased.Renamed, so stale code raises (
AttributeErrororTypeError):T3Frame.up_tucker_cores→down_tucker_coresandT3Frame.down_tt_cores→up_tt_cores(dataclass fields, so also constructor anddataclasses.replacekeywords);UT3Frame.up_tucker_supercore→down_tucker_supercoreandUT3Frame.down_tt_supercore→up_tt_supercore; the backend keywordsup_tucker_cores[_dot]=→down_tucker_cores[_dot]=(probing.compute_xi,compute_deta_tilde,compute_deta_tilde_tangent;sampling_derivatives.compute_deta_tilde_jets,compute_deta_tilde_tangent_jets) anddown_tt_cores[_dot]=→up_tt_cores[_dot]=(probing.compute_eta,compute_sigma,compute_tau,compute_dxi_tilde,compute_dxi_tilde_tangent;sampling_derivatives.compute_sigma_jets,compute_tau_jets,compute_dxi_tilde_jets,compute_dxi_tilde_tangent_jets).updatetakes a tuple of single store letters in the new meaning (T3Tangent.align_padded,UT3Tangent.align_padded,padded_frames.tv_align_padded_frame,uniform_padded_frames.utv_align_padded_frame):'D'down,'U'up,'L'left,'R'right, any order, default('D', 'U', 'L', 'R'); the two-colour passes are('D', 'L'), then('U', 'R'). Convert a 2026.4.0 string letter by letter ('U'→'D','O'→'U','L'and'R'kept) and split it:'ULRO'→('D', 'U', 'L', 'R'),'UL'→('D', 'L'),'RO'→('U', 'R'). Everystrraises:ValueError: update must be a non-empty tuple of the store letters 'D', 'U', 'L', 'R' without repeats (D down, U up, L left, R right), e.g. ('D', 'L'); got 'ULRO'; that is the 2026.4.0 form, whose 'U' was the Tucker store (now 'D') and 'O' the TT-shaped store (now 'U'): swap each letter and pass a tuple, e.g. 'UL' -> ('D', 'L'), not ('U', 'L'), which now means up and left
A tuple or list of the old letters, which 2026.4.0 also accepted, raises only if it holds
'O'; otherwise it runs with the new meaning:('U', 'L')now updates the up and left stores.Migrate in one pass. Two
sedpasses undo each other. Swap every name at once, longest first, and only these (never a*_orthogonalize_*or*_svd*name, whose words are unchanged):import re SWAP = {'up_tucker_cores': 'down_tucker_cores', 'down_tt_cores': 'up_tt_cores', 'up_tucker_cores_dot': 'down_tucker_cores_dot', 'down_tt_cores_dot': 'up_tt_cores_dot', 'up_tucker_supercore': 'down_tucker_supercore', 'down_tt_supercore': 'up_tt_supercore', 'up_ranks': 'down_ranks', 'down_ranks': 'up_ranks', 'up_weights': 'down_weights', 'down_weights': 'up_weights', 'up_weight_supercore': 'down_weight_supercore', 'down_weight_supercore': 'up_weight_supercore', 'up_mask': 'down_mask', 'down_mask': 'up_mask', 'variations_up_mask': 'variations_down_mask', 'variations_down_mask': 'variations_up_mask', 'nU': 'nD', 'nD': 'nU'} pattern = re.compile(r'\b(' + '|'.join(sorted(SWAP, key=len, reverse=True)) + r')\b') source = pattern.sub(lambda m: SWAP[m.group(1)], source) # then review the nU/nD hits: they may be your own names
\btreats_as a word character, soup_maskdoes not match insidevariations_up_mask, norup_tucker_coresinsideup_tucker_cores_dot(hence its own entry).rLandrRare unchanged. Theupdatestrings need the hand edit above.What does not change. Positions:
T3Frame.dataand every rank, mask, weight and uniform tuple keep their order, which now reads(down, up, left, right), soup, down, left, right = frame.datakeeps working (rename the locals to read right), and so do positional width calls (UT3Frame.from_t3frame(F, N, 7, 5)). Saved files load unchanged (save/loadkey arrays by position). Every number is bit-identical, seededpadded_seed/cone_seedstreams included. The orthogonalization and SVD method names (down_orthogonalize_tucker_cores,up_orthogonalize_tt_cores,up_svd, …), every optimizer keyword, and every other public name are unchanged.Text only: the reprs (
T3Frame(… down_ranks=…, up_ranks=…),UT3Frame(… nD=…, nU=…)) and every error message that names a store use the new words.
Changed#
Letters in the docs, docstrings and math notes. Diagrams, equations and shape comments write the stores
D,U,L,Rwith widthsnD,nU,rL,rR(docs/frame_variations.md, “Four rank stores”); a T3’s own coresB,G(the corewise frame is(B, G, G, G):Bsubstituted forD,GforU,L,R); a variation-shaped arrayVorHby its shape, whatever computed it (e.g. the transposes’ outputsV_tilde,H_tilde); the jet shiftsh/shᵀ(wasD/U; the functions_shift_down/_shift_upkeep their names); the derivative an uprightd(dΦ); edge variables’ travel directions with-ward(upward,adjoint-upward), so a bare up or down always names a store. All six math notes are converted, the T4S-notation ones included; each states the correspondence once: T4S writes U, O, P, Q for our D, U, L, R; its δU is our V (tucker_variations), its δG our H (tt_variations). Docs and changelog entries before 2026.5.0 wroteUfor the Tucker factor andOfor the TT-shaped core.
Fixed#
The verbose display names the
'cone'reference. A convergednewton_cgrow withg0_reference='cone'ended “converged (‖g‖ ≤ gtol·‖g₀‖)”, naming no reference; it now ends “…, g₀ = cone (aligned zero tensor))”, as the other references do.Messages. Eight runtime error messages no longer end with an internal review code, and the ones that named a “sample stack” or an “A-block” now say probe stack and old block, the words the docs use (
docs/glossary.md).
Added#
Phase timing for
newton_cg:timing=True(keyword-only, aftercone_seed; backend and frontend, which forwards it only when set). Each history row’swall_timewindow is split into phases: the local model’s build (frame,sweep,companion,residual,curvature),gradient, row 0’sreference,cg,forms, every trial’strial_retractionandtrial_objective, the previous row’s callback and aremainder; on a jax run each phase also carries jax’s compile wait (fromjax.monitoring;Noneon numpy and on jax 0.4.30, which cannot unregister a listener). The run’s one-offs are recorded too: the setup,padded_from’s alignment, the seconds per pass of the alignment and of the'cone'reference, the last callback. It changes no number:xand every otherstatsfield are bitwise the untimed run’s, thewall_timeclock readings aside. Withtiming=False(the default) nothing is read or synchronized and every output, the display included, is the untimed run’s (clock readings aside). User guide:docs/fitting_and_optimization.md§4.13.NewtonInfo.timing: aNewtonTimingper row (window,secondsandcompile_secondsasPhaseSeconds,trials,accepted_retraction; row 0 adds the one-offs),Nonewhen off; not a history field. Both records are inbackend.optimizers. (PhaseSeconds.trackingtimes thehessian='switch'tracking product, below.)stats['timing'], a plain dict:total,setup,alignment,alignment_passes,reference_passes,last_callback,phases,compile,cg_per_iteration,rows;totalis the sum of the setup, the alignment, the rows’ windows and the last callback.The display (
verbose=True,backend.optimizer_display.make_newton_display): atimeline under each timed row’s header and a closing table after the run’s last row.The geometry members
aligned_padded_frame(..., timing=False), ragged and uniform:timing=Trueadds a third element, the seconds per pass (Noneunder the uniform whole-loop jit). The optimizers passtimingonly to a member whose signature names it, so a custom member without it keeps working.backend.common.tree_block_until_ready(tree): wait for every jax array in a pytree (a no-op without one).Cost. Every phase waits for its results, which serializes a jax run. Measured on a laptop CPU (AMD Ryzen 7 3700U; numpy 2.4, jax 0.10.2 in x64), timing on against off differed by −4 % to +2 % on numpy, eager jax and
use_jit, ragged and uniform, at d = 3 and d = 6: within the run-to-run noise. On an A100 GPU the same cases and a downstream level differed by −1.4 % to +3.1 %, also within the noise.
Starting with Gauss-Newton and switching to the exact Hessian:
newton_cg(hessian='switch')(backend and frontend). The run starts with Gauss-Newton and switches to the exact Hessian for good once the exact model has predicted the objective clearly better: after each countable step (the full model step taken: an accepted trust-region trial, or an Armijo step withα = 1), one curvature product gives the exact model’s misse_N = |Δf − m_N(s)|beside Gauss-Newton’se_GN = |Δf − m_GN(s)|, andswitch_kconsecutive steps withe_N < switch_tau·e_GNswitch, from the next point on (defaults: four times better, twice running). A miss, a rejected trust-region trial, a line-search backtrack, the−gfallback, a step forced byon_line_search_failure='accept', or two errors at the objective’s rounding level (1000·ε·(‖ω⊙y‖·‖ω⊙r‖ + |f|),εthe residual dtype’s) resets the count. The default step control is the trust region, whose radius carries across the switch; each call starts in Gauss-Newton. Before the switch the run is the Gauss-Newton run with the same step control, step for step; after it, the exact run resumed at that point. The rule comes from the maintainer’s nicks-optimizers (https://github.com/NickAlger/nicks-optimizers). User guide:docs/fitting_and_optimization.md§4.14.Four keyword-only options after
timing, eachNoneby default and a structural error withouthessian='switch':switch_tau(0.25; in[0, 1);0tracks and never switches),switch_k(2; an int≥ 0;0is exact from iteration 0),switch_cg_forcing_power(1.0, the forcing power from the switch on;cg_forcing_powerstays the Gauss-Newton phase’s) andswitch_track('countable', or'all': the product on every Gauss-Newton-phase step, the non-countable ones reported but never counted). An option the run would not read raises too (switch_tauorswitch_trackwithswitch_k=0;switch_korswitch_cg_forcing_powerwithswitch_tau=0).The rows:
NewtonInfo.hessianis now the row’s model ('gauss_newton'or'exact'; the run’s mode, as before, outside switch mode). Five new fields,switch_e_gn,switch_pKp,switch_e_n,switch_countandswitch_fired, areNoneoutside switch mode and instats['history']only in switch mode. On a Gauss-Newton-phase rowlmis the Gauss-Newton view of the point’s exact-mode build, and the row equals the pure Gauss-Newton run’s row apart from theswitch_*fields andwall_time.stats, in switch mode only:hessian('switch'),switch_trackandswitched_at(the index of the first row whose model is exact;Noneif the switch never fired).The display: each Gauss-Newton-phase step row’s header ends with
sw <e_N/e_GN> ×<count>, the switching row with⇒ exact. Withtiming=Truethe tracking product is thetrackingphase (thetrackcell).least_squares_problem(hessian='switch')sizeschunk_size='auto'as'exact'.Problem.local_modeland thefitting*_modelfactories keep their two modes (a model has one Hessian).Cost: each Gauss-Newton-phase point is built once, in exact mode (one misfit transpose, as in either pure mode, plus the curvature data), and each tracked step adds one curvature product; under
use_jitCG compiles at most two programs per call, the Gauss-Newton one shared with a pure Gauss-Newton run. Withhessianother than'switch'every run is bitwise unchanged.Messages: the invalid-
hessianmessages ofnewton_cgandleast_squares_problemlist'switch', andnewton_cg’scurvature_dampingwith Gauss-Newton now reads “… only meaningful with hessian=’exact’ or ‘switch’”.
[2026.4.0] — 2026-11-10#
The headline is the aligned padded frame: after a zero-padded rank increase, newton_cg can start from a frame
whose new directions are aligned with the misfit gradient (padded_from=x_old), and measure its relative stop
against the gradient norm at the zero tensor on such a frame (g0_reference='cone'). The frame twins behind them
are public on both layers. All of it is opt-in; no default changes. User guide: docs/aligned_padded_frame.md;
mathematics: the math note docs/padded_frame_cone.pdf (source docs/padded_frame_cone.tex). Upgrade notes:
docs/release_notes.md, “Upgrading from 2026.3.0”.
Measured (A100, exact Hessian, gtol_rel=1e-3, the Darcy rank-continuation ladder of the downstream
T3Polynomial project, 2026-11-10). On 10 points × 100 directions (six levels), the Newton totals were 254 for the
library’s own start frame with the 'zero' reference, 119 with 'cone', 110 for the hint-free padded start with
'cone' and 115 for the aligned start with 'cone'; CG totals 10,175 / 2,610 / 2,576 / 1,839. The reference, not
the start, halves Newton: 'cone' was 20–100× larger than 'zero' there, so the same gtol_rel stops at a larger
‖g‖, with best test errors within 4 % (p50 0.0607–0.0631). Within 'cone', the aligned start took about 30 % fewer
CG iterations than either other start, mostly at levels 3–5. At 20 points × 1000 directions (eleven levels, the same
reference), the aligned start took 166 Newton / 4,130 CG against the hint-free start’s 191 / 4,719, with identical
test error; a library-start run from 2026-11-01 (zero-type reference, another card) took 167 / 4,688. Every
alignment stopped on the 10-pass cap, never on tol=0.05 (last movements 0.27–0.43): in practice
padded_max_passes is the knob that sets the alignment’s cost.
Added#
newton_cg(..., start_frame=, padded_from=), keyword-only.start_frame=Flinearizes iteration 0 at a frame ofx0that you built (checked structurally always; orthonormal and representingx0in safe mode).padded_from=x_oldbuilds iteration 0’s frame by aligningx0’s new directions with the misfit gradient, wherex0isx_oldzero-padded; optionspadded_oversampling,padded_oversampled_passes,padded_max_passes,padded_tol,padded_alternate,padded_seed.padded_max_passes=0is the cheap hint-free start.stats['start_frame']('given'/'padded') andstats['start_movements']record it. Manifold geometries only.g0_reference='cone'fornewton_cgandgradient_descent: the gradient norm at the zero tensor ofx0’s ranks on the frame aligned with the data gradient there, like-for-like with the gradient norms the stop compares (use it withgtol_relnear1e-4). Optionscone_oversampling,cone_oversampled_passes,cone_max_passes,cone_tol,cone_alternate,cone_seed;stats['cone_movements']records the passes.cone_max_passes=0is the zero tensor’s hint-free start, which is a different frame from'zero'’s.The frame twins, ragged and uniform:
T3Frame.padded(x_old, tucker_ranks, tt_ranks, sharing=None, seed=0)/UT3Frame.padded(...): the hint-free padded frame (x_old’s frame in the leading slots, Gaussian slot-indexed seeds completing the new ones; the uniform twin returns the block layout and its split);frame_variations_format.fv_aligned_padded_frame(x_old, tucker_ranks, tt_ranks, hint, ...)/uniform_frame_variations_format.ufv_aligned_padded_frame(...): the aligned padded frame for any hint (a T3 or a dense array, or a customproject), and the movement of every pass; the uniform twin returns the frame at a level’s widths;T3Tangent.align_padded(...)/UT3Tangent.align_padded(...): one alignment pass (updateselects the stores;'UL'/'RO'are the two colours).
The schedule of the loops: oversampled passes (
oversampling=5foroversampled_passes=2), one truncating pass, then two-colour('UL', 'RO')pairs; the loop stops after a pair whose two movements are both belowtol(never on the truncating pass; a NaN movement never stops it), or atmax_passes(default 10) in all.use_jiton the loops and onpadded_start: a memoized jitted step inside the host loop (ragged) or the whole loop as onejax.jitprogram (uniform).newton_cg’s ownuse_jitgoverns the alignment too. With jax inputs passuse_jit=True: eager jax compiles every op of a new structure (about 22 s on the first step at d = 4) and adds thousands of process memory mappings per alignment.Problem.local_model(..., frame=F)andbackend.optimizers.padded_start(problem, x0, x_old, ...): a problem’s aligned frame without Newton, and a local model at it, for custom optimizers.TuckerTensorTrain.oversampled_ranks(p, sharing=None)/UniformTuckerTensorTrain.oversampled_ranks(...)andbackend.ranks.oversampled_ranks:+pon every rank, structurally minimal, never below the input.Backend: the modules
backend.padded_frames(fv_empty_frame,fv_padded_frame,tv_align_padded_frame,fv_aligned_padded_frame, theALIGN_*defaults) andbackend.uniform_padded_frames(ufv_empty_frame,ufv_padded_frame,utv_align_padded_frame,ufv_compact_frame,ufv_aligned_padded_frame);backend.linalg.pinned_completion,pinned_leading_columnsandpad_safe_pinned_completion;backend.ufv_masking.ufv_frame_widths; the optional geometry memberswith_frame,require_frame_structureandaligned_padded_frameon the manifold geometries (theGeometryprotocol documents them).
Changed#
No existing behaviour changes. The default Newton reference stays
'zero',fv_zero_point_frameis unchanged, and anewton_cgcall without the new keywords returns bit-identicalstats.Tests: a dispatch row (numpy in, numpy out; jax in, jax out; under
jax.jitwhere jittable) for every new public function, host loops included;tests/test_import_graph.pykeeps the backend import graph acyclic; the heavy jax dispatch tests release their compiled programs (jax.clear_caches()), so parallel workers stay under the process memory-map limit.CI: the py3.9 floor job is pinned to
ubuntu-24.04(ubuntu-latestmoved to 26.04, wheresetup-pythonhas no 3.9 build).
Removed#
None released. (A template-signature
fv_operations.fv_padded_frameexisted during development and never shipped.)
Known limitations#
The hint-free start is a function of the old frame’s representation, slot signs included: the ragged and uniform starts of one point differ, and a start can differ across BLAS builds. The aligned frame is representation-independent up to
tol.At a fixed point, every store’s completion spans the leading new directions of its own content, given the other stores’ completions, so one more pass moves nothing. The completions are then a stationary point of the captured hint energy
‖Π_{T(F)} hint‖²(proved for matrices, measured on T3s) but generally not a maximum of it: rotating one store’s completion alone never lowers that energy and generically raises it at second order. In measurements on small trees, they are a strict local maximum of the cone merit, one of many. The one reached depends on the start and the schedule. The cone merit is the share of the hint’s normal part that the new directions represent on one side of every edge; its best value does not depend on which side.The uniform movement record is NaN after the last pass and cannot tell a NaN movement from an unrun pass.
[2026.3.0] — 2026-10-29#
The headline is the exact Riemannian Hessian for newton_cg (hessian='exact'): the Gauss-Newton term
plus the manifold’s curvature, under a Steihaug–Toint trust region — the superlinear Newton tail on a
nonzero-residual fit, for every sampling kind on every geometry and representation. It comes with a
breaking-release groundwork: a zero-tensor default for the Newton reference, new stats keys, a public
problem constructor, the GaussNewtonModel → LocalModel rename, clean uniform padding, and recurrence
jet kernels. The mathematics – the lift, the two-hole sweep, the canonical zero-point frame, the trust region
and their verification – is written up in the math note docs/exact_hessian_two_hole.pdf (source
docs/exact_hessian_two_hole.tex). Upgrade notes: docs/release_notes.md, “Upgrading from 2026.2.0”.
Changed — breaking#
fitting.GaussNewtonModelis renamedfitting.LocalModel(alsot3toolbox.LocalModel), mirroring the backend class it wraps,backend.optimizers.LocalModel. It is not aliased – the old name is gone, asUniformGaussNewtonModelwent in 2026.2.0 – so a breaking release breaks loudly once rather than carrying two names. The six*_modelfactories keep their names, and the rename leaves the class’s methods and fields as they were (the exact mode adds to them, under Added).The default Newton reference is the zero tensor of the level’s ranks, on the manifold geometries.
newton_cg’s relative stop‖g‖ ≤ gtol_rel·‖g₀‖and its CG forcing term, andgradient_descent’s stop, used the warm-start‖g(x0)‖as‖g₀‖. After a zero-padded continuation restart that gradient is deflated, so the stop was unreachable at the defaultgtol_reland every level ran to its cap. Nowg0_reference=Nonemeans the geometry’s own reference: onMANIFOLD/UNIFORM_MANIFOLDand their shared wrappers, the gradient norm at the zero tensor ofx0’s ranks; on the corewise geometries (where the zero cores are a critical point) the warm start, as before. The reference is evaluated at a canonical zero-point frame (under Added), so it is a deterministic convention good to an O(1) factor, the same on the ragged and uniform layers, and nested across continuation levels. It moves every manifold stop by an O(1) factor relative to 2026.2.0, zero starts included (the old reference sat at the start’s LAPACK completion). Passg0_reference='warm_start'to keep the old reference; the explicitg0norm_newton/g0norm_cgoverrides still win. The downstream measurement behind the change (T3Polynomial, 30 Newton iterations per continuation level):level
dof
‖g₀‖at the zero tensorwarm start / zero
1
417
10.0
1.03
3
1617
14.4
0.37
5
4609
17.7
0.21
7
10545
22.2
0.13
9
17917
27.3
0.053
The zero reference also tightens the CG forcing term (~2× more CG work per step at high rank there, for the same accuracy). Continuation loops that carried
stats['history'][0]['gnorm']intog0norm_newtoncan drop that bookkeeping.newton_cg’sstats['newton']is replaced bystats['newton_steps'](the same count: CG solves),stats['newton_accepted'](steps taken:newton_stepsminus the rejections – an Armijo-exhausted step underon_line_search_failure='stop', or a rejected trust-region trial) andstats['stop_reason']('gradient'/'max_newton'/'line_search', and with the trust region'objective_floor'/'trust_region_floor'). It is removed, not aliased: it overloaded “solves” and “steps”.A non-positive
g0norm_newton/g0norm_cgraisesValueError.0.0used to crash with aZeroDivisionErrorin the forcing term.The private
optimizers._setupis removed, replaced by the publicoptimizers.least_squares_problem(under Added), which takes the same arguments (plushessian, the mode the problem will be solved in) and returns a namedLeastSquaresSetuprather than a 3-tuple. Not aliased.optimizers.newton_cgno longer takes**kwargs. Its options are explicit keywords –max_newton,gtol_rel,cg_maxiter,c_armijo,on_line_search_failure,g0_reference,g0norm_newton,g0norm_cgandcg_forcing_power, beside the existing ones, and the exact-Hessian optionshessian,curvature_damping,step_controlandtr_radius0(under Added) – with the backend’s defaults, so every option is in its signature and its docs. A misspelt option raisesTypeErrorat the call, before the problem is built (it used to be forwarded, and the backend call rejected it after the setup work). Every valid call is unchanged. (gradient_descent/mc_sgd/adamstill forward**kwargs.)Uniform transposes return clean padding. Every uniform transpose wrapper that holds the frame’s or the point’s masks now re-masks its output, so the padded slots come back as exact zeros instead of the raw sweep’s garbage (the boundary-bond squash broadcasts the gradient into the padded boundary slots; measured up to ~3e12 on a moderate case). That covers the six uniform kinds’
transpose(backend.uniform_fitting.Uniform*Kind), the publicutv_{probe,apply,entries}_transposeandutv_*_derivatives_transpose(and soUT3Tangent.*_transpose), andut3_*_corewise_transpose/ut3_*_corewise_derivatives_transpose(and soUniformTuckerTensorTrain.*_corewise_*transpose). This is numerical hygiene, not a change of numerics: the real block is bit-identical (one multiply by a host mask, which under jit is a folded constant), so every result that honours the equivalence contract’s “padding is don’t-care” is unchanged, and a new consumer – the CG state included – no longer has to remember to mask on entry. It breaks only code that read the padding. The bareutv_*_transpose_from_sweepseam halves stay bare by contract; their callers, the kinds, re-mask.Every production jet kernel is now a recurrence or an order scan; the binomial tensor is test-only (
backend.sampling_derivatives; performance and memory, numerics equal to ~1e-15 relative – not bitwise, the summation order changed). 2026.1.0’s move off the densetrs[t,r,s] = C(t,r)·[r+s=t]contraction had stopped partway: the apply/entries-derivative forward and transpose, the probe transpose’sdx̃icombine and the TT gradient assembly (on every branch – the W-chunked form only wrapped the dense kernel) still contractedtrsor a slice of it, and the order scans applied(order+1)²weight slices. Now an affine factor gives a banded two-term recurrence, and a full convolution is an order scan whose binomial weights come from a shift recurrence on a carried jet. Measured (CPU, float32memory_analysis, per W-row, uniform, unchunked): the TT assembly 4-8× less scratch,dx̃i13-15×, the exact Hessian’s two-hole TT assembly 5-14×; the jitted uniform probe-derivative transpose 4.3× and the two-hole 6.4× less temporary (d=4, r=16, order 3, W=2000). Time: the ragged-numpy GN probe-derivative transpose 2.3× faster there, the apply-derivative transpose 2×; small jitted uniform problems pay the sequential scans’ latency (~1.6× at d=5, r=8, W=300). Breaking, for backend callers of the jet kernels:trsarguments are gone.compute_mu_jets/compute_nu_jetstakeorderin its place (their input jets stop at order 1);compute_eta_jets,compute_{sigma,tau,deta}_jets,compute_{tau,sigma}_tilde_jets,compute_dxi_tilde_jets,compute_sigma_hat_jets,assemble_tt_variation_jets,compute_{tau,sigma}_tilde_tangent_jets,compute_dxi_tilde_tangent_jetsandassemble_tt_tangent_variation_jetsdrop it (the order is read off their jets).compute_dxi_tilde_jets/compute_dxi_tilde_tangent_jetsreturn only the two rows that are read:(2,)+W+K+C+(nOi,)(rowsu = 0, 1; row 1 is zero at order 0), not(order+1,)+...;assemble_tucker_variation_jets/assemble_tucker_tangent_variation_jetstake that two-row jet.Removed (not aliased):
binomial_combine_tensorand the dense*_trstwins (compute_{mu,nu,eta}_jets_trs,compute_{sigma,tau,deta}_jets_trs,compute_{tau,sigma}_tilde_jets_trs,assemble_tt_variation_jets_trs) – they are the test suite’s reference forms now (tests/_jet_trs_twins.py);assemble_tucker_variation_jets_trs(which contracted notrs) is removed too – it lives on privately as_assemble_tucker_variation_jets_dense; passchunk_size=Nonetoassemble_tucker_variation_jetsfor the unchunked assembly.estimate_chunk_size/max_chunk_size_withinmeasure the running program: the per-row cost is now the slope inchunk_sizeof the compiled chunked transpose (and, forhessian='exact', of the two-hole) – the assemblies plus the chunk’s slices of their input jets – where it was one dense kernel lowered alone. The answers grow with the smaller cost: rank 128, order 5, a 16 MiB budget gives 195 (was 2); the balanced policy now admits the wholeWin the usual case (the assemblies cost less per row than the resident jets), sochunk_size='auto'fits chunk less or not at all. The measured cost is the jax release’s own (figures above: current jax): jaxlib 0.4.30 packs the chunk loop into memory the earlier stages free, about one jet slice per row (~5-15× less), so its budget chunks are that much larger.
Changed#
SamplingKindhas a sixth operation,corewise_hessian, needed only for the exact Hessian (hessian='exact'): the derivative oftransposealong raw core directions. A kind written against the five-operation recipe keeps working with the default Gauss-Newton model;Problem.local_model(..., hessian='exact')(and sonewton_cgand the*_modelfactories in exact mode) rejects it up front with a structuralValueErrornaming the missing operation (the base method carries the stdlibabc.abstractmethodmarker, which the check reads; the class is not anABC, so instantiation is unaffected). Every built-in kind and itsUniform*twin implements it. Likewise a custom geometry needs the four exact-mode members (under Added) only forhessian='exact', andzero_point_frameis optional.NewtonInfo.cg_truncatedexcludes trust-region boundary stops: it is now(not cg_converged) and (not cg_ok) and (not cg_boundary)– a Steihaug stop on nonpositive curvature is a boundary step, not a truncation – andcg_convergedisFalseon a boundary stop, so a row’s CG outcome is exactly one of converged / boundary / truncated / the cap. With the default line search there is no boundary, so both are unchanged there.Display only, numerics unchanged: the
verbose=True/make_newton_displayconverged line names its reference –converged (‖g‖ ≤ gtol·‖g₀‖, g₀ = zero tensor)/warm start/override(a hand-builtNewtonInforow with no reference kind prints exactly as before) – and a run’s last row names its stop when that is not the gradient test (| stop: max_newton,line_search,objective_floor,trust_region_floor). The Gauss-Newton line-search rows are otherwise byte-identical.The backend’s private CG
_cg_solvereturns a 5-tuple(p, iters, resid², ok, boundary)and takes a trailingradius(defaultinf: the plain CG, bit for bit). Internal, listed for scripts that called it.Bit-identical refactors the exact Hessian reuses:
backend.sharing.fv_shared_frame_datatakes its centers from the newfv_operations.fv_center_factors;backend.tv_operations.tv_project_t3_onto_tangent_spacegauges the shared T3-to-T3 kernelt3_linalg.t3_inner_product_corewise_transpose; the shared manifold’s tied projection and retraction share the filtered solve with the tied lift; the raggedt3_precompute_inner_product_sweep/t3_inner_product_corewise_hessian_from_sweepare polymorphic over supercores (d-prefixed contractions).
Fixed#
The safe-mode gauge check no longer rejects a near-cancelling difference of gauged tangents.
MANIFOLD.norm/inner(and the uniform twins) measureda - bagainst its own norm, so the finite-difference check of a Hessian,MANIFOLD.norm(H_fd - hessian(p))with the two agreeing to1e-8, raised on each operand’s1e-16roundoff gauge violation. A tangent built by+/-/ scalar*/stack_tangentsis now measured against its operands’ scale (max(‖a‖, ‖b‖),|c|·‖a‖, per stack element, recursively) as a floor under its own norm, so the check is never stricter than before; a tangent computed directly (a projection, a gradient) keeps the self-relative check, and one ungauged in its own right still fails when checked itself. The scale is recorded only in safe mode, eagerly, and is not jax pytree state, so a jit round-trip measures self-relative again. Its limit, documented: dividing a finite-difference quotient by its step divides the recorded scale too, so to certify a computed tangent’s gauge, check that tangent itself. Backend:tv_gauge_residual/utv_gauge_residualtakescale=(defaultNone: unchanged, bitwise).docs/numerical_contracts.md.Jet outputs keep their inputs’ dtype. Each jet kernel (the
*_derivativesforwards, transposes and the two-hole) now preserves float32, underjax_enable_x64and on numpy alike. Their scan inits (the order-0 ones, the zero boundary jets, the adjoint zeros, the inner-scan accumulators, the entries one-hots) were built in the default dtype and promoted every float32 jet to float64 – 2026.2.0 did the same. A float32 fit can still come back float64 (every manifold fit does): the frame build (t3_orthogonal_representations), the plainprobe/apply/entriesops and a few uniform paddings still build default-dtype arrays upstream of the kernels (recorded in the deferred ledger for a follow-up).Uniform tangent stacks reach the local model. A uniform kind’s
forward(hence a Gauss-Newton or exacthvp), the uniform geometries’projectandinner, and the uniformfitting.LocalModel’s actions took aK-stacked trial tangent’s coordinates (a stack of tangents at one frame) with the frame’sC-stacked masks and failed in a reshape; the masks are now broadcast overK, as the ragged layer and the uniform transposes already did. The uniform geometries’innerkeeps the wholeK + Cstack per element, as the ragged twin (it kept only|C|leading axes –K’s, on a stacked pair – unreachable until now).A uniform
fitting.LocalModelkeeps its static structure out of the traced leaves. Its jax flatten traced the frame sweep’s mode sizes (Python ints) as leaves, so underjitthey became tracers; it now partitions them into the treedef like the backendLocalModel(backend.common.partition_static).The uniform tied projection’s padding is exactly zero.
backend.sharing.ufv_share_tucker_variations(the shared uniform manifold’sproject) left roundoff (~1e-16 relative) in the padded rows of the group modes’ Tucker variations – the companion SVD’sU_Mis not exactly zero there – so its output was not masked-clean as documented; it is now re-masked. The real blocks, and every fit, are unchanged bit for bit.estimate_chunk_size/max_chunk_size_withinno longer warn on a float64dtypewith x64 off. jax truncated the requested float64 to float32 with aUserWarningon every lowering (sochunk_size='auto'warned for every numpy-float64 uniform fit); the measurement now requests the canonical dtype itself – the same float32 program, the same answer, silently.
Added#
The exact Riemannian Hessian –
hessian='gauss_newton' | 'exact'(case-insensitive; Gauss-Newton stays the default) onnewton_cg(frontend and backend), the sixfitting.*_modelfactories and the backendProblem.local_model(x, sample, data, hessian, curvature_damping). An exact model’s Hessian action isΠ[𝒥ᵀω²𝒥Πp + Lᵀ(K_{Aᵀω²r} − K_{grad f})LΠp] (+ H_R p)– the Gauss-Newton term plus the Weingarten curvature (Absil, Mahony & Trumpf 2013), through the liftLfrom gauged coordinates to raw core directions, the kind’scorewise_hessianat the weighted residual and the inner product’s two-hole at the misfit gradient – equal to the second derivative of the objective along the T3-SVD retraction (second order on a minimal, numerically full-rank frame); on a corewise geometry it is the plain Hessian off ∘ Φin the cores. It runs for every sampling kind (apply,entries,probeand their*_derivatives), on every geometry and representation –MANIFOLD/COREWISE,UNIFORM_MANIFOLD/UNIFORM_COREWISEand theshared(...)wrappers of all four –use_jitincluded; per stack element the uniform exact model is the ragged one. It gives the superlinear Newton tail where Gauss-Newton is linear on a nonzero-residual fit (q-quadratic withcg_forcing_power=1.0; the default stays0.5in both modes), at about 3-4× the cost of a Gauss-Newton Hessian-apply (measured 2.8-3.9× on numpy CPU across the six kinds; the two-hole’s memory peak is ~2× the Gauss-Newton transpose’s). Per Newton step the model does one misfit transpose, shared by the gradient (an exact model’s gradient is the Gauss-Newton one, bit for bit) and the curvature term.curvature_damping(defaultNone=backend.geometry.DEFAULT_CURVATURE_DAMPING = 1e-6, relative to‖X‖_HS) damps the lift’s pseudo-inverses; it raises with the Gauss-Newton model and on a corewise geometry, where nothing would read it. Where the representable set is flat (a slot at maximal rank; every slot atd = 1) the curvature term vanishes by itself, and the manifoldd = 1model skips it. At a zero-padded continuation restart the clipped lift drops the new zero-singular-value directions from the curvature (no special case); on the shared manifold the lift is tied – each sharing group’s coordinates lift to ONE raw factor direction,U̇_g = M_g^{+ε}[V_i₁; …], against the same stacked-SSVD the tied projection uses, its transpose summing the group’s copies – the normal part is taken against the shared misfit gradient, a padded restart’s zeros_glevels filter to exactly 0, and the shared retraction is second order as measured (O(h²)), not proven. On the uniform layer every padded slot of a direction is masked (with the masks of the FRAME, a strict subset of the point’s at TT slack) before the second derivative sees it – the masks are load-bearing there, not hygiene – and every output is re-masked; from a numerically full-rank start a uniform exact run is the ragged run (counts and objective row by row), from a zero-padded restart the two layers’ frames legitimately differ and each converges on its own.docs/fitting_and_optimization.md§4.12.Trust-region step control in
newton_cg(both layers):step_control='line_search' | 'trust_region'(None: the line search with Gauss-Newton, unchanged bit for bit; the trust region with the exact Hessian; either combines with either) andtr_radius0. Steihaug-Toint CG inside‖p‖ ≤ Δ– it steps to the boundary on nonpositive curvature or when it would leave the region – then one trialretract(p), accepted iffρ = Δf / (gᵀp + ½pᵀHp) > 0.1;Δ ← ¼‖p‖whenρ < 0.25,Δ ← min(2Δ, 10⁴Δ0)whenρ > 0.75on a boundary step;Δ0 = tr_radius0, by default the Gauss-Newton Cauchy length‖g‖³/⟨g, H_GN g⟩(tr_radius0with the line search raises, as doeson_line_search_failure='accept'with the trust region). A rejected trial keepsxand its local model and counts towardmax_newton. Two newstop_reasonvalues, checked only after a rejection:'objective_floor'– the predicted change is below the objective’s floating-point resolution,|pred| ≤ 10·ε·(‖ω⊙y‖·‖ω⊙r‖ + |f|)withεthe residual dtype’s machine epsilon: the attainable accuracy is reached, not a failure – and'trust_region_floor'(Δ < 10⁻¹²·Δ0). A trust-regionNewtonInforow hasls_steps = ls_failed = Noneandalpha = 1.0(filter history rows onstep_control).NewtonInfofields, all defaulting toNone(so a hand-built row needs none) and carried instats['history']:g0_reference(the Newton-stop reference:'zero'/'warm_start'/'override'),cg_reference(the CG-forcing one),step_control,hessian,stop_reason(on the last row), and the trust-region / exact onestr_radius,tr_accepted,cg_boundary,pKp(the curvature term’s part ofpHp),lift_sigma_min(the smallest lift singular value; a shared group’ss_gin place of its modes’ own),lift_eps(the absolute lift damping). The display’sstepsegment readsTR Δ … ✓/✗on a trust-region row, CG’s symbol∂on a boundary stop, and an exact row appendsκ σ ε(κ = pKp/(pHp − pKp)).The frontend exact model:
fitting.LocalModelgains thecurvaturefield (the backendCurvatureState, a jax leaf: a rebuilt model or a new damping does not recompile) and the derived read-onlyis_exact; new methods, in both modes,hessian(p)/quadratic(p)(the mode’s Hessian action and form –gn_hessian/gn_quadraticon a Gauss-Newton model, plus the curvature term on an exact one) andretract(p)(geometry.retract(p)at the model’s frame, with the shared manifold’s stored companion – the twin ofbackend.optimizers.LocalModel.retract); on an exact model only (a Gauss-Newton one raises),curvature_hessian(p)/curvature_quadratic(p), the curvature term alone.evaluate(p)is mode-aware (the Gauss-Newton value is unchanged). The frontend run is the backend run, bit for bit; the exacthessian(p)sums its two gauged halves and so equals the backendhvpto rounding.The exact mode’s backend surface.
backend.optimizers.LocalModelgainscurvature,is_exact,curvature_hvp,quadraticandcurvature_quadratic(gradient,gn_quadratic,jacobianandretractare unchanged);backend.optimizers.CurvatureState(the model’s one misfit gradient and the geometry’s per-frame curvature data, pytree leaves). The geometries gain four exact-mode members –curvature_precompute,lift,lift_transpose,tangential_curvature– withbackend.geometry.ManifoldCurvatureData(diagnosticssigma_min/eps) andDEFAULT_CURVATURE_DAMPING; the kinds gaincorewise_hessian(under Changed). The building blocks, each a standalone backend function (ragged ones polymorphic over uniform supercores; uniformut3_/utv_/ufv_twins mask their inputs with the point’s or frame’s masks and re-mask their outputs):the lift –
backend.linalg.filtered_reciprocal/damped_pseudo_inverse(the clipped, optionally Tikhonov-damped reciprocal of a spectrum, and the pseudo-inverse built on it);backend.fv_operations.fv_center_factors(a frame’s centersH_i, Tucker factorsS_iᵀand bond factorsT_i, recomputed by zipper),LiftFactorsandfv_lift_factors(frame, curvature_damping);backend.sharing.fv_tied_lift_factors(a shared point’s tied lift factors;LiftFactorsgainsshared_data/tied_filters);backend.tv_operations.tv_corewise_lift/tv_corewise_lift_transpose, exact at zero damping on every numerically full-rank orthogonal frame, minimal or not; the uniformufv_operations.ufv_lift_factors/ufv_tied_lift_factorsandutv_operations.utv_corewise_lift[_transpose](each block clipped at its REAL dimensions; padded singular values exactly 0);the T3-to-T3 term –
backend.t3_linalg.t3_inner_product_corewise_transpose(the gradient ofθ ↦ ⟨z, Φ(θ)⟩),t3_precompute_inner_product_sweepandt3_inner_product_corewise_hessian[_from_sweep](its Hessian on a stack of directions, by a two-hole sweep), the tangent zippersbackend.tt_operations.tt_zipper_tangent_left_to_right/_right_to_left, and the uniformut3_linalg.ut3_inner_product_corewise_transpose/ut3_precompute_inner_product_sweep/ut3_inner_product_corewise_hessian[_from_sweep];the sampling terms – per kind, the derivative of its corewise transpose along raw core directions by a hand-written two-hole sweep (exact, symmetric; the weight enters as
ω²r, as in the gradient):backend.sampling_derivatives.t3_probe_corewise_derivatives_hessian[_from_sweep](its assemblies W-chunked bychunk_sizelike the transpose’s) with its public piecescompute_deta_tilde_tangent_jets,compute_tau_tilde_tangent_jets/compute_sigma_tilde_tangent_jets(the dotted adjoint sweeps),compute_dxi_tilde_tangent_jets,assemble_tucker_tangent_variation_jetsandassemble_tt_tangent_variation_jets(factored by the product rule);backend.probing.t3_probe_corewise_hessian[_from_sweep](withcompute_deta_tilde_tangent,compute_tau_tilde_tangent/compute_sigma_tilde_tangent,compute_dxi_tilde_tangent,assemble_tucker_tangent_variations,assemble_tt_tangent_variations);backend.apply.t3_apply_corewise_hessian[_from_sweep]andbackend.entries.t3_entries_corewise_hessian[_from_sweep](the residual-seeded right context swept through the cores);sampling_derivatives.t3_apply_corewise_derivatives_hessian[_from_sweep]/t3_entries_corewise_derivatives_hessian[_from_sweep](withcompute_sigma_hat_tangent_jets, besidecompute_sigma_hat_jets); and their uniform twinsbackend.ut3_sampling.ut3_{probe,apply,entries}_corewise_hessian[_from_sweep],ut3_probe_corewise_derivatives_hessian[_from_sweep]andut3_{apply,entries}_corewise_derivatives_hessian[_from_sweep];chunk sizing –
estimate_chunk_size/max_chunk_size_withintakehessian='gauss_newton'(the default, the transpose-only answer) or'exact'(anything else raisesValueError);'exact'sizes the chunk so that the two-hole, whose chunk costs ~1.3-2.2× the transpose’s per row, also fits.chunk_size='auto'resolves toNonefor the five kinds other thanprobe_derivativesin both modes, as their transposes do not chunk.
g0_referenceonnewton_cgandgradient_descent(frontend and backend):None(the geometry’s own),'zero'or'warm_start', case-insensitive. An explicit'zero'on a geometry with no zero-point frame (a corewise one) is aValueError; a vanishing zero reference (e.g. all-zero data) falls back to the warm start with aRuntimeWarningby default and raises when'zero'was asked for explicitly.The canonical zero-point frame:
backend.fv_operations.fv_zero_point_frame(frame, groups, seed)and its uniform twinbackend.ufv_operations.ufv_zero_point_frame, with the fixed seedfv_operations.ZERO_FRAME_SEED = 0. Seeded Haar Tucker factors (one per sharing group, from a stream keyed by the group’s first mode) and identity-prefix TT cores: rank-independent, nested, and the same real blocks on both layers. A Haar completion because a coordinate-aligned one gives a reference of exactly 0 on data with no energy on its leading coordinates.Geometry.zero_point_frame(frame), an optional, duck-typed member: the four backend geometries define it (Noneon the corewise ones). A custom geometry without it keeps working, with the warm-start reference as its default.optimizers.least_squares_problem(geometry, kind, sample, data, x0, order, weight, regularizer, chunk_size, batch, hessian), the frontend twin ofbackend.optimizers.least_squares_problem: it builds the backendProblemfrom the frontend vocabulary (a geometry singleton orSharedGeometry, a kind name,order/weight, a ragged or uniformx0) – the constructor the four optimizers use, now public for scripts that build local models or drive a backend optimizer directly.hessian('gauss_newton'default, or'exact') is the mode the problem will be solved in: it does not fix the mode, it sizeschunk_size='auto'for the exact Hessian’s two-hole too (newton_cgpasses its own). It returnsoptimizers.LeastSquaresSetup, a frozen dataclass with.problem,.x0_cores(the backend starting cores, reduced to minimal ranks where the optimizers reduce them) and.rewrap(backend cores -> the frontend tensor). Module-level only, not re-exported at the root.backend.geometry.UniformManifoldGeometryOps.from_frame(frame_data, plain_masks, sharing): the uniform manifold geometry from a frame already in hand – its variation masks are the frame’s own, gauge-shifted – the same geometry asfrom_pointwithout re-orthogonalizing. The uniformfitting.LocalModelbuilds its backend geometry this way (one orthogonalization fewer per regularized or exact model).
[2026.2.0] — 2026-08-25#
Changed — breaking#
The optimization layer’s axis objects are classes, not records of closures. A geometry and a sampling kind are now frozen dataclasses whose parameters are fields; their behaviour is methods. This is what makes them compare and hash by value, which matters because both ride as jax
aux_dataand therefore form part of the compilation cache key. Rationale, measurements and the rejected alternatives:contributor/parameters_not_closures.md.New
backend/geometry.pywithManifoldGeometryOps/CorewiseGeometryOpsand theirUniform*twins (the uniform ones carry the fixed rank they were built at; usefrom_point). Removed:backend.optimizers.GeometryOps,MANIFOLD_OPS,COREWISE_OPS,shared_geometry_ops, andbackend.uniform_fitting.uniform_{manifold,corewise,geometry}_ops.Sharing is a
groupsfield, not a wrapper — one class and one code path for shared and unshared. The frontendshared_manifold/shared_corewiseconstructors are unchanged.SamplingKindis a class hierarchy (ApplyKind,EntriesKind,ProbeKind, the three*DerivativesKind, and theirUniform*twins). The*_kindconstructor spellings still work. Removed: theidentityfield and its__eq__/__hash__, and the six uniform builder functionsuniform_{apply,entries,probe}_kind/uniform_{apply,entries,probe}_derivatives_kind(useUniform*Kind.from_point(x0_data, **parameters), or the unchangeduniform_sampling_kind/uniform_derivatives_kinddispatchers). A custom kind is now a subclass; deriving one withdataclasses.replaceno longer type-checks, and that is the point — see below.ScalarOutputKindandProbeOutputKindare public, so a new operator can inherit the‖·‖²reductions.fitting.UniformGaussNewtonModelis removed. OneGaussNewtonModelserves both representations; the factories still dispatch onx. It is deliberately not aliased.optimizer_displaygates its error table onkind.has_block_sumsqrather than on ablock_sumsqfield beingNone.block_sumsqis optional; the flag is declared by whoever implements it.A custom backend geometry needs three more members:
stack_shape(x_cores),base_point(frame), and aprecomputethat is a callable returningNonerather thanNoneitself. TheGeometryprotocol inbackend/optimizers.pylists the full surface.
Optimizing a STACKED point raises
NotImplementedError. It never worked –newton_cgandgradient_descentfailed onfloat()of a shape-Cobjective,mc_sgdon a broadcast, andadamonce its loss logging first fired – but it failed obscurely, from deep inside the loop. Building the local model on a stacked point is supported and still works, so rolling your own loop over a stacked problem is the route. Stacked optimization is possible future work.
Fixed#
The items below came out of the 2026-08-22 whole-library review (dev/review_2026-08-22/).
The safe-mode trace detector is the committed-array probe alone (review H6-12). The old primary detector,
jax.core.trace_state_clean, does not exist in jax 0.10 – every check on jax inputs paid a raise/catch before falling back – and its docstring promised any-transform detection the probe never delivered. Behavior under jit is unchanged (checks skip); undergrad/vmapwith concrete operands the checks run, as they always effectively did – harmless and now documented. The batching docs also record why a stackedUniformTuckerTensorTraincannot bevmap-ed at all (masks are static aux; use the nativeCstack).The uniform same-frame guard compares real (masked) content only (review H5-5). Two frames identical up to the don’t-care padding now count as the SAME frame – the tangent space depends only on the real content – so
UT3Tangentarithmetic /stack_tangentsbetween a frame and a re-padded copy of it works instead of raising “different tangent spaces”.safety.frames_equalitself stays representation-agnostic; its contract is now explicit: callers pass real content, and the uniform call sites mask their supercores first. (This also makesUT3Frame’s documented “frames_equal on the masked supercores” true.)The review’s oracle sweeps are permanent tests (Phase D):
tests/test_oracle_sweep.pyruns the O1 sampling/tangent sweep (dense einsum + exact combinatorial jet oracles + adjoint identities, ragged and uniform incl. varying-rank stacks) and the O2 fitting sweep (polynomial-interpolation oracle vsGaussNewtonModel; optimizer trajectories vs hand recomputation, ragged == uniform) from verbatim copies of the review scripts intests/oracle_sweeps/. Two tiers: always-on (full O1 + full O2 models + a pairwise-covering optimizer subset) andT3TOOLBOX_SLOW_TESTS=1for the full optimizer matrix – a required release-gate step, so nothing the review matrix covered stops being enforced.Small ergonomics from the review’s E list (R9-10, R7-11, R3-7):
chunk_sizenow threads through both frontends’probe_corewise_derivatives_transpose(and the uniform backend wrapper) – it existed only on the ragged backend and the tangent-level transposes;chunk_size='auto'resolution reads supercore shapes without pulling the arrays to host, and the fallback chunk size is the singlebackend.sampling_derivatives.DEFAULT_CHUNK_SIZEconstant; the minimal-rank recurrence inbackend.ranksuses the dispatched backend throughout (three straynp.minimumcalls made it jit-hostile).jit cache-key hygiene on the value-hashed aux family (reviews H1-5, H1-6, R2-7, H2-8, R7-13). The mask holders’
hashand==now derive from one content key (they could disagree on dtype and silently zip-truncate on length); a jax-array field in aValueHashedFieldsaux raises a directive TypeError (device arrays belong in leaves); the aux objects (mask holders, uniform geometries and kinds) store defensive read-only copies of their mask arrays, so mutating a caller’s mask in place can no longer stale a cached cache key – in-place writes to stored masks now raise;shared(...)geometries key their identity (and jit aux) on the canonical partition, so label spellings of the same partition share one compiled program, and aSharedGeometrysubclass now survives the jit round-trip as itself. Thestack(unstack(x))-under-jit findings were verified already fixed by the review’s static-axesmoveaxisand are pinned by a regression test.Obscure errors on malformed inputs became structural guards (the review’s E-cluster sweep, 2026-08-24: R2-8, R2-12, R2-13, R3-6, H3-7, R8-6, R8-9, R1-15, R10-6, H3-8, R9-9). Str leaves no longer recurse the tree helpers forever;
tree_ziprejects structure mismatches instead of silently truncating;truncated_svd(min_rank > max_rank)raises (min used to silently win);t3_inner_producttakes list/tuple mixes andt3_sum_stackan ndarray axis; uniform*is scalar-only with a clear TypeError, uniformstackvalidates the static layout, and uniformminimal_ranksstays host numpy on jax-backed trains; the ragged tensor-weight ops check rank/stack consistency (one-metric broadcast still allowed);COREWISE.retractrejects a detectable manifold-frame tangent;SharedGeometrynames a wrong-layer point/frame. One regression test per finding.The uniform frame at a numerically rank-deficient point loses no tangent directions (review S1b – the last open review item). Every kept-basis SVD in the uniform orthogonalization and T3-SVD sweeps now goes through the new mask-aware
backend.linalg.pad_safe_svd, so thesigma ~= 0completion columns stay OFF the padding instead of landing in padded slots that the masks then erase. Before the fix, a zero-paddedresizewarm start – the rank-continuation restart – produced a uniform frame whose masked real block was genuinely rank-deficient (60/60 trials), silently losing exactly the tangent directions continuation needs to grow into. AffectsUT3Frame.from_ut3/ut3_orthogonal_representations, the per-coreut3_*_orthogonalize_*ops, andut3svd/ut3_rank_adjustment_sweep/ut3svd_orthogonal_representations(unshared and SF-T3 shared). Regression tests:TestPadSafeFrameintests/test_uniform_frame_variations_format.py.Uniform
+,-,squash_tailsandsum_stackread padding garbage.ut3_squash_tailssummed the leading/trailing TT bond over every slot, including the padded ones the equivalence contract declares don’t-care – and a corewise gradient step (adam(UNIFORM_COREWISE, …),UNIFORM_COREWISE.retract) leaves exactly those slots nonzero, sox_fit + ywas silently wrong whileto_dense/norm(which mask on entry) were right. It now masks on entry.t3mwith boundary TT ranksr0, rd != 1.inplace_fused(the default) never SVD’d the last bond, so an unsquashed trailing bond survived asrd_x · rd_yand escapedmax_tt_ranks;swapcontracted the two operands’ trailing bonds against each other (silently wrong when equal, a raw einsum error when not) and ignored a per-positionmax_tt_ranksgiven as a numpy array. Everyt3mmethod now canonicalizes both operands’ boundary bonds to 1 on entry – the rule, and why the exact*/t3_multdeliberately do not, is int3m_methods.md.entries_ambient_transposereturned zero factors for a negative index. Its one-hots were built witharange(N) == index, which matches nothing for-1; the forwardentriesand the tangent/corewise transposes wrap numpy-style, so the adjoint identity silently failed. All four now agree (eye(N)[index]). Documented alongside: an out-of-range index raises under numpy but clamps under jax (gather semantics).The documented singular-value-metric recipe applied the σ’s in the wrong gauge.
docs/weighting.mdpairedT3FrameWeights.from_t3weights(T3Weights.from_t3svd(x))with a frame fromt3_orthogonal_representations(x), which re-SVDs the already-orthonormal Tucker factors of a T3-SVD result – a degenerate spectrum, so the frame’s Tucker basis comes back rotated by an arbitrary orthogonal matrix relative to the singular basis, and per-coordinate σ-weights then weight the wrong directions (unstacked too; the planning measurement said “stacked only”). Newt3svd_orthogonal_representations(x, **t3svd_kwargs)(+ theut3svd_twin, both exported at the root) returns(frame, variations, T3Weights)from ONE SVD with the frame builtalready_left_orthogonal=True, so its Tucker basis is the singular basis; the recipe and thefrom_t3svddocstring now say so.The shared-factor companion was wrong on a frame converted between layers.
fv_shared_frame_datarecomputed the centers by re-running the SVD sweep that built the frame, which reproduces the construction’s sign choices only when it is the same SVD on the same arrays; on aUT3Frame.to_t3frame()leaf – the routeUniformManifoldGeometry.project_ambientrecommends for dense gradients – the tied projection was silently 30% off (the group spectrum, being gauge-invariant, looked right). The centers are now the zipper of the stored chains (H_i = L_i Z_{i+1}, no SVD), exact and gauge-consistent for a frame built by either layer; the uniform twin masks first, and the “frames packed from ragged are not guaranteed” caveat is gone.jax.gradthrough uniformnorm()/inner()/ut3_weighted_norm/ut3_weighted_innerwas all-NaN on any train with rank slack – the default orthogonalized path differentiated through the SVD, whose JVP has1/(σᵢ²−σⱼ²)terms and a padded train has several exactly-zero σ’s. New backend twinsut3_norm/ut3_inner(closing a ledger item) keep the precise orthogonalized VALUE and carry acustom_jvpwith the exact multilinear derivative (2⟨T, dT⟩, via the zipper with the orthogonalized side held fixed – no SVD in the derivative path); the frontend and the weighted ops route through them.backend.optimizers.Problem.objective(x, data=…)/.local_model(x, data=…)ignoreddatawhensamplewas omitted, silently scoring the training data;sample=alone crashed with a bareTypeError. The pair now goes together or not at all (a structural error otherwise).The regularized objective was wrong at a raw point on the ragged manifold.
ManifoldGeometryOps.point_norm_sqread‖last TT core‖², exact only for a left-orthogonal point (measured 3 where the truth was 1400 on arandnpoint). Backend-only: the optimizers evaluate the regularizer through the frame or at retraction outputs, so no optimizer result orstatsrow was affected. It now left-orthogonalizes first (noWfactor, negligible beside the misfit it sits next to), matching the uniform twin.UT3Variations.sum_stack(axis=-1)/UT3Tangent.sum_tangents(axis=-1)summed over the MODE axis (the raw1 + axissent-1to array axis 0), silently whenK == dand with an obscure shape error otherwise. Negative axes now count from the last stack axis, as in numpy and the ragged twin; out of range raises.A structural tangent mismatch was caught only by the numerical same-frame guard, which is skipped under
safety.unsafe()/ a jax trace – soa + bfor tangents at frames of different rank structure broadcast silently there. The core-shape comparison now runs unconditionally (structural problems always error), inT3Tangentand the fitting model’s trial-tangent guard.30 structural checks were written as
assert(x * ndarrayshape, stack-axis ranges, core-tuple lengths,corewiseoperand types,dense_probevector shapes, …): a bareAssertionErrornormally, and no check at all underpython -O, where a wrong-shapedx * ndarraybroadcast silently. All areValueError/TypeErrorwith a message now.The gauge precondition compared an absolute residual against the relative tolerance.
gauge_residualwasmax|UᵀV|, which scales with the tangent, whileMANIFOLD.inner/normthreshold it atrtol(1e-9 numpy, 1e-5 jax): a correctly gauged tangent of norm ≳1e8 failed in numpy, and on jax’s default float32 one of norm ≳50 – the documented jax-eager safe-mode use – while a tiny ungauged tangent passed. The residual is now relative (each gram divided by its variation core’s norm, per stack element), on both layers.The tangent/corewise
apply/entriestransposes rejected a bare Python float residual (the natural unstacked case; the ambient twin’s own doctest passes1.7).d = 1on the ragged manifold:MANIFOLD.project_ambient(frame, <T3>),project_ambient(…, method='t3svd')andMANIFOLD.transportraised anIndexError(an empty TT chain has no zipper);dense_proberaised on a one-mode tensor with a probe stack. A one-mode T3 is a vector; these now degenerate to that case like everything else.UNIFORM_MANIFOLD.transport/project_ambientcrashed on aK-stacked tangent or gradient (the frame’sC-stack gauge masks were handed toK+Cvariations and failed in a reshape); the ragged twins acceptedK. The masks are now broadcast overK(newufv_masking.ufv_variation_masks_over_stack, the same rule the sampling transposes already used).stack()was not jittable (TuckerTensorTrain.stack,T3Frame.stack,T3Tangent.stack_tangents, the uniform twins):moveaxiswas given anarangesource, which is a tracer underjit.adamon a ragged manifold with a non-minimal-rankx0crashed at step 2 (its moment trees were allocated atx0’s core shapes; the first retraction drops the redundant rank). A ragged manifoldx0is now reduced to minimal ranks on entry, mirroring the uniform path’suniform_minimal; a minimal start is untouched.A slack-padded
x0crashed every uniform manifold optimizer at step 2.UniformTuckerTensorTrain.from_t3(x, n=, r=)(the documented “force a larger pad”) passes the minimal-rank gate, bututv_retractreturned its point at the max rankut3svdkept rather than at the frame’s padded dims (its docstring promised the latter), so the loop-invariant masks no longer fit. The retraction now re-pads (newbackend.ut3_operations.ut3_pad_ranks).newton_cg(verbose=True, val_data=…)withoutval_samplefailed deep inside the kind, andval_samplealone was silently ignored; both now raise at the entry (make_newton_displaytoo).uniform_least_squares_problemaccepted any non-'manifold'geometry string as corewise (so'Manifold'silently fit on the wrong geometry), and built aProblemfor a derivative kind withoutorder=that failed on first use. Geometry and kind strings are validated (case-insensitively, see below) andorderis required up front.Structural validation gaps and wrong messages (each a deep or misleading failure before):
check_fv_pairaccepted a frame and variations with different numbers of cores (four ops then returned partial sums);T3Frame.validate’s Tucker-rank message printed stack dimensions on a stacked frame;entries()with a wrong-length list index raisedAttributeErrorinstead of the documentedValueError;share(rtol=…)on a stacked T3 failed insidetruncated_svd; uniform+/inneron operands with different padded widthsNraised raw numpy errors; the sixGaussNewtonModelfactories did no validation of the sample / residual against the point;set_default_safety(None, None)was accepted and then every check crashed (it now means unsafe by default, the one script-level way to get it; a loneNoneis rejected);has_numerically_minimal_ranks()raised on a stacked train (now a per-element bool array like the other checkers).
Changed#
==andhashare now explicit-only on every runtime array-carrying class (review R1-13 extended; ruled 2026-08-24).TuckerTensorTrain,T3Weights,T3Frame,T3Variations,T3FrameWeights,T3Tangentand their six uniform twins refuse==with a TypeError naming the named checks (x == xstays True via the identity fast path) and are unhashable – the equality of a floating-point tensor representation is not a well-posed operator question, so the user says which equality they mean:a.allclose(b[, rtol=, atol=])for what the objects REPRESENT (numerical, per stack element; gauge/padding-invariant for trains; the BASE POINT for frames, withsafety.frames_equalanswering the same-FRAME question),a.corewise_equal(b)for the bitwise representation,a is bfor identity. Previously==raised numpy’s ambiguous-truth error (T3Frame: silently compared identity – a vestige of the pre-safety-redesign aux_data era, per its own history). Value-based hash/eq remains exactly where jit needs it: the aux_data family (mask holders, geometries, kinds). Rule + rationale:backend.common.ExplicitEquality. The pre-existingallclosemethods (T3Tangent/UT3Tangent/UT3Frame) are unified into the family: defaultrtolis now the ambient safety default (same value on numpy float64), the reference is the symmetricmax(||a||, ||b||)(was||other||), and the tangent twins now CHECK the same-frame precondition they used to assume.Citing T3Toolbox means citing the software, not the T4S paper.
CITATION.cff’spreferred-citationused to redirect citations to the research preprint the library grew out of; the library is a general-purpose T3 toolkit and is cited as software. The paper moved to the CFFreferenceslist (cite it when building on its research contributions); README / docs wording aligned.The six
utv_*_transpose_from_sweephooks now defaultsum_over_probes=False, matching their ragged twins (review H2-4). Each says it “shares” the ragged function, but the uniform defaults summed the probe stackWwhile ragged kept it – so a raw-.datauser porting ragged split-seam code to uniform silently got a different result shape. No shipped path changes (both frontends already defaultedFalse; the fitting kinds passTrueexplicitly). Breaking only for raw-backend callers that relied on the old uniform default: passsum_over_probes=Trueexplicitly.A failed Armijo line search stops
newton_cg/gradient_descentinstead of silently accepting an ascent (review R7-7). Exhausting every halving (40 / 50) used to accept the last trial anyway – measured objective increases accepted at the precision floor, ~2×40 objective evaluations per stagnant iteration – and the recordedalphawas one halving past the step actually taken, so that row’sdelta_f/rho/step_reldescribed a step never tried. Now: the defaulton_line_search_failure='stop'rejects the step and terminates;'accept'opts into the old take-the-step behavior as a deliberate escape mode (it can bump a stagnant iterate loose);NewtonInfo/stats['history']gainls_failed,gradient_descent’s stats gain'line_search_failed', andalphanow records the last trial actually evaluated.The ragged backend geometries’
inner/point_norm_sqare per-element over the frame stack, matching the uniform twins and the frontend (review H3-5).ManifoldGeometryOps.inner,CorewiseGeometryOps.inner/point_norm_sq, andt3_left_orthogonal_norm_sqused to collapse the stackCto a scalar whileUniformManifoldGeometryOps.innerandMANIFOLD.innerreturned shapeC– a silent cross-layer asymmetry for a raw-.datauser composing a stacked loop. Unstacked behavior is unchanged (a 0-d scalar); shipped optimizer paths reject stacked points up front and are unaffected.The uniform manifold frame is gauge-equivalent to ragged, no longer bit-identical. The old bit-equality was an accident of both layers feeding the same matrices to the same LAPACK kernel; the pad-safe sweep (previous section) computes the same subspaces and singular values through a different – still fully deterministic – factorization route, so gauge-carrying cores agree with ragged only up to the SVD’s inherent gauge freedom (column signs, rotations within equal-
sigmaclusters, the choice of null-space completion). Every gauge-invariant quantity – objectives, gradient norms, optimizer trajectories, represented tensors – still matches ragged exactly. The contract statement for gauge-carrying operations is now indocs/uniform_equivalence_contract.md.jax requested but not installed: run on numpy and warn, never raise.
TuckerTensorTrain.randn(use_jax=True)/UniformTuckerTensorTrain.randn(use_jax=True)used to die with a bareNameError,to_jax()/load(use_jax=True)silently returned numpy, and the optimizers’use_jit=Trueraised. The policy is now one rule (backend.common.jax_or_warn): the request runs on numpy with a one-timeRuntimeWarningnaming thet3toolbox[jax]extra – a project developed without jax on one machine and deployed with it on another runs unchanged on both. (use_jit=Truewith jax present still auto-converts to jax, as in 2026.1.0.)Geometry and kind strings are case-insensitive on the frontend optimizers and
uniform_least_squares_problem('Manifold','PROBE_DERIVATIVES', …).adamon a manifold geometry warns: its per-coordinate moments live in the gauge-dependent core coordinates, so its iterates depend on the backend / representation (measured ~1e-2);COREWISEis the intended geometry,mc_sgd/newton_cgthe gauge-invariant manifold optimizers.A per-mode residual weight may have more rows than modes. The extra rows are ignored (intended: one weight rides through a continuation scheme that adds modes), now on both layers – the frontend used to reject it while the backend truncated silently. Fewer rows than modes is a structural error on both.
Fixed (continued)#
d = 1on the uniform layer. The uniform boundary-bond squash duplicated the single core, which took down every squashing op (+,-,norm,inner,t3svd,rank_adjustment_sweep,UT3Frame.from_ut3,is_left_orthogonal). A one-mode T3 now degenerates to the vector case on both layers, as intended.A regularized fit of a stacked point silently mis-weighted, and now raises. The data misfit keeps the frame stack
C(one value per element) while every regularizer scalar collapses it, soobjective = misfit + ρadded the whole-stack regularization total to each element – inflating the effectiveλby about|C|, unevenly. The regularizer gradient was per-element correct, which is what made it easy to miss. No test combinedstack_shapewith a regularizer.A derived sampling kind silently reused its parent’s compiled program.
dataclasses.replacecopied the hand-maintainedidentitytuple unchanged, sodc.replace(APPLY, forward=<other math>)compared equal toAPPLY; underjitit returnedAPPLY’s answer (measured: 115.302888 where eager gave 28.825722). Unrepresentable now — a variant is a subclass, hence a distinct type.
Documentation#
rank_adjustment_sweep’s orthogonality is conditional, and the docs said so unconditionally: the sweep re-SVDs the TT cores and bonds and preserves Tucker orthonormality but never creates it, so its result is right-/left-orthogonal in the full sense only when the input’s Tucker cores were already orthonormal (anyt3svdresult) – the documented precondition, now stated at every site. The one real gap behind “compose both directions for guaranteed minimal ranks” – a Tucker rank above its mode size (n_i > N_i), which no TT-side step can reduce – is closed by a Tucker up-SVD at the start of the sweep.A sweep of doc ↔ code mismatches found by the 2026-08-22 review: the README / user-guide core diagram and frame-core listings (
dcores, notd+1;up_tucker_cores), the Tucker-rank tuple, the uniform mask form (canonical prefix vs gappy working form), the registered-pytree list (the uniform classes were missing), the paper section cited for probing, stale “slice”/”deferred” module docstrings on the uniform layer, theUT3FrameMasksvalue-hash comment,chunking.md’s'auto'default (it is the frontend’s),sharing.md’s “closure state”, sixdev/regularization_design.mdpaths (now indev/archive/), thet3m_methods.mdboundary-bond sentence, theweighting.mdrecipes and “same operations” claim, theGeometryOpsname in the project guide,backend.geometryandcorewisein the API reference, and thesave/loaddoctests, which now write into a temporary directory instead of the working directory; and, found by the same review:truncated_svd’s documented truncation rule (it is the tail-Frobenius TT-SVD rule, not a per-singular-value cut), theGeometryprotocol’s member list, theshared(…).framecontract row and the rank-deficient-frame retraction caveat innumerical_contracts.md, the corewise transpose’s description intransposes.md(a pullback, not a projection), the λ-vs-drawscaling note, the chunking memory caveats (two-chunk and kept-path regimes), theresizecall in the uniform continuation loop, the retired identity-guard wording onT3Tangent, andt3_norm(use_orthogonalization=False), which orthogonalized anyway (it now honors the flag; stack-shape mismatches in+/innerareValueErrors, as documented).
Performance#
The inner CG compiles once per fitting run instead of once per Newton iteration (measured 1 → 0 compiles per iteration on the uniform
probe_derivativespath, warm)._cg_solve(local_model, rhs, tol, maxiter, use_jit)dispatches to one function compiled over(local_model, rhs, tol, maxiter), so the cache key is the model’s pytree treedef — value-based, thanks to the change above.mc_sgd/adamper-step kernels compile once per shape signature, process-wide, rather than once per optimizer call: the kernels are module-level functions and the jit wrapper is memoized on them, replacing a per-call closure that discarded its own cache.A user-defined kind or geometry now gets this for free, provided its parameters are dataclass fields.
[2026.1.0] — 2026-08-20#
Added#
The explicit equality checks:
allclose(other, rtol=, atol=)andcorewise_equal(other)on all twelve runtime classes (see the==entry under Changed),corewise.corewise_equal(the bitwise tree comparison underneath), andsafety.comparison_rtol(the ambient jax-aware default tolerance for pure comparisons; mode-agnostic, likeframes_equal). Trainallclosecompares the represented TENSORS bynorm(a - b)– the difference train through the orthogonalized norm, numerically stable exactly in thea ~= boptimization-residual case.Scalar-left multiplication and scalar division on the point/tangent classes (review R1-12 / H4-8):
TuckerTensorTraingains__rmul__(2.0 * xused to raise whilex * 2.0worked), andTuckerTensorTrain/UniformTuckerTensorTrain/T3Tangentall gain scalar-only__truediv__(x / 2). The ragged weighted frontendst3_weighted_norm/t3_weighted_innergain theuse_orthogonalizationkwarg their backend and uniform twins always had (review H2-6), andcheck_fw_pairis exported as the docs already said (review R10-7). Per-axis uniformsum_stack(axis=)is deferred-and-documented (review H2-7;contributor/deferred_and_rejected.md).backend.linalg.pad_safe_svd– the mask-aware SVD of a zero-padded matrix: the firstmin(n, m)triplets are exactly the economy SVD of the unpadded real block, bitwise zero on the padding, with no rank tolerance anywhere and one jit compile across mask patterns (masks are runtime data). Batched, backend-agnostic, symmetric in(n, m)(wide real blocks need no caller-side transpose), deterministic (fixed Haar sketch per width). The algorithm is Method D (“sketch-project”) of the pad-safe SVD design packet,dev/review_2026-08-22/repros/S1b/packet/: pads are permuted to the trailing QR pivots (Householder reflectors then never touch a padded row), one small augmented SVD pins the surplus, and the right factor is rebuilt fromA^T U = V diag(ss). The uniform sweeps use it wherever an SVD produces kept basis columns. The complete derivation note – problem, contract, algorithm, measurements, and the alternatives considered – isdocs/pad_safe_svd.tex(+pdf).Shared Tucker factors (SF-T3) — optimize over Tucker tensor trains whose Tucker factors are constrained equal within user-specified groups of modes (the SF-ETT decomposition of Molozhavenko & Rakhuba (2026), generalized from one trailing block to an arbitrary partition; the partition is always user-provided). A
sharingspec is one hashable group label per mode, e.g.(0, 0, 1); a shared T3 is an ordinaryTuckerTensorTrainwhose group factors are equal (redundant storage — a compute-not-memory feature). Ragged layer and its full uniform mirror:The shared geometries —
shared(MANIFOLD, sharing)with shorthandsshared_manifold(sharing)/shared_corewise(sharing), exported from the package root: drop-in geometry wrappers for every optimizer and fitting model. Projections post-pass onto the tied tangent subspace in the base geometry’s own metric (manifold: the tilted least-squares projection through a per-frame SVD companion; corewise: the per-group mean), and the manifold retraction goes through a tied doubled-rank embedding plus the groupedt3svd, so every iterate stays exactly tied (one array per group).Grouped
t3svd(sharing=)/rank_adjustment_sweep(..., sharing=)— the paper-faithful two-phase truncation (TT rounding, then simultaneous group Tucker SVDs on concatenated matricizations), reporting one spectrums_gper group;sharing=Noneor an all-singleton partition is the existing sweep exactly.TuckerTensorTrain.share(sharing, ...)— the quasi-optimal shared initializer (exact common-span rewrite + grouped truncation), and the checker methodhas_shared_tucker_factors(sharing, rtol=)(per-stack-element bool).Shared rank bookkeeping —
get_minimal_ranks(..., sharing=)/backend.ranks.compute_minimal_ranks(sharing=)with the group ceilingn_g <= min(N_g, sum_i min(N_g, rL_i*rR_i))(per-mode ceilings ADD across a group, so a shared rank may exceed an individual mode’srL_i*rR_i— the unshared reduction would clip it and untie the group),manifold.manifold_dim(s, sharing=)(one Stiefel term per group; validated against dense tied-tangent ranks), andframe_has_minimal_ranks(..., sharing=).Shared rank continuation —
continuation_ranks(sharing=)/backend.ranks.compute_continuation_ranks(sharing=): a group’s Tucker edges are ONE edge — oneκ_g = s_g[0]/s_g[-1]in the conditioning pool, one growth decision applied group-wide, onemax_growcandidate — with the shared useless-rank removal (κ_gis never worse than the group’s worst per-mode condition number, and can be far better on complementary spectra). Plusresize(..., sharing=)for the zero-padded warm start: the group factor is padded once (one array per group), the represented tensor unchanged. A freshly padded restart carries exactly-zero new spectrum levels (the tied Tucker channel is gated); the escape runs through the untied TT-variation channel within the first Newton steps — which is why full shared rank is a diagnostic, never an enforced precondition.Uniform mirror, grouped truncation family —
UniformTuckerTensorTrain.t3svd(sharing=)/rank_adjustment_sweep(..., sharing=)/has_shared_tucker_factors(sharing, rtol=), backendut3svd(sharing=)(the two-phase grouped sweep in scan/supercore form: TT-bond rounding scan with the Tucker steps skipped, centers collected by the polymorphic right sweep, per-group SVDs on statically-gathered concatenations — mask-only truncation, ONE group rank mask at every group mode),ut3_rank_adjustment_sweep(sharing=), the grouped host recurrencecompute_raw_sweep_ranks(sharing=)(verified == the ragged grouped output ranks over randomized structures/caps), the masked checkersut3_sharing_residual/ut3_tucker_factors_shared, and a sharing-awareuniform_minimal— required: the per-mode reduction silently unties a shared uniform start (it can clip a group rank to unequal per-mode values). All verified under the uniform equivalence contract (== the ragged grouped ops on real parts, per stack element, varying-rank stacks included), with exact output-mask assertions, garbage robustness, and jit-clean dispatch.Uniform mirror, tied tangent machinery — the uniform companion
ufv_shared_frame_data(the identical polymorphic derivation on the frame’s stored supercores — deliberately NOT re-masked: the companion’s exactness rests on reproducing the construction’s own sweep on the same arrays, and the padded rows of eachS_i^Tvanish because completion rows are orthogonal to the centers’ row space), the tied post-passesufv_share_tucker_variations/ufv_share_tucker_variations_corewise(mask-and-delegate to the polymorphic ragged solves), andshared_data=threading throughutv_orthogonal_gauge_projection/utv_to_ut3(the TIED doubled-rank embedding:Udotat every group mode, the companion’s centers replacing the down cores, the variation block rebuilt at the up width) /utv_retract(tied embedding + the groupedut3svd). Verified gauge-invariantly against the ragged twins (dense tangents/points at machine precision; outputs exactly tied).Uniform mirror, shared geometries + fitting —
shared(UNIFORM_MANIFOLD, sharing)/shared(UNIFORM_COREWISE, sharing): theSharedGeometrywrapper now takes the uniform singletons too (uniform points/frames/tangents in and out; same value-hashed identity), the backend factories takesharing=(uniform_geometry_opsand both singles — the closures capture the partition beside the masks and populateprecomputewith the uniform companion),uniform_least_squares_problem(sharing=)with a shared-minimal gate, and the frontend fitting models carry the companion as ageometry_auxleaf (UniformGaussNewtonModel), so the packed compile-once path holds for shared fits (one trace across rebuilt same-rank models). All four optimizers run shared on the uniform layer; deterministic trajectories match the ragged shared runs, and every iterate stays exactly tied.Docs: the user page
docs/sharing.md(the format, the grouped truncation, what the group spectrum is, the two geometries, rank machinery, batching, uniform, scope — including sharing ≠ symmetry); the design recorddocs/contributor/sharing_internals.md; a shared section in the CI-doctested getting-started tour; the sharing section ofdocs/rank_continuation.md; and the TIED precondition rows indocs/numerical_contracts.md.Weights × sharing — the combination composes within the existing framework (absorbing keeps a tied T3 tied iff the group Tucker weight vectors are equal; TT-bond weights never touch the factors;
from_t3svd(x, sharing=…)builds group-equal weights; the weight algebra preserves group-equality), so the only addition is the non-enforcing compatibility checker:T3Weights.has_shared_tucker_weights(sharing, rtol=)and theUT3Weightstwin (masked content), witht3_tucker_weights_sharing_residual/t3_tucker_weights_shared(+ut3_*) inbackend.sharing. Nothing gates — absorbing group-unequal weights legitimately unties.Example:
examples/fit_shared_factors_jetted_probes.py— a groupwise-symmetric five-mode target (two Hilbert tensors coupled by a random matrix; two sharing groups of different mode sizes) fit from noisy probe-derivative jets, running the SAME rank-continuation fit shared vs unshared: tying the factors the target’s symmetry justifies reaches ~35% lower true error with ~37% fewer parameters before overfitting.Entering the format is the geometry’s job.
shared(...).frame(x)ties an untiedxfirst, silently, by the per-group mean — so an untied initial guess is a non-event for the optimizers, and the slow drift a long run of low-precision first-order steps can produce is absorbed at the next frame. An already-tied point is a bitwise fixed point, so the ordinary path is unchanged. The uniform layer gets the same route without a round trip through ragged:ut3_tie_tucker_factors, the twin oft3_tie_tucker_factors(garbage-transparent, so it needs no masking; masks and TT cores untouched). The shared corewise retraction ties the sum rather than aliasing one mode’s copy of it, which makes it total:mean_i(U_i + V_i) = mean_i(U_i) + mean_i(V_i), so an untied tangent (always handled) and an untied base point both land on the shared set with nothing silently discarded. The TIED-tangent precondition is now one backend checker —fv_tied_variations_residual/ufv_tied_variations_residual, a single global Frobenius ratio per stack element — replacing two hand-rolled formulas that disagreed between the ragged and uniform paths and collapsed the whole stack into one scalar (so one untied stack element could hide behind many tied ones).Backend surface in
backend.sharing(validate_sharing,t3_sharing_residual,t3_tucker_factors_shared,t3_tie_tucker_factors,SharedFrameData+fv_shared_frame_data, the tied post-passes) andbackend.t3_svd.t3_share_tucker_factors. Safe mode checks tied factors at shared entry points; full shared rank is a diagnostic, never a precondition (rank-continuation restarts legitimately sit below it).
The grouped-einsum interpreter
backend.contractions.contract— one general entry point for every grouped contraction:contract('WCa,Caib,WCi->WCb', *operands, len_W=...). Standard einsum strings where an UPPERCASE letter is a group of zero or more axes (Wprobe stack,Ktangent stack,Cframe stack, …); group sizes are solved exactly from the operand ndims (identifiability is decided from the subscripts alone — a call site either always needs alen_<G>supplement or never does, and the error names precisely what is missing); groups expand into fresh single-axis letters and one ordinary einsum runs on the operands as given. No reshape ever happens, so every sub-axis of every group is shardable (compiler-verified across the whole library vocabulary) and fusing two groups is inexpressible. numpy keeps the greedy pairwise BLAS path (computed on the grouped string); jax gets a single fused einsum.Weighting (edge weights) — diagonal weights on the internal edges of a T3, as a lightweight data format plus
absorbinto cores, in both the ragged and uniform representations. Two classes per layer, because a tensor and a tangent have genuinely different edges:T3Weights/UT3Weightsweight a Tucker tensor train as a tensor (tucker[d],tt[d+1]— exactly the shapet3svdreturns, so the singular values are the canonical weight object).T3FrameWeights/UT3FrameWeightsare a metric on a tangent’s coordinates (up/down/left/right, eachlen=d) — the Grasedyck–Kramer preconditioner — absorbed into the variation cores with the frame left orthonormal, so they areO(ranks).Operations on all four:
absorb_weights,weighted_norm/weighted_inner,reciprocal/sqrt, andconcatenate/kronecker(the+/⊙duality: ranks add / multiply). Constructorsfrom_t3svd/from_ut3svdandfrom_t3weights/from_ut3weights, plus ragged↔uniform conversions for both weight types.The frontend free functions carry the family prefix —
t3_absorb_weights,ut3_absorb_weights,fv_absorb_weights,ufv_absorb_weights(+t3_/ut3_weighted_norm/_weighted_inner) — and the whole surface is exported from the package root. Docs:docs/weighting.md; design records:docs/contributor/weighted_internals.md.
Regularization on the fitting objective —
regularizer=on every optimizer (gradient_descent/mc_sgd/adam/newton_cg) and on the six model factories, minimizing½‖ω⊙(S(x) − y)‖² + ρ(x). Shipped implementation:IdentityRegularizer(λ)=½λ‖x‖²— a Hilbert–Schmidt ridge onMANIFOLD, weight decay onCOREWISE— composing with every optimizer, sampling kind, geometry and representation (ragged and uniform), withλauto-scaled bybatch/nin the minibatch steps so the stochastic objective is an unbiased estimate of the full one. Extensible through the smallRegularizerprotocol inbackend/regularization.py. Docs:docs/fitting_and_optimization.md§4.9; exampleexamples/fit_hilbert_regularized.py(denoising, with λ chosen by held-out validation).Per-mode residual weighting — the fitting layer’s residual weight
ωgeneralizes from a per-order vector to anω[mode, order]matrix, owned by the sampling kind:probe_model(weight=)takes a length-dper-mode vector andprobe_derivatives_model(weight=)a(d, order+1)matrix (probe is the only kind with a per-mode axis, soapply/entriesstay per-order). A bare vector is still read as per-order, so existing calls are unchanged. Docs:docs/fitting_and_optimization.md§4.6; exampleexamples/fit_per_mode_weight_probes.py(inverse-noise weighting of a noisier mode).Newton-CG diagnostics —
newton_cg(..., verbose=True)prints a per-iteration block (objective and gradient norms, CG statistics, line search, ρ, wall time) plus a per-(mode, order)relative-error table, with an optional held-out validation column viaval_sample=/val_data=; the same records are returned instats['diagnostics']andstats['history'], and a regularized run splits the objective asobj = misfit + reg. Backend-owned (backend.optimizer_display.make_newton_display+ acallback=hook), so a raw-.datauser gets the identical display; ragged and uniform. Exampleexamples/fit_probe_display.py.Newton-CG warm-start controls —
g0norm_newton/g0norm_cgpin the reference‖g₀‖that the Newton stopping test and the CG forcing term are measured against (the computed initial norm is misleadingly small after a rank-continuation warm start;g0norm_newtonalso feeds CG unlessg0norm_cgis given), andcg_forcing_power(default0.5) trades CG iterations per Newton step against the number of Newton steps.NewtonInfo.g0normreports the effective reference. Docs:docs/fitting_and_optimization.md§5.chunk_sizefor the probe-derivative transpose — the𝒥ᵀvariation assemblies are computed in chunks over the probe stackW, trading recompute for peak memory:chunk_size(default100,None= dense) threads through the whole transpose chain and bothT3Tangent/UT3Tangent.probe_derivatives_transpose, and the optimizers acceptchunk_size='auto'(the default), which sizes it fromx0’s shapes. The sizing helpersbackend.sampling_derivatives.estimate_chunk_size/max_chunk_size_withinare eager (outsidejit), measure the per-row cost by lowering the real kernel rather than estimating it analytically, and take ann_shards=for per-device sizing and astack_shape=for a batch of base points (the frame stackCmultiplies the assembly but not an absolute byte budget, so omitting it on a stacked frame would makemax_chunk_size_withinreturn a chunk up toprod(C)times too large). Docs:docs/chunking.md.Recurrence/scan jets are now the standard derivative path — the pushthrough, combine and variation-assembly jets are computed by affine two-term recurrences and order-scans rather than by contracting the dense binomial
trstensor. The lean forms own the canonical names (compute_mu_jets,compute_eta_jets,compute_{sigma,tau}_jets,compute_deta_jets, the tilde twins, andassemble_{tt,tucker}_variation_jets); the dense forms remain public as the*_trsreference twins (numerically equal, and the test oracle). Underjiton the uniform layer this is a large memory win at unchanged accuracy — measured at rank 128,W=32000: ~14–28× less XLA temporary for theetajets and 168 GB → 2.63 GB (64×) for the TT-core variation assembly. (Not all of them, as shipped: several kernels kept densetrscontractions until 2026.3.0 – see there.)
Changed#
BREAKING: the backend
optimizers.GeometryOpsprotocol gains an optionalprecomputeslot (frame -> geometry aux,Nonefor the existing geometries), andproject/retracttake a third argument ((frame, variations, aux=None)).Problem.local_modelbuilds the aux once per Newton step (aLocalModel.geom_auxleaf field besidesweep) and passes it toproject/retract; the frontendGaussNewtonModelmirrors it as ageometry_auxleaf. Migration for customGeometryOps: accept (and ignore)aux=Noneinproject/retract; the shared geometries use the slot to compute their per-frame SVD companion once per local model instead of once per CG matvec.The
Regularizerprotocol threads the geometry aux:gradient/hessian/quadraticgain anaux=Noneparameter (the per-frame geometry companion, e.g. the SF-T3SharedFrameData), and every model/LocalModelcall site passes its stored companion — closing the one seam where a regularized shared fit rebuilt the companion per CG matvec. CustomRegularizerimplementations: accept (and may ignore)aux=None. Design record:docs/contributor/precompute_and_caching.md(the precompute/caching principle and audit).backend/common.pygainsprefix_mask(the boolean prefix indicator shared by every uniform prefix structure) and now hostsrequire_concrete_masks, which moved frombackend/ut3_masking.py— it is infrastructure for the uniform mask-representation contract, not part of any one object family.use_jit=Truenow converts its inputs to jax instead of silently running eager. Previously the flag was accepted but ignored unlessx0/sample/datawere already jax arrays, so a “jit” run could be an eager one (and a meaningless benchmark). Requesting jit is now taken as opting into jax-world precision:x0,problem.sampleandproblem.dataare moved onto jax, the result comes back jax-backed (float32 unlessjax_enable_x64is set), and the call raises if jax is not installed.use_jitis also now an explicit keyword onnewton_cg/mc_sgd/adamrather than arriving through**kwargs. Docs:docs/fitting_and_optimization.md§4.5.
Fixed#
A
GaussNewtonModelbuilt from a parameterized sampling kind recompiled on every rebuild. The model carries itsSamplingKindas jax pytreeaux_data, and jax keys its compilation cache on the aux; the derivative kinds and the weighted probe kind are built per model out of fresh closures, which under dataclass field equality never compare equal. So the documented “roll your own optimizer” pattern — rebuild the model at each outer point,jita function of it — paid a full recompile every step (measured: 3 traces for 3 rebuilds, against 1 for theapply/entries/probesingletons).SamplingKindnow compares on a valueidentity(name, order, residual weight,chunk_size) rather than on its closures, so a rebuilt kind with the same parameters is the same cache key while a genuinely different one still gets its own compilation. The uniform model already did this through its value-hashed aux; the ragged twin now matches, and both are pinned by regression tests.backend.fv_conversionsignoredsquash_tails=False— the parameter was shadowed inside the function, so the tails were squashed regardless of what the caller asked for.The uniform frame/variation entry points (
ufv_apply_frame_masks,ufv_apply_variations_masks,ut3frame_to_t3frame,ut3variations_to_t3variations) accepted traced masks and failed deep inside jax with aTracerArrayConversionError; they now callrequire_concrete_masksand raise the actionable message, like the plain-layer entry points already did.
Removed#
BREAKING: the ~104 named contraction functions in
backend.contractions(WCa_Caib_WCi_to_WCb-style), replaced by thecontractinterpreter above. Migration is mechanical: the function name is the subscripts string (X_Y_to_Z(a, b)→contract('X,Y->Z', a, b)), and the trailingn_probe/n_framearguments becomelen_W=/len_C=keywords. Numerically identical (each named function was verified equal to itscontractcall over an empty/single/multi-axis block-shape matrix before removal).The old parked weighted layer (
weighted_tucker_tensor_train.py,backend/wt3_operations.py, thewt3_prefix, and the brokenabsorb_weights_into_tangent_cores), superseded by the above.
[2026.0.0] — 2026-07-13#
The first public release — the initial public surface:
The Tucker tensor train (T3) format — arithmetic with dense-tensor semantics, orthogonalization, minimal ranks, T3-SVD, save/load, batching on every operation.
The three sampling operations (
entries/apply/probe), their symmetric directional derivatives, and the ambient/corewise/tangent transposes.The fixed-rank T3 manifold: orthogonal frame + gauged variations, tangent vectors, gauge projections, retraction, and the
MANIFOLD/COREWISEgeometries.Least-squares fitting from any sampling operation or its derivatives (Gauss-Newton models) with four optimizers (
gradient_descent,mc_sgd,adam,newton_cg).The uniform layer: supercores + boolean rank masks mirroring the whole stack, for
jax.lax.scanvectorization and compile-oncejit(optimizers included).NumPy / JAX backends with dispatch inferred from input array types; safe mode for numerical-precondition checking.