wai-quantum 0.3.23: belief-propagation tensor networks, a second method for the same circuits #140

Merged
dcharlot merged 1 commit from wai-quantum-bptn into main 2026-10-01 22:43:29 -04:00

2026-10-01

Transaction Science
wai-quantum 0.3.23: belief-propagation tensor networks, a second method for the same circuits
All checks were successful
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m46s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 3m19s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 16s
WAI conformance / independent verifiers · claims, JWP and key discovery (Python) (pull_request) Successful in 2m12s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 23s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 44s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 1m4s
WAI JPEG-AI whole decode (pinned inputs, required) / fetch pinned JPEG-AI inputs → whole decode + pixel hash, required (pull_request) Successful in 1m0s
WAI neural sink gates / model-free refusals of the neural sink (pull_request) Successful in 48s
WAI mbt2018_mean integer decode (regenerated vectors) / regenerate mbt2018_mean integer vectors → Rust decode, required (pull_request) Successful in 3m54s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 1m33s
standards workspaces build + test / jouleclaw-rs (pull_request) Successful in 4m34s
standards workspaces build + test / aac-rs (pull_request) Successful in 2m5s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 2m9s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 1m26s
standards workspaces build + test / map-rs (pull_request) Successful in 1m45s
standards workspaces build + test / mesh-rs (pull_request) Successful in 1m26s
standards workspaces build + test / openpay (pull_request) Successful in 6m16s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 4m24s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 43s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 1m39s
standards workspaces build + test / arl-rs (pull_request) Successful in 2m16s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 2m50s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 2m46s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 2m42s
standards workspaces build + test / sense-rs (pull_request) Successful in 2m45s
standards workspaces build + test / macOS energy backend (jcp-energy) (pull_request) Successful in 3m18s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 4m48s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 29s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 1m38s
quantum_bptn holds a tensor-network state on the hardware's coupling graph:
one tensor per qubit, one bond per edge, in Vidal gauge.
- A two-qubit gate on an edge is a simple update: QR-reduce both sides,
  apply the gate, SVD, keep at most χ singular values.
- Expectations take each tensor's environment from its bond weights, or
  from belief propagation run to a fixed point on the norm network.
  regauge() brings the network into the belief-propagation gauge, and
  run_gauged() does so after every layer.
- Its errors are unrelated to those of sparse Pauli dynamics, so the two
  can check each other on the same circuit.

Measured:
- On trees with no truncation it is exact: 3.7e-15 against exact sparse
  Pauli dynamics, and the same with belief-propagation environments.
- 127-qubit heavy-hex, 5 steps, χ = 32: the exactly computed
  magnetization to within 3.5e-7 at θ_h = kπ/32 for k = 2, 4, 6, 8.
- 127-qubit heavy-hex, 20 steps, ⟨Z62⟩: 0.9786 at θ_h = 0.2 and 0.8498
  at θ_h = 0.4, the published belief-propagation values
  (arXiv:2306.14887) at the same angles.
- At θ_h = 0.6 it approaches the published value as χ grows (0.696 at
  χ = 16, 0.676 at χ = 32, against 0.669).

edge_layers() partitions a graph's edges into layers of vertex-disjoint
edges: Δ layers on a bipartite graph (König), three on heavy-hex.
kicked_ising() now applies its RZZ gates a layer at a time, as the device
does. For sparse Pauli dynamics this changes no bit, because the gates are
commuting exact Cliffords. A layer's gates touch disjoint tensors and bonds,
so the tensor network computes them in parallel and commits them in order,
bit-identical to applying them one at a time.

src/linalg.rs holds the complex type, the Jacobi SVD and a Householder QR,
shared with the MPS backend, whose arithmetic is unchanged. The SVD the new
backend uses runs to convergence. The original's stopping rule leaves the
singular vectors orthonormal only to about 1e-7. That is harmless where a
backend keeps U·S·V† whole, as MPS does, and is wrong to 1e-8 where
expectations assume orthonormal tensors. Its |γ| is computed from / and √:
libm's hypot made the native and WASI results differ in the last bit until
it went.

tests/bit_identity.rs pins a tensor-network run, confirmed natively and
under wasm32-wasip2. tests/utility_reference.rs holds the 5-step values by
both methods. `wai-quantum utility --method bptn --chi N` runs it from the
CLI, with output byte-identical natively and as a WASI component.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-01 20:40:14 -04:00