Manuscript Offprint
arXiv:2610.34492Wave Is All You Need: A Quantum Language Model Based on Fully Connected Quantum Boltzmann Machine
Liu Jun
School of Economics, Hunan University of Finance and Economics, Changsha 410205, China
To address the limitations of the classical self-attention mechanism, this work proposes a self-attention mechanism based on the fully connected quantum Boltzmann machine (FC-QBM), and further constructs a fully connected quantum Boltzmann machine language model (FC-QBM-LM) using the mechanism as the core engine. By performing unitary evolution on semantic quantum states, the mechanism implicitly implements positional encoding and self-attention computation, eliminating the need to decompose continuous semantic streams into discrete matrices for explicit matrix multiplication, with the measurement results naturally satisfying the normalization condition. Specifically, this work rigorously derives the computational principle of the self-attention mechanism based on FC-QBM. It demonstrates that this mechanism, in which FC-QBM encodes token positions and interactions and gates perform differentiated information extraction, is mathematically equivalent to the classical self-attention mechanism. The mathematical principles governing the training and generation of FC-QBM-LM are thoroughly derived, and the two corresponding algorithms are subsequently developed. An 8-qubit FC-QBM-LM is finally constructed and trained on the corpus of Three Hundred Tang Poems, followed by computational experiments using the model. Under the 8-qubit setting, the quantum layer implements the entire positional encoding and self-attention computation pipeline with only 44 parameters. In the noiseless scenario, the model exhibits favorable convergence. Furthermore, the quantum circuit proposed in this work, which terminates with gates, achieves better convergence than the counterpart terminating with gates. Under the small-sample regime and across eight distinct noise intensity levels, the model demonstrates strong noise robustness, retaining over 99% of its noiseless convergence performance. Experiments on five-character quatrain generation reveal that the model preliminarily exhibits three core capabilities: associative and divergent thinking, content generation across imagery and human-aligned word ordering, validating the effectiveness of the proposed self-attention mechanism based on FC-QBM.
Keywords: Fully Connected Quantum Boltzmann Machine; Quantum Machine Learning; Quantum Self-Attention Mechanism; Quantum Language Model; Three Hundred Tang Poems; Noise Robustness; Energy-Based Generative Model; Natural Language Processing
I. INTRODUCTION
The evolution of language models is essentially a process of continuous advancement in semantic modeling capabilities. Early rule-based language models relied on manually constructed formal grammars and dictionaries[1]. Constrained by scalability bottlenecks, they struggled to characterize the complex properties of real-world language. In the 1990s, statistical language models exemplified by n-gram and hidden Markov models (HMMs) enabled probabilistic prediction of word sequences using large-scale corpora and greatly improved the performance of tasks such as machine translation[2]. Nevertheless, they were plagued by the curse of dimensionality. At the beginning of the 21st century, neural network language models pioneered vector representations. Bengio et al. (2003) first mapped words into a low-dimensional continuous vector space[3]. Recurrent neural networks (RNNs) and long short-term memory networks (LSTMs) captured long-range dependencies through gating mechanisms[4]. However, sequential computation hindered parallel processing, and long-term memory decay also limited model scaling. In 2017, the transformer architecture adopted the self-attention mechanism to implement parallel modeling of global sequence dependencies[5], thoroughly breaking the performance bottleneck of recurrent architectures and directly promoting the explosive development of large language models (LLMs).
However, the classical self-attention mechanism suffers from two fundamental limitations. First, within the conventional framework, the computation of semantic interactions between tokens can only be realized through large-scale matrix operations. Such matrix computation based on discrete token sets inherently undermines the continuity and integrity of semantic representations. A study indicates that the underlying semantics of natural language
essentially lie on a continuous manifold, and discretization leads to the loss of manifold smoothness[6]. Second, the implementation approach of the classical self-attention mechanism, which relies on massive matrix operations, further introduces substantial computational overhead. The mechanism requires repeated execution of numerous matrix multiplications, and its time and space complexity grows quadratically with the sequence length. Notably, even approximate computation, as a common strategy to reduce such quadratic overhead, faces theoretical constraints. Under the strong exponential time hypothesis, it is impossible to construct subquadratic approximate self-attention algorithms with rigorous error guarantees[7]. Given the current technical conditions, training and inference typically rely on large-scale or even ultra-large-scale GPU clusters, resulting in prohibitive computational resource consumption.
To address the aforementioned limitations of the classical self-attention mechanism, continuous semantic modeling has emerged as an important breakthrough direction. Diffusion-LM pioneered research on diffusion language modeling in the embedding space[8], while Dillermer proposed an improved scheme addressing critical drawbacks such as training instability exhibited by Diffusion-LM[9]. Hu et al. (2026) proposed embedded language flows (ELF), which constructs diffusion language models within the continuous embedding space and maps continuous vectors to discrete tokens only at the final generation step. This design preserves the continuity of semantic representations and enables direct transfer of well-established diffusion techniques from the vision domain, achieving substantial improvements in generation quality and sampling efficiency over discrete diffusion language models[10]. While these attempts mitigate the loss of semantic continuity induced by matrix operations based on discrete token sets, they remain largely rooted in the transformer architecture and fail to substantially address the computational complexity bottleneck.
Quantum computing, leveraging superposition and entanglement, opens up a new avenue for performance breakthroughs in language models. Research on quantum language models has grown rapidly in recent years, yet most mainstream works remain limited to peripheral enhancement and partial substitution within the classical transformer framework. A survey has systematically summarized the acceleration potential of quantum computing in the training, inference and optimization of machine learning models[11]. Hybrid quantum transformers represented by HyQuT integrate variational quantum circuits into the transformer framework to achieve local parameter compression[12]. Nevertheless, their self-attention computation still follows classical schemes and does not redefine the matrix operation logic for token interactions. Another review in quantum natural language processing also notes that most existing quantum language models fail to innovate upon the underlying computational framework of classical LLMs[13]. Overall, existing quantum language models mostly leverage quantum computing to assist and augment the original classical processing pipeline, leaving the core architecture and computational logic of the self-attention mechanism fundamentally unaltered, thus rendering it infeasible to resolve the two inherent limitations of classical self-attention at their root.
By contrast, in the fields of probabilistic graphical models and energy-based learning (EBL), Boltzmann machines (BMs) offer an alternative route for global dependency modeling distinct from matrix dot-product operations. The foundational work on BMs originates from Hinton and colleagues[14, 15]. The original fully connected Boltzmann machine (FC-BM) proposed in 1985 can theoretically fit any finite discrete joint distribution via bidirectional coupling among units[15]. Nevertheless, computing the partition function and performing Gibbs sampling incur overheads scaling exponentially with the number of units, making FC-BMs impractical for deployment on classical computing hardware. To mitigate this bottleneck, Smolensky (1986) proposed the restricted Boltzmann machine (RBM) by introducing a bipartite graph topology without intra-layer connections, substantially reducing the model's computational complexity[16]. Building upon this, Hinton et al. (2006) constructed deep belief networks (DBNs) by stacking RBMs layer-wise, fueling the resurgence of deep learning[17]. However, while simplifying the structure to enable feasible training, RBMs abandon the inherent pairwise coupling among units in fully connected architectures and partially lose the capacity to directly characterize high-order variable correlations. Recently, Kim and Park (2026) proposed Boltzmann attention, which introduces learnable Ising couplings into the transformer framework[18]. They conducted experiments with exact Boltzmann computation on small-scale tasks, yet the exponential cost still prevents scaling toward large sequences. It follows that although FC-BMs possess prominent theoretical potential for interaction modeling, they have long been constrained by the inherent limitations of classical computing.
Quantum Boltzmann machines (QBMs) offer a viable route to tackle the aforementioned dilemma. Wiebe et al. (2014) demonstrated that quantum approaches can not only accelerate the training of deep RBMs but also enable efficient training of multi-layer FC-BMs[19].
Benedetti et al. (2017) further illustrated the feasibility of embedding probabilistic graphical models into quantum-assisted learning hardware[20]. Amin et al. (2018) replaced classical binary units with qubits and leveraged quantum annealing to achieve efficient sampling from the Boltzmann distribution[21]. They also explored the possibility of verifying the model's generative modeling capability on quantum annealing hardware. Liu (2026) proposed a bilevel optimization training scheme based on the quantum approximate optimization algorithm (QAOA)[22]. Breaking the constraint of the fixed target Hamiltonian in standard QAOA, the scheme simulates the contrastive divergence learning through inner-loop and outer-loop computational procedures, enabling the training of fully connected quantum Boltzmann machines (FC-QBMs) using only a single layer of QAOA while delivering favorable noise robustness in noisy simulation settings. These studies indicate that quantum computing holds the potential to resolve the training bottleneck of FC-BMs. Nevertheless, to date, no work has deeply integrated FC-QBMs with the self-attention mechanism to reconstruct the computational architecture of attention.
Based on the above discussions, this paper attempts to reconstruct the classical self-attention mechanism at the fundamental level to overcome its inherent limitations. Specifically, a novel self-attention mechanism based on FC-QBM is designed, and a quantum language model is further constructed using the proposed mechanism as its core engine. The organization of this paper is as follows. First, on the basis of a brief review of the classical self-attention mechanism, the computational principle of the FC-QBM self-attention mechanism is derived, and its functional equivalence to the classical counterpart is mathematically proven. Second, the construction and implementation processes of the quantum language model based on FC-QBM are elaborated; the mathematical principles underlying model training and text generation are derived; and the corresponding algorithms are developed. Third, a fully connected quantum Boltzmann machine language model (FC-QBM-LM) with eight qubits is constructed based on the proposed algorithms. Finally, the model is trained on the corpus of Three Hundred Tang Poems via the PennyLane quantum simulation platform and the PyTorch machine learning framework, followed by a comprehensive evaluation of its three core properties: convergence performance, noise robustness and five-character quatrain generation capability.
A. Review of Classical Self-Attention Mechanism
The self-attention mechanism serves as the core module for transformer-based language models to perform contextual semantic modeling. It endows the model with the ability to capture long-range textual dependencies and perceive word order, imagery and grammatical correlations, enabling the model to understand and generate natural language. Based on the classical transformer architecture proposed by Vaswani et al. (2017), this paper first briefly reviews the basic principle and computational procedures of the self-attention mechanism[5]. Define a token sequence of length , where each token is denoted as ( ). Let denote the embedding matrix, where is the total vocabulary size and denotes the dimension of embeddings. Each row of is a -dimensional vector, denoted as . Scaling by the factor produces the embedding vector of token :
Stacking the embedding vectors of all tokens row by row yields the embedding matrix for the entire token sequence:
The positional encoding is subsequently applied, with the specific rule from the original paper as follows:
where pos denotes the position of the token in the sequence, taking values of ; i denotes the dimension index of embeddings, taking values of . The sequence’s positional encoding matrix is thereby obtained. Adding the embedding matrix of the token sequence and the positional encoding matrix yields the input matrix of embeddings with positional information:
Let be the -th row vector of , i.e., the -dimensional vector characterizing the comprehensive information of a single token. The three row vectors , and can be obtained via the following operations:
where , and are trainable projection weight matrices. Stacking the computed results of all row vectors in row by row yields the corresponding matrices Q, K and V:
The raw attention score matrix is thereby computed as follows:
The element in matrix S denotes the raw dot product of the l-th row vector in Q and the m-th row vector in K, characterizing their similarity:
When is large, the variance of dot-product results increases significantly, which may lead to vanishing gradients in subsequent computations. For this reason, the original paper further divides the raw attention score matrix by the scaling factor to obtain the scaled attention score matrix , whose element is :
On this basis, softmax normalization is computed row by row for the scaled attention score matrix , yielding the attention weight matrix , whose element is :
Finally, the attention weight matrix is multiplied by the matrix V to obtain the scaled dot-product attention output matrix Z that encodes the contextual interaction information between token embeddings, with row vector :
From the above computations, the formula for scaled dot-product attention proposed in the original paper can be derived:
Based on the foregoing review, the computational logic and core steps of the classical self-attention mechanism can be summarized. First, the range of the token sequence for analysis and computation is defined. All tokens within this range are mapped to corresponding token embeddings, and positional encoding information is incorporated to yield the input matrix . It should be noted that the token embeddings at this stage are completely independent of each other, so has not yet encoded the interaction information between tokens. Next, matrices Q, K and V are computed, and scaled dot-product operations are performed on Q and K to obtain the raw attention score matrix S, whose elements correspond to the raw scores for any pair of token embeddings. Subsequently, scaling and softmax normalization are applied to S to yield the attention distribution of any token embedding over all token embeddings in the sequence (including itself), namely the attention weight matrix . Finally, is multiplied by matrix V to yield the scaled dot-product attention output Z, which incorporates positional information and encodes pairwise interactions among tokens.
The above computational logic indicates that the self-attention mechanism can essentially be regarded as a black box for encoding the degree of interactions between tokens in a sequence, as illustrated in Figure 1. It leverages matrix operations to process raw non-contextual token embeddings augmented with positional encoding. By modeling pairwise interactions among all tokens, including self-interactions, it transforms these static embeddings into contextualized representations that capture global context. Specifically, each output embedding is obtained as a weighted sum over all input embeddings in the sequence via softmax-normalized attention weights. From a functionalist perspective, this implies that if another similar mechanism can realize self-attention encoding of token interactions, it can replace the classical self-attention mechanism and serve as the core engine for natural language processing.

Non-contextual token embeddings augmented with positional encoding
Contextual token embeddings augmented with positional encoding
Figure 1: Self-Attention Mechanism Black Box
However, the architecture of the classical self-attention mechanism has two inherent drawbacks that are difficult to mitigate. First, discrete matrix computations lead to the loss of continuous semantic features. In reality, natural language is a semantic information flow that evolves continuously over time. For engineering considerations, the classical self-attention mechanism truncates this semantic flow into discrete matrix forms and computes attention scores via explicit matrix operations, breaking the inherent continuous semantic structure of language. Although tokenization is an indispensable preprocessing step for text modeling, this computational scheme erodes semantic integrity and inevitably sacrifices the implicit continuity that enables smooth transitions during the sequential evolution of meaning, thereby disrupting the native semantic context of text. The model can only reconstruct global semantics through explicit weight matching between discrete features. Second, numer-ous complex matrix operations incur substantial computational overhead. The mechanism relies on multiple matrix multiplications to perform feature projection and global correlation modeling, consuming considerable computational and storage resources, with both time and space complexity of . As the token sequence length n increases, the computational complexity grows sharply on the order of . Even if a sliding window strategy is introduced to constrain the interaction range and reduce computational scale, the model still needs to explicitly compute attention scores for all token combinations within each window, resulting in high computational overhead.
To address the above two drawbacks of the classical self-attention mechanism, this work replaces the mechanism with an FC-QBM architecture and constructs a quantum language model on this basis. It will be subsequently demonstrated that FC-QBM can fully encode token positions and interactions. Functionally equivalent to the classical self-attention mechanism, this architecture is expected to reduce resource consumption by leveraging the parallelism and entanglement properties of quantum computing, thus enabling it to act as a core engine for natural language processing tasks.
Most notably, unlike the classical self-attention mechanism that explicitly decomposes continuous semantic flows into discrete matrices to compute attention scores, FC-QBM can implicitly encode positional information and capture pairwise interactions entirely through the unitary evolution of semantic quantum states. This approach not only circumvents the disruption to the continuous semantic structure of natural language caused by the discretized modeling of classical self-attention, but also maximally preserves the implicit continuous information that exhibits smooth transitions during the sequential evolution of semantics. In addition, it fundamentally reduces the computational overhead introduced by extensive redundant computations. Moreover, the probability distribution yielded by quantum measurements naturally satisfies the normalization constraint, eliminating the need for the softmax operation and further reducing computational complexity.
B. Computational Principle of Self-Attention Mechanism Based on Fully Connected Quantum Boltzmann Machine
This work constructs a computational module for the self-attention mechanism based on FC-QBM. It should be emphasized that, although this section derives in detail the compu-tational principle of the self-attention mechanism built upon FC-QBM, it does not imply that explicit computation must be performed step by step strictly following the derivation process. In fact, the advantage of quantum computing is that once the corresponding quantum circuit is designed according to established rules, the system can spontaneously and implicitly yield the result via unitary evolution of the initial state. Let the real vector of the token sequence processed by quantum amplitude encoding be , where denotes the number of qubits in the quantum circuit. This vector is then encoded into the quantum circuit as the amplitudes of basis states to prepare the initial state :
For simplicity, Equation 13 adopts the shorthand notation for the binary string corresponding to the measurement outcomes of individual qubits, and denotes a basis vector from the space spanned by qubits. FC-QBM adapted to the quantum circuit is defined by Hamiltonian :
where denotes the bias of the -th unit, and denotes the connection weight between the -th unit and the -th unit, both of which are trainable parameters. denotes the Pauli-Z gate acting solely on the -th qubit, and denotes the tensor product of two Pauli-Z gates acting respectively on the -th qubit and the -th qubit:
(15)
where I denotes the identity gate. The Pauli-Z gate satisfies the following properties:
The classical FC-BM energy function EF corresponding to H is:
In Equation 17, and denote the values of the -th unit and the -th unit, respectively, with and . The corresponding probability distribution function P and partition function Z are given by:
(18)
Based on the properties of the Pauli-Z gate given in Equation 16, the result obtained by applying the Hamiltonian H to an arbitrary basis vector is:
(19)
The unitary evolution operator corresponding to H is :
Let . According to the properties of the Hamiltonian eigenvalue equation, applying the unitary evolution operator obtained from Equation 20 to the initial state results in the intermediate state :
At the end of the circuit, a Y-axis rotation gate is placed on each qubit, and the corresponding unitary evolution operator is:
Subsequently, projective measurements are performed on the measurement basis vector composed of qubits, where is the shorthand notation of the binary string . After applying to the basis vector used to expand the intermediate state , the probability amplitude projected onto the measurement basis vector is:
In Equation 23, the matrix form of and its corresponding matrix elements are:
The final state after applying to the intermediate state is:
Projecting the final state onto the measurement basis vector yields the corresponding amplitude :
At this point, the probability of measuring an arbitrary basis vector is:
In the expression for the probability from Equation 27, when , the following result holds:
Therefore, the corresponding term in the expression is:
When , the corresponding term in the expression is:
The expression inside the parentheses contains two exponential terms. According to Euler's formula:
Without loss of generality, to avoid redundant computations, let . Thus, when , the corresponding term in Equation 27 simplifies to:
The probability of measuring an arbitrary basis vector is hence given by:
The corresponding probability vector is .
C. Equivalence Between Fully Connected Quantum Boltzmann Machine Self-Attention Mechanism and Classical Self-Attention Mechanism
From the above derivations, the quantum amplitude encoding scheme for tokens proposed in this work concatenates the token sequence into a non-negative -dimensional real vector subject to the constraints on quantum amplitudes, where each vector element corresponds to the amplitude of a basis vector. Each token embedding has a dimension of , and hence every such token is represented using basis vector amplitudes. After modulation by FC-QBM and application of the rotation gates, the positional and interaction information of tokens is encoded into the measurement probabilities given by Equation 28. These measurement probabilities are equivalent to the results obtained from the classical self-attention mechanism.
First, expand the intermediate state modulated by FC-QBM given in Equation 21, yielding:
(29)
Equation 29 decomposes the global phase factor of the intermediate state into two components: the first is the bias phase factor, and the second is the weight phase factor. On the one hand, single-qubit phase combinations from the first component encode token order, assign positional markers to all tokens in the sequence, and thereby realize positional encoding. On the other hand, phase combinations generated by arbitrary two-qubit interactions in the second component encode the pairwise interactions between tokens at the qubit level, laying a foundation for subsequent matching with the classical attention score computation. It can thus be seen that the intermediate state modulated by FC-QBM implicitly encodes the positional and interaction information of all token embeddings in the sequence via combinations of qubit phases. After further application of the rotation gates, evolves into the final state , yielding measurement probabilities encoding the positional information and interaction strength of tokens.
The core computation of the classical self-attention mechanism is the dot product between token embeddings. Geometrically, the dot product equals the product of the norms of the two vectors multiplied by the cosine of the angle between them. Equation 28 naturally embodies this intuitive geometric interpretation, and the dot product of any two basis vectors is given by:
At this point, a single token embedding is represented by the amplitudes of basis vectors. Therefore, the dot product between token embeddings can be decomposed into the definition described in Equation 30, which simultaneously includes the initial real-amplitude terms and as well as the cosine term . The real-amplitude terms correspond to the quantum-state amplitudes of the original token sequence used as the initial input. These amplitudes carry no global interaction information. In contrast, the cosine term represents the phase information modulated by FC-QBM, encoding the positional information and interaction strength of token embeddings. Mathematically, Equation 30 fully conforms to the geometric interpretation of the dot-product operation. On this basis, by leveraging parameter combinations for the rotation gates assigned to respective qubits, different values for the coefficients and in Equation 28 are obtained, thereby enabling biased encoding of the dot-product components under each distinct basis vector. This mechanism avoids uniform representation and ensures that the dot-product components under each basis vector can be adaptively adjusted in accordance with token features.
The above steps can be briefly summarized as follows. First, FC-QBM encodes token positions and global pairwise interactions, with this information represented as phases. Then, the rotation gates extract differentiated information. In this manner, the encoding and computational functions of classical self-attention are fully realized. Most notably, the unitary evolution of semantic quantum states enables implicit attention computation by exploiting quantum parallelism and entanglement, removing the need to decompose continuous semantic streams into discrete matrices for explicit attention-weight computation. Furthermore, circuit measurement returns a probability distribution over basis vectors, which naturally satisfies normalization and requires no separate softmax step. The resulting probability vector encodes token positions and interactions, and can be directly applied to downstream generation and recognition tasks. In summary, by leveraging the strengths of quantum computing, the method can theoretically greatly reduce computational complexity, speed up model inference and overcome the inherent drawbacks of classical self-attention.
III. CONSTRUCTION AND IMPLEMENTATION OF FULLY CONNECTED QUANTUM BOLTZMANN MACHINE LANGUAGE MODEL
A. Initial State Preparation and Quantum Circuit Construction
First, quantum amplitude encoding is performed on the token sequence.
To begin with, an embedding matrix is trained from the text corpus, where denotes the vocabulary size and represents the dimension of word embeddings. Each row of corresponds to a -dimensional word embedding . For the convenience of subsequent derivation, this vector is abbreviated as . Given a token sequence with a length of , the word embeddings are strictly concatenated in token order to form an -dimensional vector :
It can be seen from Equation 31 that after concatenation, every elements in vector represent one token from left to right. There are a total of elements, which can characterize n tokens. Subsequently, the minimum value among all elements of is subtracted from these elements to make all vector elements non-negative, and a new vector is obtained accordingly:
Then, is processed via L1 normalization to yield vector :
To satisfy the requirements for quantum state amplitudes, all elements in vector are further square-rooted to yield vector :
Let the number of qubits in the quantum circuit be , which corresponds to a -dimensional Hilbert space. Therefore, the total capacity of amplitude encoding is . To encode all elements of , must satisfy the following capacity constraint:
The minimum number of qubits N satisfying the above constraints is computed using the ceiling function:
If the number of basis vectors slightly exceeds the number of required elements, the amplitudes corresponding to the extra basis vectors are padded with zeros, thereby yielding the -dimensional vector :
Finally, the vector computed via Equation 37 is assigned to vector , thus completing the quantum amplitude encoding process for the token sequence:
where denotes the shorthand notation obtained by converting integer into the binary string .
Second, an N-qubit quantum circuit is constructed, and the vector is encoded into the circuit as the amplitudes of basis vectors, thereby preparing the initial state .
Third, FC-QBM and Y-axis rotation gates are constructed in the quantum circuit according to the detailed computation and derivation procedures presented above. Specifically, FC-QBM is implemented using , and CNOT gates, and will be illustrated in detail with an 8-qubit model subsequently. The Y-axis rotation gates are realized via gates. Here, , and are trainable parameters. The number of is . The number of is , and the number of is also .
B. Construction of Classical Neural Network Layers
To further predict the next token using the probability vector processed by the quantum circuit, this work constructs classical neural network layers following FC-QBM. Execution of the quantum circuit yields the final state , while measurement produces the probability vector . This vector, in turn, is fed into the classical neural network layers to predict the next token embedding. Specifically, the classical neural network layers consist of two linear layers with a Gaussian error linear unit (GELU) activation function inserted in between. The first classical linear layer fuses the features of and reduces its dimensionality, compressing it into an M-dimensional representation:
The bias and the weight in Equation 39 are trainable parameters, where denotes the output vector processed by the first classical linear layer. The number of is , and the number of is . Subsequently, elements of vector undergo nonlinear transformation via the GELU activation function, yielding vector :
where denotes the cumulative distribution function for the standard normal distribution:
Finally, vector is fed into the second classical linear layer to output the -dimensional predicted token embedding :
The bias and the weight in Equation 42 are trainable parameters. The number of is , and the number of is .
C. Model Training
Combined with the foregoing analysis, the language model constructed in this work contains three groups of parameters. The first group consists of the FC-QBM circuit parameters , and , where the number of is , and the numbers of and are each N. The second group consists of the parameters and of the first classical linear layer, where the number of is M, and the number of is . The third group consists of the parameters and of the second classical linear layer, where the number of is , and the number of is . In practice, the corpus and the pre-trained embedding matrix are used to update model parameters through rounds of iterative optimization.
The training process of FC-BM is generally divided into two stages: positive-phase energy minimization and negative-phase contrastive divergence learning. Compared with classical FC-BM, FC-QBM constructed in this work, which acts as the core engine of the quantum language model, possesses unique features. First, FC-QBM is built by means of quantum circuits and various rotation gate operations. Second, classical neural network layers need to be executed after running FC-QBM. Accordingly, while following the standard training procedures of FC-BM, this work uses the backpropagation method to update the model parameters . Specifically, the forward propagation of the model is first used to simulate the positive-phase energy minimization of FC-BM. During forward propagation, the three groups of parameters are initially assigned random values, and then the model runs layer by layer from the quantum layer to the classical layers to obtain the predicted next token embedding. Subsequently, parameter gradients are obtained via model backpropagation for updating, so as to simulate negative-phase contrastive divergence learning.
Regarding the selection of the loss function, this work adopts the mean squared error (MSE) to measure the difference between predicted and ground-truth token embeddings. Mathematically, let the predicted token embedding generated by the model be , and the ground-truth token embedding be . The corresponding loss function is defined as:
1. Parameter Updates for Second Classical Linear Layer
According to the computational rules of backpropagation, the gradients of the loss function with respect to the parameters and of the second classical linear layer at the output end are first computed, followed by the update of the parameters. The corresponding computational formulas are as follows:
According to Equation 42 and Equation 43, the results for all terms in Equation 44 are:
Therefore, the final gradients of the loss function with respect to and are:
The corresponding parameter update formulas are:
where denotes the learning rate of the second classical linear layer.
2. Parameter Updates for First Classical Linear Layer
Next, the gradients of the loss function with respect to the parameters and of the first classical linear layer are computed, followed by the update of the parameters. The corresponding computational formulas are as follows:
The results for all terms in Equation 48 are:
Accordingly, the final gradients of the loss function with respect to and are:
The corresponding parameter update formulas are:
where denotes the learning rate of the first classical linear layer.
3. Parameter Updates for Quantum Layer
Finally, the gradients of the loss function with respect to the parameters , and of the quantum layer are computed, followed by the update of the parameters. The three parameter sets of the quantum layer are defined as follows:
Accordingly, the unitary evolution operators and defined above are combined into the total unitary evolution operator U, i.e.:
At this point, the final state modulated by the quantum layer can be briefly written as:
Equations 53 and 54 show that the entire quantum circuit can be combined into a total unitary evolution operator , where , and are the angular parameter sets of . Any change of an arbitrary parameter in the above three sets will cause the final state to change, thereby affecting the measurement results of all basis vectors. The measurement operator for the basis vector is constructed as:
After the final state is measured, the probability vector is obtained, where any element in this vector is the measurement expectation value corresponding to the measurement operator :
From the perspective of theoretical derivation, to obtain all elements in , all measurement operators are required to act on one by one for respective measurement and computation. In engineering practice, however, as shown in equation 56, a total of measurements can be performed at once. The count of outcomes corresponding to each basis vector is recorded, and the measured frequency of this basis vector is further used to approximate the measurement probability.
The formulas for the gradients of the loss function with respect to the quantum layer parameters , and are given as:
The results for all terms in Equation 57 are given as:
Equation 58 employs the parameter-shift rule (PSR)[25] in the computation of partial derivatives for the quantum layer and provides formulas for approximating partial derivative values in experiments. The term with a positive sign in the numerator corresponds to the outcome counts corresponding to each basis vector after shifting the parameter by and executing the circuit times. Meanwhile, the term with a negative sign represents the outcome counts corresponding to each basis vector after shifting the parameter by and executing the circuit times. In engineering practice, once the parameters are adjusted, only measurements need to be performed. Then the outcome counts corresponding to each basis vector can be read, and the measured frequency of the basis vector is adopted to approximate its measurement probability.
The corresponding parameter update formulas are:
where denotes the learning rate of the quantum layer.
D. Generation Process
The basic generation flow is as follows. Based on the quantum state encoding of the prompt, the trained model performs one forward propagation to obtain the -dimensional predicted embedding for the next token. The token closest to this embedding is retrieved from the embedding matrix as the generated token. Subsequently, the newly generated token is appended to the sequence to predict the token after the next token. Text is produced via autoregressive generation until the termination condition is met.
Let the quantum state encoded by the prompt be . After the execution of the trained quantum layer and, subsequently, the trained first and second classical linear layers, a -dimensional predicted token embedding is obtained. Next, the dot product between and all token vectors in the embedding matrix is computed to yield the similarity score :
where the variable V denotes the number of tokens in the embedding matrix. Following the computation of the standard self-attention mechanism, the similarity scores are scaled to obtain the scaled similarity score :
All tokens are sorted according to the scaled similarity scores. The top-m scaled similarity scores are selected to form the raw candidate similarity score set :
After removing tokens that fail to meet the filtering rules, the filtered candidate similarity score set of is obtained:
After applying maximum shift to each element in , softmax normalization is conducted to obtain the sampling probability of each token:
Thus, the discrete probability distribution over each element in is obtained as . Sampling is performed on the corresponding tokens according to this discrete distribution to obtain the -th token generated in this round. The generated token is concatenated with the previous tokens to form a new sequence of tokens. The same generation procedure is executed to obtain the -th token. This autoregressive text generation process is repeated iteratively until the termination condition is met.
E. Algorithm
Based on the above derivations, the training algorithm and generation algorithm of FC-QBM-LM are presented separately, as shown below.
Algorithm 1 Training of Fully Connected Quantum Boltzmann Machine Language Model
Input
Initial parameters: .
Learning rates: .
Output
Optimal parameters: .
Preliminary setup
Construct the corpus and train the word embedding matrix.
Quantum amplitude encoding for token sequence: .
Prepare the initial state based on the quantum amplitude .
Construct FC-QBM and Y-axis rotation gates in the quantum circuit using , and CNOT gates.
Construct a classical neural network layer containing two linear layers and one set of GELU activation functions.
Self-supervised learning: use tokens to predict the -th token in forward propagation, then update all parameters via backpropagation after computing gradients
for all training epochs do
for all token sequences in corpus do
Forward propagation (simulate positive-phase energy minimization of FC-BM)
Obtain the predicted embedding for the -th token via forward propagation.
Compute MSE against the ground-truth embedding for the -th token.
Backpropagation (simulate negative-phase contrastive divergence learning of FC-BM)
Compute required partial derivatives to obtain gradients of all parameters.
for all do
end
Optimize all parameters using the computed gradients.
for all do
end
end
Save optimal parameters from this epoch.
end
Obtain globally optimal parameters across all epochs: .
Algorithm 2 Generation of Fully Connected Quantum Boltzmann Machine Language Model
Input
Optimal parameters: .
Prompt token sequence.
Output
Target token sequence generated from the prompt.
Preliminary setup
Load FC-QBM-LM with the optimal parameters.
Encode the prompt as the initial state and feed it into the model.
Autoregressive generation: set window to tokens and generate sequence autoregressively do
Obtain the -th predicted embedding after executing quantum and classical layers.
Compute dot products between the predicted embedding and all vectors in embedding matrix, and select top- tokens by scores.
Apply scaling and filtering to the tokens to obtain tokens.
Perform maximum shift followed by softmax to obtain the discrete probability distribution of the tokens.
Sample one token from the discrete probability distribution as the -th generated token.
Concatenate the newly generated token with the previous -1 tokens to obtain the latest -token window.
Encode the latest tokens as the initial state and feed it back into the model.
while Termination condition is not met
Generate the full token sequence conditioned on the prompt.
IV. 8-QUBIT FULLY CONNECTED QUANTUM BOLTZMANN MACHINE LANGUAGE MODEL
In this work, Three Hundred Tang Poems is adopted as the raw corpus for an 8-qubit FC-QBM-LM. Its text is cleaned and preprocessed to yield the training corpus. A word2vec model based on skip-gram is used to learn word embeddings, and an embedding matrix specific to Tang poetry with vocabulary size and embedding dimension .
is constructed. Following the principle of traceability, all training code, execution logs and the final .csv file of the embedding matrix are properly preserved.
The model consists of the quantum module and the classical module, and focuses on training and generation. Specifically, the quantum module consists of one quantum layer, and the classical module consists of two linear layers with a GELU activation function inserted in between. The number of tokens processed by the model at each time step is set to , i.e., the input token sequence is . Accordingly, an initial concatenated token vector with dimension is obtained. Based on the above estimation method, the ceiling function is adopted to compute the number of qubits required in the quantum layer for encoding the 250-dimensional concatenated token vector:
Since the total number of basis vectors is , the amplitudes of the extra 6 dimensions are padded with zeros. Through the foregoing processing procedures, the 250-dimensional concatenated token vector is converted into a 256-dimensional amplitude encoding vector . Subsequently, is encoded into the 8-qubit quantum circuit to prepare the initial state :
Next, FC-QBM and Y-axis rotation gates are constructed within the quantum circuit following the computation and derivation procedures presented earlier. The Hamiltonian expression corresponding to FC-QBM is:
The structure of the quantum circuit is illustrated in Figure 2. Its function is to implicitly implement positional encoding and self-attention computation through FC-QBM. FC-QBM is realized by , and CNOT gates, while Y-axis rotation gates are implemented by gates. The number of parameters is 28, and the numbers of and are each 8, leading to a total of 44 parameters in the quantum circuit. It should be noted that all angle parameters of rotation gates are omitted in Figure 2 due to space constraints.

Figure 2: Quantum Circuit of 8-Qubit Fully Connected Quantum Boltzmann Machine Language Model
Trainable variational angles are assigned as follows: bias is parameterized by , entangling by weights and by .
After the quantum circuit is executed, the final state is obtained. A 256-dimensional probability vector is further extracted from measurement outcomes. This probability vector is fed into the classical module to produce the next token embedding predicted by the model. The first classical linear layer fuses the features of and reduces its dimensionality, compressing it into a 128-dimensional vector:
Here, the number of parameters is 128, and the number of is . Thus, the total number of parameters in the first classical linear layer is 32896. Subsequently, elements in vector are nonlinearly transformed by the GELU activation function to yield the 128-dimensional vector :
Finally, the vector is fed into the second classical linear layer to produce the 25-dimensional predicted token embedding :
Here, the number of parameters is 25, and the number of is . Thus, the total number of parameters in the second classical linear layer is 3225.
As derived above, the total number of trainable parameters in the proposed model is 36165. Among them, the quantum circuit layer contributes only 44 parameters, while the two classical linear layers account for the remaining parameters. It is worth noting that the quantum layer uses only 44 parameters to implement positional encoding and self-attention computation, demonstrating that the quantum language model based on FC-QBM can substantially reduce parameter overhead.
Table I: Parameter List of 8-Qubit Fully Connected Quantum Boltzmann Machine Language Model
| Layer | Parameter | Quantity | Subtotal |
|---|---|---|---|
| 8 | |||
| Quantum self-attention layer | 28 | 44 | |
| 8 | |||
| First classical linear layer | 128 | 32896 | |
| 32768 | |||
| Second classical linear layer | 25 | 3225 | |
| 3200 | |||
| Total | 36165 | 36165 |
During training, 10 tokens are sequentially read from the corpus of Three Hundred Tang Poems. These tokens are encoded following the aforementioned algorithm and fed into the model. The forward propagation of the model is used to simulate the positive-phase energy minimization of FC-BM. Leveraging the properties of quantum computation, the quantum layer implicitly implements self-attention processing without matrix operations and outputs a probability vector encoding token positions and interactions. The classical layers further analyze this probability vector and predict the next plausible token embedding. In forward propagation, with all parameters initialized to random values, the model runs from the quantum layer to the subsequent classical layers and finally outputs the next predicted token embedding. Subsequently, parameter gradients are obtained via backpropagation, and all parameters are updated, simulating the negative-phase contrastive divergence learning process of FC-BM. The above process runs iteratively until the entire Three Hundred Tang Poems corpus is traversed, marking the completion of one full training epoch.
In the generation stage, the prompt is first encoded into a quantum state and fed into the model. The trained quantum and classical layers perform one forward propagation to obtain a 25-dimensional predicted embedding for the next token. On this basis, the token with the smallest distance to this predicted embedding is retrieved from the embedding matrix trained on Three Hundred Tang Poems and taken as the generated token. The newly generated token is then appended to the sequence to predict the subsequent token. The above generation process is repeated to produce text in an autoregressive manner until the termination condition is met.
Training unit

