Skip to main content

A collection of quantum information science problems formulated as reinforcement learning environments

Project description

Qiskit Gym 🏋️‍♀️

Python Qiskit

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.

🔭 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:

  • Pauli Network synthesis
  • 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)

🤝 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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

qiskit_gym-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl (466.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

qiskit_gym-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (416.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

qiskit_gym-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl (437.4 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

qiskit_gym-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl (465.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

qiskit_gym-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (418.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

qiskit_gym-0.1.0-cp311-cp311-macosx_10_12_x86_64.whl (443.4 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

qiskit_gym-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl (465.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

qiskit_gym-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (418.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

qiskit_gym-0.1.0-cp310-cp310-macosx_10_12_x86_64.whl (443.5 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

qiskit_gym-0.1.0-cp39-cp39-manylinux_2_34_x86_64.whl (467.2 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.34+ x86-64

qiskit_gym-0.1.0-cp39-cp39-macosx_11_0_arm64.whl (418.5 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

qiskit_gym-0.1.0-cp39-cp39-macosx_10_12_x86_64.whl (444.7 kB view details)

Uploaded CPython 3.9macOS 10.12+ x86-64

File details

Details for the file qiskit_gym-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for qiskit_gym-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ad6b8ba6dd817fba3b28fafbefd41e5ec83ff721e10c5bf4d4d3f2a065f93d1b
MD5 1eef76dfef097d284e818df5a6f80fac
BLAKE2b-256 a45d149a34543c1754145dc418dc2c4b92b80f2ae764d4d845b89df19d4751ad

See more details on using hashes here.

File details

Details for the file qiskit_gym-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qiskit_gym-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0a80459f498fdda9ed430a71cf0edb278606e11ca74a6e58bd8c9fbd0a4a91d6
MD5 b8e41fb13b6f91e9560addb8b5fb942f
BLAKE2b-256 ebe268c4537ef9fc2ee7dfa7603d01b4702a0c7cb42ffd6975f93aa3b9149776

See more details on using hashes here.

File details

Details for the file qiskit_gym-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for qiskit_gym-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2505b45bc5f13d0e5346236a8619965bd824a8c509bc5ae80d13d912f8daccb3
MD5 391efa238089879e0906df4228f51e6c
BLAKE2b-256 57ba0eb4cc54e28872671c6379de8983cc0b5e9e5ea0df2357181710900415a1

See more details on using hashes here.

File details

Details for the file qiskit_gym-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for qiskit_gym-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a57192c3d7c6729cf1fa8ae6549a44149d2808198cdc30a39c04168f663f3dfc
MD5 4bd3b3b9393ad7400602e4cac357b0f1
BLAKE2b-256 42c946d3ed9e347190a8af6880e71c4b123bcf8c19abcbd7342b357ff04933a8

See more details on using hashes here.

File details

Details for the file qiskit_gym-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qiskit_gym-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 06bc9d915627c0870f9fd736bbe59880db48276df78ba23127d51d52bbb7dc52
MD5 b531b6db9c3ca6ee79ce8dde746373f6
BLAKE2b-256 e7036a21325b7f37f6666466c8df51e9fed87125116fada54197ad76ef0a87aa

See more details on using hashes here.

File details

Details for the file qiskit_gym-0.1.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for qiskit_gym-0.1.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 dcf4c68a61d84517bcb28f7a7534b394ef1b2c1e01441d8dbf5403ba1b603435
MD5 a010e5ccd352aa312e1ef807745d6f7c
BLAKE2b-256 a557fdb5e2dd295367fc3b52605ec01264db72fbd6e7079ae0d774b70aab349d

See more details on using hashes here.

File details

Details for the file qiskit_gym-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for qiskit_gym-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 bc45369f577f7883bcbe393875544ea8dbecfcc71dac720f0550c2e930448b12
MD5 126e0b334b95ba564419761c86ec2a95
BLAKE2b-256 7e4c2b634c1c19a42eee9b69e7a3a7aec44107905bfabae2c1eaeee3e4e86435

See more details on using hashes here.

File details

Details for the file qiskit_gym-0.1.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qiskit_gym-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 71dedd2b0c112cce173696485e8b3c4b259055afa4b530095108ae2b14c94720
MD5 a6c3a2f5ad716be9be70e57691050c7f
BLAKE2b-256 860b1c7b710fc79c52b030c215d471af5ce381b321692fecbf012a552b3a85c3

See more details on using hashes here.

File details

Details for the file qiskit_gym-0.1.0-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for qiskit_gym-0.1.0-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c483269742350ef260d4dfdca2dde87c4094e38ce090a0a9b9e8a0b9e05ec08f
MD5 d8e1c44eca66dd70e6807cbe309dc6e6
BLAKE2b-256 262dc45d84bd191850cfd4ebe3483075f90cef3616bb6baf0277333b101ae75b

See more details on using hashes here.

File details

Details for the file qiskit_gym-0.1.0-cp39-cp39-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for qiskit_gym-0.1.0-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 bd938f807c024a345d47c40541e343b118b5c7064e99d348a074cb872ae3c51c
MD5 a6e0b790e014cd18c513de61bc954b6a
BLAKE2b-256 b019c723e2da65b3f900a2fa9c5f6b43c8f76a07de6c85908e5b4f62382c2c77

See more details on using hashes here.

File details

Details for the file qiskit_gym-0.1.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qiskit_gym-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8b98fa19173c8883bc45b735b640ffa725692cf6bed85ee52b69e497d1b23c5e
MD5 644eda73c0dc0cd4e9362ab9d8152849
BLAKE2b-256 041253e9b2d3f356c89136ee78a3faaff6f564e32fef7d7c71cbcbdd6fd4ad0d

See more details on using hashes here.

File details

Details for the file qiskit_gym-0.1.0-cp39-cp39-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for qiskit_gym-0.1.0-cp39-cp39-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6f60d234606f546266ad44bf27a4d7076f49ef3841ccdb8d26541f76b086696a
MD5 647ca7be3d53a6c51a4ebbccdb222621
BLAKE2b-256 2c9a02673d10b22f670e43c590b3671d6ca3bb8507edb0ea99a3a3467f2c2e6a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page