Manuscript Offprint
arXiv:2611.03262Qyantram: A Transparent and Verifiable Quantum Computing Platform
Sadique Khatib
Dept. of Computer Science and Design
K. K. Wagh Institute of Engineering
Education and Research
Nashik 422003, India
Dr. Uday Wad
Professor of Practice
Dept. of Computer Engineering
K. K. Wagh Institute of Engineering
Education and Research
Nashik 422003, India
Sharyu Kekane
Dept. of Computer Science and Design
K. K. Wagh Institute of Engineering
Education and Research
Nashik 422003, India
Dr. S. M. Kamalapur
Head of Department
Dept. of Computer Engineering
K. K. Wagh Institute of Engineering
Education and Research
Nashik 422003, India
Abhushan Bokade
Dept. of Computer Science and Design
K. K. Wagh Institute of Engineering
Education and Research
Nashik 422003, India
Dr. Y. D. Bhise
Departmental Coordinator
Dept. of Computer Science and Design
K. K. Wagh Institute of Engineering
Education and Research
Nashik 422003, India
Abstract—Most platforms dealing with quantum circuits only go as far as idealized circuit assembly or simulation. The real engineering — like compiling for specific hardware, locating errors without measuring the qubit, or training variational models — usually gets hidden behind black-box calls. QYANTRAM is built differently: it is an open platform, broken into four subsystems, and everything revolves around a single rule — every result comes bundled with its supporting evidence, and no result gets through without an independent double-check. The compilation pipeline is split into clear stages where each one changes just one thing at a time, so if the pipeline adds a gate it is easy to trace back and see exactly why it got added. The router publishes the list of SWAP candidates that did not make it along with their scores, so routing is not a guessing game. For verification, QYANTRAM focuses on the active part of the layout: any qubit line left untouched stays locked at , so the check only has to touch the occupied wires. The cost then scales as for used qubits rather than for the whole device, and the reduction is mathematically exact, not an approximation. That makes it practical to run full per-compilation verification on 127- and 156-qubit layouts, with speed-ups of around four orders of magnitude and the restricted check holding steady below a millisecond. Error identification does not cut corners: every possible pattern of Pauli errors gets checked, with no sampling, agreeing with closed-form predictions to . The machine-learning engine lands within of qiskit. quantum_info and trains roughly 25 to 50 times faster. For full disclosure, the router adds about as many SWAPs as Qiskit's SABRE because it skips optimisation — that extra cost is the price of keeping every routing decision visible from start to finish.
Index Terms—quantum compilation, qubit mapping, SABRE, equivalence checking, quantum error correction, explainable systems, quantum computing education
I. INTRODUCTION
A quantum circuit as written and the same circuit as executed are different objects. Between them sits the compiler, which must solve two problems the author of the circuit never mentioned. The first is connectivity: a superconducting processor couples each qubit to only a handful of neighbours, so an entanglement operation whose two operands are not neighbours cannot run at all, and the compiler inserts SWAP gates until they are. The second is the gate set: a device calibrates a small number of physical operations, so every gate outside that set must be rewritten in terms of the ones inside it.
Both problems are well studied. Qubit mapping is NP-hard in general and has a substantial literature of heuristics [1]–[4], of which SABRE [3] and its recent reworking LightSABRE [5] are the most widely deployed; gate synthesis has been understood since Barengo et al. [6]. What is far less developed is the observability of the process. A production compiler such as Qiskit [7] is invoked as a single call and returns a single circuit. A learner, or an engineer debugging a surprising result, is therefore left with an observation of the form “my five-gate circuit became seventy gates” — the growth a five-qubit star circuit actually undergoes on a heavy-hex lattice in our own engine — and no mechanism for asking which of the two problems caused it, which SWAPs were inserted and why those rather than others, or whether the rewriting preserved the computation at all.
This last question is not rhetorical. Compilation is a sequence of semantics-preserving rewrites, and a bug in any of them produces a circuit that runs perfectly and computes the wrong thing. Equivalence checking for quantum circuits is an active field [8]–[10], but it is normally treated as an offline verification task applied to selected cases, not as something a compiler does to every circuit it emits — in large part because the obvious method, comparing state vectors, costs amplitudes in the device size and is therefore unthinkable on a 127-qubit processor.
-
A stage-separated pipeline with cost attribution. Decomposition, layout and routing, and basis translation run as distinct stages under an invariant: each stage may alter exactly one property of the circuit (gate arity, qubit placement, gate set) and must leave the others intact. Every gate in the final circuit is therefore attributable to a single cause. Within each stage, every individual compiler pass is recorded with its name, its duration, and the depth and size of the circuit it produced (Section IV).
-
A decision-recording router. Our implementation of the SABRE heuristic emits, for each round of its main loop, the set of gates that became executable, the front layer that then blocked, the look-ahead set, every candidate SWAP with its front-layer cost, look-ahead cost, decay factor and combined score, and the winner with the reason it won. Layout synthesis becomes an inspectable process rather than an opaque transformation (Section IV-B, Table III). The dependency DAG behind each stage is exposed alongside it, and compiled QASM can be exported for several device layouts at once so their costs can be compared directly (Sections IV-C and IV-D).
-
Occupied-sub-space equivalence verification. We observe that the device wires a compiled circuit never touches remain in for the whole circuit and so factorise out of the state exactly. Restricting the state-vector comparison to the k occupied wires is consequently not an approximation of the comparison but the same comparison with an identical tensor factor cancelled from both sides. This reduces per-compilation verification from to amplitudes and makes it routine rather than exceptional (Section V).
-
An exactly validated error-identification module. Three stabiliser codes are implemented with syndrome extraction and lookup decoding, and validated by enumerating every error pattern the noise model can produce — not by sampling — and comparing the resulting logical error rate against closed-form algebra (Section VI).
-
A batched state-vector engine for variational training, checked against a general simulator. Training evaluates one circuit per sample per iteration, where a general-purpose simulator's per-call overhead dominates. Holding the state as an n-dimensional array with a batch axis turns one training iteration into one contraction per gate rather than one pass per sample. We report both halves of the trade: agreement with qiskit.quantum_info to , and the speed-up that justifies writing a second simulator at all (Section VII).
-
A deterministic diagnostic learning layer. Topic mastery is computed from weighted evidence with four published thresholds and no learned parameters, and a learner's misconception is measured rather than inferred: a candidate mistake is reported only when mechanically undoing it in the submitted circuit makes that circuit meet the goal under simulation (Section VIII).
-
A measured evaluation, including the cost of transparency. Section IX reports routing quality against three Qiskit routers across six topologies up to 156 qubits, verification cost against device size, and error-correction validation. Our router is deliberately unoptimised and starts from the identity layout; it therefore inserts more SWAPs than Qiskit's SABRE, and we quantify the gap rather than omit it.
We make no claim to improve on the state of the art in routing quality, and we do not present a user study: the learning layer's design is described and its mechanism validated, but its educational effect is not measured here. Both limitations are discussed in Section X.
II. RELATED WORK
A. Qubit mapping and routing
Mapping a logical circuit onto a restricted coupling graph while minimising inserted SWAPs is NP-hard, and the practical literature is accordingly heuristic. Siraichi et al. [1] framed qubit allocation as a compiler problem; Zulehner et al. [2] gave an -based method for the IBM QX devices; Murali et al. [4] showed that calibration data should inform the mapping, since qubits differ in quality. Li and colleagues [3] introduced SABRE, a routing algorithm that ranks candidate SWAPs by how far they close the physical distance between the operands of the gates waiting at the executable front layer. It uses a look-ahead term to discount future moves and a decay factor that encourages SWAPs to be spread around rather than focus on just one spot in the device. That is why it became the go-to router in Qiskit. LightSABRE [5] later reworked this approach, with results reported there showing roughly faster execution and nearly 19% fewer SWAPs on average. Nash et al. [11] and Maslov [12] treat the complementary problem of optimising for a particular architecture's native operations.
Our router implements the SABRE heuristic as published in [3]; we claim no algorithmic contribution to it, and we do not reproduce the enhancements of [5]. What we add is the emission of the decision record. To our knowledge no production or educational compiler exposes the candidate set with its decomposed score, which is precisely the information needed to understand why a particular SWAP was chosen.
B. Verification of compiled circuits
Since compilation is a chain of rewrites, its output should be checked. Researchers like Viamontes et al. [8] used decision diagrams to check whether two circuits or quantum states are equivalent. Burgholzer and Wille [10] take a slightly different route: they compose a circuit with the inverse of its supposed equivalent, and if the identity comes out you have a match — which saves considerable work compared with building either unitary outright. Amy [9] and Kissinger and van de Wetering [13] bring other tools, path-sum and the ZX-calculus, to the same end. All of these are stronger than ours: they verify unitary equality rather than the action on a single input, and they handle circuits far beyond what state-vector simulation can reach.
Our goal is more modest, but more practically grounded: we want a check fast and reliable enough to run every single time the compiler is called, even inside a web request. This is not to catch hardware mistakes, but to make sure our own pipeline does not go off the rails. What makes it possible is not some fancy algebra — it is architectural: a typical user circuit only uses a handful of qubits on the whole device, leaving the rest untouched. That shrinks the problem enough to do exact state-vector comparisons on the small, active subspace. Our method's cost depends only on the circuit, not on the hardware size, and it complements decision diagrams rather than competing with them. They scale with circuit size; we stay agnostic to device size, with the trade-off that our approach meets a ceiling in circuit width, where the cost catches up with us.
C. Quantum error correction in teaching
The three-qubit repetition codes and Shor's nine-qubit code [14], [15] remain the standard introduction to error correction, and the stabiliser formalism [16] the standard language for it. Modern devices have driven interest in codes matched to low-degree coupling graphs [17]. Our contribution here is not a code or a decoder but a validation methodology appropriate to a teaching tool: because the codes are small, every error pattern the noise model can produce can be enumerated exactly, so the module's reported logical error rate can be compared against closed-form algebra rather than against a sampled estimate of itself.
D. Platforms and tooling
Qiskit [7], t|ket⟩ [18] and PennyLane [19] are the dominant programming frameworks, and OpenQASM [20] the interchange format we accept as input. Web-based circuit editors have made it easy for anyone to build quantum circuits, and the Qiskit textbook does a good job of teaching the algorithms. But there is a gap right between those two: the editors stop at drawing and simulating the circuit, and the critical step — compiling for real hardware, where NISQ-era [21] engineering actually gets done — is still hidden in a single, black-box call.
E. Mastery modelling
Our approach borrows from mastery learning [22] and the original model of knowledge tracing by Corbett and Anderson [23], where skill is treated as a probability that updates as more evidence of what a learner knows arrives. Later work

