A collection of quantum information science problems formulated as reinforcement learning environments
Project description
Qiskit Gym 🏋️♀️
Qiskit Gym is a collection of quantum information science problems formulated as reinforcement learning environments.
🚀 Key Features
Train AI agents to discover efficient and near-optimal quantum circuit implementations for various quantum computing tasks.
- 🎯 Purpose-Built RL Environments: Specialized Gymnasium-compatible environments for quantum circuit synthesis problems
- 🔧 Hardware-Aware Environments: Design environments matching real quantum hardware coupling maps
- 🔄 Flexible Gate Sets: Define custom gate sets as part of your environments
- 🧠 State-of-the-Art RL Integration: Built-in support for PPO, Alpha Zero, and custom policy configurations
- ⚡ High-Performance Backend: Rust-powered core for lightning-fast quantum circuit operations
- 💾 Model Persistence: Save and load trained models for deployment
- ⚖️ Scalable Training: Efficient parallel environment execution
- 📊 Built-in TensorBoard Integration: For training visualization and performance tracking
- 🔌 Qiskit integration: You can use Qiksit seamlessly to define your problem and use your trained models.
🎲 Supported Problem Types
🔄 Permutation Synthesis
Learn to implement arbitrary qubit permutations using minimal SWAP gates on constrained coupling maps.
🔢 Linear Function Synthesis
Decompose linear Boolean functions into efficient quantum circuits using CNOT gates.
🌊 Clifford Synthesis
Generate optimal implementations of Clifford group elements with customizable gate sets.
🎛️ Pauli Network Synthesis
Optimize circuits containing Clifford gates and parametric rotations (RX, RY, RZ) for variational algorithms.
🔭 Roadmap and Vision
There are lots of interesting quantum computing problems that can be addressed with RL. We hope to centralize the problem formulations here to make it easier for Quantum and AI researchers to collaborate in taclikng them.
For future releases we plan to include envs for:
- Qubit routing
- Clifford+T synthesis
We are also open to env requests and contributions!
Stay tuned!
🏃♂️ Quick Start
Get started with quantum circuit synthesis RL in minutes! Check out our comprehensive tutorial:
👉 examples/intro.ipynb - Interactive Introduction Notebook
This Jupyter notebook walks you through:
- Setting up different synthesis environments
- Training RL agents from scratch
- Evaluating and using trained models
- Visualizing quantum circuits and training progress
🛠️ Installation
git clone https://github.com/AI4quantum/qiskit-gym.git
cd qiskit-gym
pip install -e .
💡 Example Usage
Here's how to set up a permutation synthesis environment and train an RL agent:
from qiskit_gym.envs import PermutationGym
from qiskit_gym.rl import RLSynthesis, PPOConfig, BasicPolicyConfig
from qiskit.transpiler import CouplingMap
# Create a 3x3 grid coupling map environment
cmap = CouplingMap.from_grid(3, 3, bidirectional=False)
env = PermutationGym.from_coupling_map(cmap)
# Set up RL synthesis with PPO
rls = RLSynthesis(env, PPOConfig(), BasicPolicyConfig())
# Train the agent
rls.learn(num_iterations=100, tb_path="runs/my_experiment/")
# Use the trained model to synthesize circuits
import numpy as np
random_permutation = np.random.permutation(9)
optimized_circuit = rls.synth(random_permutation, num_searches=1000)
🏅 Reward and Gate Penalties (at a glance)
- Each step returns
reward = (1.0 if solved else 0.0) - penalty. penaltyis the weighted increase in cost metrics after the chosen gate: CNOT count, CNOT layers, total layers, and total gates.- Default weights (
MetricsWeights) aren_cnots=0.01,n_layers_cnots=0.0,n_layers=0.0,n_gates=0.0001; configure per env viametrics_weights. - Metrics accumulate over the episode; once the target is solved, the positive reward is offset by the penalties from any extra cost incurred.
🤝 Contributing
We welcome contributions! Whether you're adding new synthesis problems, improving RL algorithms, or enhancing documentation - every contribution helps advance quantum computing research.
📝 License
Licensed under the Apache License, Version 2.0. See LICENSE for details.
🧪 Relevant Papers
-
Kremer, D., Villar, V., Paik, H., Duran, I., Faro, I., & Cruz-Benito, J. (2024). Practical and efficient quantum circuit synthesis and transpiling with reinforcement learning. arXiv preprint arXiv:2405.13196.
-
Dubal, A., Kremer, D., Martiel, S., Villar, V., Wang, D., & Cruz-Benito, J. (2025). Pauli Network Circuit Synthesis with Reinforcement Learning. arXiv preprint arXiv:2503.14448.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
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 qiskit_gym-0.4.1-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: qiskit_gym-0.4.1-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 987.6 kB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e108009b80b11df3b11def896a97049ab897f04b852ddf0ff499008cfa7992b
|
|
| MD5 |
df75e9777e28cdcf0663c8861a2346f1
|
|
| BLAKE2b-256 |
69e77b0c00e5ce676f6c10b3585e06e53de1d415fa5b48e0b3a0a37e73184db8
|
File details
Details for the file qiskit_gym-0.4.1-cp314-cp314-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: qiskit_gym-0.4.1-cp314-cp314-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.14, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a986f6e1ee39e656d20925bde2da00b96783f4405b40a4487e4f1dee7862ff1b
|
|
| MD5 |
481405c776c22b4d8f404c89c394d7a5
|
|
| BLAKE2b-256 |
7cfff848f7c570dbff3da822dd928e821c0f06736b096fda745bef2b3adb957b
|
File details
Details for the file qiskit_gym-0.4.1-cp314-cp314-macosx_11_0_arm64.whl.
File metadata
- Download URL: qiskit_gym-0.4.1-cp314-cp314-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.14, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23b0ae4176df3d2f5426b4d8c8a378df180ef62cb6ead99b1a27e66be44e8f6b
|
|
| MD5 |
a46088ffea348e790627db2c67219e94
|
|
| BLAKE2b-256 |
1ca3dd6e0e82c8f33a69ce2a27186039c3e2a8e21dfe9ab1d2d20a6dab75817c
|
File details
Details for the file qiskit_gym-0.4.1-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: qiskit_gym-0.4.1-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 986.8 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2219a0d0c095cc628caa29e6279092ba9267ba7445dff00c3862e9b35134d734
|
|
| MD5 |
0f7d7102d46ddd3c6b85053b0ac49c51
|
|
| BLAKE2b-256 |
651c75be69b6a53459bf80088feb15ec969732cca95535ea3431f9dfbb0f50c2
|
File details
Details for the file qiskit_gym-0.4.1-cp313-cp313-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: qiskit_gym-0.4.1-cp313-cp313-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.13, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53c87e0c3cf7448313b7af547fab2703652ed60b24f4b953ba9a6c9df2861734
|
|
| MD5 |
378937c52b2cb1eb954f978bb8c14232
|
|
| BLAKE2b-256 |
493a9581eee3468f76fb11d7bc3f24fa8c279072440114b6a7edbe7ca6941eb7
|
File details
Details for the file qiskit_gym-0.4.1-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: qiskit_gym-0.4.1-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0150814823598659835504ecc3560b781d7a349c10b2e169bccf4a80e95dd6de
|
|
| MD5 |
70be2a6bb75ffada765cd14dccd5e38a
|
|
| BLAKE2b-256 |
8aee833bb92c455aa57116e21b5ee1eff76d8bf78622ca8a34741bdf09769d54
|
File details
Details for the file qiskit_gym-0.4.1-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: qiskit_gym-0.4.1-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 987.0 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2a9336ccfe2375bef3849fc04a9ae218485fbc927de8ed97f2cab6555d18ffb
|
|
| MD5 |
f67bb1e7a1268dcf838f0ceff5070b9f
|
|
| BLAKE2b-256 |
fa6276a68b4209ad1dc9ed1c509dac357e74d3a2bd7a6c2771e3b259f4b3f533
|
File details
Details for the file qiskit_gym-0.4.1-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: qiskit_gym-0.4.1-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07841a46bc350d07ccbb909d76188aeddbeff8371e10f8904c9d81d4140bdfcc
|
|
| MD5 |
ba8183b296f483f40024ce5546840c60
|
|
| BLAKE2b-256 |
e8bd25da09b1bb6709d3aaa271e2ecd634933b71b1eb69232be8e1a9872dc2e6
|
File details
Details for the file qiskit_gym-0.4.1-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: qiskit_gym-0.4.1-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccc800d6ef6c8368067767bc9559ebe3aa63b8aee3769124921209bef5f91896
|
|
| MD5 |
5d412f49688789ad0fb99f1a7a0a0229
|
|
| BLAKE2b-256 |
1f5af7a509ce66e34cb3332e0a8395870d92974e28c6ff24453d638ed35fca82
|
File details
Details for the file qiskit_gym-0.4.1-cp312-cp312-macosx_10_12_x86_64.whl.
File metadata
- Download URL: qiskit_gym-0.4.1-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7795ef5df30d74c8f203c0aa4cd36ed6abc2cc205ff80d38d29ffdcf5c251995
|
|
| MD5 |
b423e2dd070faa5c9d8ce25eba678f55
|
|
| BLAKE2b-256 |
89ce7bc58db0d0bde1783731426758324c8f603a14fd19384b4b54d837304426
|
File details
Details for the file qiskit_gym-0.4.1-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: qiskit_gym-0.4.1-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 988.0 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
538c9a1985348ea7ea6dacd9f97019dfd2e4bbd4d417d6a1cf1825eab7b73420
|
|
| MD5 |
44c207096dbbf13d98c52c0126e98d39
|
|
| BLAKE2b-256 |
bfafb5e6b32d3e62fbb3690c8982292c4866f84fd77b6e49f545f24864c5038e
|
File details
Details for the file qiskit_gym-0.4.1-cp311-cp311-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: qiskit_gym-0.4.1-cp311-cp311-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b462d8105e6e7ecb638c00cba00e9200f65a43ffe277b88684ff6394f58b6a91
|
|
| MD5 |
4950880a897d0ab78b3b84bd16419f50
|
|
| BLAKE2b-256 |
a414609d69797221a5c77e72304a661564d3a1cd8d01156f43c5d1b08a56279d
|
File details
Details for the file qiskit_gym-0.4.1-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: qiskit_gym-0.4.1-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88f84e05aee81210abe789443e448f681297753e55de3af17c5cb2f8b846cc24
|
|
| MD5 |
29cab423ae678aa414ae1f641b12f5e3
|
|
| BLAKE2b-256 |
7a374836882537ea29e5addf8b64c8ef816dc8c8133395a17e837b542a411be9
|
File details
Details for the file qiskit_gym-0.4.1-cp311-cp311-macosx_10_12_x86_64.whl.
File metadata
- Download URL: qiskit_gym-0.4.1-cp311-cp311-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0e56e6ae9ca1dc85157af67c5a06b7bd98070cd6dbf9933bc130f1eca628345
|
|
| MD5 |
6c537b217a31992fa08dee855b59c1d8
|
|
| BLAKE2b-256 |
d41c908665e6652f0c62327f9bf06edda309ec1ab85d53c0cb61a0b9ab5dee09
|
File details
Details for the file qiskit_gym-0.4.1-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: qiskit_gym-0.4.1-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 987.8 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33629a7ffc9e4a42d7c557f8865eff1765b7e31ccc22a3a68912adaafc53d1fe
|
|
| MD5 |
5a6a0ea0ce976967b0da2ae5ba7d08ca
|
|
| BLAKE2b-256 |
2912bc76f92b8628bbab92a1f018b6e2c61b9c48d5dbcaeedba0aa2fd1ff5382
|
File details
Details for the file qiskit_gym-0.4.1-cp310-cp310-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: qiskit_gym-0.4.1-cp310-cp310-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.10, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71287608fb0159bd1c9c8c40a6647f16d59b2411d97b01fd421c8cbd84d6b937
|
|
| MD5 |
523f840840ce6f0930b358aafdf5e4da
|
|
| BLAKE2b-256 |
d2eec7f60362e24a87408e6543c6aaa736f64eb3331fa7d1f0125b4510ece347
|
File details
Details for the file qiskit_gym-0.4.1-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: qiskit_gym-0.4.1-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0afc54f8749da1605580cadcfa5a4948a9446f37439e59d8dacbfa33f54ff730
|
|
| MD5 |
ebaf74cef5a9a73f796ee34e271a87d1
|
|
| BLAKE2b-256 |
4bad28e64fc368efc2caddf149f97cc14df23647e0dad0448f65857d79f23fa1
|
File details
Details for the file qiskit_gym-0.4.1-cp310-cp310-macosx_10_12_x86_64.whl.
File metadata
- Download URL: qiskit_gym-0.4.1-cp310-cp310-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.10, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e10efe4a5ee15437e28e9c76eaca8c22b68e8d25c5496e7cc56cf2c74b32aeba
|
|
| MD5 |
7145b2985437ba9de593c28c2b986154
|
|
| BLAKE2b-256 |
16959547510aa2bede0815a6d254f1215325abbad383f6bd85b30f718745fda0
|