# Software

## Optimizers for Noisy Intermediate-Scale Quantum devices

Software available at pypi and github.

Classical optimizers have important roles to play in quantum computing: in calibration, circuit synthesis, hybrid algorithms, machine learning, hyper-parameter selection, etc., etc. In many cases, the inputs to the optimization consist of noisy data, the result of both stochastic noise due to experimental setups and the probabilistic nature of algorithms, and circuit-level noise due to the limitations of current quantum devices. Within QAT4Chem, we have a particular interest in the Variational Quantum Eigensolver (VQE), a hybrid quantum-classical algorithm, which alternates between a classical optimizer that drives parameter selection and a quantum step that simulates, for example, a molecule.

The figure on the right shows the effect of circuit-level noise, simulated as Gaussian noise on rotation gates, on the optimization surface close to the global minimum for a quantum simulation of an ethylene molecule. This quantum simulation involves only two parameters, with the most relevant one shown, and is about as simple as it gets. There are two effects: first, since the noise does not commute with the circuit, it leads to a random walk away from the true ground energy as calculated by the quantum chip. Second, there is a large increase in variability of experimental outcomes. Clearly, the classical optimizer in the loop needs to be noise-aware for the full VQE algorithm to run properly.

Many optimization tools readily available in standard Python software such as SciPy are not noise-aware. Some methods (e.g. trust regions) are more robust than others, but seldom by design. Fortunately, applied mathematicians in the optimization community have long been working on this type of problem and have provided high quality, open source, software. However, some of the best of these are written for MATLAB, while the quantum computing community has chosen for Python and C++.

*Quantum simulation of ethylene (4 qubits, 2 parameters) with increasing levels of circuit noise (Gaussian, numbers in radians) on rotation gates, in a region around the global minimum of the main parameter.*

*Quantum simulation of ethylene (8 qubits, 14 parameters) with increasing levels of circuit noise (Gaussian, in radians) on rotation gates, showing quality of result of the full VQE algorithm. Any result below the "Science cut-off" can be used in practical applications.*

We have taken the optimizers that handle noise well, rewritten the MATLAB ones into Python, provided consistent interfaces and plugins for frameworks such as Cirq for all, and packaged this in scikit-quant. All these optimizers easily handle the above ethylene simulation (and larger problems besides), even at the largest levels of noise shown. Unfortunately, at those levels the results of the quantum simulation itself will have drifted too much to be scientifically useful. However, at levels where the quantum chip can deliver, state-of-the-art optimizers do deliver, where standard tools can not (see image on left).

The optimization package in scikit-quant also provides tutorial notebooks with tips and hints for hyper-parameter optimization, and an evaluation harness to quickly assess the applicability of the optimizers to new problems.

## RAndom Circuit Block Encoded Matrix (RACBEM)

https://github.com/qsppack/RACBEM