Fig. 1. Platform architecture. The compilation engine (100) is a pure function of its request: it holds no state, stores no circuit, and has no import path to the hardware-submission module, so a compilation can never become a hardware job by accident.
swaps that explicit, interpretable model for a recurrent neural network [24], but in doing so loses the transparency that makes feedback meaningful. VanLehn [25] showed that feedback at the step level — telling a learner what, specifically, needs fixing — explains much of the benefit of intelligent tutoring, which for us means zeroing in on a specific structural mistake rather than handing out survey scores. That is why we stick with a transparent rule that weighs evidence instead of a learned model: if our platform exists to explain itself, every recommendation needs to come with a reason you can inspect. The direction we have taken lines up with the needs analysis of Hughes et al. [26], who found that employers want engineers who have grappled with real hardware constraints rather than only the algorithms.
III. SYSTEM ARCHITECTURE
QYANTRAM is a web application: a browser client and a Python service layer over a relational store (Fig. 1). The service layer is divided into six packages that do not import one another except where stated: the compilation engine, the machine-learning studio, the error-identification module, the assessment module, the learning layer (which deliberately depends on assessment), and authentication. Table I gives their sizes.
Three structural properties are worth stating because they are enforced rather than merely intended.
The compilation engine is stateless and isolated: The engine (numeral 100 in Fig. 1) is a pure function from a request to a response. It persists nothing, so no user circuit is stored server-side, and it has no import path to the hardware-submission module. The latter is checked by a test that walks the engine's transitive imports and fails if the hardware module appears among them. Running a circuit on real hardware is a separate, separately authenticated feature; the consequence of the isolation is that a compilation can never become a billable hardware job through a coding error.
TABLE I IMPLEMENTATION SIZE, BY PACKAGE. LINES INCLUDE COMMENTS AND BLANK LINES AS THE SOURCE CONTAINS THEM.
| Layer | Package | Files | Lines |
|---|---|---|---|
| Service | compilation engine | 10 | 4 187 |
| machine learning studio | 12 | 5 777 | |
| error identification | 5 | 1 277 | |
| learning layer | 10 | 2 326 | |
| assessment | 7 | 1 811 | |
| authentication | 27 | 2 029 | |
| Tests | automated test suite | 22 | 6 391 |
| Client | browser application | 125 | 24 696 |
Every limit is explicit: A request is bounded before work begins: at most 400 source instructions, at most 60 per-pass circuit snapshots per stage, no snapshot of a circuit exceeding 900 gates, and equivalence verification only up to 12 occupied qubits. QYANTRAM does not treat these as fuzzy settings — they are hard promises. Either the engine answers within the time a web request allows, or it declines and says exactly why. No silent timeouts, and no degraded result passed off as a complete one.
Scoring is server-side: Quiz answers, challenge grading and progress all live in the service layer. Nothing that determines a result is present in the browser before it is due, and the dashboard cannot disagree with the stored record because it is derived from it on each request.
A. Device models
The engine ships the coupling graphs listed in Table II. Linear, ring, grid and all-to-all graphs are generated analytically; the heavy-hex lattices follow the degree-≤ 3 construction IBM adopted for its superconducting processors [17], and the two named layouts reproduce the qubit and coupling counts of specific device generations. A user-supplied edge list is also accepted, subject to a connectivity check — a disconnected graph makes routing impossible, and rejecting it with that explanation is more useful than failing to converge.
Each device's connectivity graph is tracked in two forms, and keeping them separate is not just pedantry. When routing, we work with the undirected map, because a SWAP moves two qubits together regardless of entangling direction. For basis translation and final verification, direction matters: the calibrated direction of a gate signals whether extra fix-ups are needed, so those stages take the directed map. Mixing the two would either create unnecessary SWAPs or miss a direction violation entirely. Keeping them apart means the final check can report wrong-direction gates as a separate, non-fatal warning.
B. Target gate sets
Five basis sets are supported: IBM's native ; the Heron set with echoed cross-resonance [27]; the textbook ; ; and the trapped-ion set built on Mølmer-Sørensen gates [28]. Offering several is pedagogically load-bearing: compiling one
TABLE II DEVICE COUPLING GRAPHS AVAILABLE TO THE ENGINE.
| Graph | Structure | Qubits |
|---|---|---|
| Linear chain | path | 3–20 |
| Ring | cycle | 3–20 |
| 2-D grid | nearest-neighbour lattice | 3–20 |
| Heavy-hex | degree-≤ 3 lattice, | 19 |
| All-to-all | complete graph (trapped-ion-like) | 3–20 |
| IBM Eagle | heavy-hex device layout | 127 |
| IBM Heron r2 | heavy-hex device layout | 156 |
| Custom | user edge list, connectivity-checked | ≤ 20 |
circuit to both the CX and the CZ set shows directly that the two-qubit count is a property of the device's calibrated entangler and not of the algorithm, and pairing the trapped-ion set with the all-to-all graph shows that the SWAP overhead which dominates superconducting compilation is an artefact of connectivity rather than a law of quantum computing.
IV. THE STAGE-SEPARATED PIPELINE
A. Stage separation and the attribution invariant
Let be the source circuit and the circuit finally emitted. A conventional compiler computes in one call. QYANTRAM computes
where, in (1), decomposes gates of arity greater than two, performs layout and routing, performs basis translation, and verifies and changes nothing. Each stage carries an invariant (Fig. 2):
-
may reduce gate arity. It may not change the qubit mapping and may not change the gate set beyond what the decomposition of a wide gate requires.
-
may insert SWAP gates and permute the logical-to-physical mapping. It may not alter the gate set.
-
may rewrite any gate into the target basis. It may not alter the qubit mapping.
-
may not alter the circuit at all.
The consequence is attribution. Because cannot change the basis, every gate present in but not in exists because of connectivity. Because cannot change the mapping, every gate present in but not in exists because of the gate set. The two costs that a single transpile() call returns summed and indistinguishable are therefore separated, and the familiar observation that a small circuit became a large one resolves into two numbers with two different remedies: a connectivity cost, addressed by a better layout, and a translation cost, addressed by choosing a different target device.
At each stage we also write down every compiler pass: what it was, how long it took, the depth and size of the circuit it passed forward, plus a human-friendly summary of what it did. Instead of a black box, you get a concrete, measurable list of steps — which is the granularity at which the growth of a circuit can actually be understood.

Fig. 2. Stage separation. Each stage is permitted to change exactly one property of the circuit, which is what makes the gate count it adds attributable. The dashed path is the conventional single call, shown for comparison.
B. The decision-recording router
Routing is where the interesting decisions are made, and where conventional tooling is most opaque. Our implementation follows the SABRE heuristic of Li et al. [3]. At each round the router maintains a mapping from logical to physical qubits, computes the front layer of instructions all of whose predecessors have executed, and executes every member of whose operands are adjacent under , repeating until no further progress is possible. If instructions remain, the front layer is blocked, and the router must insert a SWAP. It forms the candidate set
that is, every device edge incident on a physical qubit that some blocked instruction is waiting on, and scores each candidate by
where is the mapping after applying , is the mean device distance between the operands of the two-qubit gates in a set under , is a look-ahead set of up to two-qubit gates immediately behind the front layer, weights the look-ahead term, and is a per-qubit decay that rises by each round and resets to 1 for the two qubits just swapped. We use the published defaults , , . The candidate minimising in (3) is applied; ties are broken on the qubit pair, which makes a run reproducible.
Two implementation choices depart from the reference formulation, and neither touches the algorithm. First, we compute neighbour sets, edge membership and all-pairs shortest paths with breadth-first search over an adjacency list rather than through a graph library, which removes a dependency from the service without changing any distance. Second, and this is the point of the exercise, the information a reference implementation would print for debugging is instead collected into a structured record: for every round, the instructions that became executable, the blocked front layer with the device distance that blocks each one, the look-ahead set, the full candidate set with , , and reported separately
TABLE III
THE DECISION RECORD FOR ONE ROUTING ROUND, IN THE FORM THE ENGINE RETURNS IT (ILLUSTRATIVE VALUES, , LOOK-AHEAD DEPTH 5, DECAY STEP 0.001). THE FRONT LAYER IS BLOCKED BECAUSE AND SIT TWO HOPS APART. EVERY CANDIDATE IS REPORTED WITH ITS SCORE DECOMPOSED, NOT JUST THE WINNER.
| Candidate SWAP | ||||
|---|---|---|---|---|
| (p0, p1) | 1.00 | 1.50 | 1.000 | 1.750 |
| (p1, p2) | 1.00 | 2.00 | 1.000 | 2.000 |
| (p2, p3) | 2.00 | 1.50 | 1.001 | 2.753 |
| (p0, p5) | 3.00 | 2.00 | 1.000 | 4.000 |
Selected at ; ties break on the qubit pair, so the run is reproducible. The decay then resets: , all others .
for each candidate, the selected SWAP with its score, and the mapping before and after (Table III).
The design decision embedded in this record is that the losing candidates are reported. A router that returns only the chosen SWAP cannot be checked; a router that returns the whole scored candidate set can be checked by hand, and its heuristic can be criticised on a concrete case. This is also what makes the router usable as a teaching object: a reader can see that the look-ahead term and the decay term occasionally disagree with the front-layer term, and can see which one won.
An unavoidable corollary is cost. The record for one round is and grows with device degree, so on a 156-qubit lattice a long routing problem produces a large record. Section IX-C measures the record size and the resulting runtime, and Section IX-B measures the routing quality this implementation achieves given that it starts from the identity layout and performs no optimisation.
C. The dependency graph
Every circuit starts as a diagram — just the order you wrote the gates in. The DAG reveals what that order really depends on. Wherever one gate is immediately followed by another on a shared wire, you draw an arrow from the first to the second. If two gates are unconnected, they can run in any order or even at the same time. The number of layers, where each node's layer is one past the deepest node feeding into it, gives you the true circuit depth. We expose this at every stage, so a

