Introducing the Strawberry Fields Applications Layer

Xanadu
XanaduAI
Published in
6 min readJan 22, 2020

--

Juan Miguel Arrazola and Thomas R. Bromley

In 2010, early-stage quantum computers were housed in University basements. The only people that could program them were the students and postdocs that had built them. Meanwhile, algorithms promising exponential speedups demanded thousands of error-free qubits. The gap between theory and experiment seemed enormous. This made quantum scientists happy: we had a job to do!

Ten years can pass by very quickly. Yet a lot can happen in a decade. In 2020, we can look back and recognize the outstanding experimental progress that has been achieved across several platforms. Likewise, new algorithms have been discovered, tailored to run on available hardware. The gap is smaller than ever.

Quantum software has been a key ingredient for progress in quantum computing. It provides users with the toolset to design and execute quantum algorithms without the need of expert knowledge. New ideas proliferate when we increase people’s ability to interact with cutting-edge technologies. This sparks a positive feedback loop: quantum software leads to new ideas, which lead to better software.

As part of these efforts, we are thrilled to announce a new addition focused on algorithms for near-term devices: the Strawberry Fields applications (apps) layer 🎉. Its main goal is to provide users with the capability to implement and test photonic quantum algorithms using only a few lines of code. It includes a remodeling of the Strawberry Fields documentation, with new introduction and tutorials sections. Technical details can be found in the accompanying paper “Applications of Near-Term Photonic Quantum Computers: Software and Algorithms”.

Quantum algorithms for near-term devices have short depth (few gates) and are usually restricted to specific operations. The apps layer focuses on Gaussian boson sampling (GBS), Xanadu’s near-term quantum device. This is a photonic algorithm using a fixed sequence of experimentally accessible gates and measurements. In its simplest form, a GBS device operates by applying squeezing gates, optical interferometers (decomposed in terms of beam splitters and phase-shifters), and photon counting, as shown in the figure below. The top image is a circuit diagram. The bottom image is a schematic of a physical implementation:

The apps layer is organized in modules, most dedicated to a specific GBS algorithm: dense subgraphs, maximum clique, graph similarity, point processes, and vibronic spectra. Auxiliary modules are also available that provide support for sampling, visualization, and access to pre-generated data. Users interested in a specific application can work almost exclusively within the designated module.

The starting point of every algorithm is a collection of measurement samples from GBS. A sample can be represented as a vector that specifies in which output channels photons were detected. The functions that implement these algorithms don’t “care” where the samples come from: they may originate from simulators or hardware. Once you have produced samples, you can just load them and run the algorithms as usual.

Known applications of GBS can be roughly classified in three main categories: graphs and networks, machine learning, and quantum chemistry. Let’s take a brief look at each of these. Graphs can be encoded into a GBS device in terms of the graph’s adjacency matrix. The number of optical channels is then equal to the number of nodes in the graph. The GBS outputs can be associated with subgraphs: we keep nodes for the subgraph if photons are detected in the corresponding mode. As shown in one of our papers, the sampled subgraphs are highly-connected (dense) with high probability. This is helpful if our goal is to identify such highly-connected subgraphs! Dense subgraphs can also be used as seeds for algorithms aimed at finding large cliques in graphs. Cliques are subgraphs where all possible connections are present. Dense subgraphs and maximum clique are important problems in data mining and optimization, notably where the goal is to identify clusters of information.

Tutorials for dense subgraphs and maximum clique can be found in the Strawberry Fields documentation.

Encoding graphs into GBS devices also allows us to compare how similar they are, which can be useful for machine learning tasks such as graph classification. This is important in many areas, for example in classifying molecules that are represented as graphs. The strategy is to coarse-grain outputs from the device and use them to build feature vectors that encapsulate important properties of the graphs. Similar graphs have feature vectors that are close to each other. It is also possible to encode collections of points into GBS devices via their kernel matrix. Samples here correspond to subsets of points and the distribution over point patterns is known as a point process. GBS has the property that sampled points are clustered with high probability.

You can take a look at our tutorials to learn how to compute feature vectors and implement point processes using the Strawberry Fields apps layer.

Finally, one of the earliest known applications of GBS is vibronic spectroscopy: computing the absorption lines of molecules due to the simultaneous vibrational and electronic transitions of a molecule upon interaction with light. The absorption spectra of molecules is relevant for example in determining their usage in photovoltaics or as dyes in industrial processes. Vibronic transitions can be described in terms of energy surfaces of the initial and final electronic states. Transformations between these energy surfaces are achieved through displacements, rotations, and squeezing. This means that vibronic transitions can be directly encoded into a GBS device, suitably adapted to include displacement transformations. Knowing also the frequencies of vibrational modes, it is possible to use GBS samples to reconstruct the molecule’s vibronic spectrum.

The apps layer has a dedicated tutorial for vibronic spectra, but why wait: let’s take a look now! To model molecular vibronic transitions with GBS, we need a few relevant molecular parameters:

  1. Ω: a diagonal matrix whose entries are the square-roots of the frequencies of the normal modes of the electronic initial state
  2. Ω′: a diagonal matrix whose entries are the square-roots of the frequencies of the normal modes of the electronic final state
  3. U_D: Duschinsky matrix, capturing how energy surfaces are rotated and squeezed
  4. δ: displacement vector for the energy surfaces
  5. T: temperature

The apps layer contains data describing these molecular parameters for formic acid. We import the relevant modules from Strawberry Fields and load the data:

These code blocks can be copied from the vibronic spectra tutorial.

We can now map this chemical information to GBS parameters of squeezing, displacement, and rotation:

Finally, we configure the GBS device according to these parameters, generate samples using a simulator, and plot the resulting spectrum:

The applications layer of Strawberry Fields makes it easy to get to grips with photonic quantum computers. We have seen how problems in graphs and networking, machine learning, and quantum chemistry can be solved using little knowledge of quantum computing — users simply need to encode their problem, generate samples, and pass samples through the provided algorithms. We hope that you will enjoy using this new feature and be able to solve some interesting problems! But don’t hesitate to get creative and use the tools in Strawberry Fields to design new approaches. Our philosophy is to get as many people thinking about photonic quantum algorithms as possible. You can also join the discussions on our Slack workspace and forum.

--

--

Xanadu
XanaduAI
Editor for

Building quantum computers that are useful and available to people everywhere.