Qcraft: A Modular Platform for Quantum Circuit Optimization and Surface Code Mapping via Reinforcement Learning
Abstract
Qcraft is a research-grade, modular desktop application for quantum circuit design, optimization, and surface code mapping. It leverages reinforcement learning (RL) to address the challenges of scalable, hardware-aware quantum compilation and error correction. This work presents the architecture, configurable workflows, and the novel RL-based surface code mapping module, highlighting the scientific motivation, reward function design, and future research directions.
1. Introduction
Quantum computing promises exponential speedups for certain problems, but practical realization is hindered by noise, limited connectivity, and hardware constraints. Surface codes are a leading error correction technique, but mapping logical qubits to physical hardware remains a complex, high-dimensional optimization problem. Qcraft addresses this by providing a unified, extensible platform for:
- Quantum circuit design and editing
- Hardware-aware circuit optimization
- RL-driven surface code mapping
- Artifact management and reproducibility
- Curriculum Learning: Progressive training with increasing difficulty, dynamic reward weighting, and robust convergence.
- Hardware Awareness: Supports IBM devices (IonQ in progress), native gate sets, and device-specific constraints.
- Modular and Configurable: YAML/JSON-driven configuration for all workflows, environments, and training parameters.
- Logging and Artifact Management: Automated tracking of training runs, metrics, and model artifacts for reproducibility.
Installation
Requirements
- Python: 3.9–3.11 (3.11 recommended)
- CUDA: 12.4 (required for RL training with surface code agents)
- Tested on: Linux, NVIDIA RTX 3070, CUDA 12.4, IBM Q devices
Install from PyPI
pip install qcraft
Installation
Option 1: Install from PyPI (Recommended)
pip install qcraft
Option 2: Install from GitHub Release Tarball
Download the latest qcraft-<version>.tar.gz from https://github.com/deba10106/Qcraft.git (see Releases tab), then install with:
pip install /path/to/qcraft-<version>.tar.gz
Note:
- Python 3.9–3.11 supported (3.11 recommended)
- CUDA 12.4 required for RL training
Usage
Main GUI
qcraft
Usage
To launch the Qcraft desktop application, simply run:
qcraft
Reward Functions: Overview
Surface Code Multi-Patch Agent
- Highly configurable reward function: Encourages valid mappings, hardware connectivity, adjacency, resource utilization, error minimization, and logical correctness.
- Curriculum learning: Dynamic reward weights and phase multipliers across training stages.
- See
configs/multi_patch_rl_agent.yamlfor all tunable parameters.
Circuit Optimization Module
- Reward engine: Penalizes gate count, depth, and SWAPs; rewards native gate usage and penalizes invalid gates.
- Curriculum learning: Difficulty and reward weights progress as training advances.
- See
configs/optimizer_config.yamlfor all tunable parameters.
Configuration and Customization
- All major workflows and RL environments are configured via YAML files in the
configs/directory. - Surface Code Agent:
configs/multi_patch_rl_agent.yaml - Circuit Optimization Agent:
configs/optimizer_config.yaml - Device/Hardware:
configs/ibm_devices.yaml,configs/ionq_devices.yaml - Other: Logging, visualization, and more via their respective YAML files.
Packaging and PyPI Publishing
To build and publish your own version:
# Clean previous builds
rm -rf dist/*
# Build the package
python3 setup.py sdist bdist_wheel
# Check the package
pip install twine
# Upload to PyPI
twine upload dist/*
Support and Extensibility
- Qcraft is modular and extensible for new devices, reward functions, and optimization passes.
- Contributions and feedback are welcome for further research and development.
Citation
If you use Qcraft in academic work, please cite the corresponding paper or this repository.
For detailed technical documentation, architecture, and workflow explanations, please refer to the full README in the source repository.
Metadata
Release files for qcraft 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qcraft-0.1.6.tar.gz | 156.6 kB | Without provenance | Details for qcraft-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qcraft-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for qcraft-0.1.6-py3-none-any.whl |
Total release size: 345.3 kB
Release files / qcraft-0.1.6.tar.gz
| Download URL | qcraft-0.1.6.tar.gz |
|---|---|
| Size | 156.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a74bcf3d15e51529daa59e5a67417f1d541e562ab0f6c1dd4946fb1f12cb894
|
|
BLAKE2b-256 checksum How to use checksums |
e21fe60d0017ad9a739e633bc5692b75d713a3d194dfd5152c7b853305d44474
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Release files / qcraft-0.1.6-py3-none-any.whl
| Download URL | qcraft-0.1.6-py3-none-any.whl |
|---|---|
| Size | 188.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a1f1870c6ad72bd9acec555a5949b8f034e49b9337e06e7b0d9a55f5d8102aa4
|
|
BLAKE2b-256 checksum How to use checksums |
903cfe2d3c02366552eb278a6356e20272cc2533181a3c4222fd89bf03413d13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Security for qcraft 0.1.6
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.