Fig. 3. Occupied-sub-space equivalence verification. Every wire the compiled circuit never touches provably remains in and therefore factorises out of the state exactly, so comparing only the occupied wires is not an approximation of the comparison — it is the same comparison, with a tensor factor of cancelled from both sides.
circuit can be read as a list of gates or as the underlying set of constraints, and so the effect of routing on the critical path is visible rather than inferred.
Two things make a circuit DAG simpler to lay out than a regular graph. Horizontally there are no choices: each gate's layer is forced, and every dependency arrow points forward. Vertically it is the qubit index that decides. Gates in the same layer always act on disjoint wires, since two gates sharing a qubit must be ordered and so cannot share a layer. Disjoint sets of wires have distinct minima, so you can plot every gate at the lane of its lowest qubit with no collisions. The upshot is that the drawing reads like the actual circuit: a gate travels along its wire, and a horizontal edge is a dependency between operations on the same qubit.
The graph is returned as data, with the per-node table of gate, layer, wires, parameters, predecessors and successors available as JSON or CSV, and the graph itself as Graphviz DOT.
D. Exporting for a chosen device
A QASM file only means something when you know what hardware it is tied to. Exporting in QYANTRAM takes a set of target devices: each gets its own compilation and its own file, and the SWAP counts sit side by side for comparison. A four-qubit star circuit, for instance, needs zero SWAPs if all-to-all connectivity is allowed, two on a linear chain and five on a heavy-hex device — all with the same circuit and the same gate basis (Section IX-B).
Every output file comes with a header, in the QASM comments, showing its provenance: which device, the coupling count, the basis set, the layout and routing method, SWAPs inserted, depth and gate counts before and after, and the result of the equivalence check of Section V. If a target device is too small, that is called out for just that target rather than as a failure of the whole request, so one impossible layout does not cost the user the others.
V. OCCUPIED-SUB-SPACE EQUIVALENCE VERIFICATION
Each compilation is checked three ways before it is returned. Two are simple bookkeeping: first, making sure every instruction in the final circuit matches what the target gate set allows;
second, re-checking connectivity, but only after all routing and transformation is done, to be sure basis translation did not introduce new problems. The third check goes deeper — it proves the circuit still computes the same thing it was meant to.
A. The reduction
Say the hardware has qubits but the circuit only uses of them — the wires carrying at least one instruction, together with the wires the user's logical qubits finally sit on. Collect the indices of those active wires in , with , and let be the rest.
There are no instructions at all on the wires in . That is not a guess; it is checked directly from the emitted instruction list. We always start from , so every idle wire in stays at the whole way, and the final state factorises cleanly:
where is the circuit re-expressed on the occupied wires alone, obtained by the order-preserving relabelling .
Let be the final logical-to-physical mapping reported by the routing stage, and define the induced basis-state map on indices
where is the number of logical qubits and gives a physical qubit's position in the sorted occupied set. Because the idle wires stay in , every logical basis state maps to exactly one physical basis state and is injective. The expected state defined by (5) is then for the source circuit's state, and the check is
Equation (4) is what makes this exact. Restricting to cancels an identical tensor factor from both sides of the comparison; no amplitude is discarded, truncated or approximated. The restricted check is the unrestricted check, performed after an exact simplification. The practical effect is that verification cost depends on the circuit the user wrote and not at all on the device they selected — which is the difference between a check that can run on every compilation and one that cannot run on a 127-qubit device at all.
B. Scope and honest limits
We only attempt verification when the conditions fit, and when they do not the engine says so clearly — there is no silent skipping. It is skipped if the circuit measures or resets, since it is then not a single unitary; if layout information is missing; and if exceeds 12, because amplitudes is simply too big for our latency target. The tolerance in (6) is on the loose side for double precision, chosen so that accumulated error in a long gate sequence does not light up a false alarm.
There are three real limits. First, we only check whether the output starting from matches — not unitary equality. A faulty rewrite that acts identically on will slip by, and tools like decision diagrams [10] and path-sums [9] are genuinely stronger here. Second, the ceiling is real: device size does not matter, but a circuit using more than twelve wires goes unverified. Third, this only checks our own compiler pipeline; it says nothing about the behaviour of the physical device. The upside is that you get an unconditional check every time, right inside the compile, so if something is wrong you find out immediately rather than in an experimental result. Section IX-C measures what that costs.
VI. ERROR IDENTIFICATION
The platform includes a module for the idea that most reliably defeats newcomers: that an error on a qubit can be located without the qubit being measured. We have built support for three codes in the stabiliser formalism [16], [29]: the basic three-qubit bit-flip and phase-flip repetition codes, and Shor's nine-qubit code [14], [15]. For each code you get the check operators, the syndrome-to-correction lookup table, and clear logical and actions. Table IV gives their parameters.
A. Representation
A Pauli error on data qubits is held as a pair of binary vectors , with , , . For a check operator with support vectors the syndrome bit is the symplectic product
Stringing these together for a batch of errors, by (7), is just multiplying a matrix by a vector over , so a whole batch of patterns costs one matrix product. Decoding is a table lookup from syndrome to correction.
B. Classifying what is left over
It is not enough to say only “corrected” or “not corrected”. What really matters is what happens after correction. Take the residual , where is the error and the correction, and classify it by how it commutes with the logical operators:
• If r is zero, the error was truly corrected.
-
If r is non-zero but still commutes with both and , you are corrected up to a stabiliser. The final state is fine even though the correction was not the literal inverse of the error. This is the first point where the subject actually feels quantum rather than binary.
-
If r anticommutes with either or and the syndrome was non-zero, you mis-corrected: the decoder acted, and made things worse.
-
If it anticommutes and the syndrome is zero, the error went undetected — it is itself a logical operator, and the code is blind to it.
The last two categories are the honest content of the subject: a code does not remove errors, it trades a high rate of correctable errors for a low rate of uncorrectable ones, and a module that reported only success would teach the opposite.
TABLE IV
IMPLEMENTED CODES. TOTAL QUBITS INCLUDE THE ANCILLAE USED FOR SYNDROME EXTRACTION.
| Code | Data | Checks | Total | Error patterns |
|---|---|---|---|---|
| Bit-flip repetition | 3 | 2 | 5 | |
| Phase-flip repetition | 3 | 2 | 5 | |
| Shor nine-qubit | 9 | 8 | 17 |
C. Exact validation
We do not estimate logical error rates by hoping repeated samples will cover the space. For an independent single-qubit noise model with per-qubit Pauli probabilities, the module enumerates every single possibility — for the nine-qubit code that is distinct patterns. For each one it calculates the exact probability, syndrome, correction and outcome class using the vectorised algebra above. Add them up and you have the exact rate, not an estimate. This is not just for completeness: it serves as a gold-standard check. With matched noise, the three-qubit code must fail exactly when two or three of its qubits are hit, matching the closed form
Section IX-E reports the measured agreement with (8).
D. Circuit construction
Alongside the algebra the module emits the actual Qiskit circuit, annotated with stage bands (PREPARE, ENCODE, ERROR, SYNDROME, MEASURE) so the same drawing can be read stage by stage. Two simulation modes are offered. In injection mode the user places specific errors and the circuit is run as a state vector, which is deterministic and so lets the syndrome be read as a fact rather than a statistic. In noise mode errors occur with probability p and the circuit is sampled; here the matrix-product-state simulator is used instead, which on the 17-qubit Shor circuit is roughly an order of magnitude faster than dense state-vector simulation and sufficient for the low-entanglement states these circuits produce. Logical-basis states of the phase-flip code are rendered in the basis, where is two terms rather than the eight it becomes in the computational basis.
VII. QUANTUM MACHINE LEARNING STUDIO
The fourth subsystem trains variational models. It is included here not because variational classification is novel — it is not — but because two of its engineering decisions follow the same rule as the rest of the platform: do the arithmetic in a way that can be checked, and check it.
A. What it offers
Three model families are implemented: a variational quantum classifier, a hybrid quantum-classical network, and a quantum-kernel support vector classifier. Each is assembled from a feature map, an ansatz and an optimiser, listed in Table V. Multi-class problems are reduced one-against-one or one-against-rest. Everything is bounded before work starts, as
TABLE V
WHAT A MODEL IS ASSEMBLED FROM. EVERY COMBINATION IS REACHABLE FROM THE BROWSER WITHOUT WRITING CODE.
| Component | Choices |
|---|---|
| Model | VQC, hybrid QNN, quantum-kernel SVC |
| Feature map | angle, angle-X, dense angle, Z, ZZ, amplitude |
| Ansatz | hardware-efficient, real-amplitudes, efficient-SU(2), product, user-supplied |
| Optimiser | Adam (parameter-shift), SPSA, COBYLA |
| Multi-class | one-vs-one, one-vs-rest |
| Datasets | moons, circles, blobs, XOR, iris, wine, digits |
| Execution | simulator, or IBM Quantum hardware |
elsewhere in the platform: the kernel classifier refuses more than 200 samples, because a quantum kernel is a dense matrix of circuit evaluations and the request would not return.
B. Gradients that differentiate the right thing
Adam uses the parameter-shift rule, which gives an exact derivative of a circuit's expectation value with respect to a rotation angle. This needs saying because it is a really easy mistake: the parameter-shift rule does not apply to the loss function directly. Loss depends on the expectation value, so you must use the chain rule — take the shift-rule gradient of the expectation value first, then multiply by the derivative of the loss with respect to that expectation. Apply the shift rule straight to the loss and it spits out a number that looks reasonable but is not a real gradient. Training might still look like it is working, which is why this mistake slips through into real code.
SPSA and COBYLA are offered alongside it because the shift rule costs two circuit evaluations per parameter per step, which is the dominant cost of training and the reason the engine below exists.
C. A second simulator, and why
Training does not call Qiskit. The loop evaluates a variational circuit once per sample per iteration, so a few hundred samples over a hundred iterations is tens of thousands of evaluations, and at the circuit widths a browser session uses — four to twelve qubits — the per-call overhead of a general-purpose simulator dominates the arithmetic it performs.
The engine in statevector.py is written for that case. It holds the state as an -dimensional array of shape rather than a flat vector of length , which turns applying a single-qubit gate into a tensor contraction along one axis and a two-qubit gate into a contraction along two. More importantly it carries a batch axis, so one circuit can be applied to every sample in a batch with one contraction per gate instead of one pass per sample. Since each sample in a batch differs only in its feature map and shares the entire ansatz, that is the whole of the hot path.
Writing a second simulator is only defensible if it gives the same answers as the first, so both properties are measured rather than asserted. Section IX-F reports agreement with qiskit.quantum_info to a worst infidelity of , and the speed-up that pays for the duplication: modest on a single circuit, and between roughly and on the batched path that training actually runs.
D. Hardware execution, and the credentials it needs
A trained model can be re-evaluated on IBM Quantum hardware. This is the one place in the platform that holds a user credential, and it is deliberately the one place: the compilation engine of Section IV has no import path to it, enforced by a test (Section III), so no amount of activity in the transpiler can turn into a hardware job.
The token is never returned by any endpoint, never written to a log, and never sent back to the browser that supplied it. It is encrypted at rest with a symmetric key the deployment supplies, scoped to the account that stored it, and revocable. Submitting jobs to real hardware uses a separate rate limit from simulation, and before anything is sent out the system checks the configuration against the chosen device — number of qubits, maximum depth. If there is no way the request could have succeeded, it is blocked up front, sparing both the hardware quota and the user's patience. These are not incidental; a teaching platform that leaks a hardware credential or silently burns a student's allocation has failed at something more important than pedagogy.
VIII. THE DIAGNOSTIC LEARNING LAYER
The compilation engine is the technical core, but a tool that only experts can reach is of limited use. The learning layer places a curriculum in front of it: ten modules running from the bit-qubit distinction to compiling a circuit and executing it on hardware, over a dependency graph of 33 topics to which 37 quiz items and 13 circuit-construction challenges are attached.
A. Grading by simulation
A challenge states a goal — produce a given state, or a given measurement distribution — optionally with constraints such as a gate budget. Submissions are graded by running the circuit and comparing against the goal up to global phase. No reference solution is compared against. The consequence is that any circuit achieving the goal passes, including ones the authors did not anticipate, which is both correct and necessary: the alternative, matching a stored answer, teaches that there is one right circuit, which is false.
B. Mastery from weighted evidence
Each piece of evidence contributes a weight and a value : a passed challenge , a failed challenge , a quiz item or , a completed lesson . For a topic with evidence set ,
where, in (9), is mastery and a confidence that reflects how much evidence exists. A topic is mastered when and ; needs revision when on non-trivial evidence; locked when a prerequisite is below 0.6; and ready otherwise (Table VI).
TABLE VI THE WHOLE MASTERY MODEL. FOUR EVIDENCE WEIGHTS AND FOUR THRESHOLDS, ALL FIXED AND PUBLISHED; THERE ARE NO LEARNED PARAMETERS.
| Evidence | Weight wi | Value vi |
|---|---|---|
| Challenge passed | 2.0 | 1.0 |
| Challenge failed | 1.0 | 0.0 |
| Quiz item | 1.0 | 0 or 1 |
| Lesson completed | 0.5 | 0.6 |
| Topic state | ||
| Mastered | μ ≥ 0.8 and c ≥ 0.6 | |
| Needs revision | μ < 0.6 on non-trivial evidence | |
| Locked | a prerequisite below 0.6 | |
| Ready | otherwise |
We score a challenge twice as heavily as a quiz because building a working circuit shows more understanding than picking the right answer. Finished lessons count for 0.6 rather than a full point, because reading exposes you to information but does not mean you can use it. These are design choices, spelled out plainly so that people can disagree with them or adjust them. We stick with a transparent rule rather than a learned one [23], [24]: every recommendation carries a clear justification, and a black-box network with hidden weights could never provide that.
C. Diagnosis by rewriting
We are interested in why an attempt failed. Rather than trying to infer intent from a learner's text, the system rewrites the submitted circuit mechanically in three specific ways and reruns it:
- exchange control and target on every CNOT;
- apply each transposition of the circuit's wires;
- compare against variants that add a missing Hadamard, or correct a phase sign.
If any transformation gets the circuit to meet the goal, that is the diagnosis, and the system reports it complete with the evidence — “your CNOTs are the right way round in principle but reversed here”, together with the fact that reversing them produces the target state. If nothing fixes it, the attempt is simply marked incorrect and the relevant lesson offered. The system never invents a diagnosis. The rewrites test for seven common misconceptions, always in a set order so that more specific issues take precedence.
One safeguard is essential, and we added it only after spotting its absence: a circuit that already works is never “diagnosed”, whatever its structure. The Bell state is symmetric under swapping its two qubits, so a wire-permutation detector would happily flag a wrong-qubit mistake in a perfectly correct submission. Correctness therefore always comes first, and only a failing circuit meets the rewrite battery — unless there is a constraint violation, such as exceeding the gate budget, which can make sense even when the outcome is right.
D. Separation of scoring concerns
Practice and the platform score different things, and an earlier version of the system reported both as one. It therefore described the same learner as being at one level on the practice page, where only challenge and quiz results counted, and at a different level on the dashboard, where completed lessons counted too. Here is the rule now: the platform controls experience level and mastery, while practice sections only track their own results. Practice links out to the main dashboard instead of showing a score of its own — because as soon as two places compute a score differently, someone ends up seeing two conflicting numbers, and that is a recipe for confusion. We record it not because the fix is interesting but because the failure is systematic.
IX. EVALUATION
A. Setup
All experiments ran on an AMD Ryzen 7 7445HS, eight cores and sixteen threads, with 15.2 GiB of RAM, Windows 11, CPython 3.12.9, Qiskit 2.5.0, Aer 0.17.2 and NumPy 2.2.6. We fixed the random seed at 42. Every experiment is driven by a script that writes its results as JSON, and every table in this section is generated from those files automatically — no measured number here was copied across by hand.
B. Routing quality, and the cost of transparency
We route six benchmark circuits — a 7-qubit GHZ preparation, a 6-qubit QFT, a three-layer CNOT chain, a 7-qubit QAOA ring layer, a chain of three Toffoli gates, and a depth-8 random two-qubit circuit, all reduced to one- and two-qubit gates — onto six device graphs: linear (7 qubits, 6 edges), ring (7, 7), grid (9, 12), heavy-hex (19, 20), the Eagle layout (127, 144) and the Heron r2 layout (156, 176). That is 36 device/circuit pairs. Each pair is routed by our router and by Qiskit's SABRE, BasicSwap and LookaheadSwap, giving 144 measurements. Each measurement runs in a child process under a 60s budget. For a routing-only comparison, the Qiskit routers are invoked with a trivial (identity) layout and optimization_level=0, matching our router's identity start and absence of optimisation.
Table VII gives the SWAP counts and Table VIII the aggregate. The result is that our router is worse than Qiskit's SABRE, by a mean factor of 1.27 in SWAP count and 1.10 in depth. Across the 36 comparison pairs our routing needed fewer SWAPs on 7, matched Qiskit's count on 8, and used more on 21, with per-pair ratios from 0.71 to 2.40 and a median of 1.28. BasicSwap is worse again at 1.53×; LookaheadSwap attains 1.08× but failed to finish within the budget on 5 of 36 pairs, including on the 7-qubit linear chain, which is the smallest device in the study.
This extra cost is not a problem with SABRE — it is the result of our design choice. We always start from the identity layout with no optimisation, so every assignment of logical to physical qubits can be tracked step by step: a reader can follow through every round. Qiskit's SABRE, by contrast, runs an extra layout-selection phase that routes the
TABLE VII
INSERTED SWAP GATES BY ROUTER, DEVICE AND BENCHMARK CIRCUIT; LOWER IS BETTER.
| Device | Router | GHZ-7 | QFT-6 | CX-chain-7 | QAOA-ring-7 | Toffoli-5 | Random-7-d8 |
|---|---|---|---|---|---|---|---|
| Linear-7 | Qyantram | 5 | 20 | 0 | 5 | 11 | 39 |
| Qiskit SABRE | 6 | 13 | 0 | 5 | 7 | 31 | |
| BasicSwap | 5 | 40 | 0 | 5 | 11 | 37 | |
| Lookahead | 5 | 20 | 0 | 5 | 6 | t/o | |
| Ring-7 | Qyantram | 5 | 17 | 0 | 0 | 11 | 20 |
| Qiskit SABRE | 6 | 13 | 0 | 0 | 7 | 17 | |
| BasicSwap | 5 | 23 | 0 | 0 | 11 | 26 | |
| Lookahead | 5 | 16 | 0 | 0 | 6 | 26 | |
| Grid-9 | Qyantram | 4 | 9 | 12 | 5 | 12 | 23 |
| Qiskit SABRE | 3 | 7 | 5 | 7 | 8 | 15 | |
| BasicSwap | 5 | 13 | 6 | 6 | 9 | 32 | |
| Lookahead | 3 | 7 | 5 | 4 | 7 | 17 | |
| Heavy-hex-19 | Qyantram | 11 | 21 | 21 | 20 | 23 | 63 |
| Qiskit SABRE | 13 | 22 | 20 | 15 | 18 | 36 | |
| BasicSwap | 13 | 44 | 43 | 20 | 22 | 79 | |
| Lookahead | 17 | 21 | 12 | 14 | 15 | t/o | |
| Eagle-127 | Qyantram | 5 | 20 | 0 | 5 | 11 | 39 |
| Qiskit SABRE | 6 | 13 | 0 | 5 | 7 | 31 | |
| BasicSwap | 5 | 40 | 0 | 5 | 11 | 37 | |
| Lookahead | 5 | 27 | 0 | 6 | t/o | t/o | |
| Heron-156 | Qyantram | 5 | 20 | 0 | 5 | 11 | 39 |
| Qiskit SABRE | 6 | 13 | 0 | 5 | 7 | 31 | |
| BasicSwap | 5 | 40 | 0 | 5 | 11 | 37 | |
| Lookahead | 5 | 27 | 0 | 6 | 7 | t/o |
t/o marks a router that did not finish inside the 60 s per-measurement budget. Our router starts from the identity layout and performs no optimisation, which is the cost of emitting a decision record; Qiskit's routers run with a trivial layout and optimization_level=0, so the comparison isolates routing.
TABLE VIII
AGGREGATE OVER EVERY DEVICE/CIRCUIT PAIR THAT COMPLETED. RATIOS ARE PER-PAIR AGAINST QISKIT SABRE ON THE SAME PAIR, THEN AVERAGED.
| Router | n | t/o | SWAP | SWAP ratio | depth ratio |
|---|---|---|---|---|---|
| Qyantram | 36 | 0 | 517 | ||
| Qiskit SABRE | 36 | 0 | 398 | ||
| BasicSwap | 36 | 0 | 651 | ||
| Lookahead | 31 | 5 | 294 |
circuit forwards and backwards several times to pick a good initial mapping, and that forward-and-back tweaking is mostly responsible for the SWAP gap. In sum: our identity start costs about 27% more SWAPs, but gives a routing record that is easy to follow and audit.
C. Cost of the decision record
Table IX reports what the record costs to produce. Over all 36 pairs the routing call, including construction of the complete record, took under 10ms in the worst case and a few milliseconds on average; the largest record covered 64 rounds and 521 scored candidates. On the two device-scale graphs (127 and 156 qubits) the worst case was under 7ms and 256 scored candidates. Recording every candidate SWAP with its decomposed score is therefore a few milliseconds, not a change of complexity class — which is the result that
TABLE IX
RUNTIME, AND THE SIZE OF THE DECISION RECORD EMITTED.
| Router | mean (ms) | max (ms) | rounds | scored cand. |
|---|---|---|---|---|
| Qyantram | 2.6 | 9.4 | 64 | 521 |
| Qiskit SABRE | 1432.1 | 2275.0 | 0 | 0 |
| BasicSwap | 1438.0 | 2335.3 | 0 | 0 |
| Lookahead | 1469.3 | 2513.6 | 0 | 0 |
Our figure is the routing call alone, including building the full decision record. The Qiskit figures are end-to-end transpile() calls and so also contain pass-manager and target construction; they bound routing time from above and are not like-for-like, so no speed advantage is claimed here. The last two columns are the point: the record costs single-digit milliseconds.
matters, since it means transparency need not be an optional mode.
Determinism was checked by re-routing every pair three further times and comparing the SWAP count, the routed depth and the final mapping. All 36 pairs produced byte-identical results on all repeats, as the tie-break on the qubit pair requires. This matters for a teaching tool: a learner who re-runs an example must see the same decisions.
D. Verification cost
Table X measures the reduction of Section V. A fixed, fully entangling 5-qubit circuit is embedded in a device register of growing size N, and we time the state-vector construction that the equivalence check needs, unrestricted and restricted to the occupied wires, taking the best of nine runs.
TABLE X
EQUIVALENCE-CHECK COST FOR ONE FIXED 5-QUBIT CIRCUIT AS THE DEVICE GROWS. THE RESTRICTED CHECK IS INDEPENDENT OF DEVICE SIZE BECAUSE IT NEVER BUILDS THE IDLE WIRES. BEST OF 9 RUNS.
| amplitudes | unrestricted | restricted | speed-up | |
|---|---|---|---|---|
| 5 | 32 | 0.84 ms | 0.828 ms | |
| 8 | 256 | 0.94 ms | 0.845 ms | |
| 10 | 1024 | 1.19 ms | 0.860 ms | |
| 12 | 4096 | 1.86 ms | 0.817 ms | |
| 14 | 16384 | 6.40 ms | 0.828 ms | |
| 16 | 65536 | 54.86 ms | 0.848 ms | |
| 18 | 262144 | 135.09 ms | 0.672 ms | |
| 20 | 1048576 | 528.02 ms | 0.563 ms | |
| 22 | 4194304 | 2302.37 ms | 0.937 ms | |
| 24 | 16777216 | 10036.14 ms | 0.921 ms | |
| 127 | GiB | 0.828 ms | — | |
| 156 | GiB | 0.828 ms | — |
The last two rows are the IBM Eagle and Heron r2 layouts the engine models; the unrestricted check is not merely slow there but impossible.
The unrestricted cost grows as expected — under a millisecond at rising to about ten seconds at , roughly a factor of four per two qubits added — while the restricted cost stays under a millisecond across the whole range, because the idle wires are never built. The speed-up therefore grows from unity to around four orders of magnitude over the range measured. Table X gives the figures from a single run.
A caution about those figures, since they are the only numbers in this paper that do not reproduce exactly. The restricted check is sub-millisecond, which is close enough to scheduler granularity that ordinary background load on the machine perturbs it. Repeating the whole experiment on the same host gave speed-ups at between roughly and , depending on what else was running, even with the best-of-nine minimum. The order of magnitude is stable and the shape of the two curves — one exponential, one flat — is not in question, but the precise ratio should be read as approximate. Every other quantity reported in this paper is computed by algebra or exhaustive enumeration and is reproducible exactly.
The last two rows of Table X are the point. On the Eagle and Heron layouts the engine actually models, the unrestricted comparison would need and amplitudes, requiring on the order of and GiB. The restricted comparison for the same 5-qubit circuit needs 32 amplitudes and under a millisecond. The difference is not one of degree: without the reduction, verification of a compilation targeting a real device is not slow but impossible, and so in practice would simply not be done.
Fig. 4 plots both curves, together with the restricted check's own growth in circuit width , which is what the ceiling reflects: a few milliseconds at , several times that by .
E. Error-identification validation
Table XI compares the module's enumerated logical error rate for the three-qubit bit-flip code under independent

