PureMagic: A Dynamic Scheduler for Lattice Surgery

PureMagic is a dynamic scheduler for lattice surgery that eliminates dedicated bus patches by repurposing all ancilla patches for both routing and stochastic magic state cultivation, achieving significant improvements in efficiency, resource utilization, and preparation time compared to traditional static approaches.

Original authors: Steven Hofmeyr, Mathias Weiden, Justin Kalloor, John Kubiatowicz, Costin Iancu

Published 2026-05-20
📖 4 min read🧠 Deep dive

Original authors: Steven Hofmeyr, Mathias Weiden, Justin Kalloor, John Kubiatowicz, Costin Iancu

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to run a massive, incredibly complex factory. This factory doesn't make cars or phones; it makes quantum computers that can solve problems impossible for today's machines. But there's a catch: the factory is incredibly fragile. If a single worker sneezes, the whole production line might crash. To fix this, the factory uses a "safety net" system called error correction, where many workers do the same job to ensure accuracy.

However, to do the most advanced work, the factory needs a special, rare ingredient called a "magic state." Making this ingredient is tricky.

The Old Way: The Dedicated "Magic Factory"

In the traditional approach (used by previous systems), the factory built huge, permanent buildings dedicated solely to making these magic states.

  • The Problem: These buildings took up a massive amount of space (logical qubits). They were like giant warehouses sitting on the edge of the factory floor.
  • The Bottleneck: Because they were fixed in place, they couldn't move. If the main production line needed a worker to move a box from one side of the factory to the other, the workers in the magic factories couldn't help; they were stuck making magic.
  • The Gamble: Making the magic state is like rolling a die. Sometimes it takes a few seconds; sometimes, due to bad luck, it takes hours. The old system had to wait for the "slow rolls" to finish before moving on, causing the whole factory to sit idle.

The New Way: PureMagic (The "Swiss Army Knife" Workers)

The paper introduces PureMagic, a new way to run the factory that changes the rules completely.

1. No More Dedicated Factories
Instead of building special buildings for magic states, PureMagic says: "Everyone is a magic maker."
Every single worker in the factory (called an "ancilla patch") is trained to make magic states. They are constantly trying to brew the magic ingredient.

2. The Dynamic Switch
Here is the clever part: These workers are also the delivery drivers.

  • Scenario A: A worker is busy brewing magic.
  • Scenario B: Suddenly, the main production line needs that worker to carry a box across the factory (routing).
  • The Magic Move: The worker instantly stops brewing, drops the half-finished magic, and carries the box. Once the box is delivered, they immediately start brewing magic again from scratch.

Why is this better?

  • Cutting the "Long Tail": In the old system, if a magic-making attempt got stuck in a "bad luck" loop (taking forever), the whole factory waited. In PureMagic, if a worker gets stuck brewing, they get interrupted by a delivery job. This naturally cuts off the "long tail" of slow attempts. The factory only keeps the "fast" magic makers, making the average time to get magic much faster (4.5 times faster, according to the paper).
  • No Idle Time: In the old system, the delivery workers sat idle while the magic factories worked, and vice versa. In PureMagic, every worker is always doing something—either making magic or moving things. There is no wasted space.

3. The "Weight Limit" Trick
The paper also mentions a software trick called a "weight limit" (denoted as ω\omega). Think of this as a rule for how many boxes a worker can carry at once.

  • The old way tried to carry huge loads (complex instructions) to save steps, but it got stuck easily.
  • PureMagic uses a rule to break instructions into tiny, single-box loads. This means the factory can run many workers in parallel at the same time. Because PureMagic has so many workers available (since they aren't stuck in magic factories), it can exploit this parallelism much better than the old system.

The Results

The researchers tested this new system on 29 different "factory designs" (benchmark circuits). Here is what they found:

  • Efficiency: PureMagic was 40% to 150% more efficient than the old bus-routing system.
  • Space: It used 19% to 80% fewer workers (logical qubits) to do the same job.
  • Speed: It reduced the time needed to prepare the magic ingredient by 4.5 times.
  • Comparison: When compared to the best existing static scheduler (DASCOT), PureMagic was up to 15 times more efficient when you count the cost of making the magic states.

The Bottom Line

PureMagic treats the factory floor like a fluid, dynamic environment rather than a rigid grid with fixed roles. By letting every worker switch between "making magic" and "delivering packages" instantly, it eliminates wasted space, cuts out the slowest attempts, and keeps the quantum computer running at peak speed. The paper claims this approach gets so close to the theoretical limit of perfection that it's nearly impossible to do much better without changing the fundamental physics of the machine.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →