
Machine Learning for Quantum Processing: How to Run Real-Time Neural Networks
Written in collaboration with and extending on research by Ilan Mitnikov
Quantum computing and neural networks; to be completely honest, I can’t imagine a more hyped-up combination of techy buzzwords. These days it seems like almost everything has a “quantum” prefix, and it often makes my eyes roll. I imagine that people working on machine learning probably feel the same. As physicists, however, we get a free pass to play around with cool algorithms that actually push neural networks and quantum computing away from the hype realm and towards reality. This blog post is about one such algorithm.
Here at QM, we pride ourselves on our innovative approaches. So even though neural network processing in quantum computing has been around for a while, we decided to put a new spin on it and bring something fresh to the table: real-time neural network processing. Yes, the kind that happens right within the FPGA. Not later, not on Python, but right there, as you conduct your experiment. We cannot stress this enough: the OPX+, our qubit control hardware is not an AWG, in fact, it’s nothing like it. Unless your AWG-based quantum control equipment also lets you do real-time classical computation and training. This is where using Quantum Orchestration and the OPX+ really comes in handy. But before I get too ahead of myself, let’s start with the basics.
Neural networks, in brief
As their name suggests, neural networks constitute a set of algorithms that mimic the animal brain’s neural pathways, in which synapses transmit information between different neurons. Neural networks learn and adapt to changing inputs, generating the best result. Artificial neural networks operate under the same basic principles. Here, neurons process and receive the signal, where the output is computed using some non-linear function made of the sum of its inputs. The connections between the neurons are called edges; both these quantities have a weight, which changes as learning progresses, changing the strength at the connection. Neurons form layers, in which different transformations are performed, traveling from the input layer to the final output layer. Neural networks can be used to perform various actions, such as classification, optimization, and decision making.
Quantum applications of neural networks
One of the main advantages of the Quantum Orchestration platform is that we can run neural networks directly on the FPGA of the OPX+ device, in real-time, and on the native scale of operations on qubits. This allows us to classify, change, and learn in real-time what we should do with our qubits; as opposed to saving the data and analyzing it at a later point.
For example, we can use convolutional neural networks to classify the state in a quantum dot system. We can thus proceed to apply gates accordingly, all that while the qubits are alive (as in, within the coherence time of qubits). Neural networks can also be applied to superconducting qubits; they can be used for optimizing parameters for real-time state estimation of multiplexed qubits, allowing for ultra-low latency feedback on multi-qubit devices. But more on these examples later. First, let’s examine how neural networks can be implemented using the pulse-level programming language, QUA.
Neural networks with QUA
The main idea of implementing the neural network is defining it through various layers and then allowing it to learn. All of this can be done in real-time as the OPX+ is being used. Let’s focus on the first part first: the network itself.
In QUA, we can define layers as Python classes that implement QUA code. We have created dense layers and convolution layers, which are created classes, much like in Python.
with program() as prog:
layer1 = Dense(3, 2, activation=ReLu())
layer2 = Dense(2, 3, activation=ReLu())
layer3 = Dense(3, 3, initializer=Normal())
nn = Network(
layer1, layer2, layer3, loss=MeanSquared(), learning_rate=0.05, name="mynet"
)