HLQuantum — High-Level Quantum Abstraction
A Python library that abstracts quantum hardware complexity. Write your circuit once with HLQuantum and execute it on IBM Qiskit, Google Cirq, Amazon Braket, PennyLane, NVIDIA CUDA-Q, or IonQ — without changing a single line of code.
Why Use HLQuantum?
Write Once, Run Anywhere
The same circuit code executes on any of 6 supported backends — no translation, no rewriting.
GPU Acceleration Built In
Transparently route circuits to NVIDIA GPU simulators for massive speedups on large circuits.
Error Mitigation
ZNE, readout mitigation, and other techniques built in — apply with a single argument.
Built-In Algorithms
QFT, Grover, VQE, QAOA, Bernstein-Vazirani — ready to use, backend-agnostic.
Async Multi-Backend
Run experiments on multiple backends simultaneously for benchmarking and verification.
AI / MCP Integration
Model Context Protocol support enables AI agents to orchestrate quantum experiments.
Supported Backends
| Backend | Framework | Install | Real QPU |
|---|---|---|---|
| qiskit | IBM Qiskit | pip install hlquantum[qiskit] | Yes |
| cirq | Google Cirq | pip install hlquantum[cirq] | Sim only |
| pennylane | Xanadu PennyLane | pip install hlquantum[pennylane] | Sim only |
| braket | Amazon Braket | pip install hlquantum[braket] | Yes |
| cudaq | NVIDIA CUDA-Q | pip install hlquantum[cudaq] | Sim only |
| ionq | IonQ (via Qiskit) | pip install hlquantum[ionq] | Yes |
Quick Start
1. Install
# Install with your preferred backend pip install hlquantum[qiskit] # IBM Qiskit backend pip install hlquantum[cirq] # Google Cirq backend pip install hlquantum[pennylane] # PennyLane backend pip install hlquantum[braket] # Amazon Braket backend pip install hlquantum[cudaq] # NVIDIA CUDA-Q backend pip install hlquantum[ionq] # IonQ backend # Or install multiple at once pip install "hlquantum[qiskit,cirq,cudaq]"2. Create your first circuit
import hlquantum as hlq # Create a 2-qubit circuit qc = hlq.Circuit(2) # Apply gates using the fluent API qc.h(0).cx(0, 1).measure_all() # Run on the default backend (auto-detects installed SDK) result = hlq.run(qc, shots=1000) print(result) # {'00': 507, '11': 493}3. Switch backends with one flag
import hlquantum as hlq qc = hlq.Circuit(2) qc.h(0).cx(0, 1).measure_all() # The SAME circuit, on DIFFERENT backends — zero code changes r1 = hlq.run(qc, shots=1000, backend="qiskit") # Qiskit Aer r2 = hlq.run(qc, shots=1000, backend="cirq") # Google Cirq r3 = hlq.run(qc, shots=1000, backend="pennylane") # PennyLane r4 = hlq.run(qc, shots=1000, backend="cudaq") # NVIDIA GPU r5 = hlq.run(qc, shots=1000, backend="braket") # Amazon Braket r6 = hlq.run(qc, shots=1000, backend="ionq") # IonQ for name, result in zip(["Qiskit","Cirq","PennyLane","CUDA-Q","Braket","IonQ"], [r1, r2, r3, r4, r5, r6]): print(f"{name}: {result}")The @kernel Decorator
The @hlq.kernel decorator lets you write quantum logic as standard Python functions. HLQuantum compiles and executes them on the selected backend automatically.
import hlquantum as hlq @hlq.kernel def ghz_state(n: int): """Create an n-qubit GHZ state.""" qubits = hlq.qvector(n) hlq.h(qubits[0]) for i in range(n - 1): hlq.cx(qubits[i], qubits[i + 1]) hlq.measure_all(qubits) # Run the kernel result = hlq.run(ghz_state, args=(5,), shots=1000) print(result) # {'00000': ~500, '11111': ~500} # Works on any backend result_gpu = hlq.run( ghz_state, args=(20,), # 20-qubit GHZ! shots=1000, backend="cudaq" # GPU acceleration )Built-In Quantum Algorithms
HLQuantum includes ready-to-use implementations of common quantum algorithms that work on any backend.
Quantum Fourier Transform (QFT)Phase estimationShor's algorithm
The quantum analog of the Discrete Fourier Transform. Used as a subroutine in many algorithms including Shor's factoring algorithm.
import hlquantum as hlq
from hlquantum.algorithms import QFT
# Create a QFT circuit for 4 qubits
qft_circuit = QFT(n_qubits=4)
result = hlq.run(qft_circuit, shots=1000)
print(result)Grover's Search AlgorithmSearchQuadratic speedup
Provides a quadratic speedup for unstructured search. Finds a marked item in √N steps instead of N.
import hlquantum as hlq
from hlquantum.algorithms import Grover
# Search for item "101" in a 3-qubit space
grover = Grover(oracle_string="101")
result = hlq.run(grover.circuit, shots=2000)
# The marked state should have high probability
print(result) # {'101': ~1800, others: ~200}VQE — Variational Quantum EigensolverChemistryOptimization
Finds the ground state energy of a Hamiltonian. Key algorithm for quantum chemistry on NISQ devices.
import hlquantum as hlq
from hlquantum.algorithms import VQE
from hlquantum.operators import PauliSum
# Define Hamiltonian
H = PauliSum.from_list([
("ZZ", -1.052), ("IZ", 0.398),
("ZI", -0.398), ("XX", 0.181),
])
vqe = VQE(hamiltonian=H, n_qubits=2, ansatz="TwoLocal", reps=2)
energy, params = vqe.run(backend="qiskit", max_iter=200)
print(f"Ground state energy: {energy:.6f}")QAOA — Quantum Approx. OptimizationCombinatorialOptimization
Approximate algorithm for combinatorial optimization problems like MaxCut, graph partitioning, and scheduling.
import hlquantum as hlq
from hlquantum.algorithms import QAOA
import networkx as nx
# Define a MaxCut problem
graph = nx.Graph([(0,1),(1,2),(2,3),(3,0),(0,2)])
qaoa = QAOA(problem="maxcut", graph=graph, p=2)
result = qaoa.run(backend="pennylane", shots=2000)
print(f"Best cut: {result.best_solution}")
print(f"Cut value: {result.best_value}")Quantum ML Layers & Pipelines
HLQuantum includes ML-inspired composition for quantum circuits — build variational ansätze as layered models, similar to PyTorch's nn.Sequential.
import hlquantum as hlq from hlquantum.layers import RYLayer, EntanglingLayer, Sequential # Build a variational quantum model model = Sequential([ RYLayer(n_qubits=4), # Layer of RY rotations EntanglingLayer(n_qubits=4), # CNOT entangling layer RYLayer(n_qubits=4), # Another RY layer EntanglingLayer(n_qubits=4), ]) # Run the model (initializes random params) result = model.run(shots=1000, backend="pennylane") # Train the model (gradient-based) loss_history = model.fit( X_train, y_train, optimizer="adam", learning_rate=0.01, epochs=50 )Async Multi-Backend Execution
Run the same circuit on multiple backends simultaneously and compare results. Great for benchmarking noise levels or verifying results across platforms.
import hlquantum as hlq import asyncio qc = hlq.Circuit(3) qc.h(0).cx(0, 1).cx(1, 2).measure_all() async def benchmark_backends(): tasks = { name: hlq.run_async(qc, shots=1000, backend=name) for name in ["qiskit", "cirq", "pennylane", "cudaq"] } results = {name: await task for name, task in tasks.items()} for name, result in results.items(): print(f"{name}: {result}") asyncio.run(benchmark_backends())Error Mitigation
HLQuantum includes built-in error mitigation techniques for real hardware execution.
import hlquantum as hlq from hlquantum.mitigation import ZNE, ReadoutMitigation qc = hlq.Circuit(2) qc.h(0).cx(0, 1).measure_all() # Zero-Noise Extrapolation (ZNE) mitigated_result = hlq.run( qc, shots=2000, backend="qiskit", device="ibm_sherbrooke", # Real hardware mitigation=ZNE(noise_factors=[1, 2, 3]) ) # Readout error mitigation result_mit = hlq.run( qc, shots=2000, backend="qiskit", mitigation=ReadoutMitigation() ) print(f"Raw result: {hlq.run(qc, shots=2000)}") print(f"Mitigated result: {mitigated_result}")GPU Acceleration
import hlquantum as hlq # Large circuit — 28 qubits qc = hlq.Circuit(28) for i in range(28): qc.h(i) for i in range(27): qc.cx(i, i + 1) qc.measure_all() # CPU simulation (may be slow for 28 qubits) result_cpu = hlq.run(qc, shots=100, backend="qiskit") # GPU simulation — orders of magnitude faster! result_gpu = hlq.run(qc, shots=100, backend="cudaq") # NVIDIA result_gpu2 = hlq.run(qc, shots=100, backend="pennylane", device="lightning.gpu") # lightning.gpu print(f"CPU: {result_cpu}") print(f"GPU (CUDA-Q): {result_gpu}")AI-Driven Quantum (MCP)
HLQuantum includes Model Context Protocol (MCP) support, enabling AI agents to construct, optimize, and execute quantum circuits autonomously. This enables a new paradigm of AI-driven quantum algorithm discovery.
Learn about HLQuantum MCP integration