
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
qiskit-ibm-transpiler
Advanced tools
A library to use Qiskit IBM Transpiler (https://quantum.cloud.ibm.com/docs/api/qiskit-ibm-transpiler) and the AI transpiler passes (https://quantum.cloud.ibm.com/docs/guides/ai-transpiler-passes)
Leverage IBM Quantum's cutting-edge Qiskit Transpiler Service and AI-powered transpiler passes to achieve superior circuit optimization through reinforcement learning algorithms.
Note: The cloud transpilation capabilities are only available for IBM Quantum Premium Plan users. The local mode is available to any user and is enabled by default if the local mode dependencies are installed. Currently in beta release.
pip install qiskit-ibm-transpiler
For running AI-powered transpiler passes locally:
pip install qiskit-ibm-transpiler[ai-local-mode]
The package automatically authenticates using your IBM Quantum Platform credentials aligned with how Qiskit Runtime manages it:
QISKIT_IBM_TOKEN
~/.qiskit/qiskit-ibm.json
(section: default-ibm-quantum
)Note: The Qiskit Transpiler Service is currently being migrated. We recommend using local mode instead.
from qiskit.circuit.library import EfficientSU2
from qiskit_ibm_transpiler.transpiler_service import TranspilerService
# Create your circuit
circuit = EfficientSU2(101, entanglement="circular", reps=1).decompose()
# Transpile using cloud service
service = TranspilerService(
backend_name="ibm_torino", # or any backend you have access to
ai="false",
optimization_level=3,
)
transpiled_circuit = service.run(circuit)
from qiskit.circuit.library import EfficientSU2
from qiskit_ibm_transpiler.transpiler_service import TranspilerService
circuit = EfficientSU2(101, entanglement="circular", reps=1).decompose()
# Enable AI optimization for superior results
service = TranspilerService(
backend_name="ibm_torino",
ai="true", # Enable AI passes
optimization_level=3,
)
optimized_circuit = service.run(circuit)
from qiskit.circuit.library import EfficientSU2
from qiskit_ibm_transpiler.transpiler_service import TranspilerService
circuit = EfficientSU2(101, entanglement="circular", reps=1).decompose()
# Let the service decide the best transpilation approach
service = TranspilerService(
backend_name="ibm_torino",
ai="auto", # Service decides: AI passes vs standard Qiskit
optimization_level=3,
)
optimized_circuit = service.run(circuit)
With ai="auto"
, the service intelligently decides whether to apply standard Qiskit heuristic passes or AI-powered passes based on your circuit characteristics.
Parameter | Values | Description |
---|---|---|
ai | "true" , "false" , "auto" | AI transpilation mode |
optimization_level | 1 , 2 , 3 | Optimization intensity |
backend_name | Backend string | Target quantum device |
coupling_map | List of tuples | Custom connectivity |
Service Limits:
Note: Only backends accessible through your IBM Quantum account can be used. Alternatively, specify the
coupling_map
parameter directly.
The AIRouting
pass provides intelligent layout selection and circuit routing using reinforcement learning:
from qiskit.transpiler import PassManager
from qiskit_ibm_transpiler.ai.routing import AIRouting
from qiskit.circuit.library import EfficientSU2
# Local mode execution
ai_routing = PassManager([
AIRouting(
backend_name="ibm_torino",
optimization_level=3,
layout_mode="optimize",
local_mode=True # Run locally for faster execution
)
])
circuit = EfficientSU2(101, entanglement="circular", reps=1).decompose()
routed_circuit = ai_routing.run(circuit)
Parameter | Options | Description |
---|---|---|
optimization_level | 1, 2, 3 | Computational effort (higher = better results, longer time) |
layout_mode | optimize | Best for general circuits (default) |
improve | Uses existing layout as starting point | |
keep | Respects previous layout selection | |
local_mode | True/False | Run locally or on cloud |
Optimize specific circuit blocks using AI-powered synthesis for superior gate count reduction:
from qiskit.transpiler import PassManager
from qiskit_ibm_transpiler.ai.routing import AIRouting
from qiskit_ibm_transpiler.ai.synthesis import (
AILinearFunctionSynthesis, AIPauliNetworkSynthesis
)
from qiskit_ibm_transpiler.ai.collection import (
CollectLinearFunctions, CollectPauliNetworks
)
from qiskit.circuit.library import EfficientSU2
# Complete AI-powered transpilation pipeline
ai_pm = PassManager([
AIRouting(backend_name="ibm_torino", optimization_level=3, layout_mode="optimize"),
# Collect and synthesize linear functions
CollectLinearFunctions(),
AILinearFunctionSynthesis(backend_name="ibm_torino", local_mode=True),
# Collect and synthesize Pauli networks
CollectPauliNetworks(),
AIPauliNetworkSynthesis(backend_name="ibm_torino", local_mode=True),
])
circuit = EfficientSU2(10, entanglement="full", reps=1).decompose()
optimized_circuit = ai_pm.run(circuit)
Pass | Circuit Type | Max Qubits | Local Mode |
---|---|---|---|
AICliffordSynthesis | H, S, CX gates | 9 | ✅ |
AILinearFunctionSynthesis | CX, SWAP gates | 9 | ✅ |
AIPermutationSynthesis | SWAP gates | 65, 33, 27 | ✅ |
AIPauliNetworkSynthesis | H, S, SX, CX, RX, RY, RZ | 6 | ✅ |
The qiskit-ibm-transpiler allows you to configure a hybrid pass manager that automatically combines the best of Qiskit's heuristic and AI-powered transpiler passes. This feature behaves similarly to the Qiskit generate_pass_manager
method:
from qiskit_ibm_transpiler import generate_ai_pass_manager
from qiskit.circuit.library import efficient_su2
from qiskit_ibm_runtime import QiskitRuntimeService
backend = QiskitRuntimeService().backend("ibm_torino")
torino_coupling_map = backend.coupling_map
su2_circuit = efficient_su2(101, entanglement="circular", reps=1)
ai_hybrid_pass_manager = generate_ai_pass_manager(
coupling_map=torino_coupling_map,
ai_optimization_level=3,
optimization_level=3,
ai_layout_mode="optimize",
)
ai_su2_transpiled_circuit = ai_hybrid_pass_manager.run(su2_circuit)
Configuration Options:
coupling_map
: Specifies which coupling map to use for the transpilationai_optimization_level
: Level of optimization (1-3) for AI components of the PassManageroptimization_level
: Optimization level for heuristic components of the PassManagerai_layout_mode
: How the AI routing handles layout (see AI routing pass section for options)Thread Pool Configuration:
# Method 1: Per-pass configuration
AILinearFunctionSynthesis(backend_name="ibm_torino", max_threads=20)
# Method 2: Global environment variable
import os
os.environ["AI_TRANSPILER_MAX_THREADS"] = "20"
Smart Replacement:
replace_only_if_better=False
Note: Synthesis passes respect device coupling maps and work seamlessly after routing passes.
Customize logging levels for debugging and monitoring:
import logging
# Available levels: NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL
logging.getLogger("qiskit_ibm_transpiler").setLevel(logging.INFO)
If you use this library in your research, please cite:
@misc{kremer2024practical,
title={Practical and efficient quantum circuit synthesis and transpiling with Reinforcement Learning},
author={David Kremer and Victor Villar and Hanhee Paik and Ivan Duran and Ismael Faro and Juan Cruz-Benito},
year={2024},
eprint={2405.13196},
archivePrefix={arXiv},
primaryClass={quant-ph}
}
FAQs
A library to use Qiskit IBM Transpiler (https://quantum.cloud.ibm.com/docs/api/qiskit-ibm-transpiler) and the AI transpiler passes (https://quantum.cloud.ibm.com/docs/guides/ai-transpiler-passes)
We found that qiskit-ibm-transpiler demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.