Skip to content

Menu

WorksPhysics and Astronomy

A machine learning architecture for scaling of holographic quantum circuits

Download PDFView on arXiv

Ask your agent about this work

Your agent reads this work through Valency, with its citations and similar works. Paste this at the start of a chat.

Use the Valency MCP. Work: W_kp9s6zbh. Fetch it with get_paper_by_id, then find its nearest works with find_similar_papers and tell me what it adds.

Works with any MCP client. Not connected yet? Connect your agent

Abstract

We describe an architecture and workflow for learning and generalizing the syntax and parameters of holographic quantum circuits (HQCs), which are natural quantum circuit analogs of classical tensor networks. An HQC uses mid-circuit measurements and resets on a small subset of "physical" qubits whose measurement outcomes become correlated through coupling with a register of persistent "ancilla" qubits, analogous to the physical and bond indices of a tensor network. Hence, an HQC with fixed qubit resources can efficiently generate samples from a large quantum state, and adding qubits to the HQC ansatz has the effect of exponentially increasing the effective bond dimension. Our machine learning approach provides mechanisms for harnessing both features of HQCs by extrapolating the syntax (e.g., a sequence of gates, measurements, and resets) and parameters (e.g., the angles appearing in single-qubit rotations) from a dataset of HQCs to longer or more expressive HQCs. We demonstrate the methodology and its performance on an analytically solvable dataset formed by a vector-valued generalization of the W-state. Finally, we provide an outlook for usage of the methodology for scaling the effective bond dimensions of HQCs in quantum simulation.

Introduction

Over the past decade, quantum computing has seen a rapid surge of progress, driven by the prospect of exponential speed-ups in a variety of domains such as optimization [1], cryptography [2], and high-dimensional many-body simulations [3]. At the same time, advances in scaling of qubit resources and fidelity [4] coupled with the development of feasible quantum error correction protocols [5] have dramatically reshaped the landscape of which is experimentally feasible. Nevertheless, present-day devices remain in the noisy-intermediate-scale-quantum (NISQ) regime [6], where limited qubit connectivity, short coherent times, and imperfect gate operations impose severe constraints on algorithmic performance. A central focus in the NISQ regime has been on variational quantum circuits, in which a classical representation of the quantum circuit is optimized based on feedback from a quantum device. Within this paradigm, one means of moving towards the regime of quantum advantage is to scale the circuit to where it cannot be simulated directly using classical means. A central obstacle to reaching this scale is the lack of an efficient quantum-circuit design strategy that can autonomously learn and scale circuits for simulations with classically-intractable sizes. In this work, we develop such a pipeline utilizing techniques from tensor networks and machine learning, demonstrate its effectiveness in an analytically tractable scenario, and present an outlook for applying it to the problem of scaling variational quantum circuits.

Classical tensor networks (CTNs) describe a large-rank tensor in terms of a contracted network of small-rank tensors, and can realize exponential improvements in storage and computation time compared to a dense tensor representation when the maximum dimension of any contracted index - known as the bond dimension - remains small. CTNs, in particular the one-dimensional CTN structure known as a Matrix Product State (MPS), have had a far-ranging impact on computational quantum science. They have enabled deeper insight into the entanglement and correlation structure of many-body quantum states, as well as forming the underpinning of the most accurate numerical methods for strongly correlated low-dimensional systems, such as the density matrix renormalization group (DMRG) [7].

Beyond classical tensor representations, tensor networks also provide a robust framework for designing parameterized quantum circuits that are resource efficient and implementable with existing quantum hardware. A natural generalization of CTNs to quantum circuits is provided by holographic quantum circuits (HQCs) [8], [9]. HQCs are quantum circuits who utilize mid-circuit measurements and resets on a subset of “physical" qubits, and whose measurement outcomes are correlated through a fixed register of “ancilla" (virtual) qubits, with direct analogies to the physical and bond indices of a CTN. In its most prevalent instantiation, there is a single physical qubit that is measured and reset after each multi-qubit operation with the ancilla register, which reproduces the well-known sequential preparation scheme of an MPS [10]. In this scheme, a single physical qubit suffices to produce samples of an arbitrarily large quantum state, and adding qubits to the HQC ansatz exponentially increases its effective bond dimension.

While HQCs have a clear theoretical scaling advantage over CTNs, methods to directly optimize an HQC on quantum hardware remain much less developed than very robust classical optimization techniques for CTNs like DMRG. The naive approach of starting from a random HQC with random parameters is known to suffer from the “barren plateau" phenomenon, in which the parameter landscape becomes featureless as its dimensionality scales. However, the development of techniques to "compile" an optimized CTN into a HQC for given target hardware provides an opportunity to develop datasets of exemplar HQCs that can then potentially be reasoned over or extrapolated using machine learning (ML), generating new trial HQCs that may be much closer to optimality, and thereby mitigating the barren plateau problem.

ML, in addition to transforming many areas of modern science and industrial practice, has brought forth promising applications for efficient quantum circuit generation. Previous studies have shown that ML architectures such as Reinforcement Learning [11], [12] and Transformers [13] can efficiently design quantum circuits while preserving high state fidelity. However, these approaches don’t directly address the needs of an ML architecture for scaling up HQCs to larger numbers of qubits. Namely, as a quantum state’s dimension is increased, building out its HQC representation requires one to keep track of the following: (1) where to appropriately place each quantum gate, (2) which qubit(s) (physical and/or ancilla) each gate acts on, and (3) when and where to perform measurement and reset operations on the physical qubit all while (4) jointly optimizing the parameters of all single-qubit gates.

