Skip to main content

qec-diverse-circuits

A Gymnasium-compatible RL environment that generates Qiskit circuits diverse in properties relevant to quantum error correction (QEC) and noise characterization: non-Clifford content, entangling-gate type and density, connectivity, depth, and idle time.

Why these properties

Circuits that differ only in generic shape don't necessarily exercise different hardware error behavior. These specific properties do:

  • Non-Clifford content (ratio, T-gate count) — determines whether a circuit needs magic-state resources, a different error regime than Clifford-only circuits.
  • Entangling-gate type and density — different two-qubit gates stress different crosstalk channels.
  • Connectivity — local vs. long-range interactions exercise different qubit pairs.
  • Depth and idle time — proxy for decoherence exposure.

Results

Validated on N=1000 generated circuits: the trained agent correlates with these properties at r=+0.574, beating a random baseline (r=0.554±0.023 across 5 seeds) by a small but real margin. It is not a large improvement — treat it as a modest, reproducible edge, not a dramatic one.

Install

pip install qec-diverse-circuits

For local development:

pip install -e .

Usage

from qec_diverse_circuits import DiverseCircuitGenerationEnv

env = DiverseCircuitGenerationEnv(max_qubits=7, max_gates=13, target_circuits=30)
obs, info = env.reset()
terminated = truncated = False
while not (terminated or truncated):
    action = env.action_space.sample()  # replace with a trained policy
    obs, reward, terminated, truncated, info = env.step(action)

for circuit, qec_properties in env.all_circuits:
    print(qec_properties)

Training

from qec_diverse_circuits.base_generator import BaseGenerator

generator = BaseGenerator(model_dir="./models")
generator.train()
circuits = generator.generate()

No pretrained checkpoint is published yet — generate() trains one from scratch (~7e5 timesteps) the first time it's called if model_dir is empty. train() and generate() use SB3's VecNormalize internally, so the observation/reward scaling a generated checkpoint is loaded with always matches what it was trained under.

Tests

pytest tests/

Changelog

See CHANGELOG.md. This project follows Semantic Versioning.

Citation

If you use this package in research, please cite it — see CITATION.cff.

License

MIT — see LICENSE.

Metadata

Release files for qec-diverse-circuits 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qec-diverse-circuits 0.1.0
File Size Uploaded Provenance
qec_diverse_circuits-0.1.0.tar.gz 27.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for qec-diverse-circuits 0.1.0
File Interpreter ABI Platform
qec_diverse_circuits-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 48.3 kB

Release files / qec_diverse_circuits-0.1.0.tar.gz

Download URL qec_diverse_circuits-0.1.0.tar.gz
Size 27.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cb56d91c8e224d796a0e79dbbb310713105848656516a053002ebb7a9fa4b95a
BLAKE2b-256 checksum
How to use checksums
1227e3a4425acbef20a0738bbf632a4627f5810c8460678613fe75bd46827ab2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Release files / qec_diverse_circuits-0.1.0-py3-none-any.whl

Download URL qec_diverse_circuits-0.1.0-py3-none-any.whl
Size 20.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
894d7467c1de71a20aa64481886fb82137d31da5263b9d7e24a6f78d73f98507
BLAKE2b-256 checksum
How to use checksums
876a340a31e8d5f4e64c0d21064d4cb4c8a825645dc12deca0836db2ec498544
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Security for qec-diverse-circuits 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for qec_diverse_circuits-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page