Parameter passing
Generative unit
Prompt
山前白鹭
Amplitude encoding
Self-attention mechanism based on fully-connected quantum Boltzmann machine
Two classical layers and GELU
Dot product
Greedy decoding
Generated token “飞”
Output the final token sequence and terminate
Add to the token sequence

Chinese–English parallel texts
春眠不觉晓
山前白鹭
飞
I slumber in spring, unaware of dawn
White egrets in front of the hills
fly
Figure 3: System Block Diagram of 8-Qubit Fully Connected Quantum Boltzmann Machine Language Model
V. EXPERIMENTAL RESULTS AND ANALYSIS
To comprehensively evaluate the model performance, three sets of experiments are designed in this work, namely model convergence experiments, noise robustness experiments and five-character quatrain generation experiments. All experiments are implemented based on the PennyLane quantum simulator and the PyTorch machine learning framework. Following the principle of traceability, all source codes, execution logs, experimental data and model checkpoint files in .pth format are properly preserved.
A. Model Convergence Experiments
This set of experiments investigates the convergence performance of the model under noiseless conditions. Preprocessing of the original text of Three Hundred Tang Poems yields a corpus of 23520 token samples, as well as a embedding matrix corresponding to a vocabulary of 2481 distinct tokens. Checkpoints are employed in the training process. After each epoch, the model with the latest parameters is saved, and training for the next epoch resumes from this checkpoint. In addition, to conduct a thorough and accurate analysis of the model convergence, a control group with X-axis rotation gates at the circuit terminal is set up for comparison against the experimental group of the scheme proposed in this work, which adopts Y-axis rotation gates at the same terminal. Except for the rotation gates at the terminal, the two quantum circuits are identical in all other parts.
The experiments use the default.qubit state-vector simulator built into PennyLane to simulate the quantum layer, and all computations are performed on a ThinkPad T14p Gen 2 laptop. A single epoch takes approximately 4.5 hours on average, and the model is trained for 30 epochs in total, yielding a total training time of hours across all epochs for both groups. To quantitatively evaluate the convergence effect of the model, the arithmetic mean of the MSE over all token samples in each epoch is taken as the performance metric for that epoch, and the corresponding curves are shown in Figure 4.

Figure 4: Computational Results of Model Convergence Experiments
From the curves in Figure 4, it can be observed that under noiseless conditions: (1) As training epochs increase, the epoch-wise mean MSEs of both groups decrease progressively, with the curves becoming gradually less steep, demonstrating the favorable convergence performance of both groups. (2) In comparison, the quantum circuit with gates at the terminal proposed in this work achieves noticeably better convergence performance than that terminated with gates.
B. Noise Robustness Experiments
In the current noisy intermediate-scale quantum (NISQ) era, noiseless quantum computing devices are yet to emerge. Noise exerts a significant impact on the precision of quantum computing. Therefore, this set of experiments specifically investigates the robustness of the proposed model against noise perturbations.
The baseline noise level is defined as 0.5% for single-qubit gates and 1.0% for two-qubit gates. This definition takes into account the global landscape of commercial superconducting quantum hardware as of August 2026, upon the completion of all experiments, and matches the real-world scenario where early-generation, mid-generation and state-of-the-art devices run in parallel. Compared with the noise setting of 0.5% for single-qubit gates and 2.0% for two-qubit gates adopted in a prior study[22], this work reduces the baseline noise for two-qubit gates by one percentage point after the latest comprehensive hardware performance evaluation.
To accurately reconstruct real-world noise scenarios, this work adopts the default.mixed mixed-state qubit simulator in PennyLane and simulates real hardware noise based on depolarizing channels. It should be noted that this scheme relies on density matrix evolution, whose computational complexity and resource consumption are substantially higher than those of conventional state-vector simulation. Under the 8-qubit configuration in this work, the data size of the density matrix can theoretically reach times that of state-vector simulation, and matrix evolution together with noise simulation introduces additional computational overhead. This inference is also validated by preliminary tests prior to the formal experiments. For this reason, only the first eight poems in Three Hundred Tang Poems, containing a total of 501 token samples, are used for computations in the noise robustness experiments.
On this basis, this work further divides the 501 token samples into 30 batches. The first 29 batches each contain 17 tokens, and the last batch contains 8 tokens. Meanwhile, to deeply investigate the model robustness under different noise scenarios, this work expands the baseline noise setting of 0.5% for single-qubit gates and 1.0% for two-qubit gates to cover the noiseless case, 2×baseline noise, ..., up to 8×baseline noise, yielding a total of nine experimental scenarios. All computational experiments are performed on the ThinkPad T14p Gen 2 laptop, and the final results are shown in Figure 5 and Table II. The computation for the noiseless scenario takes approximately 1.5 hours. For the remaining eight noisy scenarios, the average computation time per scenario is about 5.5 hours. Therefore, the total computational time for this set of experiments is approximately hours.
Cumulative mean MSE

