GPU-accelerated tensor ring VQA simulation plugin for Qiskit, powered by PyTorch
Project description
qiskit-trev
Qiskit TREV is a GPU-accelerated quantum circuit simulation plugin for Qiskit, built on PyTorch. It provides efficient variational quantum algorithm (VQA) simulation using tensor ring (periodic Matrix Product State) representations, powered by PyTorch's GPU acceleration.
Features
- Tensor Ring Architecture: Efficient quantum state representation using periodic Matrix Product States
- PyTorch Backend: GPU acceleration via PyTorch tensors and CUDA
- Qiskit Integration: Works seamlessly as a Qiskit plugin with
BackendV2interface - Multiple Measurement Methods:
- Full Contraction
- Perfect Sampling
- Efficient Contraction
- Right Suffix Contraction
- Variational Algorithm Support: Built-in parameter-shift rule gradient computation
- Hamiltonian Operations: Full support for Pauli string Hamiltonians via
SparsePauliOp
Requirements
- Python 3.10+
- NVIDIA GPU with CUDA support
- PyTorch with CUDA
- Qiskit >= 1.0
- NumPy
Installation
pip install qiskit-trev
For development:
git clone https://github.com/keunjunpark/qiskit-trev.git
cd qiskit-trev
pip install -e ".[dev]"
Tutorials
See the tutorials/ directory:
- Getting Started — Circuits, sampling, and the TREV backend
- Expectation Values — Hamiltonians, estimator, and measurement methods
- VQE Optimization — Gradient descent and CMA-ES for variational algorithms
- Auto Batch Size — GPU memory-aware batch size tuning for parameter-shift gradients
- JAX backend — Enable the JAX-JIT path for 2–9× GPU gradient speedup, persistent compile cache (including Colab Drive), backend toggle, and OOM mitigation
Architecture
qiskit_trev/
├── __init__.py # Public API
├── backend.py # TREVBackend (Qiskit BackendV2)
├── estimator.py # TREVEstimator (Qiskit Estimator primitive)
├── sampler.py # TREVSampler (Qiskit Sampler primitive)
├── tensor_ring/ # Core tensor ring engine
│ ├── state.py # Tensor ring state representation
│ ├── contraction.py # Tensor contraction routines
│ └── gates.py # Gate-to-tensor decomposition
├── measure/ # Measurement strategies
│ ├── full_contraction.py
│ ├── perfect_sampling.py
│ ├── efficient_contraction.py
│ └── right_suffix.py
└── transpiler/ # TREV-specific transpiler passes
└── passes.py
How It Differs from TREV
| TREV | qiskit-trev | |
|---|---|---|
| Backend | PyTorch | PyTorch |
| Interface | Custom Circuit API |
Qiskit BackendV2 / Primitives |
| Gradients | Parameter-shift rule | Parameter-shift rule |
| Ecosystem | Standalone | Qiskit plugin |
| Install | pip install TREV |
pip install qiskit-trev |
Contributing
Contributions are welcome! Please feel free to submit pull requests, report bugs, or suggest features.
pip install -e ".[dev]"
pytest
License
MIT License
Citation
If you use qiskit-trev in your research, please cite:
@software{qiskit_trev,
title={qiskit-trev: PyTorch-based Tensor Ring VQA Simulation for Qiskit},
author={Park, Keunjun},
url={https://github.com/keunjunpark/qiskit-trev},
}
Acknowledgments
This project builds on TREV.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qiskit_trev-0.2.0.tar.gz.
File metadata
- Download URL: qiskit_trev-0.2.0.tar.gz
- Upload date:
- Size: 66.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ca7bf8cdcfb8e58af2298580c1fbf7681bed41cb78249f7a5b4a19b32ae05e9
|
|
| MD5 |
c248ea56f4378d950e0b23516916d94a
|
|
| BLAKE2b-256 |
a1b8c72708cb9c20396ed3fe8aa01dbda7e80e56818f2e95af410487544955df
|
Provenance
The following attestation bundles were made for qiskit_trev-0.2.0.tar.gz:
Publisher:
publish.yml on keunjunpark/qiskit-trev
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qiskit_trev-0.2.0.tar.gz -
Subject digest:
6ca7bf8cdcfb8e58af2298580c1fbf7681bed41cb78249f7a5b4a19b32ae05e9 - Sigstore transparency entry: 1365239460
- Sigstore integration time:
-
Permalink:
keunjunpark/qiskit-trev@4100befa34643a07273a95a081d6227dbc71f426 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/keunjunpark
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4100befa34643a07273a95a081d6227dbc71f426 -
Trigger Event:
push
-
Statement type:
File details
Details for the file qiskit_trev-0.2.0-py3-none-any.whl.
File metadata
- Download URL: qiskit_trev-0.2.0-py3-none-any.whl
- Upload date:
- Size: 61.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f54786bb5a24fa03ef805b2a01db06c0056e397c5240c51eedefba142572792
|
|
| MD5 |
5386f4ac4ca0a7551fda75e1036bdffa
|
|
| BLAKE2b-256 |
29017ad5614265c07bfb7c035737966196674da197642d67009cda859d23db16
|
Provenance
The following attestation bundles were made for qiskit_trev-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on keunjunpark/qiskit-trev
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qiskit_trev-0.2.0-py3-none-any.whl -
Subject digest:
3f54786bb5a24fa03ef805b2a01db06c0056e397c5240c51eedefba142572792 - Sigstore transparency entry: 1365239526
- Sigstore integration time:
-
Permalink:
keunjunpark/qiskit-trev@4100befa34643a07273a95a081d6227dbc71f426 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/keunjunpark
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4100befa34643a07273a95a081d6227dbc71f426 -
Trigger Event:
push
-
Statement type: