Qcraft: Quantum Circuit Design, Optimization, and Surface Code Mapping Platform
Project description
Qcraft: Quantum Circuit Design, Optimization, and Surface Code Mapping Platform
What is Qcraft?
Qcraft is an advanced, research-grade platform for quantum circuit design, optimization, and surface code mapping. It leverages reinforcement learning (RL), curriculum learning, and hardware-aware optimization to enable scalable, high-fidelity quantum circuit compilation and error correction. Qcraft is modular, extensible, and production-ready, supporting both classical and quantum error-corrected circuit workflows.
Key Features
- Reinforcement Learning for Quantum Circuit Optimization: Device-aware, reward-driven optimization of quantum circuits, supporting gate fusion, commutation, SWAP insertion, and more.
- Surface Code Multi-Patch Mapping: RL-based mapping of multiple logical surface code patches to hardware, with advanced reward shaping and curriculum learning.
- 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
Install from Source (Recommended for Research)
# Clone the repository
$ git clone <repo-url>
$ cd quantum-surface-code-generator-using-reinforcement-learning
# (Recommended) Create and activate a Python 3.11 virtual environment
$ python3.11 -m venv venv
$ source venv/bin/activate
# Install dependencies
$ pip install -r requirements.txt
# Build and install the package locally
$ pip install .
Usage
Main GUI
qcraft
RL Training (Examples)
- Circuit Optimization RL Training:
python -m circuit_designer.workflow_bridge --config configs/optimizer_config.yaml
- Surface Code Multi-Patch RL Training:
python -m scode.rl_agent.train_multi_patch --config configs/multi_patch_rl_agent.yaml
Evaluation and Simulation
- Evaluation:
python -m evaluation.evaluation_framework --config configs/your_eval_config.yaml
- Execution Simulation:
python -m execution_simulation.execution_simulator --config configs/your_exec_config.yaml
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qcraft-0.1.3.tar.gz.
File metadata
- Download URL: qcraft-0.1.3.tar.gz
- Upload date:
- Size: 156.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7da737fc965f98e0afe518c0c55c984fa03301a25b2a7e8138b131349de3bea
|
|
| MD5 |
d0b6c52d725ae0f3e2821c3d799c6319
|
|
| BLAKE2b-256 |
e5dafe1d64503eaa0ce4ef306407b8f63c84b70a66af4fd8798045eeb8b437cd
|
File details
Details for the file qcraft-0.1.3-py3-none-any.whl.
File metadata
- Download URL: qcraft-0.1.3-py3-none-any.whl
- Upload date:
- Size: 188.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81dd041b4a3e1ae5821609c0e05bcb20315635af54ebff5ce5991d83eb78f8b9
|
|
| MD5 |
3a2df29bcce4d866b8dd962583e34d3d
|
|
| BLAKE2b-256 |
0396c36eeeff62a27c120e24c796fc529017e2e81d9f9773e5257d052a995373
|