Reference states
In this lesson, we will explore how we can initialize our system with a reference state to help our variational algorithm converge faster. First, we will learn how to construct a reference state manually, and then explore several standard options that can be used in a variational algorithm.
Default state
A reference state refers to the initial fixed start for our problem. To prepare a reference state, we need to apply the appropriate, non-parametrized unitary at the start of our quantum circuit, such that . If you have an educated guess or datapoint from an existing optimal solution, the variational algorithm will likely converge faster if you use that as a starting point.
The simplest possible reference state is the default state, where we use the starting state of an -qubit quantum circuit: . For the default state, our unitary operator . Due to its simplicity, the default state is a valid reference state used in many scenarios.
Classical reference state
Suppose you have a three-qubit system and you want to start in the state instead of the default state . This is an example of a purely classical reference state, and to construct it, you simply need to apply an X gate to qubit (following Qiskit's qubit ordering), as .
In this case, our unitary operator is , which leads to the reference state .
from qiskit import QuantumCircuit
qc = QuantumCircuit(3)
qc.x(0)
qc.draw("mpl")
Output:

Quantum reference state
Suppose you aim to start with a more complex state that involves superposition and/or entanglement, such as .
To obtain this state from , one approach is to use a Hadamard gate on qubit (), a CNOT (CX) gate with qubit as the control qubit and qubit as the target qubit (), and finally an gate applied to qubit ().
In this scenario, our unitary operator is , and our reference state is .
qc = QuantumCircuit(3)
qc.h(0)
qc.cx(0, 1)
qc.x(2)
qc.draw("mpl")
Output:

Constructing Reference States using template circuits
We can also use various template circuits, such as TwoLocal
which allows for expressing multiple tunable parameters and entanglements with ease. We will cover these template circuits in more detail in the next lesson, but we can use them for our reference states if we bind the parameters:
from qiskit.circuit.library import TwoLocal
from math import pi
reference_circuit = TwoLocal(2, "rx", "cz", entanglement="linear", reps=1)
theta_list = [pi / 2, pi / 3, pi / 3, pi / 2]
reference_circuit = reference_circuit.assign_parameters(theta_list)
reference_circuit.decompose().draw("mpl")
Output:

Application-specific reference states
Quantum machine learning
In the context of a variational quantum classifier (VQC), the training data is encoded into a quantum state with a parameterized circuit known as a feature map, where each parameter value represents a data point from the training dataset. The zz_feature_map
is a type of parameterized circuit that can be utilized to pass our data points () to this feature map.
from qiskit.circuit.library import zz_feature_map
data = [0.1, 0.2]
zz_feature_map_reference = zz_feature_map(feature_dimension=2, reps=2)
zz_feature_map_reference = zz_feature_map_reference.assign_parameters(data)
zz_feature_map_reference.decompose().draw("mpl")
Output:

Summary
With this lesson, you learned how to initialize your system using:
- Default reference state
- Classical reference states
- Quantum reference states
- Application-specific reference states
Our high-level variational workload looks as follows:
While reference states are fixed, initial starting points, we can use a variational form to define an ansatz to represent a collection of parametrized states for our variational algorithm to explore.