Source-linked AI summary
ffsim: Faster simulation of fermionic quantum circuits
Kevin J. Sung, Inho Choi, Mirko Amico, Bartholomew Andrews, Esra Ayantuna, Yukio Kawashima, Wan-Hsuan Lin, David Omanovic, Samuele Piccinelli, Javier Robledo Moreno, Abdullah Ash Saki, James Shee, Soyoung Shin, Minh C. Tran, Kento Ueda, Haimeng Zhang, Mario Motta
TL;DR
Fermionic quantum-circuit simulation needs efficient classical tools for prototyping and benchmarking, but general-purpose simulators can be resource-intensive. ffsim exploits particle-number and spin symmetries, adds domain-specific simulation and integration features, and demonstrates substantially reduced memory use and faster benchmarks, including applications up to 64 qubits.
Problem
Classical simulation is important for testing and benchmarking quantum algorithms, while general-purpose simulators can be inefficient for structured fermionic systems.
Method
ffsim is an open-source library that restricts state-vector simulation to conserved particle-number and spin sectors and provides fermionic gates, Hamiltonian evolution, sampling, and software integrations.
Results
ffsim outperforms FQE across the largest state-vector benchmarks and uses 19.3 GiB versus 256 EiB for the demonstrated 64-qubit Hubbard-model state vector.
Takeaways & Limitations
ffsim supports scientific fermionic simulations and optimized Qiskit circuits, with demonstrated applications involving circuits of up to 64 qubits.
Abstract
from arXiv · showhide
We present ffsim, an open-source software library for fast simulation of fermionic quantum circuits. ffsim exploits conservation of particle number and the z component of spin, symmetries present in a wide range of fermionic systems, to dramatically reduce memory usage and simulation time compared to general-purpose quantum circuit simulators. Compared to FQE, a library with similar functionality, ffsim differs in software design and is faster on a representative set of simulation benchmarks. Beyond state vector evolution by basic fermionic gates, ffsim offers a number of additional features including variational ansatzes, Hamiltonian time evolution via Trotter-Suzuki product formulas, efficient sampling of Slater determinants, seamless integration with Qiskit and PySCF, and comprehensive documentation. We demonstrate ffsim's capabilities on scientific applications involving quantum circuits of up to 64 qubits.
1 Introduction
ffsim is a Python library for simulating fermionic quantum circuits by exploiting conserved particle number and spin symmetries. It reduces resources relative to general-purpose simulators and supports circuits involving up to 64 qubits.
- Classical simulation helps researchers prototype quantum algorithms, explore tractable instances, and benchmark quantum hardware results.
- ffsim exploits conservation of particle number and the z component of spin, symmetries present across many fermionic systems.It also integrates with Qiskit and PySCF and provides ansatzes, Hamiltonian evolution, Slater-determinant sampling, and documentation.
- 256 EiB versus 19.3 GiB: ffsim stores the demonstrated 64-qubit Hubbard-model state vector using far less memory than a general-purpose simulator.The example uses a Hubbard model at 1/8 filling.
- The paper proceeds from mathematical background and state-vector algorithms to software features, benchmarks, and scientific applications.
2 Background and notation
The paper defines fermionic configurations, spin-resolved orbitals, orbital rotations, and Slater determinants, then identifies conserved quantities that partition the Hilbert space into simulation sectors.
- A fermionic system uses creation and annihilation operators over modes whose occupations are zero or one.Number operators have eigenvalues 0 and 1, with the vacuum as a shared zero-eigenvalue state.
- Electronic configurations are Slater determinants formed from occupied spin-orbital subsets, distinct from configuration state functions.
- A Hartree-Fock state is the configuration occupying the first η orbitals after a Hartree-Fock calculation.
- An orbital rotation is a unitary fermionic operator, and applying it to an electronic configuration produces a Slater determinant.Products of orbital rotations remain orbital rotations.
- With spin, each spatial orbital contains α and β spin orbitals, and configurations track separate occupied subsets for the two spins.
- Conserved particle number and spin z component divide the Hilbert space into sectors labeled by (Nα, Nβ), and ffsim simulates one sector.
- The background introduces molecular, double-factorized, and diagonal Coulomb Hamiltonian representations alongside the gate parameter conventions.
3 State vector simulation
ffsim represents fixed-particle-number fermionic wave functions in a symmetry-reduced basis and evolves their coefficients using a small set of efficient fermionic operations and compositions.
- ffsim implements a universal set of fermionic gates for circuits conserving particle number and the z component of spin.Several listed gates are redundant because they are special cases or compositions of more general operations.
- The state vector stores coefficients γ(Iα, Iβ) for Slater-determinant configurations, with addresses assigned using PySCF’s FCI module.
- The symmetry-reduced state vector is smaller than the 2^2N-dimensional vector used by general-purpose simulators mapped from 2N spin orbitals.
- Gate evolution computes new coefficients from the old ones, with number-operator sums and diagonal Coulomb evolution applying coefficient-dependent phases.Orbital rotations are handled separately, while other gates use special cases or compositions.
- Number-operator sums and diagonal Coulomb evolution support spin-dependent coefficients through separate spin-specific vectors or matrices.
- Orbital rotations accept unitary matrices and are decomposed into Givens rotations applied to pairs of same-spin orbitals.The implementation uses LAPACK’s zrot operation for the coefficient updates.
4 Software design and features
ffsim uses a Python-facing design with selected Rust performance extensions distributed as binaries across supported platforms.
- ffsim’s public interface is written in Python, while some performance-sensitive features are implemented internally in Rust.The compiled Rust extensions are distributed with the library on all supported platforms.
4.1 State vector representation and manipulation
ffsim represents fermionic state vectors as NumPy arrays supplemented by orbital and spin-electron counts, then applies fermionic gates through functions that return evolved vectors. Its illustrated LUCJ workflow prepares a Slater determinant, applies diagonal Coulomb evolution, and performs an orbital rotation.
- Representation: A state vector is a one-dimensional NumPy array accompanied by the number of spatial orbitals and spin-up and spin-down electrons.These quantities are passed as additional arguments to state-vector manipulation functions.
- Manipulation: Fermionic gate functions accept an initial state vector and return the evolved state vector.An orbital rotation is shown as an example of this usage pattern.
- LUCJ workflow: The illustrated LUCJ circuit prepares a Slater determinant with a diamond-shaped pattern of Givens rotations, applies diagonal Coulomb evolution, and ends with an orbital rotation.The orbital rotation uses brickwork Givens rotations followed by single-qubit phase gates.
4.2 Operator action and computing expectation values
ffsim supports non-unitary fermionic-operator action in addition to unitary gate evolution, enabling expectation-value calculations. It represents operators through SciPy's LinearOperator interface and can use sparse linear-algebra routines for exact Hamiltonian time evolution.
- Operator action: ffsim applies arbitrary fermionic operators, including Hamiltonians, non-unitarily to state vectors for tasks such as computing expectation values.Specialized implementations are available for common operators.
- Hamiltonian representation: MolecularHamiltonian stores one-body and two-body tensor coefficients and can be converted to a SciPy LinearOperator.The conversion uses ffsim's linear_operator function.
- Time evolution: SciPy's expm_multiply computes exact Hamiltonian time evolution by applying e^(-iHt)|Ψ⟩ through the resulting LinearOperator.The LinearOperator can be passed to SciPy sparse linear-algebra routines.
4.3 Integration with Qiskit
ffsim integrates with Qiskit by simulating circuits composed of Hamming-weight-preserving gates and by providing a Sampler primitive and state-vector interface. It also optimizes fermionic circuit decompositions, including LUCJ circuits, for execution on quantum computers.
- Circuit simulation: ffsim can simulate Qiskit circuits whose gates preserve Hamming weight, including CPhaseGate, SwapGate, and XXPlusYYGate.The circuit need not otherwise be related to fermionic simulations.
- Circuit requirements: A valid simulated circuit prepares a computational basis state, applies Hamming-weight-preserving unitary gates, and measures only at the end.The preparation begins with X gates applied to the all-zeros state.
- Qiskit interfaces: ffsim provides a Qiskit Sampler implementation and a function that accepts a Qiskit circuit and returns its final state vector.These interfaces support direct integration with Qiskit circuit workflows.
- Circuit optimization: ffsim defines Jordan-Wigner fermionic gates, optimized lower-level decompositions, and a transpiler pass that merges orbital rotations and detects efficient state preparation opportunities.The resulting Qiskit circuits are intended to be ready for execution on quantum computers.
- LUCJ example: A single-repetition LUCJ ansatz has the form UDU†, where U is an orbital rotation and D is a diagonal Coulomb evolution.ffsim simplifies the circuit so it prepares a Slater determinant, applies diagonal Coulomb evolution, and ends with a general orbital rotation.
4.4 Comprehensive documentation
ffsim provides comprehensive documentation covering its publicly exposed functionality, including explanations, how-to guides, tutorials, and detailed API references.
- Documentation scope: ffsim documents all publicly exposed functions and classes through explanatory pages, how-to guides, tutorials, and detailed API references.The documentation website is provided by the project.
4.5 Additional features
ffsim extends fermionic state-vector simulation with variational ansatzes, Hamiltonian time evolution, factorization tools, efficient Slater-determinant sampling, and fermionic-operator utilities.
- 4.5.1 Variational ansatzes: ffsim implements UCJ, LUCJ, and UCCSD variational ansatzes, while allowing users to define ansatzes that conserve particle number and spin z.Ansatz parameters can be applied to state vectors through the ffsim.apply_unitary protocol.
- 4.5.1 Variational ansatzes: ffsim provides flat real-valued parameter conversions and implements the gradient-based linear method for variational optimization.The paper notes that the linear method can outperform alternatives such as L-BFGS-B.
- 4.5.2 Compressed double factorization: ffsim provides double factorization for molecular Hamiltonians and t2-amplitudes, including compressed factorization that uses fewer terms to approximate the original tensor.The representation can reduce the cost of time evolution and measurement compared with the standard representation.
- 4.5.3 Hamiltonian time evolution: ffsim supports exact Hamiltonian evolution through SciPy LinearOperator representations and approximate evolution through arbitrary-order Trotter-Suzuki product formulas.Trotter steps divide total evolution time into smaller intervals and approximate each step by a product of exactly implementable term evolutions.
- 4.5.4 Efficient sampling of Slater determinants: ffsim efficiently samples Slater-determinant configurations using an algorithm with time complexity O(η^2N), where η = max(Nα, Nβ).The sampled configurations follow the determinant’s squared-amplitude probability distribution, also known as a determinantal point process.
- 4.5 Additional features: ffsim also supplies a Rust-implemented FermionOperator class for representing fermionic operators and functions for constructing, manipulating, and converting them for subsequent computation.The class is mainly used to build model Hamiltonians before conversion to an array-based data structure.
5 Comparison with other software
ffsim is compared with FQE and Qiskit Aer for state-vector simulation, and with DPPy and OpenFermion for additional operations. Across the largest tested state-vector instances, ffsim is faster than FQE while using symmetry-reduced state vectors.
- 5 Comparison with other software: ffsim and FQE both simulate fermionic wave functions with particle-number and spin-z symmetry, but differ in software design, performance, and features.ffsim uses functional NumPy-array state manipulation, whereas FQE uses an object-oriented wave-function representation and offers PySCF integration.
- 5.1 Comparison with FQE: ffsim uses Givens rotations for orbital evolution, while FQE uses LU decomposition and may require tracking orbital permutations.FQE therefore uses basis rotations and reversals for some quadratic-Hamiltonian and diagonal-Coulomb evolutions.
- 5 Comparison with other software: The benchmarks compare state-vector simulation with FQE and Qiskit Aer, Slater-determinant sampling with DPPy, and fermionic-operator normal ordering with OpenFermion.State-vector timings vary spatial orbitals, filling, thread count, and hardware; additional-feature timings are collected on a Linux x86 laptop.
- 5.2 Performance benchmarks: Across all state-vector benchmarks, ffsim outperforms FQE at the largest tested system size.On single-threaded MacBook benchmarks, reported speedups are 2.4×, 1.2×, and 8.4× for quadratic, diagonal-Coulomb, and molecular-Hamiltonian operations, respectively.
- 5.2 Performance benchmarks: Up to 18× speedups occur for double-factorized Trotter simulation, partly because FQE’s corresponding function does not use its optimized LU-decomposition code.For applicable benchmarks, Qiskit Aer cannot simulate the largest 16-spatial-orbital, 32-qubit instance; ffsim and FQE require 2.5 GiB at 1/2 filling and 51 MiB at 1/4 filling.
6 Applications
ffsim is applied to sample-based algorithms, Trotterized Hubbard-model evolution, and Krylov quantum diagonalization. These applications examine Trotter error, time-step selection, and the feasibility of approximate time evolution.
- 6.1 Sample-based algorithms: ffsim supports sample-based quantum algorithms by providing a state-vector representation that can be readily sampled.Previous studies used it for chemical systems beyond the reach of general-purpose state-vector simulators.
- 6.2 Estimating Trotter error: In the 2D Hubbard model at 1/8 filling, Trotter error decreases as the two-qubit gate budget increases, while larger lattices require more gates for a given error.The study fixes t = 1 and U = 8, uses a 4 × y lattice with y ranging from 2 to 8, and applies periodic boundary conditions in x.
- 6.3 Krylov quantum diagonalization: KQD energy error depends strongly on the time step: steps that are too small cause near-singular generalized eigenvalue problems, whereas steps that are too large slow convergence.With very small steps, Krylov vectors become nearly identical and error may not decrease monotonically with dimension.
- 6.3 Krylov quantum diagonalization: KQD can perform well with roughly approximated time evolution from short-depth Trotter circuits, reducing resource demands for quantum demonstrations.The application fixes ∆t = 0.3 and compares different numbers of first-order Trotter steps with exact evolution.
7 Conclusion
The paper presents ffsim as an open-source library for efficient fermionic-circuit simulation. It concludes that symmetry exploitation enables substantial efficiency gains and demonstrations involving circuits of up to 64 qubits, with GPU acceleration proposed as future work.
- 7 Conclusion: ffsim exploits particle-number and spin-z conservation to outperform general-purpose simulators and FQE in fermionic-circuit simulation.The library also includes variational ansatzes, Hamiltonian evolution, Slater-determinant sampling, Qiskit and PySCF integration, and documentation.
- 7 Conclusion: ffsim demonstrates scientific applications involving quantum circuits of up to 64 qubits.The conclusion presents these demonstrations as evidence of the library’s capabilities.
- 7 Conclusion: GPU acceleration is identified as a future direction because fermionic-gate application can be parallelized over state-vector entries.The authors expect this could provide further speedups and extend the range of classically tractable systems.
- 7 Conclusion: The authors hope ffsim will support quantum-computing researchers as hardware matures and algorithms are developed and tested.This anticipated use follows the library’s role in classical simulation and benchmarking.