3 × Baseline
4 × Baseline
2 × Baseline
5 × Baseline
6 × Baseline
7 × Baseline
8 × Baseline
Batch
Figure 5: Computational Results of Noise Robustness Experiments The experimental scenarios include the noiseless case, baseline noise, baseline noise, baseline noise, baseline noise, baseline noise, baseline noise, baseline noise and baseline noise. Starting from the second subplot, solid lines denote the cumulative mean MSE over batches under different noise scenarios, while the dashed line represents that for the noiseless case.
Table II: Cumulative Mean of Mean Squared Error and Convergence Performance Retention Rate Under Different Noise Scenarios.
| Noiseless | Baseline | 2×Baseline | 3×Baseline | 4×Baseline | 5×Baseline | 6×Baseline | 7×Baseline | 8×Baseline | |
|---|---|---|---|---|---|---|---|---|---|
| Mean | 0.040688 | 0.041006 | 0.040829 | 0.040756 | 0.040847 | 0.041006 | 0.040798 | 0.040848 | 0.040889 |
| SD | 0.009318 | 0.009547 | 0.009263 | 0.009146 | 0.009344 | 0.009490 | 0.009293 | 0.009183 | 0.009482 |
| Retention | 1.000000 | 0.992245 | 0.996547 | 0.998332 | 0.996107 | 0.992245 | 0.997304 | 0.996083 | 0.995084 |
Mean in the table denotes the mean of the cumulative mean MSE across all 30 batches, and SD represents the corresponding standard deviation. Both metrics are computed considering variations in token count within each batch. Retention refers to the convergence performance retention rate, defined as the ratio of Mean under the noiseless case to that under a noisy case, quantifying the preservation of the model's convergence performance under noise perturbations.
From Figure 5 and Tabale II, it can be concluded that under the small-sample regime, the model exhibits strong robustness against noise perturbations of varying intensities, maintaining over 99% of the noiseless convergence performance. In particular, for all cases where the noise intensity exceeds the baseline, the model's convergence performance is no worse than that for the baseline noise case. This experimental result is highly consistent with the findings of Kuzmin et al. (2024). They found that injecting moderate noise into quantum neural networks can function similarly to regularization in classical neural networks, substantially improving generalization ability, reducing prediction MSE and boosting convergence performance[26]. In addition, the classical backend layers designed in this work possess a powerful nonlinear mapping capability, enabling them to adaptively compensate for shifts induced by noise and further stabilize the convergence performance of the model. Admittedly, this experimental result might be a special phenomenon specific to the small-sample regime. However, due to the limited computing power of the laptop, only preliminary small-scale experiments can be conducted at present. Furthermore, more refined and comprehensive verification on real quantum devices will be carried out in future work when conditions permit.
C. Five-Character Quatrain Generation Experiments
This set of experiments examines the model's generative capability through the task of generating five-character Tang quatrains. Five-character quatrains are classic metrical poetic forms that matured in the Tang Dynasty. A standard form has four lines of five characters each, totaling 20 characters, making them one of the most concise forms in classical Chinese poetry. Emerging from the Yuefu folk-song tradition of the Han and Wei Dynasties, this poetic form passed through centuries of systematic experimentation with tonal and metrical patterns during the Southern Dynasties, before attaining a fully defined set of formal conventions and aesthetic paradigms in the Tang Dynasty. Drawing on highly condensed imagery to evoke a profound, immersive artistic mood, it stands as a core representative category of short verse included in Three Hundred Tang Poems, with a highly distinctive stylistic identity. For researchers in natural language processing, the five-character quatrain features both strict formal constraints and high semantic density, making it a highly valuable experimental benchmark for classical Chinese poetry generation tasks.
The prompt “Wine in hand, I ask the mountain moon” is specified as the opening line. Checkpoints at epoch 1, epoch 10, epoch 20 and epoch 30 from the first set of noiseless experiments are then used for the five-character quatrain generation tasks. The poetry generation code strictly follows the computational procedures described above. Any post-hoc manual modification, supplementation, polishing or other manipulations are strictly prohibited, so as to faithfully reflect the comprehensive performance of the model at different checkpoints. All computational experiments are conducted on the ThinkPad T14p Gen 2 laptop, and the experimental results are presented in Figure 6.
Chinese–English parallel texts
Prompt: 把酒问山月 (Wine in hand, I ask the mountain moon)
Generated from the model checkpoint at epoch 1
把酒问山月,Wine in hand, I ask the mountain moon.
时雨年去落。Seasonal rain falls as the year slips away.
孤别秋叶春,I bid lonely farewell to autumn leaves and spring.
楼色十寒花。Towers stand, with ten cold blossoms in view.
Generated from the model checkpoint at epoch 10
把酒问山月,Wine in hand, I ask the mountain moon.
歌岂何能处?Where, then, can my song dwell?
到暮落城风,Dusk arrives. City winds drift down.
夜南水闻今。To the south, night falls — I hear the waters now.
Generated from the model checkpoint at epoch 20
把酒问山月,Wine in hand, I ask the mountain moon.
昨雨江流满。Yesterday's rain swelled the river to its brim.
落树春何事?Leaves drop from trees — what troubles spring?
君者此年为。This year, you shall act as you will.
Generated from the model checkpoint at epoch 30
把酒问山月,Wine in hand, I ask the mountain moon.
君识水处归?Do you know where the waters return?
雨树暮南斜,Rain-soaked trees lean southward at dusk.
满秋夜上歌。Autumn fills all. A song rises in the night.
Figure 6: Computational Results of Five-Character Quatrain Generation Experiments
From the experimental results shown in Figure 6, the following conclusions can be drawn: (1) The model preliminarily exhibits associative and divergent capabilities, indicating that the self-attention mechanism based on FC-QBM functions effectively in the experiments. As observed from the results, the model can associate the prompt word “mountain moon” with related words such as “night”, “spring”, “autumn” and “river”. It can also map “ask” to interrogative words including “what” and “how”. Guided by the overall imagery of the full prompt “Wine in hand, I ask the mountain moon”, the model further forms associative and divergent links to relevant concepts such as homesickness, parting, passage of time and positive action. (2) The model possesses a certain capability to organize word order in accordance with human natural language conventions. It can be observed that the model is capable of roughly arranging words according to human natural language sequences and generating poems compliant with grammatical rules, demonstrating that positional encoding within the self-attention mechanism also takes effect in the model. (3) As training epochs increase, the coherence, fluency, antithesis and imagery rendering of the generated poems exhibit a trend of gradual improvement. (4) Constrained by architecture and parameter scale, the model constructed in this work is only a preliminary small-scale language model for verification, whose performance exhibits notable gaps when compared with professional large language models, leaving room for further exploration in subsequent research.
VI. CONCLUSION
To address the limitations of the classical self-attention mechanism, a self-attention mechanism based on FC-QBM is designed in this work, and a quantum language model using the mechanism as the core engine is constructed. The findings are summarized as follows: (1) The encoding of token positions and the computation of token interactions are realized via FC-QBM, with gates adopted for differentiated information extraction, and this design is mathematically equivalent to the classical self-attention mechanism. (2) Implicit computation for self-attention is realized by unitary evolution acting on semantic quantum states. Continuous semantic streams do not need to be decomposed into discrete matrices for explicit matrix multiplication, and quantum computing advantages can be leveraged to accelerate the overall process. Measurement results obtained after quantum circuit execution naturally satisfy the normalization condition without requiring softmax computation. Under the 8-qubit setting, the quantum layer implements the entire positional encoding and self-attention computation pipeline with only 44 parameters. (3) Under noiseless conditions, the model exhibits favorable convergence performance. Furthermore, the quantum circuit proposed in this work that terminates with gates achieves better convergence performance than the counterpart terminated with gates. Under the small-sample regime and across eight distinct noise intensity levels, the model demonstrates strong noise robustness, retaining over 99% of its noiseless convergence performance. (4) Experiments on five-character quatrain generation reveal that the model preliminarily exhibits three core capabilities: associative and divergent thinking, content generation across imagery and human-aligned word ordering. These results validate the effectiveness of the proposed self-attention mechanism based on FC-QBM within the model.
[1] N. Chomsky. Syntactic Structures. Mouton, 1957. ISBN 9783110172799. doi:10.1515/9783110218329. 2002 De Gruyter Mouton reprint.
[2] T. Brants et al. Large language models in machine translation. In Proceedings of the 2007 Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning, pages 858–867, 2007. URL https://aclanthology.org/D07-1090/.
[3] Y. Bengio et al. A neural probabilistic language model. Journal of Machine Learning Research, 3(Feb):1137–1155, 2003. URL http://jmlr.org/papers/v3/bengio03a.html.
[4] S. Hochreiter and J. Schmidhuber. Long short-term memory. Neural Computation, 9(8):1735–1780, 1997. doi:10.1162/neco.1997.9.8.1735.
[5] A. Vaswani et al. Attention is all you need, 2017. URL https://arxiv.org/abs/1706.03762.
[6] M. A. Mabrok. Latent semantic manifolds in large language models, 2026. URL https://arxiv.org/abs/2603.22301.
[7] F. D. Keles, P. M. Wijewardena, and C. Hegde. On the computational complexity of self-attention. In Proceedings of the 34th International Conference on Algorithmic Learning Theory, volume 201 of PMLR, pages 597–619, 2023. URL https://proceedings.mlr.press/v201/duman-keles23a.html.
[8] X. L. Li et al. Diffusion-LM improves controllable text generation, 2022. URL https://arxiv.org/abs/2205.14217.
[9] Z. Gao et al. Empowering diffusion models on the embedding space for text generation. In Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers), pages 4664–4683, 2024. URL https://aclanthology.org/2024.naacl-long.261/.
[10] K. Hu et al. ELF: embedded language flows, 2026. URL https://arxiv.org/abs/2605.10938.
[11] J. Biamonte et al. Quantum machine learning. Nature, 549:195–202, 2017. doi:10.1038/nature23474.
[12] D. Kong et al. Hybrid quantum transformer for language generation, 2025. URL https://arxiv.org/abs/2511.10653.
[13] F. Nausheen et al. Quantum natural language processing: a comprehensive review of models, methods, and applications, 2025. URL https://arxiv.org/abs/2504.09909.
[14] G. E. Hinton and T. J. Sejnowski. Optimal perceptual inference. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 448–453, 1983. URL http://stanford.edu/~ngoodman/Hinton_Sejnowski_OptimalPerceptualDifference_1983.pdf.
[15] D. H. Ackley, G. E. Hinton, and T. J. Sejnowski. A learning algorithm for Boltzmann machines. Cognitive Science, 9(1):147–169, 1985. doi:10.1207/s15516709cog09017.
[16] P. Smolensky. Information processing in dynamical systems: foundations of harmony theory. In Parallel Distributed Processing (Vol. 1: Explorations in the Microstructure of Cognition: Foundations), pages 194–281. MIT Press, Cambridge, 1986. doi:10.7551/mitpress/5236.003.0009.
[17] G. E. Hinton, S. Osindero, and Y. W. Teh. A fast learning algorithm for deep belief nets. Neural Computation, 18(7):1527–1554, 2006. doi:10.1162/neco.2006.18.7.1527.
[18] G. Kim and D. K. Park. Boltzmann attention: learnable Ising couplings for cooperative attention, 2026. URL https://arxiv.org/abs/2606.12478.
[19] N. Wiebe, A. Kapoor, and K. M. Svore. Quantum deep learning, 2014. URL https://arxiv.org/abs/1412.3489.
[20] M. Benedetti et al. Quantum-assisted learning of hardware-embedded probabilistic graphical models. Physical Review X, 7:041052, 2017. doi:10.1103/PhysRevX.7.041052.
[21] M. H. Amin et al. Quantum Boltzmann machine. Physical Review X, 8:021050, 2018. doi:10.1103/PhysRevX.8.021050.
[22] J. Liu. Breaking QAOA's fixed target Hamiltonian barrier: a fully connected quantum Boltzmann machine via bilevel optimization, 2026. URL https://arxiv.org/abs/2605.07473.
[23] D. Hendrycks and K. Gimpel. Gaussian error linear units (GELUs), 2016. URL https://arxiv.org/abs/1606.08415.
[24] D. E. Rumelhart, G. E. Hinton, and R. J. Williams. Learning representations by back-propagating errors. Nature, 323(6088):533–536, 1986. doi:10.1038/323533a0.
[25] K. Mitarai et al. Quantum circuit learning. Physical Review A, 98(3):032309, 2018. doi:10.1103/PhysRevA.98.032309.
[26] V. Kuzmin et al. Method for noise-induced regularization in quantum neural networks, 2024. URL https://arxiv.org/abs/2410.19921.