hf-banner-ai-transpiler_routing

AI Routing Model for Quantum Circuits

Introduction

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.

Scope

  • Routing and layout optimization for quantum circuits on any device topology.
  • The model is not tied to a specific qubit count or topology; it generalizes across different coupling maps.

Contents

  • routing_model.safetensors: trained policy weights in safetensors format.

Training

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.

Usage example

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()}")

Acknowledgements

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.

Downloads last month
64
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Collection including Qiskit/ai-transpiler_routing