# Circuit Ansatz¶

In the context of variational circuits, an *ansatz* usually describes a subroutine consisting of a sequence of gates
applied to specific wires. Similar to the architecture of a neural network, this only defines the base structure,
while the types of gates and/or their free parameters can be optimized by the variational procedure.

Many variational circuit ansaetze [1] have been proposed by the quantum computing community. The strength of an ansatz depends on the desired use-case, and it is not always clear what makes a good ansatz.

One can distinguish three different base structures, namely a
**layered gate ansatz**, an **alternating operator ansatz**, and a **tensor network ansatz**.

## Layered gate architectures¶

A *layer* is a sequence of gates that is repeated. The number of repetitions
of a layer forms a hyperparameter of the variational circuit.

We can often decompose a layer further into two overall unitaries \(A\) and \(B\).

Block \(A\) contains single-wire gates applied to every subsystem or wire. Block \(B\) consists of both single-wire gates as well as entangling gates.

Layered gate ansaetze can differ in three regards:

- Whether only \(A\), only \(B\), or both \(A\) and \(B\) are parametrized
- Which types of gates are used in \(A\) and \(B\)
- Whether the gates in Block \(B\) are arranged randomly, fixed, or determined by a hyperparameter

Such layered ansaetze appear in both discrete and continuous-variable quantum computing models.

### A parametrized, B fixed¶

In the simplest case of qubit-based devices, we can use general SU(2) gates (i.e., rotations) \(R\) in Block \(A\) and let \(B\) be fixed.

### A parametrized, B parametrized¶

We can also have both \(A\) and \(B\) parametrized and the arrangements of the two-qubit gates depends on a hyperparameter defining the range of two-qubit gates (see also Romero, Olson and Aspuru-Guzik (2016), Schuld et al. (2018)).

A fully parametrized architecture specific to continuous-variable systems has been proposed in Schuld & Killoran (2018).

The entangling layer \(B\) contains an interferometer, a passive optical circuit made up of individual beamsplitters and phase shifters. Block \(A\) consists of single-mode gates with consecutively higher order for the quadrature operator \(\hat{x}\) which generates the gate: the displacement gate \(D\) is order-1, the quadratic phase gate \(Q\) is order-2, and the cubic phase gate \(V\) is order-3.

### A fixed, B parametrized¶

An example where the single-qubit gates are fixed is a so-called *Instantaneous Quantum Polynomial (IQP)*
circuit, where \(A\) consists of Hadamard gates and \(B\) is made up of parametrized diagonal
one- and two-qubit gates (Shepherd & Bremner (2008),
Havlicek et al. (2018)).

Analogous circuits can also be considered for continuous-variable systems Arrazola, Rebentrost and Weedbrook (2017).

IQP circuits are structured so that all gates in the \(B\) block are diagonal in the computational basis.

### Other structures¶

Generalizing the simple two-block structure allows to build more complex layers, such as this layer of a photonic neural network which emulates how information is processed in classical neural nets (Killoran et al. (2018), Steinbrecher et al. (2018)).

## Alternating operator ansatz¶

The alternating operator ansatz was first introduced by
Farhi, Goldstone and Gutmann (2014) as the
*Quantum Approximate Optimization Algorithm* (QAOA), and later used
for machine learning (Verdon, Broughton, Biamonte (2017))
and other domain-specific applications (Fingerhuth et al. (2018)).

Again, we use layers of two blocks. The difference is that this time the unitaries representing these blocks are defined via Hamiltonians \(A\) and \(B\) which are evolved for a short time \(\Delta t\).

The idea of this ansatz is based on analogies to adiabatic quantum computing, in which the system starts
in the ground state of \(A\) and adiabatically evolves to the ground state of \(B\). Quickly
alternating (i.e., *stroboscopic*) applications of \(A\) and \(B\) for very short times \(\Delta t\)
can be used as a heuristic to approximate this evolution.

## Tensor network ansatz¶

Amongst the architectures that do not consist of layers, but a single fixed structure, are gate sequences inspired by tensor networks (Huggins et al. (2018), Du et al. (2018)). The simplest one is a tree architecture that consecutively entangles subsets of qubits.

Another tensor network is based on *matrix product states*. The circuit unitaries can be decomposed in different ways,
and their size corresponds to the “bond dimension” of the matrix product state — the higher the bond dimension,
the more complex the circuit ansatz.

Note

Tensor networks such as matrix product states were invented to simulate certain quantum systems efficiently (though not universally) on classical computers. Hence, tensor network architectures do not necessarily give rise to classically intractable quantum nodes, but have found use as machine learning models (Stoudenmire & Schwab (2016)).

See also

In PennyLane, an ansatz is called a *template*. PennyLane contains
a growing library of such circuit architectures.

Footnotes

[1] | “Ansaetze” is the German plural for “ansatz”. |

## Contents

## Downloads