In Figure 1, we display our proposed hybrid ML architecture used to efficiently scale up HQCs. Our approach employs a Long Short-Term Memory (LSTM) [14] model and a fine-tuned pre-trained Large Language Model (LLM) with Chain of Thought (CoT) [15] to individually learn and extrapolate each respective feature of an HQC: (1) parameters (e.g. single qubit rotation angles) and (2) syntax (e.g. sequence of gates, measurements, and resets). Then, by inserting the predicted rotation angles into the scaled-up syntax, we obtain a final scaled-up HQC. We stress that in our hybrid ML architecture, the LSTM works strictly with numerical data and the LLM works strictly with syntax, of which we represent in open Quantum Assembly Language (openQASM) [16]. As we will demonstrate, our architecture is capable of learning from a dataset of HQCs up to nn qubits, then scaling up to HQCs with m>nm > n qubits.

Overview of holographic quantum circuit generation workflow

Figure 1. Overview of holographic quantum circuit (HQC) generation workflow. The user supplies a parameter vector (e.g., a classical representation of the state p\mathbf{p} or a collection of quantum circuit parameters θ\boldsymbol{\theta}), which is fed into the LSTM model that predicts the required rotation angles for an HQC of YY qubits. In parallel, a Large Language Model (LLM) generates a "skeleton" of the quantum circuit syntax (e.g., in openQASM). The angle data from the LSTM and the openQASM skeleton from the LLM are merged and post-processed, yielding a complete quantum circuit that directly implements the desired W state on a quantum processor.

It may be argued that perhaps a fine-tuned, pre-trained LLM could be applied towards scaling-up HQCs by simultaneously extrapolating its rotation angle parameters and syntax. While LLMs have seen enormous success in learning natural language syntax and grammatical rules [17], they notoriously struggle with numerical data [18], [19], [20]. Numerical data is critical for defining the single qubit rotation angles in a quantum circuit and avoiding barren plateaus, and any misrepresentation of the rotation angle parameters can significantly change the final quantum state. Therefore, it is natural to decompose the challenge of scaling HQCs into the individual scaling of parameters and syntax, in which separate specialized ML models are assigned to generalize the facets individually.

We benchmark the methodology and performance of our hybrid ML architecture on an analytically solvable dataset formed by a vector-valued generalization of the W state, a well-known entangled state from quantum information theory. The W-state (and our vector-valued generalization) also has the additional property that its minimal bond dimension MPS representation is not translationally invariant even when the state itself is, in contrast to many other states with known MPS representations like the GHZ state [21]. Because of this property, the generalization of W-state HQC representations to longer circuits is non-trivial. We demonstrate that our architecture is capable of scaling up the generalized W state by learning and generalizing an nn-dimensional vector-to-angles mapping (pn→θn\mathbf{p}_n \to\boldsymbol{\theta}_n) and the standard W state by extending rotation angles corresponding to an nn-qubit state to rotation angles of m>nm > n qubit state (θn→θm\boldsymbol{\theta}_n \to\boldsymbol{\theta}_m).

The paper is organized as follows. In Section 2, we present an analytical construction of the generalized W state with holographic algorithms. In Section 3, we present and justify our proposed hybrid ML architecture used to scale up HQCs. In Section 4, we benchmark our hybrid ML architecture on scaling up the HQC representation of the generalized W state and the standard W state. Finally, we conclude the paper by providing an outlook for the application of our proposed hybrid ML architecture towards achieving large scale quantum simulations.

Analytical Holographic Compilation of the generalized W state

In this section, we present our vector-valued generalization of the W state and an analytic construction of holographic algorithms for its construction on two qubits. Namely, the generalized W state on nn qubits is defined as

∣W(p)⟩=∑i=1npi∣00…1i…00⟩(1)\lvert W(\mathbf{p}) \rangle= \sum_{i=1}^{n} \sqrt{p_i}\lvert00\ldots1_i\ldots00\rangle \tag*{(1)}

in which p\mathbf{p} is a vector of positive real numbers whose elements sum to 1. Measuring ∣W(p)⟩\lvert W(\mathbf{p}) \rangle in the computational basis yields the one-hot outcome ∣0…01i0…0⟩\lvert0\ldots01_i0\ldots0\rangle with probability pip_i. When pi=1/np_i = 1/n the state reduces to the standard W state. Such a state permits an MPS representation with bond dimension 2. After gauging in left canonical form, the isometries of the MPS are then:

Lij[j]=(δij,0sin⁡θjδij,10cos⁡θjδij,0)(2)\mathbb{L}^{[j]}_{i_j} = \begin{pmatrix} \delta_{i_j,0} & \sin\theta_j\delta_{i_j,1} \\ 0 & \cos\theta_j\delta_{i_j,0} \end{pmatrix} \tag*{(2)}
sin⁡θj=pj∑i≤jpi,cos⁡θj=∑i<jpi∑i≤jpi(3)\sin\theta_j = \sqrt{\frac{p_j}{\sum_{i\leq j}p_i}}, \quad \cos\theta_j = \sqrt{\frac{\sum_{i<j}p_i}{\sum_{i\leq j}p_i}} \tag*{(3)}

Because each Lij[j]\mathbb{L}^{[j]}_{i_j} is an isometry, it can be embedded into a unitary U^L[j]\hat{U}^{[j]}_L acting on a physical qubit and an ancilla qubit:

Lαβ[j]=⟨iα∣U^L[j]∣0β⟩(4)L^{[j]}_{\alpha\beta} = \langle i\alpha|\hat{U}^{[j]}_L|0\beta\rangle \tag*{(4)}

Using these unitaries, the generalized W state can be constructed as

(U^L[1]∣01⟩…(U^L[n−1]∣0n−1⟩(U^L[n]∣0n0⟩))…)=∣W(p)⟩∣0⟩.(5)\left(\hat{U}^{[1]}_L|0_1\rangle\ldots\left(\hat{U}^{[n-1]}_L|0_{n-1}\rangle\left(\hat{U}^{[n]}_L|0_n0\rangle\right)\right)\ldots\right) = |W(\mathbf{p})\rangle|0\rangle. \tag*{(5)}

Consequently, this construction can be interpreted as a sequential quantum circuit acting on a single physical qubit and a single ancilla qubit. The explicit derivation and gate decomposition of U^L[j]\hat{U}^{[j]}_{L} for j<nj<n and for j=nj=n is given in Appendix A.

Hybrid Machine Learning Framework

In this section, we describe in detail how our hybrid machine learning framework applied towards scaling holographic quantum circuits (HQCs). Here, the task of scaling HQCs is divided into two parts: (1) scaling parameters and (2) scaling quantum circuit syntax (represented in openQASM). To tackle (1), we implemented a Long Short-Term Memory (LSTM) model [14], and to tackle (2), we implemented a fine-tuned pre-trained Large Language Model (LLM) with Chain of Thought (CoT) [15]. Below, we explain and justify the application of these models towards these scaling problems.

Parameter Generalization

The problem of parameter generalization can be decomposed into two cases.

Case 1: Suppose an nn-qubit quantum state is described by a classical vector p\mathbf{p} that is mapped to a vector of circuit parameters (e.g., single-qubit rotation angles) θ\boldsymbol{\theta}. A learning model trained on the mapping p→θ\mathbf{p} \to\boldsymbol{\theta} for nn qubits should be able to extrapolate this relationship to quantum states with m>nm>n qubits, i.e., to produce the appropriate rotation-angle vector for any m>nm>n. In other words, the model learns the mapping fpf_{\mathbf{p}}:

fp:p→θ(6)f_{\mathbf{p}}:\mathbf{p}\to\boldsymbol{\theta} \tag*{(6)}

Such a problem is applicable to the generalized W state, whose state is parameterized by a positive, real-valued probability vector p∈R+n\mathbf{p}\in\mathbb{R}^{n}_{+} with ∑ipi=1\sum_i p_i=1.

Case 2: Suppose an nn-qubit quantum state is parameterised solely in terms of its quantum circuit parameters θ\boldsymbol{\theta} within a defined circuit architecture. Then, the model’s task is to take an input θ\boldsymbol{\theta} that corresponds to an nn-qubit state and correctly extend it to a parameter vector that describes a state with a larger number of qubits (m>nm>n). In other words, the model learns the mapping fθf_{\boldsymbol{\theta}}:

fθ:Rn∋θ→θ∈Rm(7)f_{\boldsymbol{\theta}}:\mathbb{R}^{n}\ni\boldsymbol{\theta}\to\boldsymbol{\theta}\in\mathbb{R}^{m} \tag*{(7)}

This problem is applicable to the standard W state because there is an unambiguous definition of the state for any nn. For the general W state with arbitrary p\mathbf{p}, the scaling of p\mathbf{p} to a longer sequence is ambiguous, and so a direct learning of the scaling up process is ill-defined.

We treat both cases of parameter generalization as a time series forecasting problem, since the known part of the sequence (either θ\boldsymbol{\theta} or p\mathbf{p}) can be used to predict its continuation (θ\boldsymbol{\theta} for larger qubit counts). Recurrent neural networks (RNNs) are a natural choice for such tasks because they process inputs sequentially while maintaining a hidden state that summarizes all previously seen elements. However, RNNs suffer from the vanishing/exploding-gradient problem which hampers long-range data dependencies, precisely the situation of which the rotation angle of the ii-th qubit influences that of the jj-th qubit for j>ij>i. The Long Short-Term Memory (LSTM) model [14] mitigates this issue by augmenting each recurrent cell with three gates (input, forget, output) and an internal memory cell, enabling robust capturing of long-term dependencies in sequential data. Therefore, an LSTM model was chosen to tackle the problem of scaling single qubit rotation angles.

Quantum circuit Syntax Generalization

Large language models (LLMs) have repeatedly shown a remarkable ability to internalize the syntactic and grammatical structure of languages [22]. Moreover, equipping LLMs with Chain-of-Thought (CoT) greatly improves reliability on complex tasks [15]. These two properties make a fine-tuned, pre-trained LLM a natural candidate for generalizing the quantum circuit syntax (i.e., the layout, ordering, and choice of quantum gates in a circuit represented in natural language through openQASM). We stress that the LLM does not interact with the rotation angle parameters; rather, the LLM will only generalize the placement and types of quantum gates and physical qubit measurements & resets. The output of the fine-tuned, pre-trained LLM is an openQASM representation of an HQC “skeleton,” without the rotation angle parameters, see Figure 1.

The prompt-to-answer pipeline is as follows. First, the LLM will be prompted to “Generate an openQASM skeleton of a holographic quantum circuit preparing the W state for Y qubits”. Next, the LLM will use CoT to enumerate the logical steps that define the holographic construction. This includes the number of sites, placement of single qubit rotations, placement of entangling gates, and reset & measurement operations. Since the model is forced to articulate these steps, it is less likely to produce incorrect openQASM code. Finally, following CoT reasoning, the LLM will output the aforementioned openQASM circuit skeleton.

Analytically Solvable Benchmark

We benchmark our hybrid machine learning framework by scaling up the HQC representation of the generalized W state described in § 2. As noted there, this family of states provides simple but non-trivial examples of non-translationally invariant quantum states, all of which can be described by an MPS with the simplest non-trivial bond dimension of 2. The benchmarking will proceed as follows. The first two subsections describe the training and validation of the LSTM towards scaling the rotation angle parameters for the generalized W state (by generalizing p→θp \to\theta mapping) and the standard W state (by extending θ\theta to longer sequences). The third subsection describes the fine-tuning procedure of a pre-trained LLM with Chain of Thought in producing a openQASM representation of the quantum circuit. Finally, the fourth subsection compares the shot distribution of a generated OpenQASM script for an arbitrary generalized W state against the true distribution using a noiseless quantum circuit simulator.

Scaling rotation angles for the generalized W state