Fig. 4. Measured equivalence-check cost (log scale). Top: with the circuit fixed at five qubits and the device growing, the unrestricted check grows exponentially while the restricted one stays flat — it never builds the idle wires. Bottom: the restricted check's own growth is in circuit width, not device size, which is why the engine caps it at .
noise against the closed form , at eleven noise strengths from to . The largest absolute deviation across both repetition codes and all eleven values is , i.e. agreement at the level of double-precision rounding. This is the expected outcome and that is the point: because the module enumerates every error pattern rather than sampling, disagreement with algebra would indicate a defect in the implementation, so the comparison functions as a test oracle rather than a statistical validation.
Table XII reports the cost. The nine-qubit Shor code has error patterns and distinct syndromes; the NumPy-powered full enumeration finishes in a fraction of a second, which makes exact logical error rates practical within normal web latency. Pseudo-thresholds come from bisection on the enumerated curve.
The thresholds teach an important lesson. With the bit-flip code under matched noise you always do better, since at any . Under depolarising noise Shor's code helps up to , but plain repetition codes help nowhere: each corrects a single Pauli type and is blind to the other two, so the logical error rate sticks at , always worse than leaving the qubit unencoded. Fig. 5 shows this against the break-even line . The area above that line is exactly what gets hidden if a module only reports successful corrections — and it is why the full nine-qubit Shor structure matters.
F. The machine-learning engine against a general simulator
Section VII argues that the training loop needs its own state-vector engine. Table XIII tests both halves of that argument.
TABLE XI
EXHAUSTIVE ENUMERATION AGAINST CLOSED FORM, THREE-QUBIT BIT-FLIP CODE UNDER INDEPENDENT X NOISE.
| p | enumerated | ||
|---|---|---|---|
| 0.001 | 0.000002998000 | 0.000002998000 | |
| 0.002 | 0.000011984000 | 0.000011984000 | 0 |
| 0.005 | 0.000074750000 | 0.000074750000 | |
| 0.01 | 0.000298000000 | 0.000298000000 | 0 |
| 0.02 | 0.001184000000 | 0.001184000000 | |
| 0.05 | 0.007250000000 | 0.007250000000 | 0 |
| 0.1 | 0.028000000000 | 0.028000000000 | 0 |
| 0.15 | 0.060750000000 | 0.060750000000 | |
| 0.2 | 0.104000000000 | 0.104000000000 | |
| 0.3 | 0.216000000000 | 0.216000000000 | |
| 0.5 | 0.500000000000 | 0.500000000000 | 0 |
Every error pattern is enumerated rather than sampled, so agreement is exact to floating-point precision. The largest deviation across both repetition codes and all noise strengths tested is .
TABLE XII
ENUMERATION COST, AND THE PSEUDO-THRESHOLD BELOW WHICH ENCODING REDUCES THE ERROR RATE.
| Code | patterns | syndromes | time | (X) | (depol.) |
|---|---|---|---|---|---|
| Bit-flip | 64 | 4 | 0.1 ms | 0.500 | none |
| Phase-flip | 64 | 4 | 0.1 ms | none | none |
| Shor-9 | 262 144 | 256 | 311.2 ms | 0.135 | 0.085 |
none means the encoded rate exceeds the bare rate at every : a repetition code is blind to one of the two error types, so under depolarising noise it adds more exposure than it removes. That is a property of the codes, not of this implementation, and it is why Shor's code exists.
Correctness first: over every circuit width from one to ten qubits and depths of one, three and six, the engine's output is compared with qiskit.quantum_info up to global phase. The worst infidelity is — agreement at double-precision rounding, as it must be, since the two are computing the same product of the same unitaries in a different order of operations.
Speed second, and here the distinction that matters is between one circuit and a batch. On a single circuit the engine is between roughly and faster, which would not on its own justify maintaining a second simulator. On the batched path — one circuit applied to every sample, which is what one training iteration is — it is roughly to faster, because the per-call work is paid once for the batch instead of once per sample. That is the difference between a parameter-shift gradient being feasible inside a web request and not, and it is the reason the duplication is there.
G. Software validation
QYANTRAM includes 22 test modules and 6391 lines of tests: 599 cases, with just one skip, running in 75.6 s. These are not for show — they enforce the claims above. Transpiler tests check the router's output against the reference implementation it was ported from and verify that the documented heuristic constants have not drifted. The error-identification logic is validated against independent Pauli algebra, for both single- and multi-qubit errors, and each correction is tested

