Showing posts with label julia. Show all posts
Showing posts with label julia. Show all posts

Tuesday, June 27, 2023

Tensor network simulations challenge claims of quantum advantage...again!

Hot off the arXiv today: Efficient tensor network simulation of IBM's kicked Ising experiment

The authors report efficient classical simulations of the experiments by the IBM quantum computing team reported in Nature last week: Evidence for the utility of quantum computing before fault tolerance

What's going on here?

Tensor network methods are proving to be extremely powerful for computations related to quantum systems and large-scale neural networks. They work best for simulations of 1-dimensional or tree-like quantum systems (corresponding to the special case of matrix product states). Higher-dimensional systems or those with long range coupling containing looped paths, however, incur increasing overheads.

The Eagle quantum processor used in IBM's recent experiments is based on a two-dimensional network of qubits on a "heavy hexagon" grid. Thus, even though it is two-dimensional (harder for tensor network methods), its loops are longer than that of a more compact square lattice. The time required to traverse a single loop is comparable to the circuit depths probed in the experiment, meaning that by applying some clever factorization tricks the dynamics can be reproduced by efficiently-simulable tree-like tensor networks!

 

This is not the first time tensor networks have challenged claims of supremacy - they have also been used to simulate Google's original quantum supremacy experiments. What is particularly striking here is that the time between the publication of the quantum experiment and publication of the classical reproduction has dropped from years to weeks!

Here are some libraries for trying out tensor network simulations of quantum systems:

tensorcircuit: Python library developed by Tencent Quantum Lab - can handle shallow circuits involving hundreds of qubits.

ITensorNetworks: Julia library developed by the Flatiron Institute, which was used to reproduce the IBM experiments.

For theorists, getting familiar with these simulation tools that can also be applied to other important areas (such as large-scale machine learning or numerical simulations) seems to be a better use of time than getting to grips with the intricacies of ever-changing device-specific error models and quantum error mitigation schemes!

Monday, December 26, 2022

Quantum circuit simulation using Julia

For better or worse, most researchers working in quantum computing write and simulate quantum circuits using python libraries such as Qiskit, Amazon Braket, QuTip, and Qibo

Python is great for prototyping, particularly when one can cobble together existing libraries that call low level C or Fortran code to perform the most time-consuming parts of the computation. However the performance of Python code will inevitably be worse than optimised code written for compiled languages. 

This is usually an acceptable tradeoff for physicists - we prefer to do physics over low level code optimization and debugging. Unfortunately state-of-the-art quantum processors have reached a scale where numerically simulating them is extremely slow and (arguably) intractable for classical computers. Cue waiting for hours or even days for code to run.

That's why many researchers are starting to use Julia for simulating quantum circuits. Julia uses just-in-time compilation to achieve speeds comparable to C without sacrificing being easy to write and debug. As an example, the figure below (taken from arXiv:221209537) demonstrates computation of matrix permanents (crucial for simulation of BosonSampling experiments) two orders of magnitude faster than Matlab and Python implementations!

Benchmarking Julia against python and matlab code for computation of matrix permanents using Ryser's algorithm

 Other Julia libraries for quantum being developed include Yao.jl (differentiable quantum circuit simulation), QuantumCumulants.jl (simulation of open quantum systems), QXTools (distributed tensor network simulations of quantum circuits), and Quiqbox.jl (computational quantum chemistry subroutines). For more, see this list of open source quantum software projects.

I have tested Julia on a few photonics-specific problems, including the numerical solutions of the nonlinear Schrodinger equation and photonic band structure calculations. I particularly liked the ease of translating mathematical expressions to working code (for example, Julia supports unicode variables), ability to easily parallelize code, and (optional) type declarations for improving performance and debugging. 

Why not give Julia a try for your next project?