arXiv:2610.06535quant-phOct 2026

Manuscript Offprint

arXiv:2610.06535

Symmetry and AI-assisted discovery of magic-state factories

Shubham P. Jain, Adam Wills, Shraddha Singh

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Shubham P. Jain, 1,2,∗^{1,2,*} Adam Wills, 2,3,†^{2,3,\dagger} and Shraddha Singh 2,‡^{2,\ddagger}

1^{1}Joint Center for Quantum Information and Computer Science,

NIST/University of Maryland, College Park, Maryland 20742, USA

2^{2}IBM Quantum, IBM T.J. Watson Research Center, Yorktown Heights, New York 10598, USA

3^{3}Center for Theoretical Physics, a Leinweber Institute,

Massachusetts Institute of Technology, Cambridge, Massachusetts 02139, USA

(Dated: October 6, 2026)

Magic-state distillation is a major resource cost in fault-tolerant quantum computing. The cost of a magic-state factory depends strongly on its failure rate, which grows with the number of input magic states. Although symmetry-restricted methods have recently made distance two searches tractable, distance three and above have remained elusive at moderate input counts. We develop symmetry-and AI-assisted methods to search this regime. We present a unified binary-matrix formulation encompassing both triorthogonal-code and direct circuit searches. We show that distance at least three is equivalent to nonzero, pairwise distinct syndromes, separating the choice of syndromes from the search for compatible output gates. We restrict the syndrome search using group symmetry and language-model agents, followed by deterministic solving and independent verification. Our searches yield 699 factory classes, including 564 new ones. These include factories for pure-T states and factories with entangled outputs comprising combinations of T, CS, and CCZ magic states. The pure-T factories [[63, 11, 3]] and [[850, 128, 6]] achieve the lowest overhead exponents we know among protocols with at most 100 and 1000 inputs, respectively, with γ=1.589\gamma = 1.589 and γ=1.057\gamma = 1.057. Our [[1715, 287, 6]] factory, with γ=0.998\gamma = 0.998, is the smallest known pure-T factory with γ<1\gamma < 1. We also provide a context directory of search briefs and campaign notes with which readers can train their own agents and tailor the search to their requirements. With these results, we begin constructing an active, open-source repository of magic-state distillation protocols for the quantum community, supplemented by our methods and data, for the practical fault-tolerant quantum computing regime.

I. INTRODUCTION

Fault-tolerant quantum computation protects logical information using quantum error-correcting codes [1–3]. On most practically accessible codes [4], the Clifford gates, generated by the Hadamard, the phase gate S=diag(1,i)S = \text{diag}(1, i) and the CNOT, can often be implemented by transversal gates or lattice surgery [5, 6]. But no code that detects an arbitrary single-qubit error has a universal transversal gate set [7]. A common way to achieve universality fault-tolerantly is to supply a non-Clifford gate U through gate teleportation [8, 9]. Gate teleportation is a Clifford circuit by which the magic state ∣U⟩|U\rangle, obtained by applying U to ∣+⟩|+\rangle states, is injected to apply U. The teleported gate is fault-tolerant when the Clifford circuit is fault-tolerant, which is generally trivial, and the magic state is of high-quality. Supplying such states is the problem that magic-state distillation [10, 11] was designed to solve. It converts many low-quality magic states into fewer high-quality ones. Resource estimates attribute a large share of a machine's qubits and time to distillation [12, 13].

The magic states most studied in the distillation literature are ∣T⟩|T\rangle, ∣CS⟩|CS\rangle and ∣CCZ⟩|CCZ\rangle. They teleport the T=diag(1,eiπ/4)T = \text{diag}(1, e^{i\pi/4}) gate, the CS=diag(1,1,1,i)CS = \text{diag}(1, 1, 1, i) gate and the doubly controlled Z gate CCZ, respectively. Among these, a noisy T state is the easiest to encode in most practical codes [14–17]. We therefore concentrate on factories whose inputs are T states. For efficiency of the compiled circuits, however, we would like to analyze as large a set of outputs as possible. We restrict to the third level of the Clifford hierarchy [8, 18]. These are the gates that map Pauli operators to Clifford operators under conjugation, and their gate teleportation circuit is trivial. 1^{1} Importantly, our set of targets spans every magic state required to teleport a diagonal gate in the third level of the Clifford hierarchy [18].

The original idea behind a distillation circuit is inspired by QEC codes with transversal implementation of non-Clifford gates. It consumes nn noisy input magic states, each with an independent and identically distributed error of probability pp, on which rr parity checks are measured, each the parity of the faults on some subset of the inputs. The distance dd is the smallest number of faulty input magic states that pass every check and still corrupt the output, thus yielding an error scaling of O(pd)O(p^{d}). If every single fault is detected, the rejection probability is approximately npnp when np≪1np \ll 1. We write such a factory as [[n,k,d]][[n, k, d]], and its width N=k+rN = k + r counts the logical qubits, or wires, it acts on. For pure-T outputs the literature uses a standard figure of merit, the

