A Review and Discussion of Variational Quantum Anomaly Detection

One of the first motivations for building quantum computers was the potential to use them for quantum simulations: the controlled simulation of complex quantum mechanical systems. An important part of understanding a complex system of this sort is to know its phase diagram. The recent emergence of QML (Quantum Machine Learning) [1] involves – in one of its facets – the application of machine learning techniques to the problem of quantum control. In this review, we summarize and discuss a recent publication that introduced a new QML algorithm called VQAD (Variational Quantum Anomaly Detection) [2] to extract a quantum system’s phase diagram without any prior knowledge about the quantum device.

Background

Since Feynman’s seminal lecture on quantum computing in 1981, scientists have had the goal of simulating quantum mechanical systems using quantum computer hardware [3].

“Nature isn’t classical dammit, and if you want to make a simulation of nature, you’d better make it quantum mechanical.”

Feynman

A body of work exists around the problem of quantum control [4], and many control systems for various types of quantum computers have been designed and demonstrated to date. Quantum control refers broadly to the application of control theory to the management of a quantum system, which can make use of optical, electrical, mechanical and other types of control mechanisms. Using machine learning for quantum control has become a common and interesting approach. In a somewhat unique fashion, the technique we are reviewing introduces a new method for using a quantum machine learning algorithm (VQAD) to aid in the control of a quantum system on the same host device.

The technique uses a quantum circuit as a neural network. This circuit is the Variational Quantum Anomaly Detector. The quantum data that serves as the input to this circuit are the ground states of a quantum system that result from a quantum simulation.

Unlike your typical computer with a central CPU, a neural network is a computational system that uses a large number of very simple computational units – the neurons. A neural network connects these neurons together in layers so that one layer’s neurons’ single-bit outputs are the next layer’s inputs.

The VQAD circuit’s parameters are trained using a classical feedback loop, which allows it to learn the characteristics of the quantum simulation’s results. The original VQAD paper shows how a VQAD circuit can be used to map out the phase diagram of a particular quantum system. However, the implication is that the technique may be capable of detecting anomalous simulation results in general, provided that the anomaly syndrome can be learned.

The Proposal

The proposal made by the authors of the original VQAD paper is summarized in this section [2].

The proposal splits a quantum circuit into two parts: the quantum simulation that prepares an initial state and the anomaly detection circuit that calculates the anomaly syndrome of the state. The anomaly syndrome is a calculation that verifies the quantum simulation’s expected outputs.

A very general circuit is a quantum auto-encoder. A quantum auto-encoder encodes information that is originally found in a larger number of qubits into a smaller number of qubits. A subset of the original qubits are used for the final encoding, and the others are “discarded” – decoupled from the rest.

The proposal repurposes the auto-encoder circuit. It is used to check how well the initial state can be encoded into the encoding qubits. An auto-encoder generally consists of several parts. These include the encoder that is responsible for reducing the dimensionality of the data and thereby compressing it with minimal loss. The bottleneck is the layer that contains the compressed low-dimensional representation of the data. Auto-encoders often have a decoder step as well, which reverses the compression at the receiving end of a communication. However, VQAD is not concerned with decoding the compressed information, only in repurposing the compression algorithm for the purpose of qubit decoupling. So, the only other component of the quantum auto-encoder used in VQAD is the method for determining the loss.

To determine this, the approach uses the Hamming distance dH, which is essentially a bit-wise comparison between two bit-strings. Measuring the discarded qubits into bit-strings N times and calculating the Hamming distance gives us an accurate idea of how much the discarded qubits’ measurement outcomes are correlated to the rest of the system. The idea is that the discarded qubits should not be correlated with the others, and the Hamming distance should always be zero regardless of what has been encoded.

The approach defines a cost C that summarizes this succinctly. When the Hamming distance is what we want, then the cost is minimized.

If we measure nd discarded qubits in the computational basis, the cost can be restated in terms of the expectation values of local Z operators local to each qubit j.

Since the purpose of the anomaly syndrome circuit is to check how coupled the discarded qubits are to the others, the circuit consists of layers with parameterized single-qubit y-rotations ry followed by controlled-Z gates between the discarded qubits and the encoding qubits. In each layer, one discarded qubit is entangled to one encoding qubit.

The circuit’s single-qubit rotations’ parameters are determined by an unsupervised learning mechanism. First, the circuit is repeatedly evaluated on a set of initial states that are considered free of anomalies. The parameters are tuned so that these states encode perfectly (C = 0).

A so-called unsupervised learning algorithm assumes no a-priori knowledge about the inputs to the algorithm’s training step. This means that the individual rows of training data are not specifically labelled for the unsupervised algorithm to learn to accept or reject. Rather, the unsupervised algorithm attempts to learn from the data what is typical and what is noise. The VQAD algorithm specifically learns the shape of the training data that minimizes the cost function C.

After the training step is complete, the circuit’s parameters are frozen. Then, the circuit will differentiate between anomalous states and non-anomalous states. If the cost is zero then the state is indeed a ground state. Otherwise, the circuit has detected an anomaly.

Since a phase transition is a change in the ground state of a quantum system, recognizing all of the ground states that comprise the system’s phase diagram is equivalent to learning the phase diagram. The phase diagram gives us a useful picture of the quantum system, so it is useful to be able to recognize it.

The Results

The authors of the original VQAD paper [2] evaluated the proposed method using two approaches. First, they took a look at the performance of the method with a theoretical data set. Second, they performed an experimental demonstration of the method on the IBMQ Jakarta quantum computer and analyzed the results.

Ideal Data

The behaviour of the VQAD circuit with ideal quantum data was studied using a Bose Hubbard Model with Dimerized Hoppings (DEBHM), which can be mapped to a spin-½ system [5].

This model describes a lattice of length L that with at most one boson in each of i sites. Here ni denotes the number of bosons at site i, and J−δJ(J+δJ) are tunneling amplitudes (coupling strengths) between odd and even nearest- neighbour sites respectively. b†, b are the bosonic raising and lowering operators.

Three distinct phases and their diagrams are known for DEBHM models with various on-site and nearest-neighbour repulsions. Density Matrix Renormalization Group (DMRG) simulations were performed to generate a subset of ideal states from these phases [6], for use as training data for the VQAD algorithm. Then, the trained VQAD model was used to identify anomalies in more DMRG-generated data from the same phases.

The authors found that a generated ground state was unique enough to the problem that it could be used on its own to train the VQAD circuit, which was then able to infer all three phases.

Experimental Data

The authors chose to use a Variational Quantum Eigensovler (VQE) for their experiment using the IBMQ Jakarta computer.

The VQE was used to perform the preparation of ground states in the Transverse Longitudinal Field Ising (TLFI) model.

Here gx, gy are the transverse and longitudinal fields, respectively. Zi, Xi are the Pauli-x and Pauli-z operators at the sites i, and J are the coupling strengths between neighbouring sites.

A gate-model VQAD anomaly syndrome circuit was created. The VQE algorithm was executed in the same run as the VQAD algorithm on the Jakarta computer.

A few additional optimizations were introduced in this experiment to help combat noise in the device and the resultant errors. First, the authors performed measurement error mitigation [7]. They also initialized the untrained rotation gate parameters with trained parameters from runs involving states nearby in the phase diagram.

With these added optimizations, they were able to train the circuit to sort its inputs. A significant cost difference was observed between even the most difficult states to differentiate. For example, the states |10101⟩ and |01010⟩ have a similar energy, which can create a problematic local minima for optimizers. However, the VQAD circuit was able to differentiate between them successfully.

Discussion

This is a unique and interesting use of quantum auto-encoders in an application that will potentially have utility in quantum software and quantum algorithm design – two advanced areas in quantum control. Arguably, the software which the authors made available on GitHub is already a useful contribution to the field.

The original VQAD paper showed that the approach is a viable way to encode the phase diagrams of quantum simulations of many-body systems, and that the approach’s main bottleneck is environmental noise that affects our existing physical real-world quantum computing devices.

