Downloads · 30 days
88
18% of all-time downloads
Qiskit/ai-transpiler_routing
ai-transpiler_routing is a machine learning model from Qiskit. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Downloads · 30 days
88
18% of all-time downloads
All-time downloads
484
Public
Repo size
149 KB
Likes
3
Public
Click a slice to open those files.
.safetensors149 KB · 97%
From the Hugging Face model README

This repository hosts the AI routing model for quantum circuit routing and layout optimization, trained with reinforcement learning techniques. The model is topology-agnostic and works with any coupling map.
Quantum circuit routing is the process of mapping logical qubits to physical qubits on a device and inserting SWAP gates so that all two-qubit interactions respect the device's connectivity constraints. The AI routing model learns a policy that selects optimal SWAP insertions and qubit layouts to minimize circuit depth and gate count.
routing_model.safetensors: trained policy weights in safetensors format.Training data is entirely synthetic and generated internally at IBM Quantum using custom reinforcement learning environments.
Data Collection: Random quantum circuits are generated and routed on various coupling maps. The model is trained to minimize routing overhead (SWAP count, circuit depth) across diverse topologies. No external datasets or third-party circuit repositories are used.
PII: No personal or sensitive data is present or used in any phase of training, as all data is synthetic and generated algorithmically.
Infrastructure: We train the models using IBM's Cognitive Computing Cluster (CCC) using NVIDIA A100 40GB GPUs. The cluster provides a scalable and efficient infrastructure for training.
Below is a snippet to route a circuit on a heavy-hex coupling map. Install qiskit-ibm-transpiler via pip install qiskit-ibm-transpiler in your virtual environment.
from qiskit.circuit.library import EfficientSU2
from qiskit.transpiler import PassManager, CouplingMap
from qiskit_ibm_transpiler.ai.routing import AIRouting
# Define your target coupling map
coupling_map = CouplingMap.from_heavy_hex(5)
# Create a circuit
circuit = EfficientSU2(coupling_map.size(), entanglement="circular", reps=1).decompose()
print(f"Original circuit -> Depth: {circuit.depth()}, "
f"Gates(2q): {circuit.num_nonlocal_gates()}")
# Route the circuit using the AI model
ai_routing = PassManager([
AIRouting(
coupling_map=coupling_map,
optimization_level=2,
layout_mode="optimize",
)
])
routed_circuit = ai_routing.run(circuit)
print(f"Routed circuit -> Depth: {routed_circuit.depth()}, "
f"Gates(2q): {routed_circuit.num_nonlocal_gates()}")
The authors acknowledge the IBM Research CCC Service for providing resources that have contributed to the production or processing of the data contained within this data collection.