†^{\dagger} a_wills@mit.edu

1^{1} States in deeper levels of the Clifford hierarchy require, with some probability, non-Clifford corrections for gate teleportation to succeed.

‡^{\ddagger} shraddha.s@ibm.com overhead exponent γ\gamma [19, 20]. Reaching an output error ϵ\epsilon by concatenating a factory with itself costs

O(log⁡γ(1/ϵ)),γ=log⁡(n/k)log⁡d,(1)O\big(\log^{\gamma}(1/\epsilon)\big),\qquad\gamma=\frac{\log(n/k)}{\log d}, \tag{1}

inputs per output. For a fixed output target and required distance, we therefore minimize the input count n.

The first factory distilled fifteen noisy ∣T⟩|T\rangle states into one on the 15-qubit Reed–Muller code, whose T is transversal [11]. Bravyi and Haah reduced the code requirement to a combinatorial condition. A factory is a binary triorthogonal matrix with prescribed single, pair and triple overlap parities of its rows [19]. Haah and Hastings extended the condition to CS and CCZ outputs and built families by puncturing Reed–Muller codes [20]. Richer protocols include Toffoli-state distillation [21, 22], synthillation, which directly distills the gate a circuit needs rather than the T states it would be built from [23, 24], catalysis, in which a magic state assists a conversion and is returned intact [25, 26], and codes over binary extension fields [27]. Existing approaches include asymptotic constructions, exhaustive classifications at small sizes, and searches within specified code families. Asymptotic constructions reach constant space overhead at large block lengths [28–31], and architectural studies estimate the cost of surface-code layouts and injections [14–17, 32–39]. At small sizes, exhaustive classification is possible. Nezami and Haah enumerated all triorthogonal codes with n+k≤38n + k \leq 38, which are the pure-T factories [40]. Our companion paper extends the enumeration to n≤54n \leq 54 and to every third-level output [41]. Other searches use particular code structures. Doubling and code conversion make transversal-T codes from transversal-Clifford codes [42–44], borrowed identities carve a factory from a circuit that acts as the identity on ∣+⟩⊗N|+\rangle^{\otimes N} [45], and satisfiability and integer-programming solvers map compact factories at small widths [46, 47].

We search beyond the classified range for factories with tens to hundreds of inputs, delivering T states and entangled states at the third level of the Clifford hierarchy [8, 9], at distance three and above. Efficient searches in the borrowed-identity framework already chart the distance-two landscape [45, 48], and cultivation [34, 36, 37, 39] supplies inputs clean enough that a single distance-two distillation step may suffice for some applications. The error rates that large algorithms demand [12], however, call for distance three or more, and there the landscape beyond n≤54n \leq 54 is uncharted.

Our method rests on one observation. Each input flips a set of checks, which we call its syndrome. When no two inputs touch the same wires, distance at least three is equivalent to the syndromes being nonzero and pairwise distinct [45] (see Sec. III A). We therefore choose the syndromes first, and we call the set of syndromes a factory uses its parent. For each parent, an enumeration of compatible output rows determines the factories it supports. Enumerating these rows for every parent gives the exhaustive search used in our companion paper [41] to extend the classification of Ref. [40]. In the language of triorthogonal codes, the parent spans the X stabilizers and the output rows are the logical operators. When this is no longer feasible, we use symmetries to restrict the parent search. A group acting on the syndromes turns the choice of a parent into a choice of its orbits. This is our symmetry slot ansatz. The choice of group or parent to start from remains heuristic, and we delegate this choice to AI agents.

A large language model (LLM) is a neural network trained to continue text and an agent uses an LLM to perform multi-step tasks such as reading solver outcomes and writing proposals for later runs. An orchestrator [49–51] coordinates several agents working on one task. Agent-based methods have already had success in quantum error correction. Cruz-Benito et al. used an LLM-guided evolutionary search to discover bivariate bicycle codes, a family of quantum low-density parity-check codes [52]. Multi-agent systems have co-designed codes with transversal diagonal gates [53]. Other LLM-driven, reinforcement-learning and evolutionary systems have found codes, encoders and encodings [54–59]. Beyond quantum, program search with language models has produced new constructions in combinatorics and new algorithms [60, 61]. Neuro-symbolic systems pair a proposing model with an exact engine that checks every step [62]. In our search, the LLM proposes candidate structures and a deterministic verifier checks the resulting circuits.

Throughout, the protocols are postselected diagonal CSS protocols, that is, level-three diagonal rotations with independent Z faults, checks of pure X type, and rejection on any nonzero outcome. Every factory we report is an explicit circuit, available in our public database [63].

Section II reports the catalog and its highlights. Section III develops the matrix formulation and its two readings, as a code and as a circuit. Section IV describes the output search for a fixed parent, Sec. V introduces symmetry slots, and Sec. VI presents the agent workflow. Section VII discusses limitations, outlook and future directions.