The use of an auto-encoder to learn the shape of noisy data is not entirely new, but with VQAD it has been transplanted from the field of communication to quantum machine learning [2].

To assess the usefulness of an auto-encoder we are interested in several quantities. These include the lossiness, error rates, code rates and bounds such as the Gilbert-Varshamov bound. While the authors do provide evidence that VQAD is capable of learning phase diagrams, none of these theoretical quantities are considered in the original VQAD paper.

An auto-encoder traditionally employed in communication or error correction schemes would have the elements depicted below.

Typically, we would identify an error syndrome that would take into account the encoding action m → Gm, channel action c → c 0 and decoding action c 0 → Hc0 . Here m is an input message vector, G is the generator matrix of the code used for the encoding (meaning it takes a message vector to an encoded message vector called a codeword), c is the encoded cryptogram corresponding to m, c 0 is the transmitted cryptogram, and H is the decoder matrix.

However, VQAD repurposes the encoding portion of the typical scheme. The auto-encoder in VQAD is a quantum auto-encoder and the bottleneck is created by the decoupling and measurement of the discarded qubits. Therefore, we may disregard the channel and decoder actions.

With a message (input) space (0, 1)^k , the minimum distance (i.e. the space between encodable codewords) is d(G). d(G) is the Hamming weight minimized over all linear combinations of the columns of G.

A generator matrix G will generate a code with (k-n)-bit codewords from k-bit messages. If such a code is linear (I.e. it can be written in matrix form m->Gm), then its rate is simply given by Rk(G) = k / (k-n).

The Gilbert-Varshamov bound gives us the limit of the code rate as the input size grows.

Here h is the binary entropy function.

In the case of VQAD, the generator matrix is the anomaly syndrome circuit. G is a parameterized matrix whose values are only fixed after the unsupervised learning step. Furthermore, it is unlike linear error-correcting codes (like the repetition code, etc.) in that it utilizes entanglement.

The gates involved are the rotation operators Ry(θ) and entanglement operator CX.

Within this framework, the question VQAD uses to determine whether an input is anomalous asks whether an input message m of k bits can be encoded completely into a cryptogram Gm = c of k-n bits. This could be restated in terms of a bound not unlike the Gilbert-Varshamov bound.

In the original paper’s examples, and in their provided software, k = 5 qubits and n = 2 discarded qubits. These quantities are fixed for the purposes of their experiments.

However, if the VQAD approach is inherently useful then it should be expected to scale beyond these 5 qubits. In general, the layers of G become G(k, n)L=layer. Here I’ve moved the bottleneck (measured) qubits to the lowest order indexes for convenience.

G concludes with the bottleneck B.

Therefore, we might define a meaningful limit for VQAD using the following approach.

Instead of using the linear code rate Rk to identify when the rate is less than the binary entropy, we can use the cost function C to identify when the mapping from input to output is lossy. This serves our purpose since the cost function the authors defined is minimized when k input bits are mapped cleanly into k-n output bits. Since we are not discussing a linear map, it is of no concern whether the inputs are mapped to sufficiently well spaced measurement outcomes – only that they are mapped to measurement outcomes whose cost is low.

We can also make use of Hk, the Shannon entropy of the input space. We do want to account for each element of the input space in the map.

We want to see that the weight |M| of the input space M is optimized to within an error . The mathematical expression of our proposed limit is the following.

Unpacking this equation into meaningful steps would allow us to optimize the training of VQAD further by augmenting the training feedback loop:

  1. Perform training circuit execution t, ending with measurement of the k-n encoding qubits.
  2. Observe the cost of the circuit at this time, and set  = C. The circuit currently supports e-encoding. Note that this epsilon will not exactly equate to the usual definition at the onset of training. However, as the model parameters attenuate through this training loop, we would expect to see a convergence with the usual epsilon.
  3. Evaluate the weight of the input space seen thus far. How does it compare to the Shannon entropy? During any training step, the input space is being cumulatively constructed and contains t bitstrings. If during any training loop t, VQAD sees a message (a ground state input corresponding to a measurement outcome) that causes the cumulative “seen” subspace M^(t) to cease to respect this limit, then the hyperparameters k, n, L and local parameters require further attenuation. M is itself a subspace of the space of all possible many-body configurations of the simulation qubits – M is composed of the anomaly-free configurations.
  4. Perform parameter estimation not only to minimize the cost but also to observe the limit.
  5.  If the limit is respected after parameter estimation, increase k, n, L