In this section, we describe the application of an LSTM towards scaling up the rotation angles of the generalized W state. Here, the objective of the LSTM is to learn and generalize the mapping p→θp \to\theta where the jj-th element of θ\theta is:

[θ]j=sin⁡−1[pj∑i≤jpi],(8)[\theta]_j = \sin^{-1}\left[\sqrt{\frac{p_j}{\sum_{i \le j} p_i}}\right], \tag*{(8)}

which connects the parameterization of the state (through the vector pp) with the parameterization of its HQC (through the rotation angles θ\theta), see § 2.

Next, we describe the procedure of curating the training and validation sets. Here, we uniformly sampled 1,000 pp vectors per length LL for L∈[2,15]L \in[2,15], normalized each pp such that ∑ipi=1\sum_i p_i = 1, then analytically computed the rotation angle vector θ\theta from each p\mathbf{p}. We then split the dataset into training (2 to 6 lengths) and validation (7 to 15 lengths). Padding up to length 15 was used to account for the variable length with respect to the p\mathbf{p} and θ\theta vectors. A 2 layer, bidirectional LSTM with hidden size of 64 was employed to learn this mapping. A full description of the model and training hyper parameters can be found in Appendix § 8. The model’s loss function, computed only on the unmasked terms, is the mean squared error (MSE):

L=1N∑i=0N(θi−θ^i)2(9)\mathcal{L} = \frac{1}{N}\sum_{i=0}^{N}(\theta_i-\hat{\theta}_i)^2 \tag*{(9)}

Here, θi\theta_i is the LSTM-generated ii-th rotation angle and θ^i\hat{\theta}_i is the true ii-th rotation angle.

We now describe the results following training. The top panel of Figure 2 shows the evolution of the training and validation loss over the course of training. The model converges to a final training loss on the order of 10−510^{-5} and a final validation loss on the order of 10−310^{-3}, indicating that the model does not over-fit despite the increase in sequence length. The bottom panel of Figure 2 shows the final per-site angle error distribution, calculated as θi−θ^i\theta_i-\hat{\theta}_i, over the entire validation set of 7 to 15 qubits. The error mean slightly deviates from 0 as the circuit length increases, but remains on the order of 10−210^{-2}. Such a result confirms that the LSTM robustly reproduces the analytical mapping for sizes never seen during training.

Training and validation loss plot and angle error distributions

Figure 2. (Top) Training and validation loss plot of the LSTM model learning the generalized W state. As mentioned in the text, the model is learning a mapping from p→θp \to\theta where pp is a vectorized representation of the generalized W state, and θ\theta is a vector of single qubit rotation parameters. The model was trained on circuit lengths from 2 to 6, and validated on lengths 6 to 15. (Bottom) All angle error distributions plotted. Here, the LSTM was evaluated on the p→θp \to\theta mapping for circuit lengths 7 to 15 following training of lengths 2 to 6. The mean of each error distribution slightly deviates from 0 as the circuit length increases, but remains on the order of 10−210^{-2}.

The empirical results demonstrate the following: first, the LSTM has implicitly captured the function dependence encoded in Eq. (8), as evidenced in the low final validation loss. Second, despite only being trained on mappings up to 6 lengths, the LSTM provides accurate predictions up to 15 lengths without any architectural change. This key result means that the rapid scale-up of HQC parameters for much larger generalized W states can be achieved by training a model on small-sized examples.

In summary, based on the training and validation loss plots and the angle error distribution plot, we conclude that the LSTM successfully learned and generalized the mapping p→θ\mathbf{p} \to\theta. This trained surrogate will provide the rotation angle parameters to be combined with an LLM-generated openQASM skeleton.

Scaling rotation angles for the standard W state

In this section, we describe the application of the LSTM towards generalizing the standard (uniform) W state. Here, the objective of the LSTM is different than that of the generalized W state, since there is no reference to the vector p\mathbf{p} but only to the rotation angle vector θ\theta. Now, the LSTM is tasked to extend an input rotation angle vector θ\theta corresponding to an nn-qubit state to a new rotation angle vector θ\theta for any state with m>nm>n qubits. Here, the jj-th element of θ\theta is:

[θ]j=sin⁡−1[1j+1](10)[\theta]_j = \sin^{-1}\left[\sqrt{\frac{1}{j+1}}\right] \tag*{(10)}

Next, we describe the procedure of curating the training and validation sets. The vector θ\theta was computed using 1,000 uniformly spaced values of jj over the interval [2,15][2,15]. Such a construction creates a continuous analog of θ\theta and artificially produces more training examples for the LSTM. The standard W state dataset was split into training (length of 2 to 6) and validation (length of 7 to 15). In order to present the LSTM with a fixed-length input, the training dataset was broken into overlapping windows of length 60. Identical to the learning of the generalized W state, a 2 layer, bidirectional LSTM with hidden size of 64 was employed to learn this rotation angle extension problem. The model loss function was computed using MSE, shown in Eq. (9). A full description of the model and training hyper parameters can be found in Appendix B.

Finally, we describe the performance of the trained LSTM. The evolution of the training and validation loss during training can be seen in Figure 3(right), with a final training and validation loss both on the order of 10−510^{-5}. The final losses indicate that the model has learned the analytical relationship shown in Eq. (10), and can extrapolate it to unseen circuit lengths. We conclude that training an LSTM on rotation angle vectors up to lengths of 6 suffices to generate correct angles for circuit lengths as large as 15. This result implies that a modestly sized training set can be leveraged to obtain HQC parameters for arbitrarily large standard W states.

Training and validation loss plots for LSTM and LLM models

Figure 3. (Left) Training and validation loss plot of LSTM model learning the single qubit rotation angles for the standard W state. The model is learning to extend a single qubit rotation angle vector θ\theta. The model was trained on circuit lengths from 2 to 6, and validated on lengths of 6 to 15. (Right) Training and validation loss plot of fine-tuning the LLM towards outputting the skeleton of an openQASM script representation of a holographic quantum circuit.

In summary, we conclude that the LSTM has successfully learned to extend the rotation angle vector θ\theta of a standard W state from a small system to a much larger-sized system.

OpenQASM script generation

In this section, we describe the application of a pre-trained Large Language Model towards generating skeletons of openQASM representations of holographic quantum circuits. By skeleton, we refer to an openQASM script that contains the type, position, and ordering of all quantum gates (single-qubit gates or two-qubit gates), but leaves all the rotation parameters blank. The rotation parameters will be supplemented by the previously discussed LSTM model. The hyperparameters of the model and the training procedure can be found in Appendix B.

The base model was "Llama-3.1-70B-Instruct", obtained from Hugging Face’s public repository. Prior to fine-tuning, the model was quantized using the BitsAndBytes library (4-bit, NF4 format) to reduce the memory consumption of our Graphics Processing Unit (GPU). Parameter-Efficient Fine-Tuning (PEFT) was then employed, in particular Low-Rank Adaptation (LoRA) [23], which significantly limits the number of trainable parameters while maintaining performance comparable to regular fine-tuning.

The training set consisted of openQASM scripts for W-state HQCs (see Sec. 2) of length 2 to 10. The validation scripts covered HQCs for lengths 11 to 15, ensuring that the model can extrapolate to larger systems. All scripts were tokenized with the in-house tokenization format provided by Llama-3.1. The loss function chosen was Cross Entropy, which is the negative log-likelihood of the true next-token distribution under the model’s next token prediction, calculated as:

L=−∑t=1Llog⁡pζ(yt∣y<t)(11)\mathcal{L} = -\sum_{t=1}^{L}\log p_{\zeta}(y_t|y_{<t}) \tag*{(11)}

Here, yty_t is the token at position tt in the target sequence and pζ(yt∣y<t)p_{\zeta}(y_t|y_{<t}) is the soft-max probability produced by the model (with parameters ζ\zeta).

During training, the model was allowed to use Chain-of-Thought (CoT) reasoning before producing the final skeleton. Here, the model was trained on an NVIDIA H100 GPU. The top panel of Figure 3(left) shows the evolution of the training and validation loss, with both final values on the order of ∼10−1\sim10^{-1}. An example length-11 skeleton displayed by the model is displayed in the bottom panel of Fig. C. In this example, the identifiers "physical" and "ancilla" represent the physical qubit and the ancilla qubit, respectively. Moreover, the act of measuring the physical qubit into a specific classical register is deliberately omitted to keep the LLM focused on pure syntactic generation and added in post-processing.

The final training and validation losses are both on the order of 10−110^{-1}, indicating that the LLM has learned and generalized the syntax of such openQASM scripts with low error. Moreover, the LLM respects the syntax of openQASM scripts, such as qubit ordering for CNOT gates and measuring and resetting the physical qubit. Therefore, we conclude that the fine-tuned, LoRa-adapted Llama-3.1-70B-Instruct has successfully learned and generalized the skeleton representation of HQCs.

Evaluation

In this section, we detail the end-to-end HQC scale up procedure using our hybrid machine learning model. Here, to generate HQCs for a system of m>nm > n qubits given training data up to nn qubits, we combine the outputs of a single qubit rotation angle predictor (LSTM) with the openQASM circuit-skeleton generator (LLM). The complete workflow is illustrated in Figure 1 and is as follows.

First, the user will gather either a probability vector p∈Rm\mathbf{p} \in\mathbb{R}^{m} or a single qubit rotation angle vector for the first nn qubits θ∈Rn\boldsymbol{\theta} \in\mathbb{R}^{n}. Second, the user will input their vector (p\mathbf{p} or θ\boldsymbol{\theta}) into the LSTM, and receive an output of rotation angles θ∈Rm\boldsymbol{\theta} \in\mathbb{R}^{m}. Third, the LLM will receive a prompt encoding the system size of mm qubits, and will output a skeleton of an openQASM script of mm qubits. Fourth, the empty rotation angles in the skeleton are replaced with the values in the newly predicted rotation angle vector θ∈Rm\boldsymbol{\theta} \in\mathbb{R}^{m}. After substitution, the script is passed through a post-processor that adds in the measurement of physical qubit values into their respective classical registers. Finally, the resulting openQASM file is loaded into Qiskit [24] and executed on the Aer Simulator to obtain a shot distribution.

We assessed the fidelity of the end-to-end pipeline with an example generalized W state with length 11. Here, p\mathbf{p} is (0.146,0.024,0.009,0.104,0.137,0.075,0.018,0.147,0.093,0.0945,0.153)(0.146, 0.024, 0.009, 0.104, 0.137, 0.075, 0.018, 0.147, 0.093, 0.0945, 0.153). The shot distribution of the generated versus analytical openQASM scripts is shown in Figure 4, with 10510^{5} shots. The total-variation (TV) distance between the two distributions, defined as TV=12∑x∈X∣P(x)−Q(x)∣\mathrm{TV} = \frac{1}{2} \sum_{x \in X} \lvert P(x) - Q(x) \rvert where XX is the sample space, PP is the predicted distribution, and QQ is the true distribution, was 1.3×10−21.3 \times10^{-2}. The non-zero TV value which can be attributed to statistical fluctuations of the chosen shot count. In general, the generated distribution matches the analytical one well, confirming that the hybrid LSTM and LLM architecture has successfully learned both the global structure of the W state and the local rotation parameters required for its preparation.

Bar chart comparing real and generated circuit shot distributions

Figure 4. Comparison plot of the length-11 relative probability distributions (with 10510^{5} shots) of the analytical (blue) generalized W state and the generated (orange) generalized W state produced by combining LSTM generated angles and LLM generated qasm script. Here, the p\mathbf{p} vector is (0.146,0.024,0.009,0.104,0.137,0.075,0.018,0.147,0.093,0.0945,0.153)(0.146, 0.024, 0.009, 0.104, 0.137, 0.075, 0.018, 0.147, 0.093, 0.0945, 0.153). We observe excellent agreement between these two distributions. The total-variation (TV) distance between the distributions is 1.3×10−21.3 \times10^{-2}, which can be attributed to finite shot count.

Conclusion and Outlook

In this paper, we proposed a hybrid machine learning framework composed of a Long Short-Term Memory (LSTM) model and a fine-tuned Large Language Model (LLM) used for scaling up holographic quantum circuits (HQCs). Here, each HQC is decomposed into two facets: (1) parameters (e.g., single qubit rotation angles) and (2) syntax (e.g., placement, type, and number of gates). The LSTM model is employed to learn and generalize the parameters, and a fine-tuned pre-trained LLM is trained to learn and generalize the syntax. A high-level overview of our workflow is shown in Figure 1. The final openQASM script is obtained by combining the individual outputs of the LSTM and LLM. The LLM chosen for this task was the Llama-3.1-70B-Instruct model. We benchmarked this hybrid ML architecture on learning and scaling up HQC representations of a family of generalized W states. Here, the LSTM model successfully scaled up rotation-angle patterns from circuits of size 6 to circuits of length 15, while the LoRA-adapted LLM extrapolated the gate-level syntax from length 10 to 15. For an example generalized W state for length 11, the generated shot distribution (with 10510^{5} shots) differed from the exact distribution by a total-variation (TV) distance of 1.3×10−21.3 \times10^{-2}. Such an error can be explained by the shot noise from a finite number of samples. Consequently, the hybrid architecture can scale the full HQC (with respect to both the parameters and syntax) to system sizes that exceed the training regime by more than a factor of two.

Our results provide a proof of principle that a hybrid architecture of syntax generation and parameter extrapolation can produce scaled HQCs in the simple but non-trivial setting of the generalized W state. Looking forwards, future research will address the utilization of such architectures to scale more complex HQCs, such as those representing correlated ground states of quantum spin chains, towards the region where HQCs display a scaling advantage over classical tensor networks. This will involve more complex syntax to be learned as the number of ancilla qubits are increased, as well as the development of techniques to "gauge fix" the ancilla degrees of freedom for different quantum states so that they can be learned consistently in a unified model.

Acknowledgements

This work was supported by the Office of Naval Research under Contract No. N00024-22-D-6404. We would like to thank Matt Abernathy and William Daniels for helpful discussions.

Derivation of the holographic compilation of the generalized W state

In this appendix section, we construct analytic construction of holographic algorithms for its construction on two qubits. Namely, the generalized W state on nn qubits is defined as

∣W(p)⟩=∑i=1npi∣00…1i…00⟩(12)|W(\mathbf{p})\rangle= \sum_{i=1}^{n} \sqrt{p_i}|00\ldots1_i\ldots00\rangle \tag*{(12)}

in which p\mathbf{p} is a vector of positive real numbers whose elements sum to 1. This state can be interpreted as an amplitude encoding of a probability distribution over one-hot vectors, which is to say that a measurement of ∣W(p)⟩|W(\mathbf{p})\rangle in the computational basis will result in the qubit ii being in state 1 and all other qubits being zero with probability pip_i. The standard W state amounts to taking p=1/n\mathbf{p}=1/n, which is an equal weight superposition of one-hot vectors. We note that our construction below can also be straightforwardly generalized to include an arbitrary phase factor on each one-hot state, but this is inessential for our purposes and so we don’t detail the construction here.

The generation of the generalized W state via a holographic algorithm follows from its representation as an MPS with bond dimension 2, the procedure to prepare an MPS sequentially, and an explicit embedding of the sequential preparation isometries into unitary operations [25]. To wit, the MPS representation of the generalized W state is

∣W(p)⟩=∑i1…in(1  0)A[1]i1…A[n]in(01)∣i1…in⟩(13)|W(\mathbf{p})\rangle= \sum_{i_1\ldots i_n} (1\ \ 0) A^{[1]i_1}\ldots A^{[n]i_n} \begin{pmatrix}0\\1\end{pmatrix}|i_1\ldots i_n\rangle \tag*{(13)}

in which

A[j]ij=(δij,0pjδij,10δij,0).(14)A^{[j]i_j} = \begin{pmatrix} \delta_{i_j,0} & \sqrt{p_j}\delta_{i_j,1} \\ 0 & \delta_{i_j,0} \end{pmatrix}. \tag*{(14)}

Using the gauge freedom of MPSs, this can be expressed in left-canonical form [7] as

∣W(p)⟩=∑i1…in(1  0)L[1]i1…L[n]in(01)∣i1…in⟩(15)|W(\mathbf{p})\rangle= \sum_{i_1\ldots i_n} (1\ \ 0) L^{[1]i_1}\ldots L^{[n]i_n} \begin{pmatrix}0\\1\end{pmatrix}|i_1\ldots i_n\rangle \tag*{(15)}

where

L[j]ij=(δij,0sin⁡θjδij,10cos⁡θjδij,0),(16)L^{[j]i_j} = \begin{pmatrix} \delta_{i_j,0} & \sin\theta_j\delta_{i_j,1} \\ 0 & \cos\theta_j\delta_{i_j,0} \end{pmatrix}, \tag*{(16)}
sin⁡θj=pj∑i≤jpi,cos⁡θj=∑i<jpi∑i≤jpi.(17)\sin\theta_j = \sqrt{\frac{p_j}{\sum_{i\leq j}p_i}},\qquad\cos\theta_j = \sqrt{\frac{\sum_{i<j}p_i}{\sum_{i\leq j}p_i}}. \tag*{(17)}

Note that each of the tensors L[j]L^{[j]} satisfies the left-canonical constraint ∑αiLαβ[j]iLαβ′[j]i=δββ′\sum_{\alpha_i}L^{[j]i}_{\alpha\beta}L^{[j]i}_{\alpha\beta'}=\delta_{\beta\beta'}, which means that they can be considered as left-isometries when reshaped as 4×24\times2 matrices. This further implies that they can be embedded into unitary operations U^L[j]\hat{U}^{[j]}_L as

Lαβ[j]i=⟨iα∣U^L[j]∣0β⟩,(18)L^{[j]i}_{\alpha\beta}=\langle i\alpha|\hat{U}^{[j]}_L|0\beta\rangle, \tag*{(18)}

in which ∣iα⟩|i\alpha\rangle denotes a state in the Hilbert space of a physical qubit (index ii) and an ancilla (i.e., bond) qubit (index α\alpha). Using these unitaries, the state can be constructed as

(U^L[1]∣01⟩…(U^L[n−1]∣0n−1⟩(U^L[n]∣0n0⟩)…))=∣W(p)⟩∣0⟩.(19)\left(\hat{U}^{[1]}_L|0_1\rangle\ldots\left(\hat{U}^{[n-1]}_L|0_{n-1}\rangle\left(\hat{U}^{[n]}_L|0_n0\rangle\right)\ldots\right)\right)=|W(\mathbf{p})\rangle|0\rangle. \tag*{(19)}

This should be read as a sequential preparation scheme in which each unitary U^L[j]\hat{U}^{[j]}_L is applied to a physical qubit ∣ij⟩|i_j\rangle in

the zero state and the current state of the ancilla register. At the end of these applications, the physical register holds the generalized W state and the ancilla qubit decouples, as in Eq. (19). Because of the sequential nature, we can also generate samples from ∣W(p)⟩|W(p)\rangle using only a single physical qubit and a single ancilla qubit by measuring and resetting the physical qubit after application of each U^[j]\hat{U}^{[j]}, i.e., as a holographic quantum circuit. It can be readily verified that the isometries Eq. (16) can be embedded into unitaries given by the gate sequences in Figure 5 for UjU_j and Figure 6 for UnU_n [25].

Circuit decomposition of $U_j$ for $j<n$ when preparing the generalized W state

Figure 5. Circuit decomposition of UjU_j for j<nj<n when preparing the generalized W state. The top line is the physical qubit and the bottom line is the ancilla qubit.

Circuit decomposition of $U_n$ when preparing the generalized W state

Figure 6. Circuit decomposition of UnU_n when preparing the generalized W state. The top line is the physical qubit and the bottom line is the ancilla qubit.

This representation is not the shortest possible; since the state is real-valued and this sequential circuit is comprised of two-qubit operations, each of the unitary operations U^[j]\hat{U}^{[j]} is in fact an element of the special orthogonal Group in four dimensions (also called SO(4)\mathrm{SO}(4)) and so can be represented with two Controlled-NOTs (CNOT), six fixed single-qubit rotations, and two parameterized special unitary of dimension two (also called SU(2)\mathrm{SU}(2)) gates [26]. However, the gates in Figure 5 and Figure 6 make explicit the relationship between the parameter pp and the quantum circuit, and so we use it for our analysis. Finally, as mentioned earlier, the W state is interesting among MPS representations in that the state itself is translationally invariant, but its minimal bond dimension representation is not [21]. This is ideal for our purposes, as it provides a non-trivial but still tractable learning problem for length generalization of holographic quantum circuits.

Hyperparameters

HyperparameterValue
Learning rate10−310^{-3}
Batch size128
Number of epochs200
OptimizerAdam
Weight decay0
Dropout rate0.0
Hidden layer size64
Number of layers2
Activation functionTanh

Table 1. Model Hyperparameters for generalized W state

HyperparameterValue
Learning rate10−310^{-3}
Batch size64
Number of epochs20
OptimizerAdam
Weight decay0
Dropout rate0.0
Hidden layer size64
Number of layers2
Activation functionTanh

Table 2. Model Hyperparameters for standard W state

HyperparameterValue
Base modelMeta-Llama-3.1-70B-Instruct
Quantization4-bit NF4 (double quantization)
Fine-tuning methodQLoRA (PEFT)
LoRA rank (rr)8
LoRA alpha (α\alpha)32
LoRA dropout0.05
LoRA target modulesq_proj, k_proj, v_proj, up_proj, down_proj
Learning rate10−410^{-4}
OptimizerPaged AdamW (8-bit)
Per-device batch size1
Warmup steps4
Max steps30
Max sequence length1024

Table 3. Model Hyperparameters for fine-tuning

Example generated OpenQASM script

OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
creg c[11];
// BEGIN FIRST SITE
ry() physical;
x physical;
cx physical, ancilla;
x physical;
measure physical;
reset physical;
// END FIRST SITE
// BEGIN SITE (REPEATED 10 TIMES)
cx physical, ancilla;
ry() physical;
cx physical, ancilla;
rz() physical;
rz() ancilla;
cx physical, ancilla;
ry() physical;
cx physical, ancilla;
rz() physical;
rz() ancilla;
measure physical;
reset physical;
// END SITE
Example output from the fine-tuned LLM for an openQASM script

Figure 7. Example output from the fine-tuned LLM for an openQASM script corresponding to a W state of length 11. The intermediate site preparation and measurement is repeated 10 times. The rotation angles are intentionally left blank to ensure that the LLM deals only with natural language and not with numerical values.

References

  1. [1]L. K. Grover, “Quantum mechanics helps in searching for a needle in a haystack,” Phys. Rev. Lett., vol. 79, pp. 325–328, 2 Jul. 1997.DOI
  2. [2]C. H. Bennett and G. Brassard, “Quantum cryptography: Public key distribution and coin tossing,” Theoretical Computer Science, vol. 560, pp. 7–11, 2014.DOI
  3. [3]B. Fauseweh, “Quantum many-body simulations on digital quantum computers: State-of-the-art and future challenges,” Nature Communications, vol. 15, no. 1, p. 2123, Mar. 2024.DOI
  4. [4]D. Lall et al., A review and collection of metrics and benchmarks for quantum computers: Definitions, methodologies and software, 2025. arXiv: 2502. 06717 [quant-ph].arxiv.org/abs/2502.06717
  5. [5]G. Q. A. Collaborators, “Quantum error correction below the surface code threshold,” Nature, vol. 638, no. 8052, pp. 920–926, Dec. 2024.DOI
  6. [6]J. Preskill, “Quantum Computing in the NISQ era and beyond,” Quantum, vol. 2, p. 79, Aug. 2018.DOI
  7. [7]“The density–matrix renormalization group in the age of matrix product states,” Annals of Physics, vol. 326, no. 1, pp. 96–192, 2011, January 2011 Special Issue, ISSN: 0003-4916. DOI: https://doi.org/10.1016/j.aop.2010.09.012
  8. [8]M. Foss-Feig et al., “Holographic quantum algorithms for simulating correlated spin systems,” Phys. Rev. Res., vol. 3, p. 033002, 3 Jul. 2021. DOI: 10.1103/PhysRevResearch.3.033002 [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevResearch.3.033002
  9. [9]M. L. Wall, P. Titum, G. Quiroz, M. Foss-Feig, and K. R. A. Hazzard, “Tensor-network discriminator architecture for classification of quantum data on quantum computers,” Phys. Rev. A, vol. 105, p. 062439, 6 Jun. 2022. DOI: 10.1103/PhysRevA.105.062439 [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevA.105.062439DOI
  10. [10]C. Schön, K. Hammerer, M. M. Wolf, J. I. Cirac, and E. Solano, “Sequential generation of matrix-product states in cavity qed,” Phys. Rev. A, vol. 75, p. 032 311, 3 Mar. 2007.
  11. [11]X. Zhu and X. Hou, “Quantum architecture search via truly proximal policy optimization,” Scientific Reports, vol. 13, no. 1, p. 5157, Mar. 2023.DOI
  12. [12]M. Paris and E. Prati, “Quantum compiling by deep reinforcement learning,” Archivio Istituzionale della Ricerca (Universita Degli Studi Di Milano), Jan. 2021.DOI
  13. [13]S. Daimon and Y.-I. Matsushita, “Quantum circuit generation for amplitude encoding using a transformer decoder,” Physical Review Applied, vol. 22, no. 4, Oct. 2024.DOI
  14. [14]S. Hochreiter and J. Schmidhuber, “Long Short-Term memory,” Neural Computation, vol. 9, no. 8, pp. 1735–1780, Nov. 1997.
  15. [15]J. Wei et al., Chain-of-thought prompting elicits reasoning in large language models, 2023. arXiv: 2201.11903 [cs.CL].arxiv.org/abs/2201.11903
  16. [16]A. W. Cross, L. S. Bishop, J. A. Smolin, and J. M. Gambetta, “Open quantum assembly language,” arXiv preprint arXiv:1707.03429, 2017.arxiv.org/abs/1707.03429
  17. [17]A. Vaswani et al., Attention is all you need, Jun. 2017.arxiv.org/abs/1706.03762
  18. [18]M. Zhao, Y. Du, and M. Wang, Large language models are bad dice players: Llms struggle to generate random numbers from statistical distributions, 2026. arXiv: 2601.05414 [cs.CL].DOI
  19. [19]H. Li et al., Exposing numeracy gaps: A benchmark to evaluate fundamental numerical abilities in large language models, 2025. arXiv: 2502.11075 [cs.CL].arxiv.org/abs/2502.11075
  20. [20]I. Mirzadeh, K. Alizadeh, H. Shahrokhi, O. Tuzel, S. Bengio, and M. Farajtabar, Gsm-symbolic: Understanding the limitations of mathematical reasoning in large language models, 2025. arXiv: 2410.05229 [cs.LG]. [Online]. Available: https://arxiv.org/abs/2410.05229
  21. [21]D. Perez-Garcia, F. Verstraete, M. M. Wolf, and J. I. Cirac, Matrix product state representations, 2007. arXiv: quant-ph/0608197 [quant-ph]. [Online]. Available: https://arxiv.org/abs/quant-ph/0608197
  22. [22]L. G. B. Johnsen, Grammaticality Judgments in Humans and Language Models: Revisiting Generative Grammar with LLMs, 2025. arXiv: 2512.10453 [cs.CL]. [Online]. Available: https://arxiv.org/abs/2512.10453
  23. [23]E. J. Hu et al., Lora: Low-rank adaptation of large language models, 2021. arXiv: 2106.09685 [cs.CL].arxiv.org/abs/2106.09685
  24. [24]A. Javadi-Abhari et al., Quantum computing with qiskit, 2024. arXiv: 2405.08810 [quant-ph]. [Online]. Available: https://arxiv.org/abs/2405.08810
  25. [25]M. L. Wall, M. R. Abernathy, and G. Quiroz, “Generative machine learning with tensor networks: Benchmarks on near-term quantum computers,” Phys. Rev. Res., vol. 3, p. 023010, 2 Apr. 2021. DOI: 10.1103/PhysRevResearch.3.023010 [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevResearch.3.023010DOI
  26. [26]F. Vatan and C. Williams, “Optimal quantum circuits for general two-qubit gates,” Phys. Rev. A, vol. 69, p. 032315, 3 Mar. 2004. DOI: 10.1103/PhysRevA.69.032315 [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevA.69.032315DOI

AI tools statement

No AI-use declaration is available for this version in Valency.

The available record does not establish whether AI systems or models contributed to this work.

How AI tools are recorded

Paper details

Cite this paper

Publication

Published
Version
Latest

Data & code

No code, data or supplementary files were declared for this version.

Pick where to look, or just type