1. Home
  2. Explore
  3. Computer Science
  4. Atos Quantum Learning Machine

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Atos Quantum Learning Machine

Quantum Simulation Frameworks: QLM, myQLM, and Qtensor

Quantum simulators run quantum circuits on classical computers. They are useful for testing and debugging algorithms, studying noise, estimating expectation values, and finding parameters for variational algorithms before using quantum hardware. Two approaches described here are the Atos Quantum Learning Machine (QLM), a broad simulation and programming platform, and Qtensor, a tensor-network simulator especially suited to certain QAOA calculations.


QLM and myQLM

What QLM provides

The Quantum Learning Machine (QLM) is a classical platform for working with quantum programs. It combines:

  • Quantum programming tools for constructing circuits.

  • Circuit optimizers that adapt programs to hardware constraints, such as limited qubit connectivity.

  • Classical simulators for ideal and noisy quantum computations.

  • Connections to external frameworks and quantum processors.

QLM’s hardware-aware compilation is intended to bridge the gap between a hardware-independent algorithm and the constraints of a particular device. For example, a program may need to be transformed to fit the connectivity or gate set of a superconducting processor, trapped-ion device, or another architecture.

The full QLM is a large classical machine with substantial memory. Its design supports computationally demanding simulation, including noisy simulation. myQLM is the laptop-oriented version: it allows users to develop programs and run small or “toy” circuits locally, while more demanding simulations can be sent to a remote QLM server through QLM as a Service.

Interoperability

QLM is designed to work with other quantum software frameworks:

  • A circuit written in QLM can be sent to a Qiskit backend.

  • A Qiskit circuit can be run on QLM simulators or optimized using QLM compilation tools.

  • The same general approach can connect a program to supported external quantum hardware.

This separation between a program and its execution backend makes it possible to change where a computation runs without rewriting the algorithm itself. Depending on the backend, the program may run on an ideal simulator, a noisy simulator, or a physical quantum processor.

Quantum processors and simulators as backends

In QLM, a QPU is the component to which a quantum job is submitted. A QPU may represent an actual quantum processor or a classical simulator that imitates one.

An ordinary circuit job contains a circuit and, optionally, an observable to measure. If no observable is specified, the simulator can return information about the final computational-basis outcomes. With an observable specified, the result can include its expectation value.

A basic job workflow is:

  1. Construct a quantum circuit.

  2. Optionally define an observable, often a Hamiltonian.

  3. Bundle the circuit and observable into a job.

  4. Submit the job to a QPU or simulator.

  5. Read the resulting probabilities, amplitudes, or expectation value, depending on the backend and job.

A perfect state-vector simulator can provide probability amplitudes for the final state. A noisy simulator generally does not provide a single ideal state’s amplitudes; instead, it models noisy outcomes and estimates probabilities or expectation values from the simulation.

Circuits, observables, and Hamiltonians

An observable is a quantity whose value is measured or estimated from a quantum state. In many quantum algorithms, it is represented as a Hamiltonian, a weighted sum of products of Pauli operators.

For example, an observable on two qubits might contain a term proportional to X0Y1X_0Y_1X0​Y1​ and another proportional to Z1Z_1Z1​. Here, the subscripts identify which qubits the Pauli operators act on. In a programming interface, the operator string and the list of qubit indices jointly specify the placement of each operator. Reversing the qubit indices changes which qubit each Pauli operator acts on.

Once a circuit and Hamiltonian are included in a job, the QPU can return the Hamiltonian’s expected value for the state prepared by the circuit. This expectation value is the objective used in a variational calculation.


Variational Quantum Eigensolver Example

The variational principle

The variational quantum eigensolver (VQE) is a hybrid quantum–classical algorithm for estimating the ground-state energy of a Hamiltonian.

It uses a parameterized quantum circuit, or ansatz, to prepare candidate states. A classical optimizer adjusts the circuit parameters to reduce the measured energy:

  1. Prepare a state using a parameterized circuit.

  2. Estimate the expectation value of the Hamiltonian.

  3. Use a classical optimizer to update the circuit parameters.

  4. Repeat until the energy stops improving or a stopping condition is met.

The variational principle ensures that the energy expectation of a normalized trial state is no lower than the Hamiltonian’s true ground-state energy. The circuit’s ability to represent a good trial state is therefore central to the method.

