Skip to main content

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.

Metadata

Release files for qiskit-trev 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qiskit-trev 0.2.1
File Size Uploaded Provenance Actions
qiskit_trev-0.2.1.tar.gz 70.0 kB With provenance Details for qiskit_trev-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qiskit-trev 0.2.1
File Interpreter ABI Platform Actions
qiskit_trev-0.2.1-py3-none-any.whl Python 3 none any Details for qiskit_trev-0.2.1-py3-none-any.whl

Total release size: 134.6 kB

Release files / qiskit_trev-0.2.1.tar.gz

Download URL qiskit_trev-0.2.1.tar.gz
Size 70.0 kB
Tags Source
SHA-256 checksum
How to use checksums
95d8236c032256023258d765dc0490029411db47374a7e8c75cc30cb222aaa80
BLAKE2b-256 checksum
How to use checksums
470c482dfd5de4c1da2f1ea5eb18b24ee80d388f90dd6214a5b00f77d50e2878
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.

Transparency log

Release files / qiskit_trev-0.2.1-py3-none-any.whl

Download URL qiskit_trev-0.2.1-py3-none-any.whl
Size 64.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8fc63c717b98d12d55ab0067f5d891bb3891ceea5a5d0cbc887c04e838d47e2
BLAKE2b-256 checksum
How to use checksums
c71e8aac17f89101f29d2ed2e84a14f17a668443c18ba04a5d233f4a8db4147e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.

Transparency log

Security for qiskit-trev 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for qiskit_trev-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page