# Quantum Data Embeddings Circuit Design #2

Designing quantum circuits for Quantum Data Embedding

In quantum computing or processing the quantum information in the form circuits. In classical computing circuit design is not in our hand, whereas in Quantum computing circuit design is the key concept for programming.

To design the circuit, need to keen understand the Qubits, Gates and Registers. The most basic part of Circuit is the Ansatz Circuit.

## What is Ansatz Circuit?

Ansatz Circuit is a basic architecture of a circuit, i.e., a set of gates that act on specific problem. Ansatz circuit is a analogous to the architecture of a Neural Network (Deep Learning).

The core component of circuit-based quantum machine learning models is the variational (parameterized) circuits called Ansatz (Plural Ansaetze).

## Types of Ansatz

Ansatz circuit is not generic and unique, it depends on the desired use-case. In general, there are three different base structures, namely a Layered Gate Ansatz, an Alternating operator ansatz and Tensor networks ansatz. — source pennylane documentation.

## Layered gate architectures

A Layer is defined as a sequence of quantum gates is repeated. While training an algorithm the number of times a layer repeated is called hyperparameter of the circuit. Here we use blocks to divide the Layer and repeated based on the need. The following diagram shows about layer in two blocks A and B.

Layer gate ansatz can be differed in three ways based on the parameterization.

- Parameterization and fixed. Parameters can be arranged in different ways.

a. Block A is parameterized, B is fixed.

b. Blocks A and B are parameterized.

c. Block A is fixed and B is parameterized.

2. Type of gates used in Block A and Block B

3. Arranging gates in Block B

## Alternating operator ansatz

In this type of ansatz again blocks used in layers. The difference from the Layered gate architecture is that block represented as Hamiltonians. Blocks are evolved for a short time and represented as

The blocks of A and B arranged as follows.

## Tensor network ansatz

Tensor network do not consist of layers, but a single fixed structure, gate sequences inspired by tensor networks. This architecture entangles subsets of qubits.

Another Tensor network is based on matrix product states. Circuit unitaries can be arranged in different ways, and the size (no of unitaries) corresponds to the “bond dimension” of the matrix product state- the higher the bond dimension, the more complex the circuit ansatz.

## Construction of Ansatz circuit

The construction of an Ansatz is formed by stacking multiple identical sub-layers, similar to the construction neuron or cell based neural architecture designs.

## Generalization of Ansatz circuit

There is no general framework to design optimal ansatz for data-specific scenarios or specific use-cases.

## Optimizing Ansatz

There are two main categories of optimizing Ansatz, they are circuit simplification and Ansatz optimization.

**Circuit Simplification**

In this category, reducing the computation for Quantum hardware. Here we can replace the architectures local or global for circuits can be replaced with the most fit.

**Ansatz Optimization**

In this category, aims to find the optimal ansatz that yields the best performance on given tasks. Consider Heuristic Search well-performed ansatz on specific tasks instead of reduce computation. In this paper, greedy heuristic search applied for reducing the depth of the circuit QAOA.

Optimized Ansatz circuit plays vital role in the designing of Quantum algorithms for specific tasks in practice.

In quantum computing, Neural network considered as Quantum Neural Network (QNN), all machine learning algorithms can be implemented in the form of QNN and most famous one is Variational Quantum Classifier (VQC).

Quantum computers uses the Quantum embedding data for faster and efficient execution. How Quantum embedding works can be found in this article.

QNNs embedding the input data (classical data) into high-dimensional quantum Hilbert space. The below figure describe Quantum Embedding in short.

## Techniques to Embedd the data into Hilbert spaces

We can achieve the representation learning from Quantum embeddings, this is the beauty of embeddings. Let us see the following example of using above embeddings and classify into 3 different classes (i.e., using Hilbert spaces in quantum nature).

A very simple complete example of Quantum Neural network which preprocess , train and classify given data into 3 three classes.

In the above figure, ansatz acts on n-qubit system as

Backpropagation will set the weights ‘**w’** will be learned to minimize the cost function through training process.

In the above circuit,

- Primitive gates for entanglement establishment is CNOT gate, which offers a highly entangled state over all qubits in the system. Primitive gates of unitary includes Control-rotation gates i.e.,

2. Quantum representation are fed forward into the fixed unitary block including multiple entangling patterns active on certain number of qubits.

3. The last block of an ansatz circuit includes control rotation gates

## Entangled Patterns of an Quantum Embeddings (Encoding Scheme)

Entangling layouts can represented as directed multi-graphs, in which vertices are qubits and edges are gates (especially CNOT).

Using this directed graph we find the optimal structure for entangling patterns on a given dataset.

Directed Graph -> Entanglement Layout -> Adjacency matrix

## Directed Graph

The entanglement layout can be defined using CNOT gates along with its adjacency matrix.

## Entanglement Layout

In the above circuit, 0–1 connected, 1–2 connected, 2–3 connected and 3–0 connected using CNOT gate.

## Adjacency Matrix

The above circuit adjacency matrix defined as follows.

Adjacency matrix representation illustrate the complexity analysis in an easy and under stable way.

In the similar way you can try to define circuit and adjacency matrix for the below directed graph.

## Conclusion

The beauty of quantum embedding is that it will embedd the data into qubits (in Hilbert spaces) and classify the labels based on representation learning. Designing circuits for quantum algorithms has various ways, we just learned only two ways to design circuits for Quantum Embedding.

Give a clap if it is useful for you. Thanks for reading my article, appreciate your feedback, comments and share.

## References

- Depth Optimized Ansatz Circuit in QAOA for Max-Cut — https://arxiv.org/abs/2110.04637
- https://arxiv.org/abs/2103.07585
- Quantum Embeddings search for Quantum Machine Learning -https://arxiv.org/abs/2105.11853
- A Quantum Approximate Optimization Algorithm — https://arxiv.org/pdf/1411.4028.pdf