This could provide a general approach for tuning not only the parameters of the VQAD circuit but also the size (in terms of inputs and outputs) and the number of layers to the problem.

There are interesting unexplored connections between this work and quantum error correction [8]. There is also a potentially interesting and unexplored connection to entanglement distillation, which is a fundamental component of several quantum-cryptographic communication schemes [9].

It is also open to explore whether the VQAD algorithm is useful strictly as a quantum algorithm, or whether there may be a classical or quantum-inspired version of the approach that would benefit from the mathematics of the encoding methodology. One might compare the performance of the simulated VQAD algorithm to other existing vector encoders in order to assess this.

Finally, it would be interesting to look at the algorithm as an encoder more rigorously, from a theoretical standpoint. We might consider its capabilities in the context of different message spaces and codes. How would the minimum distance of a code be limited by this architecture, and the noise levels in existing quantum computer? What code rates and bounds could be derived in theory and achieved in practice?

References

[1]  J. Biamonte, P. Wittek, N. Pancotti, P. Rebentrost, N. Wiebe, and S. Lloyd, “Quantum machine learning,” Nature, vol. 549, no. 7671, pp. 195–202, Sep. 2017. [Online]. Available: https://doi.org/10.1038/nature23474

[2]  K. Kottmann, F. Metz, J. Fraxanet, and N. Baldelli, “Variational Quantum Anomaly Detection: Unsupervised mapping of phase diagrams on a physical quantum computer,” arXiv e-prints, p. arXiv:2106.07912, Jun. 2021, _eprint: 2106.07912.

[3]  A. Trabesinger, “Quantum simulation,” Nature Physics, vol. 8, no. 4, pp. 263–263, Apr. 2012, bandiera_abtest: a Cg_type: Nature Research Journals Number: 4 Primary_atype: Editorial Publisher: Nature Publishing Group Sub ject_term: Quantum information Subject_term_id: quantum-information. [Online]. Available: https://www.nature.com/articles/nphys2258

[4]  R. Wu, J. Zhang, C. Li, G. Long, and T. Tarn, “Control problems in quantum systems,” Chinese Science Bulletin, vol. 57, no. 18, pp. 2194–2199, Jun. 2012.

[5]  K. Sugimoto, S. Ejima, F. Lange, and H. Fehske, “Quantum phase transitions in the dimerized extended Bose-Hubbard model,” \pra, vol. 99, no. 1, p. 012122, Jan. 2019.

[6]  S. R. White, “Density matrix formulation for quantum renormalization groups,” \prl, vol. 69, no. 19, pp. 2863–2866, Nov. 1992.

[7]  S. Bravyi, S. Sheldon, A. Kandala, D. C. Mckay, and J. M. Gambetta, “Mitigating measurement errors in multiqubit experiments,” \pra, vol. 103, no. 4, p. 042605, Apr. 2021, _eprint: 2006.14044.

[8]  C. H. Bennett, D. P. DiVincenzo, J. A. Smolin, and W. K. Wootters, “Mixed-state entanglement and quantum error correction,” Physical Review A, vol. 54, no. 5, pp. 3824–3851, Nov. 1996, publisher: American Physical Society (APS). [Online]. Available: http://dx.doi.org/10.1103/PhysRevA.54.3824

[9]  R. Renner, “Security of Quantum Key Distribution,” arXiv:quant- ph/0512258, Jan. 2006, arXiv: quant-ph/0512258. [Online]. Available: http://arxiv.org/abs/quant-ph/0512258

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: