Skip to content
KUQCIPublic

About

Non-idealistic QEC Testing Environment

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Nove

Nove is an open-source, Python-first quantum error-correction testing environment named after the nine-qubit Shor code. It gives existing Stim experiments an additive path to readable stateful-noise studies: ordinary .stim circuits remain ordinary Stim circuits, while Nove-specific models are supplied separately.

Nove provides three execution paths:

Backend Purpose Noise model
stim Direct compatibility baseline using Stim's public sampler Noise already expressed in the circuit
python Readable NumPy Pauli-frame reference Supported Pauli noise and phenomenological leakage
rust Private compiled implementation of the same structured model Supported Pauli noise and phenomenological leakage
auto Stim without structured noise; otherwise Rust when installed, Python as a faithful fallback Never drops requested noise

Nove is research software. Its leakage process is a phenomenological classical latent-state model, not a qutrit simulation, a coherent model, or evidence of hardware accuracy.

Install for development

Python 3.10+, Rust stable, and a C/C++ build environment are required.

python -m pip install --upgrade pip maturin
python -m pip install -e ".[dev]"
maturin develop

PyMatching support is optional:

python -m pip install -e ".[pymatching]"

Migrate an existing Stim experiment

import stim
import nove

stim_circuit = stim.Circuit.generated(
    "surface_code:rotated_memory_x",
    distance=3,
    rounds=3,
    after_clifford_depolarization=0.001,
)

circuit = nove.Circuit.from_stim(stim_circuit)
result = nove.run(circuit, shots=10_000, backend="stim", seed=1234)

print(result.detection_events.shape)
print(result.observables.shape)
print(result.metadata)

Passing the original stim.Circuit directly is also supported. Text and paths remain explicit: use Circuit.from_stim_text(...) or Circuit.from_stim_file(...); Nove never guesses whether a string is text or a filename.

Add stateful leakage

experiment = nove.Experiment(
    circuit,
    noise=nove.NoiseModel(
        leakage=nove.LeakageModel(
            entry_probability=2e-4,
            decay_probability=0.15,
            spread_probability=1e-3,
            partner_pauli_probability=5e-3,
            measurement_one_probability=0.5,
            reset_success_probability=0.99,
        )
    ),
)

sampler = experiment.compile(backend="auto", seed=1234)
result = sampler.sample(shots=10_000)
print(result.leakage_summary)
print(result.fidelity)

Stateful leakage cannot be exactly exported as an ordinary independent-error Stim DEM. experiment.to_detector_model() therefore raises ModelNotRepresentableError instead of silently approximating it.

Add calibrated device noise

device = nove.DeviceModel(
    device_id="example-chip",
    time_unit="ns",
    connectivity=[(0, 1)],
    gate_durations={"CX": 40, "H": 20},
    measurement_duration=300,
    reset_duration=200,
)

hardware = nove.HardwareNoiseModel(
    gate_defaults={
        "H": nove.PauliChannel((1e-4, 1e-4, 2e-4)),
        "CX": nove.PauliChannel((1e-4,) * 15),
    },
    default_idle_rate=nove.PauliRate(x=1e-6, y=1e-6, z=5e-6),
    default_readout_flip_probability=0.01,
    default_reset_flip_probability=0.002,
)

experiment = nove.Experiment(
    circuit,
    noise=nove.NoiseModel(hardware=hardware),
    device=device,
)
result = experiment.run(shots=10_000, backend="auto", seed=1234)

TICK delimits concurrent physical moments. Nove validates target conflicts and connectivity, resolves operation and idle durations, and compiles the resulting local Pauli, readout/reset, and crosstalk channels into ordinary Stim instructions. Exact operation parameters override named gate defaults; missing parameters in an enabled process are errors.

CalibrationSnapshot, QecDataset, fit_noise_model, and validate_noise_model provide hashed calibration and held-out evidence artifacts. The first fitter identifies a conservative global fault scale from detector records only and explicitly reports finer physical parameters as non-identifiable, with a moving-block-bootstrap 95% scale interval. The Willow adapter consumes user-selected extracted Stim b8 files from DOI 10.5281/zenodo.13273331; the large archive is never downloaded implicitly. See calibrated models.

CLI

nove inspect experiment.stim
nove validate experiment.stim
nove sample experiment.stim --shots 10000 --backend stim --seed 1
nove sample experiment.stim --shots 10000 --backend rust --noise leakage.json --output run.npz
nove sample experiment.stim --shots 10000 --noise calibrated.json --device device.json
nove dem experiment.stim --output model.dem

A noise file has an explicit extensible shape:

{
  "leakage": {
    "entry_probability": 0.0002,
    "decay_probability": 0.15,
    "spread_probability": 0.001,
    "partner_pauli_probability": 0.005,
    "measurement_one_probability": 0.5,
    "reset_success_probability": 0.99
  }
}

Compatibility and limitations

Import and export preserve semantic Stim circuit and DEM structure, including nested repeats, tags, coordinates, record targets, and timing boundaries. The direct Stim backend delegates execution to Stim. Structured backends intentionally support a narrower subset: annotations; Z/X/Y reset, measurement, and measure-reset operations; ordinary one- and two-qubit Clifford gates on qubit targets; standard Pauli/depolarizing channels; and correlated Pauli errors.

Structured backends reject sweep/feedback controls, Pauli-product measurements, heralded channels, arbitrary non-Clifford operations, and other advanced instructions with a location-bearing capability error. Nove has no state-vector, density-matrix, exact qutrit, tensor-network, GPU, or coherent-error backend. Calibrated models use stochastic Pauli approximations and make no hardware-accuracy claim without a held-out ValidationReport. Cross-shot DriftProcess execution is capability-rejected until an explicit acquisition engine is implemented. See compatibility and fidelity.

The frame backends model deviations from a single Stim-selected ideal reference trajectory. Detector and observable declarations must be deterministic in the noiseless circuit. Raw measurement retention is rejected when ideal outcomes are intrinsically random (for example H 0; M 0); use the direct Stim backend when those collapse samples are required. Leakage suppresses Clifford propagation of the deviation frame but does not remove that gate from the fixed reference trajectory, so literal missing-gate stabilizer backaction requires a future higher-fidelity backend.

Development

pytest -q
ruff check .
ruff format --check .
mypy python/nove
cargo fmt --all --check
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace
python -m build

Examples live in examples/; standalone measurement-only benchmarks live in benchmarks/ and make no performance assertions. The architecture is described in docs/architecture.md, and future phases are listed in ROADMAP.md.

License

Apache License 2.0. See LICENSE.

About

Non-idealistic QEC Testing Environment

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages