Skip to main content

GPU-accelerated tensor ring VQA simulation plugin for Qiskit, powered by PyTorch

Project description

qiskit-trev

Python 3.10+ License: MIT codecov Tests Qiskit Ecosystem

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 BackendV2 interface
  • 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:

  1. Getting Started — Circuits, sampling, and the TREV backend
  2. Expectation Values — Hamiltonians, estimator, and measurement methods
  3. VQE Optimization — Gradient descent and CMA-ES for variational algorithms
  4. Auto Batch Size — GPU memory-aware batch size tuning for parameter-shift gradients
  5. 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 both the underlying method (TREV paper) and this implementation:

@unpublished{park2025trev,
  title={{TREV}: Python Library for Efficient Implementations of Variational Quantum Algorithms for Optimization using Tensor Networks},
  author={Park, Keun Jun and Peddireddy, Dheeraj and Aggarwal, Vaneet},
  year={2025},
  note={Submitted to ACM Transactions on Quantum Computing; revised April 2026},
}

@software{qiskit_trev,
  title={qiskit-trev: Tensor Ring VQA Simulation as a Qiskit Plugin},
  author={Park, Keun Jun},
  year={2026},
  version={0.2.1},
  url={https://github.com/keunjunpark/qiskit-trev},
  note={Qiskit plugin built on 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

qiskit_trev-0.2.1.tar.gz (70.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qiskit_trev-0.2.1-py3-none-any.whl (64.7 kB view details)

Uploaded Python 3

File details

Details for the file qiskit_trev-0.2.1.tar.gz.

File metadata

  • Download URL: qiskit_trev-0.2.1.tar.gz
  • Upload date:
  • Size: 70.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qiskit_trev-0.2.1.tar.gz
Algorithm Hash digest
SHA256 95d8236c032256023258d765dc0490029411db47374a7e8c75cc30cb222aaa80
MD5 ea6d02c362eec710d9fa23bda6070880
BLAKE2b-256 470c482dfd5de4c1da2f1ea5eb18b24ee80d388f90dd6214a5b00f77d50e2878

See more details on using hashes here.

Provenance

The following attestation bundles were made for qiskit_trev-0.2.1.tar.gz:

Publisher: publish.yml on keunjunpark/qiskit-trev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qiskit_trev-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: qiskit_trev-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 64.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qiskit_trev-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a8fc63c717b98d12d55ab0067f5d891bb3891ceea5a5d0cbc887c04e838d47e2
MD5 dcf21f47c92fb128c8a732c3bdc8752c
BLAKE2b-256 c71e8aac17f89101f29d2ed2e84a14f17a668443c18ba04a5d233f4a8db4147e

See more details on using hashes here.

Provenance

The following attestation bundles were made for qiskit_trev-0.2.1-py3-none-any.whl:

Publisher: publish.yml on keunjunpark/qiskit-trev

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page