SeQuant: Symbolic Tensor & Operator Algebra
- SeQuant is an open-source library for symbolic tensor and operator algebra that bridges complex tensor manipulation with high-performance numerical evaluation.
- It employs a graph-theoretic tensor-network canonicalizer, using colored graph representations and tools like Bliss or Nauty, to manage nonunique index encodings efficiently.
- The framework integrates symbolic code generation with compiler-like lowering, optimizing contractions and common subexpressions for scalable computations in many-body physics.
Searching arXiv for papers relevant to “SeQuant” and closely related similarly named quantization frameworks to ground the entry and handle possible ambiguity. SeQuant is an open-source library for symbolic algebra of tensors over commutative (scalar) and non-commutative (operator) rings, designed to bridge symbolic tensor manipulation and high-performance numerical evaluation. It emerged from quantum many-body theory, especially high-order coupled-cluster and related methods, where one must derive, simplify, canonicalize, and evaluate large tensor expressions with nontrivial index symmetries, noncovariant products, and nested index dependencies. Its central technical component is a graph-theoretic tensor-network canonicalizer, used for routine simplification, for optimizing Wick’s theorem over operator fields, and for transforming symbolic expressions into an intermediate representation suitable for numerical execution (Gaudel et al., 13 Nov 2025).
1. Scope and research setting
SeQuant addresses a longstanding problem in computational many-body theory and symbolic tensor algebra: the same tensor network can be written in many formally different but equivalent index encodings. Dummy-index renamings, permutations of identical factors, slot reorderings, and internal tensor symmetries all create representational nonuniqueness. In operator-valued settings, the problem is compounded by noncommutativity, so canonicalization cannot simply sort factors freely (Gaudel et al., 13 Nov 2025).
The framework was designed to support both conventional tensor algebra and operator algebra. In the symbolic phase it constructs and manipulates expressions in abstract index notation; in the evaluation phase it lowers those expressions into an optimized intermediate representation, applies contraction-ordering and common-subexpression elimination, and either interprets the result at runtime or transpiles it into host-language code that calls an external tensor backend such as TiledArray (Gaudel et al., 13 Nov 2025).
The paper frames this as a reusable community framework rather than a domain-specific derivation script. Its stated design goals include support for arbitrary index symmetries, noncovariant products, nested parametric index dependencies, an optimized Wick’s-theorem engine, and a workflow that blends symbolic code generation with direct interpretation (Gaudel et al., 13 Nov 2025).
2. Software architecture and expression model
SeQuant is organized around two principal components, SQ/core and SQ/eval. SQ/core is the symbolic engine, while SQ/eval performs compiler-like lowering and execution planning. Within SQ/core, SQ/expr provides a minimal abstract expression DAG whose atoms include constants, variables, tensors, and normal-ordered operators, and whose composites include sums and products with optional noncommutativity flags. It supports recursive visitation and pattern-based rewriting operations such as expand, canonicalize, and rapid_simplify (Gaudel et al., 13 Nov 2025).
SQ/tensor, built on top of SQ/expr, represents indexed tensors over both commutative and noncommutative rings. It supports rich index-space vocabularies, nested index dependencies via protoindices, noncovariant contractions, a graph-theoretic tensor-network canonicalizer, and an optimized Wick’s-theorem engine (Gaudel et al., 13 Nov 2025).
A compact summary of the architecture is given below.
| Component | Role | Notable capabilities |
|---|---|---|
SQ/expr |
Abstract expression DAG | Recursive visitation; pattern-based rewriting |
SQ/tensor |
Indexed tensor layer | Symmetries, protoindices, noncovariant contractions, TN canonicalization, Wick engine |
SQ/eval |
Lowering and execution | IR generation, TN contraction ordering, CSE, interpretation, transpilation |
This division is significant because it separates algebraic correctness from execution strategy. Symbolic equivalence is established in SQ/core; numerical efficiency is pursued in SQ/eval. The paper explicitly describes this as a way to blur the line between symbolic code generation and direct numerical interpretation (Gaudel et al., 13 Nov 2025).
3. Graph-theoretic tensor-network canonicalization
A defining feature of SeQuant is its tensor-network canonicalizer. The paper formulates canonicalization for a tensor network with automorphism group as a mapping
such that for every , , and for some , where equivalence is taken modulo overall sign, phase, or complex conjugation (Gaudel et al., 13 Nov 2025).
Instead of using a traditional group-theoretic Butler-Portugal procedure, SeQuant encodes a tensor network as a colored graph. The graph includes vertices for tensor cores, slot bundles, individual slots, indices, and protoindex bundles; edges encode occupancy relations, bundle membership, and index dependencies. Two coloring functions, color(K) and ccolor(K,c), ensure that distinct objects and composite structures remain distinguishable (Gaudel et al., 13 Nov 2025).
The construction proceeds in five stated steps: create a core vertex for each tensor factor; attach braket-, bra-, ket-, column-, and aux-bundle vertices; attach slot vertices; attach index vertices; and attach protoindex-bundle vertices for nested dependencies. The resulting colored graph is passed to Bliss or Nauty, which compute both a canonical vertex ordering and automorphism generators. SeQuant then reorders factors, bundles, and slots according to that canonical order, accumulates phase factors from antisymmetric bra/ket permutations, and regenerates dummy indices in order of first appearance (Gaudel et al., 13 Nov 2025).
Although graph canonicalization can be worst-case exponential, the paper reports that for the bounded-valence graphs arising from tensor networks, the cost grows roughly as in the number of slots . Figure 1 is reported to show that SeQuant’s canonicalizer out-scales both the standard Mathematica Butler-Portugal implementation and the Niehoff-enhanced Butler-Portugal extension, particularly for networks with many identical factors (Gaudel et al., 13 Nov 2025).
4. Commutative and noncommutative tensor algebras
SeQuant distinguishes two subclass models of AbstractTensor: Tensor, whose elements lie in a commutative scalar ring, and NormalOperator, whose elements are normal-ordered products of bosonic or fermionic creation and annihilation operators. In the commutative case, products can be reordered freely; in the operator case, canonicalization must respect the canonical (anti)commutation relations and the loss of reordering freedom (Gaudel et al., 13 Nov 2025).
For fermionic operators, the paper writes
It also notes that if 0, then 1, illustrating why conventional commutative normalization is insufficient (Gaudel et al., 13 Nov 2025).
Canonical rewriting in the operator case is handled by an optimized Wick’s-theorem engine. For genuine-vacuum normal ordering, the paper gives the rank-1 contraction rule
2
with contraction 3. For rank-2 operators it writes
4
In the fermionic Fermi-vacuum case, both top-bottom and bottom-top contractions appear, with sign factors such as
5
These details matter because naïve Wick recursion generates factorially many equivalent terms (Gaudel et al., 13 Nov 2025).
SeQuant reduces this combinatorial blow-up through two stated mechanisms. First, it applies topological optimizations based on automorphism generators from the tensor-network canonicalizer, so that equivalent contraction patterns are grouped and weighted by degeneracy factors. Second, it supports connectivity constraints that require particular operator factors to be contracted, pruning dead-end branches in the recursion (Gaudel et al., 13 Nov 2025).
5. Noncovariant tensor networks and nested dependent modes
A major extension point in SeQuant is support for noncovariant tensor networks and tensor modes whose degrees of freedom depend parametrically on other indices. The paper identifies this as typical in tensor decompositions and in quantum-chemical compression methods such as pair-natural-orbital constructions, where one cannot always regard all data as entries of a single global tensor over a fixed vector-space product (Gaudel et al., 13 Nov 2025).
The canonical example is the pair-dependent decomposition of the two-electron amplitude slice 6:
7
Because the rank varies with 8, the factors are most naturally treated as a tensor of tensors. SeQuant’s abstract-index representation therefore allows dependent indices such as 9 and 0, leading to expressions of the form
1
The paper also describes a compact notation that suppresses repeated protoindex structure while preserving the same dependency semantics (Gaudel et al., 13 Nov 2025).
To support such cases, AbstractTensor provides three mode types: bra/ket modes associated with index spaces and optional permutation symmetries, aux modes for non-vector-space directions, and protoindex bundles for nested dependencies. This machinery is used both in symbolic manipulation and in the graph encoding consumed by the canonicalizer (Gaudel et al., 13 Nov 2025).
This support is important because many symbolic tensor systems assume covariant contractions over fixed index spaces. SeQuant explicitly targets settings in which that assumption fails, including tensor factorizations, hypercontractions, multicomponent fields, and nonorthogonal bases (Gaudel et al., 13 Nov 2025).
6. Lowering, optimization, and numerical evaluation
After symbolic simplification, SQ/eval lowers expressions into an intermediate representation. The paper describes the IR as a full-binary tree whose leaves are constants, variables, or indexed tensor references, and whose internal nodes are specific binary operations such as tensor-tensor addition, tensor-tensor contraction over specified index sets, scalar-tensor scaling, or permutation to a canonical layout (Gaudel et al., 13 Nov 2025).
Each IR node carries a unique canonical identity. For sums and products of scalars this identity is obtained by flattening; for tensor products it is derived from the canonical form of the colored graph. The IR also stores the physical layout order of the output tensor, determined by tensor-network canonicalization (Gaudel et al., 13 Nov 2025).
Three IR-level optimizations are emphasized. The first is tensor-network contraction ordering, implemented as a bottom-up dynamic-programming search that chooses a binary-tree evaluation plan minimizing total FLOPs while exploiting exact runtime dimensions. The second is common-subexpression elimination, enabled by canonical identities so that identical subtrees, even across different equations, are computed once. The third is optional user-driven tensor-network fusion, which factors out common subnetworks across terms (Gaudel et al., 13 Nov 2025).
The optimized IR can then be executed in one of two ways. It can be interpreted directly by a tree-walk evaluator using a pluggable Result interface and a cache keyed by canonical identities, or it can be transpiled into C++ or Python that issues calls to an external tensor algebra library such as TiledArray or TACO. The paper presents this mixed symbolic/numerical workflow as a way to avoid repeated recompilation while allowing runtime specialization based on actual index sizes, memory constraints, and executor count (Gaudel et al., 13 Nov 2025).
7. Workflows, benchmarked behavior, and naming ambiguity
The paper describes several representative workflows. For tensor-network canonicalization, it uses equivalent forms of a CCD residual,
2
and shows that SeQuant maps both to the same canonical colored-graph form, then reorders factors and slots, accumulates antisymmetry signs, and renames dummy indices to produce a unique final expression (Gaudel et al., 13 Nov 2025).
For Wick-theorem derivation of coupled-cluster amplitude equations, the workflow feeds SQ/tensor with NormalOperator factors and invokes the Wick engine with full_contractions(true). With all optimizations enabled, CCSDTQ amplitudes are reported to take 3, and disabling topological optimizations slows the same derivation by more than three orders of magnitude. Table 2 and Figure 2 are summarized as showing sub-second derivations up to rank 8 on a laptop and near-linear scaling of derivation wall time with cluster rank when all optimizations are active (Gaudel et al., 13 Nov 2025).
For numerical evaluation, the paper states that detailed end-to-end timings are deferred to Part II, but internal tests using the TiledArray backend are said to show that interpreted SeQuant plans routinely match or exceed the performance of comparable handwritten code for medium-sized molecules, owing to exact tensor-network contraction ordering and runtime common-subexpression elimination (Gaudel et al., 13 Nov 2025).
The name “SeQuant” also has a distinct use in the arXiv literature that can cause confusion. In “Serial Quantization for Sparse Time Sequences,” SQuaTS is explicitly described as the “SeQuant” scheme: a streaming quantizer-decoder architecture for 4-sparse time sequences that updates a single 5-bit register by bitwise OR and achieves asymptotic bit growth 6 while matching the distortion of an 7-level scalar quantizer under suitable rate conditions (Cohen et al., 2019). This is unrelated to the tensor-algebra library. Two additional similarly named but separate quantization frameworks are “SQuant,” a data-free DNN quantization method based on a diagonal Hessian approximation and the CASE objective (Guo et al., 2022), and “SegQuant,” a post-training quantization framework for diffusion models built around SegLinear and DualScale (Zhang et al., 20 Jul 2025).