Product · Tensor lattice contraction
Lumen Weave 1.0
Lumen Weave never allocates the amplitude vector. It writes the circuit as a lattice of small tensors — one per gate, one per open wire — and contracts that lattice down to the scalar or the small tensor the caller asked for.
Tensors, not kets
Each gate is a tensor whose indices are the wires it touches, doubled into incoming and outgoing legs. A one-qubit gate is a rank-2 tensor. A CX is rank-4. An open input leg is contracted with a rank-1 initial state, usually |0⟩. An open output leg is either left free (the caller wants that reduced tensor) or contracted with a bra or a projector.
The memory that matters is the width of the largest intermediate, not 2ⁿ. A shallow, lightly entangled circuit on 80 wires can be cheaper than a deep circuit on 24 wires. Weave reports both estimates before it runs: a byte forecast for the heaviest intermediate, and a flop forecast for the whole plan.
Contraction plans
The planner searches pairwise contraction orders. It scores an order by the size of the tensor created when two factors merge, then by arithmetic count. Slicing is allowed: a free index can be fixed to 0 and 1, the two smaller contractions run separately, and the results sum. Slicing trades latency for a lower memory peak and is the default when the unsliced peak exceeds the deployment ceiling.
Callers may pin a cut. A pinned cut tells the planner that a particular wire must be an intermediate boundary, which is how a research job reuses the same left-half contraction across many right-half patches. Unpinned, the planner may ignore the caller’s visual layout.
- Path search budget is a millisecond cap, not an exhaustive search of every binary tree.
- Plans are cached by a hash of gate list, free legs, and slice budget.
- A plan that cannot meet the byte ceiling returns lumen.weave.memory_ceiling with the suggested slice count.
Truncation
When the caller opts into a bond limit, Weave inserts a truncated singular-value decomposition on the cut they name. Discarded weight is returned as a single number, the sum of squares of dropped singular values divided by the total. Data-T does not hide truncation inside a ‘success’ flag. A result with discarded weight above the caller’s tolerance is marked approximate.
Exact mode disables SVD. Exact mode on a volume-law circuit simply fails the memory ceiling. That failure is preferable to a silent approximate amplitude in a risk calculation.
Where Weave hands off
If the free set is the entire register and the width is inside the State budget, the router prefers State, because the vector is then the simpler object. If any channel appears, Weave refuses and names Lumen Drift. If the only free object is a Pauli expectation with a thin cone, the router prefers Lumen Trace. Weave’s job is the middle: wide circuits, small answers.
All documents
- OverviewLumen Lattice
- Lumen StateLumen State 1.0
- Lumen DriftLumen Drift 1.0
- Lumen TraceLumen Trace 1.0
- AmplitudesAmplitudes and measurement
- ContractionContraction and bond limits
- NoiseNoise, channels, and purity
- ObservablesObservables and expectations
- SamplingSampling and shots
- MemoryMemory model and refusal
- LibrariesLibraries and documents
- ReferenceReference