Inspiration

Bioinformatics has had a suite that holds the field together for decades: Rosetta. One shared score function, reused by every protocol, keeps researchers speaking the same language. Quantum computing has nothing like it. Circuits get written in one framework, compiled in another, benchmarked in a third, and judged differently at every step. Gatesmith is our step toward a unified, Rosetta-inspired pipeline that keeps quantum researchers on the same page and streamlines how they develop circuits.

What it does

Give Gatesmith a GitHub repository link, a local folder or a single OpenQASM file. It finds the quantum circuits without running your code, lets you pick which ones to score, and drafts a manifest describing what must stay the same in each.

The scoring engine, qscore, then:

  • Validates first and explains before running. Every input problem is reported at once with a location and a fix, and nothing runs until you confirm what Gatesmith understood.
  • Compiles across multiple seeds for a hardware target (IBM's 133-qubit Torino layout by default) and reports the best result along with the spread, not one lucky run.
  • Measures 20 metrics in four groups: resources, hardware cost, optimization opportunities and research. It places each one among 119 public benchmark circuits from QASMBench and MQT Bench.
  • Diagnoses where the cost comes from. Ten rules turn metrics into located findings, such as "routing dominates this circuit" or "this block can be re-synthesized", each naming the qubits, the gates and the fixes that apply.

From there, researchers can ask the CLI to improve a circuit with one of two layers: deterministic Qiskit resynthesis, or open-weight models from Hugging Face. Every proposed rewrite must pass exact equivalence checking and be re-scored with the same seeds. It counts only if it's strictly better and breaks no constraint.

Our guiding rule: AI proposes, the scoring engine decides.

On top of the pipeline sits a research platform: a web app, and a GitHub review bot that brings Gatesmith's results into pull requests, with Gemini turning the findings into review comments.

How we built it

Engine: Python 3.12, Qiskit 2.x and OpenQASM 2/3, managed with uv.

  • Strict Pydantic schemas, with seeds, versions and hashes recorded on every result.
  • Five code layers whose import direction is enforced in CI.
  • Equivalence is decided by exact methods only, such as Qiskit operator comparison. Random tests count as supporting evidence, never as proof.

Improvement layers:

  • reference-qiskit wraps Qiskit's own synthesis passes, so the same input always gives the same output.
  • hf sends only the flagged region of a circuit to four pinned open-weight models through Hugging Face Inference Providers: gpt-oss-120b, Qwen3-Coder-30B, DeepSeek-V4-Flash and gpt-oss-20b. Replies must be strict JSON at temperature 0, within call and cost budgets.

AMD: we built Qiskit Aer for ROCm on a Radeon PRO W7900. qscore bench measured statevector simulation at 6.7× faster than the CPU at 28 qubits in double precision.

Platform: an always-on Vultr server running Docker Compose. Caddy serves the web app over HTTPS and forwards /api to a FastAPI service backed by a durable SQLite job queue. Workers pull jobs over HTTPS, so no machine ever has to accept inbound connections.

GitHub review bot:

  • A GitHub Action scores the base and head of a pull request inside the repository's own CI, so repository code never runs on our servers.
  • A GitHub App checks the results' checksums and provenance, then posts one summary and a check.
  • Gemini, opt-in, adds line comments that must cite recorded evidence. Every number comes from the engine, never the model.

Frontend: React, Vite and TypeScript, designed in Paper and built screen by screen to match the designs.

CI/CD: GitHub Actions runs linting, type checks, import-layer checks and close to 1,000 tests on Python 3.11 and 3.12, plus the bot's own suite. It then deploys the exact tested commit to Vultr.

Challenges we ran into

  • Models can't do exact quantum bookkeeping. Across our evaluation runs, 102 of 104 AI-proposed rewrites were not equivalent to the original circuit. A typical mistake was adding gates to "convert" one gate into another without undoing them. The verifier caught every one. Getting replies parseable at all took its own work: reasoning models spent 4,000–6,000 tokens thinking before writing any JSON, and few-shot examples were what got invalid replies to zero for three of the four models.
  • Qiskit is already very good at small regions. The regions our diagnostics flag are usually 2–6 two-qubit gates, where Qiskit's synthesis is near-optimal. Commutation-aware routing made one circuit 35% worse, so we dropped it. IBM's RL synthesis models won big on synthetic circuits but found no gain on any of 68 QASMBench circuits.
  • Sandboxing differs by OS. Our builder sandbox caps memory with RLIMIT_AS, which macOS rejects, so circuits built from Python code need Linux, and CI runs there. We kept the limit rather than weakening it.
  • Qiskit edge cases. Classical control hidden inside nested gate definitions slipped past validation until we walked definitions recursively.

Accomplishments that we're proud of

  • The scoring engine works end to end. It finds circuits from just a repository link or path, scores them on 20 metrics and pinpoints where the cost comes from. It has scored 119 circuits from QASMBench and MQT Bench, two widely used open-source benchmark suites.
  • A real, verified improvement. The deterministic layer cut QASMBench's fredkin_n3 from 12 to 10 two-qubit gates (−17%). It's proven equivalent and reproduces on 20 fresh seeds.
  • Zero false improvements. Every wrong AI rewrite was caught, and the engine never claims a gain it can't justify.
  • The GitHub bot works on real pull requests. On a demo PR, it caught a change that took a circuit from 1 to 6 two-qubit gates and added a SWAP. It failed the regression check and posted a Gemini review comment citing the evidence.
  • The research platform turns Gatesmith from a standalone tool into the start of a Rosetta-esque suite.

What we learned

Creating deterministic diagnostic tools is harder than it looks, especially for a team entirely new to quantum circuits and quantum computing. This project was a chance to really learn the field and where it's heading. Funnily enough, some of the repositories we looked at were bioinformatics projects. One of our example circuits is a QAOA circuit for protein side-chain packing, because quantum algorithms could speed up searching that enormous conformational space.

The improvement loop was less straightforward than we expected. To show meaningful improvements, we'd need many examples of badly written circuits that can't be fixed deterministically, since the goal is to let any AI improvement layer slot in, as is common in current pipelines. That isn't an inherent limitation, just a matter of scope for 36 hours.

What's next for Gatesmith

  • Deeper AMD ROCm acceleration. We've laid groundwork for ROCm acceleration and want to push it much further. We chose AMD because ROCm is open source end to end, the same openness we want for quantum research.
  • Circuit maps, not just single circuits. Researchers' repositories hold many circuits, often nested inside one another. We want to score the whole map and use AMD hardware to run many more optimizations. That would show how optimizing one circuit affects the rest, and which circuits to target first.
  • A graph learning layer that screens out noisy candidates during optimization to speed up processing, once we've assembled the training data.
  • The full multi-round loop, GPU verification on the W7900 and an open leaderboard on Hugging Face that ranks models by verified-improvement rate under identical budgets.
  • More frameworks, starting with Cirq and PennyLane.

Built With

  • amd-rocm
  • caddy
  • docker
  • fastapi
  • gemini-api
  • github-actions
  • github-api
  • gradio
  • hugging-face
  • openqasm
  • pydantic
  • pytest
  • python
  • qiskit
  • qiskit-aer
  • radeon-pro-w7900
  • react
  • sqlite
  • typescript
  • uv
  • vite
  • vultr
Share this project:

Updates

Submission history