You can’t book an afternoon on a dilution fridge to see whether an idea works. Fridge time is scarce, and a real chip keeps changing while you use it: a qubit that was fine at 10am has a defect sitting on its frequency by noon. Most of the questions people ask about calibration code (“does my fit survive a bad hour?”, “is this scan worth what it costs?”) need a device that behaves like that, on your laptop, on demand.
So we built one. QSim is an open-source simulator of a superconducting transmon chip, designed and built by Khushiyant Chauhan at Hopline. It is MIT licensed and comes with a browser explorer for looking at the simulated chip in real time.
What it is
QSim models a line of up to 20 flux-tunable transmon qubits, with a tunable coupler between each neighbouring pair. It keeps a hidden ground truth: the real T1, frequency, and error of every qubit at every moment. Your code never sees that truth. It sends measurement requests (twelve routines, from resonator spectroscopy and Rabi to Ramsey, T1, randomized benchmarking, CZ phase and flux crosstalk), pays for them in seconds of device time, and gets noisy data back.
The device drifts whether you measure it or not. Measuring doesn’t perturb the drift, and the same seed gives the same history, so two pieces of code can be compared on an identical chip.
Start it cold, with nothing calibrated, and the T1 fitter returns ok=False and a NaN rather
than a number. We wanted fitters that admit they don’t know rather than report a confident
wrong answer.
How the device model works
Each piece of physics is there because it breaks calibration code in a way you’d otherwise only find on hardware.
Gate error. Frequency detuning, amplitude and DRAG mismatch enter quadratically near the optimum. Decoherence enters linearly in gate time over T1 and T2.
TLS defects. Each qubit gets zero to three two-level-system defects within ±120 MHz, with couplings and linewidths drawn from Klimov et al.’s published Table S1. Defects diffuse in frequency, and about half of them also hop between two frequencies. When one wanders onto a qubit, T1 collapses. In the built-in self-test, one qubit’s T1 swings between 4.1 and 58.0 µs over 24 simulated hours.
Flux noise. Eight Ornstein-Uhlenbeck modes with correlation times from 60 s to about 28 hours, adding up to 50 kHz of slow frequency wander.
Cosmic rays. A chip-wide burst about once every ten seconds, 25 to 30 ms long, that drops every qubit’s T1 to 0.7 µs at once. It’s a correlated failure that no per-qubit model will predict.
Readout. Two Gaussian blobs in the IQ plane with asymmetric error: the excited state can decay mid-measurement, the ground state can’t climb.
Couplers and crosstalk. Each coupler carries an effective coupling, a static ZZ and a CZ error budget. Fast-flux crosstalk between Z-lines is a static matrix, about 0.01% per element by default.
Cost. Every measurement is charged in seconds of occupancy:
cost = t_reconfig + n_points * n_shots * (t_init + t_seq + t_readout)
+ per_extra_qubit * (n_qubits - 1)
In the self-test, the same 2,500-point sweep takes 501 s with passive reset and 6.4 s with active reset, 79 times cheaper. Measuring 20 qubits in one batch costs 1.33 times a single qubit; measuring them one at a time costs 15 times more than the batch.
Every constant has a source, or says it doesn’t
All tunable values live in one file, src/qsim/constants.toml. Nothing physical is
hard-coded anywhere else. Each entry says where it came from: a cited paper, DERIVED (with the
arithmetic written beside it), modelling (our deliberate choice), ASSUMPTION (ours, where the
source is silent), or UNSOURCED.
That last tag was the uncomfortable one to write. The 1.5% thermal population carries it: it was long cited to a paper whose text gives no such figure. Where we found no source at all, we set the value to claim nothing. The fixed reconfiguration time per batch defaults to 0 s, because a wrong number there would dominate every machine-time figure. Set it from your own instrument.
The physics is checked against something outside the model. Error terms are compared with an independently integrated propagator and a Lindblad evolution, not the model’s own closed form. A test suite that re-derives the model agrees with it by construction, and that is how a spurious factor of pi squared once survived review before being caught.
The baseline values
These are the defaults a fresh install uses, from constants.toml:
| Setting | Default | Where it comes from |
|---|---|---|
| T1 base | 68 µs (spread 8 µs, clipped to 45 to 95 µs) | modelling: modern transmon median of 60 to 100 µs |
| White dephasing | T_φ = 3 × T1 | modelling |
| Qubit frequencies (design) | 4.5 to 5.5 GHz | chip-drawing values |
| Fabrication scatter | 40 MHz σ, clipped at 120 MHz | Kreikebaum 2020 |
| Anharmonicity | −200 MHz (spread 4 MHz) | Koch 2007 design point, α = −E_C/h |
| Single-qubit gate | 25 ns | modelling: Barends 2014 reports 10 to 20 ns |
| Gate error floor | 2e-4 | modelling |
| CZ effective coupling | −5.9 MHz (a 60 ns CZ) | Sung 2021 |
| Readout resonators | centred at 6.8 GHz, 8 MHz apart | chip-drawing values |
| Readout IQ separation | 6.0 σ | Walter 2017 |
| Thermal population | 1.5% | UNSOURCED |
| Reset time | 200 µs passive, 2 µs active | passive reset, ~5 × T1 |
| Readout time | 0.5 µs | modelling |
| Reconfiguration per batch | 0 s (set your own) | no published value |
| In-spec thresholds | gate 1e-3, CZ 5e-3, readout 2% | modelling |
Simulating your own chip
A device profile is a complete replacement for constants.toml: the same sections and keys,
your values. Point the QSIM_CONSTANTS environment variable at it and the whole
package, GUI included, rebuilds its defaults from your file.
cp src/qsim/constants.toml profiles/my-chip.toml
# edit t1_base_s, f01_design_hz, anharmonicity_hz, duration_s ... to your chip's numbers
QSIM_CONSTANTS=profiles/my-chip.toml uv run python -m qsim.selftest
QSIM_CONSTANTS=profiles/my-chip.toml uv run --group gui marimo run gui/app.py
Two rules to know. The loader does not merge, so a profile missing a key fails to load instead
of quietly falling back to a default. And the variable is read once, at import, so set it
before you import qsim in Python.
The repo ships one example under profiles/, built from published hardware measurements
(arXiv:2508.03434), with every value tagged MEASURED (printed in the paper), DERIVED, ASSUMPTION or INHERITED (kept from the defaults because the paper is silent). Its cost model
reproduces five of the six scan times that paper reports to within 5%, and
docs/device-profiles.md walks through every number, including the ones the paper doesn’t
publish.
Tutorial: run it locally
You need Python 3.12 or newer and uv.
git clone https://github.com/Hopline-AI/qsim.git
cd qsim
uv sync
Check the install. The self-test runs five end-to-end checks, including a cold-start calibration of one qubit that has to finish in spec, and exits non-zero if any fail. The full suite is 286 property and integration tests, about a minute and a half on a laptop.
uv run python -m qsim.selftest
uv run --group gui pytest
Open the explorer
uv run --group gui marimo run gui/app.py
Open the URL it prints (http://localhost:2718 by default).

The top bar sets the run: a device seed (which random chip and drift history you get), 2 to 20 qubits, 1 to 24 simulated hours, passive (200 µs) or active (2 µs) reset, and the fixed reconfiguration time per batch.
The sidebar holds all 63 device settings in ten groups, from gate and coherence to flux crosstalk. Each field shows its default in lab units, a one-line description, and where a published value exists, what the literature reports and who reported it. Change a number and every view recomputes.
The main area has five tabs:
- Device: T1 and frequency drift for a chosen qubit, T1 across the chip, the best gate error a perfect calibration could reach over time, and a plot of the TLS defects passing that qubit’s frequency. The T1 dips line up with defect crossings.
- Device card: the hidden truth for every qubit at a time you pick. It’s the table your calibration code never gets to see.
- Spec floors: each qubit at t = 0 with everything set perfectly. Anything above the green band can’t be fixed by calibration alone.
- Sweep: pick one setting and a range, and see how a metric such as the fraction of in-spec qubits changes, over up to five seeds.
- RB precision: 30 randomized-benchmarking batches on one qubit, with the true error drawn as a line, so you can check whether RB’s error bars match its actual scatter.
Compare two devices
Flip Compare with a second device. You now have A (your device) and B (a what-if copy) on the same seed, so they differ only by their settings. Use Copy A → B, change a field in B, and the Device tab plots the T1 change between them per qubit over time.

To compare against the literature, open Published-values preset in the sidebar. It replaces nine defaults with values measured on real devices (for example a 20 ns gate and −350 MHz anharmonicity) and shows the source for each. It’s drawn from several papers, not one vetted device, and the explorer says so. Save settings writes the whole configuration to JSON so someone else can load exactly your run.
Drive it from Python
from qsim import MockQPU, SimInstrument, MeasurementRequest, Routine
from qsim.analysis import fit_t1
qpu = MockQPU(n_qubits=20, seed=0)
inst = SimInstrument(qpu, budget_s=8 * 3600) # an eight-hour shift
for q in range(20):
d = inst.design_params(q)
inst.apply(q, f01_hz=d["f01_hz"], pi_amp=d["pi_amp"],
readout_freq_hz=d["readout_freq_hz"], readout_amp=d["readout_amp"])
res = inst.measure(MeasurementRequest(Routine.T1, tuple(range(20)),
n_points=41, n_shots=2000))
print(f"{res.cost_s:.1f} s of device time for 20 qubits") # 26.5
t1, sigma, ok = fit_t1(res.data[0], n_shots=2000)
print(f"q0 T1 = {t1 * 1e6:.1f} +/- {sigma * 1e6:.1f} us") # 58.5 +/- 0.8
design_params() returns chip-drawing values, not the truth. Fabrication scatter moves real
frequencies up to 120 MHz off them, which is exactly the gap your calibration code has to close.
Who it’s for
In a course, students can watch a TLS defect walk through a qubit and T1 fall off a cliff, without anyone’s cooldown at stake.
If you write calibration code, you can run your fitters and scan schedules against a device that drifts, bursts and bills you, and find the failure modes before your hardware slot.
If you study drift, a seed plus a settings file is a full, shareable device history.
What it isn’t
No QSim result has yet been compared with a running chip. Crosstalk is static and fabrication
scatter has no shared per-chip offset. If you cite work built on it, cite the primary
measurements named in constants.toml: the physics is theirs, only the assembly is ours.
We’re building calibration tooling on top of QSim, and we’ll write about that separately.
If you run it against your own chip’s numbers, we’d like to hear how close it gets. Issues and pull requests are open on GitHub, or say hello.