Fig. 5. Logical error rate against physical error rate under depolarising noise, from exhaustive enumeration of all error patterns rather than sampling. Encoding helps only where a curve lies below the dotted break-even line. Shor's nine-qubit code does, up to . The bit-flip and phase-flip codes do not, at any measured: each sits at , adding more exposure than it removes, because each corrects one Pauli type and is blind to the other two. That symmetry also makes their two curves identical to within , so they are drawn as one. Plotting the codes that fail is deliberate — showing only the one that works would teach that encoding is always an improvement.
TABLE XIII
THE QML STUDIO STATE-VECTOR ENGINE AGAINST QISKIT. QUANTUM_INFO.
| Mode | Size | Qyantram | Qiskit | Speed-up |
|---|---|---|---|---|
| single | 4 qubits | 300 s | 779 s | 2.6 |
| single | 6 qubits | 499 s | 1189 s | 2.4 |
| single | 8 qubits | 795 s | 1796 s | 2.3 |
| single | 10 qubits | 1374 s | 2829 s | 2.1 |
| single | 12 qubits | 2965 s | 4938 s | 1.7 |
| batch | 16 states | 0.62 ms | 16.07 ms | 26 |
| batch | 64 states | 1.24 ms | 64.95 ms | 52 |
| batch | 256 states | 5.52 ms | 280.73 ms | 51 |
Single is one circuit evaluated once; batch is one circuit applied to many input states at once, which is what a training iteration does. The two engines agree to a worst infidelity of over every width and depth tested.
by state fidelity. Machine-learning tests rerun the cross-check of Section IX-F after every code change, so drift between the two engines is caught right away rather than quietly changing a model's predictions. And one specific check walks the compilation engine's transitive imports and fails if any hardware-submission logic sneaks in — which is how the isolation property of Section III is kept true rather than merely intended.
X. DISCUSSION AND LIMITATIONS
A. What the measurements support, and what they do not
Four claims in this paper are supported by the measurements reported above. The decision record costs a few milliseconds and does not change the complexity class of routing (Table IX). The occupied-sub-space reduction makes per-compilation equivalence verification independent of device size, turning an impossible check into a sub-millisecond one on the device layouts the engine models (Table X). The error-identification module agrees with closed-form algebra to within (Table XI). And the machine-learning engine agrees with qiskit.quantum_info to while running the batched training path roughly 25–50× faster (Table XIII).
Several claims are not supported, and we would rather say so than let them be inferred.
We do not improve routing quality: Our method uses about as many SWAPs as Qiskit's SABRE (Table VIII). That is intentional: the contribution is transparency, not winning a SWAP-count contest. Anyone focused purely on minimising execution cost should use a production compiler. Combining transparency and quality is not impossible — you could run a layout search and still keep a readable decision record — and bringing those together is the next obvious step.
Verification checks one input, not unitary equality: Our verifier compares only what the circuit does to the input, not whether the entire unitaries are identical. If an error leaves that input unchanged, it gets through. Decision-diagram [10] and path-sum [9] approaches check full unitary equivalence and are therefore stronger. Still, our method is orthogonal and could work alongside them: you could limit a decision-diagram check to the occupied sub-space, just as we do, to shrink the problem.
The circuit-width ceiling is real: The width ceiling removes scaling with device size N, but not with circuit width k. At k = 12 the check still costs a few milliseconds; by k = 14 it is several times that, and after that things blow up exponentially. We still compile wide circuits and return them, but verification is skipped and that is spelled out in the response. Extending coverage means abandoning state vectors for a representation that does not enumerate amplitudes.
No learning outcomes are measured: This is the most important limitation. Section VIII describes an architecture and validates its mechanism: the mastery rule is deterministic and inspectable, and the misconception diagnoses are confirmed by re-simulation rather than guessed. Whether any of it improves what learners understand is an empirical question this paper does not answer. We have not run a controlled study, we have no cohort data, and we therefore make no claim about educational effect. Designing that study — pre/post assessment against a control using conventional materials, with the diagnostic feedback as the manipulated variable — is the work we consider most urgent, and until it is done the learning layer should be read as a hypothesis with a careful implementation, not as a validated intervention.
Simulator scope: The compilation engine is deliberately simulator-side and has no path to hardware submission (Section III). Consequently nothing in this paper reports what happens when a compiled circuit meets a real device's noise. The compilation is verified; the execution is not characterised.
B. Design positions worth defending
Two decisions recur through the system and are worth stating as positions rather than details.
Report the losing candidates. A system that shows only its conclusion cannot be checked. Our router reports every candidate SWAP it rejected and the score it rejected it at; the learning layer reports the reason behind every recommendation; the error module reports mis-corrections and undetected errors alongside successes. In each case the extra information is what makes the output falsifiable by its reader.
Decline rather than degrade. Every limit in the engine is explicit and every refusal carries its reason: the equivalence check says it was skipped because the circuit measures, or because it occupies thirteen qubits; the topology builder rejects a disconnected graph by name rather than failing to converge. In a teaching tool a clear refusal is more instructive than a silent approximation, and in any tool it is easier to debug.
C. Threats to validity
The routing comparison uses six circuit families on six graphs with a single seed; a broader benchmark suite, several seeds, and the randomised model circuits of Cross et al. [30] would give a better estimate of the figure, which should be read as indicative rather than precise. All timings come from one host and one software stack (Section IX-A); the verification speed-up is a ratio of two measurements on the same host and so is robust to that, but the absolute millisecond figures are not portable. Qiskit's routers were invoked through transpile(), whose cost includes pass-manager construction, so Table IX does not license any claim that our router is faster, and we make none.
XI. CONCLUSION
Compilation is the point in the quantum stack where a circuit stops being the object its author wrote, and it is conventionally the point at which the stack stops explaining itself. We have described QYANTRAM, a platform built on the position that this is a design choice rather than a necessity, and that reversing it costs little.
Three mechanisms carry the argument. Separating decomposition, routing and basis translation into stages that may each change exactly one property of the circuit lets each added gate be traced to one cause, which turns “my circuit grew by a factor of thirty” into two numbers with two different remedies. Emitting the router’s full decision record — the blocked front layer, the look-ahead set, and every candidate SWAP with its decomposed score, including the ones rejected — makes layout synthesis inspectable, and we measure the cost at under 10ms and 521 scored candidates across 36 device/circuit pairs up to 156 qubits. Restricting equivalence verification to the qubits a compiled circuit actually occupies makes the check exact, independent of device size, and fast enough to run unconditionally: flat at under a millisecond where the unrestricted comparison reaches seconds at 24 qubits and GiB at 127.
The transparency is not free, and we have quantified rather than hidden the price: with an identity initial layout and no optimisation, our router inserts the SWAPs of Qiskit's SABRE. We regard that as a favourable exchange for a teaching and debugging tool, and an unfavourable one for production compilation — which is why the two should be combined rather than chosen between.
Future work
Four directions follow directly. First, a layout-selection phase that still emits a decision record, which should close most of the SWAP gap without sacrificing observability. Second, applying the occupied-sub-space restriction in front of a decision-diagram equivalence checker [10], which would raise the width ceiling while keeping independence from device size. Third, extending the error-identification module to a surface-code patch, where the exhaustive enumeration that validates the present codes becomes infeasible and must be replaced by a sampled estimate with stated confidence intervals — a change in evidentiary standard that the module should be honest about. Fourth, and most importantly, the controlled study of learning outcomes that Section X identifies as missing: without it, the diagnostic layer remains a well-implemented hypothesis.
The platform, its 599 automated tests, and the four benchmark scripts that produced every table in this paper are available as open source.
REPRODUCIBILITY
The four experiments in Section IX are driven by the scripts bench_routing.py, bench_verify.py, bench_qec.py and bench_qml.py, each of which writes the JSON file from which the corresponding results table is generated mechanically, so no measured value in this paper was transcribed by hand. The tables that describe the system rather than measure it — implementation size, device graphs, model components, evidence weights, and the illustrative routing record of Table III — are written out in the text, and are marked as such where it matters. All randomness is seeded (seed 42). Software versions and host details are given in Section IX-A.
ACKNOWLEDGMENT
The authors thank the faculty of Department of Computer Science and Design, K. K. Wagh Institute of Engineering Education and Research, for access to computing facilities and for guidance during this work.
REFERENCES
[1] M. Y. Siraichi, V. F. d. Santos, C. Collange, and F. M. Q. Pereira, “Qubit allocation,” in Proc. Int. Symp. Code Generation and Optimization (CGO), 2018, pp. 113–125.
[2] A. Zulehner, A. Paler, and R. Wille, “An efficient methodology for mapping quantum circuits to the IBM QX architectures,” IEEE Trans. Computer-Aided Design of Integrated Circuits and Systems, vol. 38, no. 7, pp. 1226–1236, 2019.
[3] G. Li, Y. Ding, and Y. Xie, “Tackling the qubit mapping problem for NISQ-era quantum devices,” in Proc. 24th Int. Conf. Architectural Support for Programming Languages and Operating Systems (ASPLOS), 2019, pp. 1001–1014.
[4] P. Murali, J. M. Baker, A. Javadi-Abhari, F. T. Chong, and M. Martonosi, “Noise-adaptive compiler mappings for noisy intermediate-scale quantum computers,” in Proc. 24th Int. Conf. Architectural Support for Programming Languages and Operating Systems (ASPLOS), 2019, pp. 1015–1029.
[5] H. Zou, M. Treinish, K. Hartman, A. Ivrii, and J. Lishman, "LightSABRE: A lightweight and enhanced SABRE algorithm," 2024, arXiv:2409.08368 [quant-ph].
[6] A. Barenco, C. H. Bennett, R. Cleve, D. P. DiVincenzo, N. Margolus, P. Shor, T. Sleator, J. A. Smolin, and H. Weinfurter, “Elementary gates for quantum computation,” Physical Review A, vol. 52, no. 5, pp. 3457–3467, 1995.
[7] A. Javadi-Abhari, M. Treinish, K. Krsulich, C. J. Wood, J. Lishman, J. Gacon, S. Martiel, P. D. Nation, L. S. Bishop, A. W. Cross, B. R. Johnson, and J. M. Gambetta, “Quantum computing with Qiskit,” 2024, arXiv:2405.08810 [quant-ph].
[8] G. F. Viamontes, I. L. Markov, and J. P. Hayes, “Checking equivalence of quantum circuits and states,” in Proc. IEEE/ACM Int. Conf. Computer-Aided Design (ICCAD), 2007, pp. 69–74.
[9] M. Amy, “Towards large-scale functional verification of universal quantum circuits,” in Proc. 15th Int. Conf. Quantum Physics and Logic (QPL), ser. Electronic Proceedings in Theoretical Computer Science, vol. 287, 2019, pp. 1–21.
[10] L. Burgholzer and R. Wille, “Advanced equivalence checking for quantum circuits,” IEEE Trans. Computer-Aided Design of Integrated Circuits and Systems, vol. 40, no. 9, pp. 1810–1824, 2021.
[11] B. Nash, V. Gheorghiu, and M. Mosca, “Quantum circuit optimizations for NISQ architectures,” Quantum Science and Technology, vol. 5, no. 2, p. 025010, 2020.
[12] D. Maslov, “Basic circuit compilation techniques for an ion-trap quantum machine,” New Journal of Physics, vol. 19, no. 2, p. 023035, 2017.
[13] A. Kissinger and J. van de Wetering, “PyZX: Large scale automated diagrammatic reasoning,” in Proc. 16th Int. Conf. Quantum Physics and Logic (QPL), ser. Electronic Proceedings in Theoretical Computer Science, vol. 318, 2020, pp. 229–241.
[14] P. W. Shor, “Scheme for reducing decoherence in quantum computer memory,” Physical Review A, vol. 52, no. 4, pp. R2493–R2496, 1995.
[15] A. M. Steane, “Error correcting codes in quantum theory,” Physical Review Letters, vol. 77, no. 5, pp. 793–797, 1996.
[16] D. Gottesman, “Stabilizer codes and quantum error correction,” Ph.D. dissertation, California Institute of Technology, 1997, arXiv:quant-ph/9705052.
[17] C. Chamberland, G. Zhu, T. J. Yoder, J. B. Hertzberg, and A. W. Cross, “Topological and subsystem codes on low-degree graphs with flag qubits,” Physical Review X, vol. 10, no. 1, p. 011022, 2020.
[18] S. Sivarajah, S. Dilkes, A. Cowtan, W. Simmons, A. Edgington, and R. Duncan, “[t]ket”: a retargetable compiler for NISQ devices,” Quantum Science and Technology, vol. 6, no. 1, p. 014003, 2021.
[19] V. Bergholm, J. Izaak, M. Schuld, C. Gogolin, S. Ahmed et al., “PennyLane: Automatic differentiation of hybrid quantum-classical computations,” 2018, arXiv:1811.04968 [quant-ph].
[20] A. Cross, A. Javadi-Abhari, T. Alexander, N. De Beaudrap, L. S. Bishop, S. Heidel, C. A. Ryan, P. Sivarajah, J. Smolin, J. M. Gambetta, and B. R. Johnson, “OpenQASM 3: A broader and deeper quantum assembly language,” ACM Transactions on Quantum Computing, vol. 3, no. 3, pp. 1–50, 2022.
[21] J. Preskill, “Quantum computing in the NISQ era and beyond,” Quantum, vol. 2, p. 79, 2018.
[22] B. S. Bloom, “Learning for mastery,” Evaluation Comment, vol. 1, no. 2, pp. 1–12, 1968.
[23] A. T. Corbett and J. R. Anderson, “Knowledge tracing: Modeling the acquisition of procedural knowledge,” User Modeling and User-Adapted Interaction, vol. 4, no. 4, pp. 253–278, 1995.
[24] C. Piech, J. Bassen, J. Huang, S. Ganguli, M. Sahami, L. J. Guibas, and J. Sohl-Dickstein, “Deep knowledge tracing,” in Advances in Neural Information Processing Systems (NeurIPS), vol. 28, 2015, pp. 505–513.
[25] K. VanLehn, “The relative effectiveness of human tutoring, intelligent tutoring systems, and other tutoring systems,” Educational Psychologist, vol. 46, no. 4, pp. 197–221, 2011.
[26] C. Hughes, D. Finke, D.-A. German, C. Merzbacher, P. M. Vora, and H. J. Lewandowski, “Assessing the needs of the quantum industry,” IEEE Transactions on Education, vol. 65, no. 4, pp. 592–601, 2022.
[27] C. Rigetti and M. Devoret, “Fully microwave-tunable universal gates in superconducting qubits with linear couplings and fixed transition frequencies,” Physical Review B, vol. 81, no. 13, p. 134507, 2010.
[28] K. Mølmer and A. Sørensen, “Multiparticle entanglement of hot trapped ions,” Physical Review Letters, vol. 82, no. 9, pp. 1835–1838, 1999.
[29] M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information: 10th Anniversary Edition. Cambridge University Press, 2010.
[30] A. W. Cross, L. S. Bishop, S. Sheldon, P. D. Nation, and J. M. Gambetta, "Validating quantum computers using randomized model circuits," Physical Review A, vol. 100, no. 3, p. 032328, 2019.