A two-qubit Heisenberg Hamiltonian

The example uses a two-qubit Heisenberg Hamiltonian with coupling set to J=1J=1J=1:

H=X0X1+Y0Y1+Z0Z1.H = X_0X_1 + Y_0Y_1 + Z_0Z_1.H=X0​X1​+Y0​Y1​+Z0​Z1​.

Its lowest eigenvalue is −3-3−3. The goal is to use VQE to find a circuit state whose energy approaches this value.

For this small system, the Hamiltonian can also be written as a 4×44 \times 44×4 matrix and diagonalized directly. Direct diagonalization is useful here for checking the answer, but it does not scale to the large Hamiltonians that motivate quantum algorithms.

Why entanglement matters in the ansatz

An initial ansatz consisting only of single-qubit rotations cannot create entanglement from a product-state input. Such circuits prepare product states, so they are inadequate when the target ground state is entangled.

Adding a two-qubit gate, such as a CNOT, allows the circuit to create entanglement. In the example:

  • Two parameterized RYR_YRY​ rotations introduce adjustable angles.

  • A CNOT connects the two qubits and can entangle them.

  • The angles are optimized to minimize the Hamiltonian expectation value.

The original single-qubit-only ansatz reached an energy of about −1-1−1, rather than the desired −3-3−3. Changing the initial parameter values did not solve the underlying problem: the circuit lacked the entangling operation needed to represent the relevant state. Adding the CNOT allowed the optimizer to reach the exact energy −3-3−3 in a small number of steps.

Key principle: An optimizer cannot compensate for an ansatz that is unable to represent the target state. The circuit must have enough expressive power, including entangling gates when the desired state is entangled.

Parameterized circuits and classical optimization

A parameterized circuit contains gates whose angles are variables rather than fixed numerical values. The optimizer searches over these variables to reduce the energy.

A standard QPU cannot evaluate a circuit whose gate angles have not yet been specified. A variational plugin or stack is therefore placed around the QPU. This layer understands that the job is an optimization problem: it supplies candidate parameter values, runs the circuit, evaluates the observable, and uses a classical minimizer to choose improved parameters.

In the example, a SciPy-based optimizer is used. It repeatedly submits parameterized jobs to a simulator and updates the angles based on the measured energy.


Noise Modeling in QLM

Why noise must be modeled

Real quantum processors are imperfect. Errors can occur during:

  • State initialization.

  • Gate operations.

  • Measurement or readout.

The NISQ era—the era of Noisy Intermediate-Scale Quantum devices—is characterized by quantum processors with limited scale and imperfect operations. Noise models allow a simulator to represent these imperfections and help assess how algorithms may behave on real devices.

Noise channels and device errors

Circuit-based noise can be modeled using quantum channels. A noise model can specify errors associated with quantum operations, as well as errors in initialization and readout. Noise can be chosen by the user, including models informed by device characterization or tomography.

For analog quantum programs represented as schedules rather than discrete gate circuits, noise can also be specified using suitable operator-based descriptions. Thus, the noise representation depends partly on how the program itself is represented.

Depolarizing-noise example

The myQLM example uses a simple depolarizing-noise model. A depolarizing plugin is placed in front of a perfect simulator, causing depolarizing noise to be applied after each one-qubit and two-qubit gate.

The noisy QPU accepts jobs in the same general way as the ideal QPU, but its outputs reflect the added noise. The example’s noisy VQE computation was slower because it used stochastic simulation and repeated the circuit many times during the variational optimization.

In the reported run:

  • The ideal calculation reached the ground-state energy of −3-3−3.

  • The noisy calculation ended near −2.77-2.77−2.77.

  • The energy therefore showed a noticeable deviation from the exact result, even though the optimization progressed in roughly a similar number of steps.

Noisy simulations can be used to examine both accuracy and convergence: whether the algorithm approaches the correct energy, how quickly it converges, and whether it instead converges quickly to an inaccurate value.

Simulation methods and scaling

QLM supports several approaches to classical simulation:

  • Linear-algebra or state-vector simulation: represents the quantum state explicitly. It is useful for ideal circuit simulation but becomes memory-intensive as the qubit count grows.

  • Stabilizer or Clifford-based simulation: exploits structure in circuits composed of certain Clifford operations.

  • Matrix product state (MPS) simulation: represents the state as a tensor network and can be effective when entanglement remains sufficiently limited.

  • Noisy simulation: can be performed using deterministic or stochastic approaches, depending on the simulation method and user choices.

The full QLM’s hardware and memory architecture is intended to support fast simulation, including demanding noisy VQE workloads. The local myQLM noise demonstration is simpler and less powerful than the noisy simulation capabilities available on a full QLM server.


Qtensor: Tensor-Network Simulation for QAOA

Purpose and general workflow

Qtensor is a tensor-network quantum simulator with a particular focus on QAOA simulations. More generally, a quantum simulator can estimate quantities such as probability amplitudes or observable expectation values by executing a classical representation of a quantum computation.

Qtensor’s main workflow is:

  1. Express an optimization problem, such as MaxCut.

  2. Convert it into a QAOA quantum circuit.

  3. Convert the circuit into a tensor network.

  4. Find an efficient order for contracting the network.

  5. Contract the network to obtain the desired amplitude or expectation value.

The choice of contraction order is crucial because intermediate tensors can become much larger than the original tensors.


MaxCut and QAOA

The MaxCut problem

The MaxCut problem asks how to assign two different labels, or colors, to the vertices of a graph so that as many edges as possible connect vertices with different labels.

For an edge joining vertices iii and jjj, the standard quantum cost term is proportional to

1−ZiZj2.\frac{1 - Z_iZ_j}{2}.21−Zi​Zj​​.

This term contributes when the endpoint labels differ. Summing it over the graph’s edges gives a cost Hamiltonian for MaxCut.

The QAOA ansatz

The quantum approximate optimization algorithm (QAOA) uses alternating layers of cost evolution and mixing operations. Its circuit is controlled by two sets of parameters, commonly denoted γ\gammaγ and β\betaβ. For a circuit depth ppp, there are ppp layers, each with corresponding cost and mixer parameters.

The resulting parameterized state is used to estimate the cost Hamiltonian’s expectation value. The parameters are then optimized to find a good approximate solution to MaxCut.

Classical simulation can be used to optimize these parameters without repeatedly sampling on a noisy quantum device. However, simulating the full output distribution or sampling the entire ansatz state can be much more difficult than calculating the energy expectation alone.


Local Light Cones for QAOA Energy

Why the energy can be simplified

The MaxCut energy is a sum of local edge terms. To calculate the contribution from an edge (i,j)(i,j)(i,j), the relevant observable acts only on the two endpoint qubits. In the expectation-value expression, circuit operations that are sufficiently far from these endpoints cancel against their conjugate operations.

This cancellation means that the energy contribution for one edge can be calculated using a reduced circuit: the light cone of that edge. Rather than simulating the full QAOA circuit over the entire graph for every edge term, Qtensor can construct smaller subcircuits that include only the relevant region.

For a depth-ppp circuit, the edge’s reduced subgraph is generated from vertices within a bounded distance of its endpoints; the described construction includes vertices at distance less than p−1p-1p−1 from the relevant region. The exact reduced circuit depends on the graph and the QAOA depth.

The total energy is then obtained by summing the contributions from the graph’s edges. In effect, the calculation involves many smaller tensor networks rather than one tensor network for the entire circuit.

Regular graphs and subgraph structure

For random regular graphs, the local subgraphs can change structure as the size of the original graph changes. At modest graph sizes, local subgraphs may contain loops. At larger sizes, tree-like local neighborhoods become increasingly common.

This can lead to a counterintuitive result: increasing the size of the original graph does not necessarily increase the simulation difficulty monotonically. If the relevant subgraphs become more tree-like, their tensor networks may be easier to contract even though the original graph has more vertices.


Tensors and Tensor Networks

What a tensor is

A tensor generalizes a vector and a matrix:

  • A vector is a rank-one tensor.

  • A matrix is a rank-two tensor.

  • A rank-three tensor can be visualized as a three-dimensional array.

Tensor-network diagrams represent tensors as vertices and their indices as edges. When two tensors share an index, that index is represented by an edge joining them.

Contracting a shared index means summing over its possible values. For tensors AAA and BBB sharing an index jjj, contraction has the form

C…=∑jA…jBj….C_{\ldots} = \sum_j A_{\ldots j}B_{j\ldots}.C…​=∑j​A…j​Bj…​.

The resulting tensor has the remaining indices of AAA and BBB.

Mapping quantum circuits to tensor networks

A circuit can be converted into a tensor network by assigning a tensor to each gate:

  • A one-qubit gate is represented by a rank-two tensor, with an input and output index.

  • A two-qubit gate is represented by a rank-four tensor, with two input and two output indices.

Connecting the gate tensors according to the circuit’s wires yields the network to be contracted. The circuit’s state amplitudes or expectation values can then be calculated by contracting that network.

The representation is useful because the computation’s difficulty depends strongly on the network’s structure and the contraction order, not just on the number of qubits.

Why contraction order matters

When two tensors are contracted, the resulting tensor may contain more indices than either input tensor. As a result, poor contraction choices can create extremely large intermediate tensors, causing memory use to become the principal bottleneck.

A contraction plan specifies the order in which indices are eliminated. Qtensor seeks a plan that keeps intermediate tensors as small as possible.


Line Graphs and Contraction Width

Converting a tensor network to a line graph

Qtensor uses a line graph representation to help find contraction orders. In the original tensor-network representation:

  • Tensor indices are edges.

  • Tensors are vertices.

In the line-graph representation, the roles are transformed:

  • Each tensor index becomes a vertex.

  • The indices belonging to the same tensor are connected to form a fully connected subgraph.

This representation makes it possible to use graph-theoretic ordering algorithms to determine a useful contraction sequence.

Diagonal-gate simplifications

Diagonal gates have a particularly simple tensor structure. For a diagonal two-qubit gate, input and output indices are constrained to match. These constraints can be represented by delta tensors, which simplify the line graph.

QAOA uses diagonal cost operations as its main two-qubit operations. Exploiting this structure can therefore reduce the line graph and lead to better contraction orders.

How a contraction changes the line graph

In the line-graph representation, contracting an index corresponds to eliminating its vertex. When a vertex is eliminated, it is removed and all its neighbors are connected to one another.

The number of neighbors the eliminated vertex has determines the number of indices on the resulting tensor. Since each qubit index has dimension two, a tensor with kkk indices has 2k2^k2k entries. Thus, the number of neighbors directly affects the size of the intermediate tensor.

Contraction width and resource use

The contraction width is the largest number of neighbors encountered for any eliminated vertex during the contraction process. It is a key indicator of the memory and computational resources required.

For qubit networks, a width of www corresponds roughly to intermediate tensors with up to 2w2^w2w entries. Consequently, a small increase in width can produce a large increase in memory requirements.

A greedy ordering algorithm can choose, at each step, the vertex with the fewest connections. This is fast but may not find a good order for complex networks. More advanced ordering methods use tree-decomposition techniques to seek lower-width contraction plans.

The line graph’s similarity to a tree is relevant: a tree-like graph has low tree width and is generally easier to contract. As local QAOA subgraphs become tree-like, their contraction complexity can decrease.


Qtensor Simulation Capabilities and Performance

Practical resource limits

Tensor-network simulations are often memory-bound. The presentation gave approximate rules of thumb for laptop-scale calculations: contraction widths around 272727 or 282828 may be practical depending on available memory and network structure. A width of 272727 corresponds to roughly 2272^{27}227 entries for a largest intermediate tensor, which is on the order of several gigabytes when stored with typical numerical values.

Larger clusters can support larger widths. The examples described calculations at widths around 323232 on systems with roughly 200200200 gigabytes of memory, with larger supercomputers extending the feasible range further. These values are approximate and depend on the tensor structure, representation, and implementation.

Reported benchmark behavior

The reported benchmarks compared Qtensor with state-vector simulation and other tensor-network simulators. The results indicated that:

  • Qtensor performed well for QAOA energy calculations on regular graphs.

  • Simulation complexity depended on the local subgraph structure, not simply on the total number of vertices.

  • Some depth-three, degree-three cases could be simulated for graphs with many vertices because the relevant subgraphs were manageable.

  • Large-scale computing resources enabled much larger QAOA energy calculations than a laptop could handle.

The presentation described simulations of very large collections of local tensor networks and large graph instances on a supercomputer. These results concern energy calculations using QAOA’s local structure; they should not be interpreted as implying that arbitrary full quantum states at the same qubit counts can be simulated with comparable ease.


Qtensor Features

Qtensor supports several useful workflows:

  • Qiskit circuits as input: circuits can be converted from Qiskit to Qtensor’s circuit representation.

  • Cirq and Qiskit circuit generation: composer interfaces can generate circuits for different frameworks.

  • Amplitude calculations: the simulator can calculate selected computational-basis amplitudes.

  • Batched amplitudes: several amplitudes associated with a selection of qubits can be returned together. If all output qubits are included, this corresponds to the full state’s amplitudes.

  • Expectation-value calculations: QAOA energy can be calculated by summing the local edge contributions.

  • Parallelization: tensor-network calculations can be distributed, although this requires additional ordering and partitioning strategies.

  • Automatic differentiation: gate parameters can be differentiated through the tensor-network calculation using a machine-learning framework such as PyTorch.

These capabilities make Qtensor useful both for direct circuit analysis and for classical optimization of variational parameters.


Automatic Differentiation and QAOA Optimization

Gradient-based optimization

Variational parameters can be optimized by evaluating the energy at different parameter values, but this can require many separate simulations. Automatic differentiation provides a way to calculate derivatives of the simulated objective with respect to circuit parameters.

When the tensor-network operations are implemented using differentiable PyTorch operations, PyTorch constructs a computation graph. Gradients with respect to parameters such as γ\gammaγ and β\betaβ can then be calculated by backpropagation through the simulation.

The general process is:

  1. Create parameter tensors and mark them as requiring gradients.

  2. Build a differentiable circuit using those parameters.

  3. Simulate the circuit and compute an energy or loss.

  4. Differentiate the loss with respect to the parameters.

  5. Update the parameters using a gradient-based optimizer.

This can avoid estimating gradients by repeatedly evaluating nearby parameter points. The approach is particularly useful when many parameters are present.

Gradient descent and Adam

A basic method updates a parameter by moving in the direction that reduces the loss. A common update rule is

θ←θ−η∇θL,\theta \leftarrow \theta - \eta \nabla_\theta L,θ←θ−η∇θ​L,

where θ\thetaθ is a parameter, LLL is the loss, ∇θL\nabla_\theta L∇θ​L is its gradient, and η\etaη is the learning rate.

More advanced optimizers, such as Adam, adapt updates using running information about the gradients. Adam can perform better than basic gradient descent in some optimization landscapes, including those with saddle points or difficult local structure.

For the full QAOA energy, Qtensor computes the light-cone contribution for each graph edge, adds the contributions, and differentiates the total energy. The total calculation takes longer than a single-edge calculation because it must account for all edges, but the resulting gradients can guide the parameter optimization.


Using Qtensor at a High Level

A typical Qtensor workflow can be organized as follows:

  1. Choose a graph and QAOA parameters. The graph defines the optimization problem, and the parameters specify the ansatz.

  2. Create a composer. A composer builds the circuit using a consistent interface for different backends or circuit frameworks.

  3. Generate a circuit or edge light cone. For an energy calculation, the composer can construct the reduced circuit associated with an edge.

  4. Create a simulator. The Qtree-based simulator contracts the corresponding tensor network.

  5. Select the desired result. The simulator can calculate a single amplitude, a batch of amplitudes, or an energy expectation.

  6. Optimize parameters if needed. The energy can be evaluated repeatedly, or differentiated automatically and optimized with a gradient-based method.

Qtensor’s circuit composers and simulators separate circuit construction from the simulation backend. This makes it possible to use similar workflows with circuits represented in Qtensor, Qiskit, or Cirq.


Comparing the Two Approaches

QLM and myQLM

  • Provide a broad quantum software platform, including circuit programming, compilation, simulation, and hardware connections.

  • Support ideal and noisy simulation through different backends.

  • Emphasize interoperability and hardware-aware compilation.

  • Offer a local myQLM environment for smaller examples and access to larger QLM servers for more demanding work.

Qtensor

  • Uses tensor networks and graph-theoretic contraction ordering.

  • Is especially focused on efficient QAOA energy calculations.

  • Exploits local light cones and circuit structure to reduce the computation.

  • Supports amplitude calculations, expectation values, and differentiable variational optimization.

The central distinction is that QLM is a general platform for quantum programs and their execution, while Qtensor is a specialized tensor-network simulator that exploits the structure of circuits—particularly QAOA circuits—to make selected calculations more tractable.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent