Quantum enhanced self-attention coding method and device based on parameterized quantum circuit
By employing a quantum-enhanced self-attention encoding method based on parameterized quantum circuits, the problem of limited expressive power of quantum machine learning in quantum architecture parameter encoding tasks in existing technologies is solved, achieving more efficient quantum feature extraction and characterization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-04
- Publication Date
- 2026-03-13
AI Technical Summary
Existing quantum machine learning methods lack quantum enhancement schemes specifically for attention mechanisms, cannot effectively characterize the superposition and entanglement properties of quantum gates, and lack the ability to model quantum interference effects, resulting in limited expressive power in quantum architecture parameter encoding tasks.
A quantum-enhanced self-attention coding method based on parameterized quantum circuits is adopted. By feature interaction transformation and position coding information injection, the query and key matrix is mapped to the quantum Hilbert space. Quantum interference terms are introduced and position quantum transformations are performed to improve coding ability.
It effectively improves the expressive power and computational efficiency of quantum architecture parameter encoding, can better characterize the superposition and entanglement properties of quantum gates, and provides more powerful encoding tools.
Smart Images

Figure CN121660121A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to quantum coding technology, and more particularly to a quantum-enhanced self-attention coding method and device based on parameterized quantum circuits. Background Technology
[0002] In the field of machine learning, self-attention is a core component of the Transformer architecture, capturing global contextual information by calculating the dependency between any two elements in a sequence. Traditional self-attention mechanisms use classic dot product operations to calculate the similarity between the query and the key, i.e. , These represent the three weight matrices: Query, Key, and Value. The key vector dimension is used. This classic approach has achieved significant success in fields such as natural language processing and computer vision, but it has inherent limitations when dealing with the task of encoding architectural parameters related to quantum systems. The classic self-attention mechanism uses dot product to calculate similarity, which cannot effectively characterize the superposition and entanglement properties of quantum gates, lacks the ability to model quantum interference effects, and has limited expressive power in the task of encoding quantum architectural parameters.
[0003] Quantum machine learning offers a new approach to solving these problems. However, existing quantum machine learning methods mainly focus on classification and regression tasks, lacking quantum enhancement schemes specifically designed for attention mechanisms. Summary of the Invention
[0004] To address the problems existing in the prior art, the purpose of this invention is to provide a quantum-enhanced self-attention coding method and device based on parameterized quantum circuits designed for attention mechanisms.
[0005] To achieve the above-mentioned objectives, the present invention provides the following technical solution:
[0006] A quantum-enhanced self-attention coding method based on parameterized quantum circuits includes the following steps:
[0007] (1) Perform feature interaction transformation and position encoding information injection on the architecture parameter matrix of the quantum circuit, and linearly project it into a query matrix, a key matrix and a value matrix;
[0008] (2) Using the first parameterized quantum circuit, the query matrix and the bond matrix are mapped to the quantum Hilbert space respectively to obtain the query quantum eigenvector and the bond quantum eigenvector; wherein, the first parameterized quantum circuit is used to first encode the matrix into the rotation angle of the qubit, and then map it to the quantum Hilbert space after variational entanglement;
[0009] (3) Calculate the quantum feature similarity and quantum interference term of the query quantum feature vector and the bond quantum feature vector, add them together and perform softmax normalization to obtain the attention weight, and perform weighted aggregation on the value matrix to obtain the aggregation result;
[0010] (4) The aggregation result is subjected to position quantum transformation through the second parameterized quantum circuit, and then the result is connected with the residual of the aggregation result and subjected to layer normalization to obtain the final enhanced quantum coding matrix; wherein, the second parameterized quantum circuit is used to perform position quantum transformation on the aggregation result through spatial transformation.
[0011] Furthermore, step (1) specifically includes:
[0012] Architecture parameter matrix of quantum circuits By employing feature interaction transformation, the enhanced feature matrix is obtained: ;
[0013] For the enhanced feature matrix By superimposing the sine and cosine position codes (PE), we obtain the feature matrix containing the injected position information: ;
[0014] Feature matrix with injected location information By pre-setting a linear transformation matrix , , Projection into a query matrix Key matrix ,value .
[0015] Furthermore, step (2) specifically includes:
[0016] Obtain a first parameterized quantum circuit, wherein the first parameterized quantum circuit includes a data encoding layer, a variational entanglement layer, and a measurement layer. The data encoding layer includes a parameterized x-direction rotation gate and a z-direction rotation gate connected in sequence. The variational entanglement layer includes a first parameterized quantum circuit connected in sequence. Chain, parameterized y-direction rotating gate and second The chain, the measurement layer is used to measure the expectation value of the output of the variational entanglement layer in the Pauli Z operator, as a quantum eigenvector;
[0017] Input each row of the query matrix into the first parameterized quantum circuit to obtain the query quantum eigenvector;
[0018] Input each row of the bond matrix into the first parameterized quantum circuit to obtain the bond quantum eigenvector.
[0019] Furthermore, the data encoding layer specifically performs the following calculations:
[0020]
[0021] In the formula, Indicates the data encoding layer. Represents the input matrix, Indicates the input number of the first... OK, Indicates learnable parameters, Indicates the first On each quantum bit The learnable parameters of the gate, This represents a parameterized x-direction rotating door. This represents a rotation gate in the z-direction, where n represents the number of rows in the input matrix, which is also the number of qubits. Indicates to Performing tensor product operations on 100 qubits, i.e., on 100 qubits A single-qubit gate acts as a parallel function of multiple qubits.
[0022] Furthermore, the variational entanglement layer specifically performs the following calculations:
[0023]
[0024] in, This represents a variational entanglement layer. Represents the input matrix, This represents the i-th row of the input matrix. Indicates learnable parameters, Indicates the first On each quantum bit The learnable parameters of the gate, Indicates the action on adjacent qubits and Controlled NOT gates between This represents a parameterized y-direction rotation gate, where n represents the number of rows in the input matrix, which is also the number of qubits. Indicates to Performing tensor product operations on 100 qubits, i.e., on 100 qubits A single-qubit gate acts as a parallel function of multiple qubits.
[0025] Furthermore, step (3) specifically includes:
[0026] Calculate the quantum feature similarity between the query quantum feature vector and the bond quantum feature vector. , and The first The query quantum eigenvector and the first Each bond quantum eigenvector;
[0027] Calculate the quantum interference term for query quantum eigenvectors and bond quantum eigenvectors. ,in For the number of attention heads, These are learnable phase parameters;
[0028] Quantum feature similarity With quantum interference The attention score is obtained by adding them together. ;
[0029] Attention score Attention weights are obtained by performing softmax normalization. Using attention weights Log-value matrix Weighted aggregation is performed to obtain an aggregated result that incorporates quantum feature information. .
[0030] Furthermore, step (4) specifically includes:
[0031] Aggregation results The dimensionality is reduced to n dimensions, where n is the number of qubits;
[0032] The aggregation result after dimensionality reduction The position quantum transformation is performed using a second-parameterized quantum circuit to obtain the transformation characteristics. The second parameterized quantum circuit includes a Hadamard gate initialization layer, several variable layers, and a measurement layer connected in sequence. The Hadamard gate initialization layer is used to employ... Will Prepared as a uniform superposition state, Describe the quantum Hilbert space of the nth tensor product. The ground state 0 represents the nth tensor product, and the variable layer comprises sequentially connected... Chain, parameterized y-direction rotation gate and parameterized z-direction rotation gate, the measurement layer is used to measure the expected value of the output of the last variable layer in the Pauli Z operator as a transformation feature. ;
[0033] Transform features After linear projection and aggregation results Residual connections are performed, and then layer normalization is used to obtain the final enhanced quantum encoding matrix.
[0034] Furthermore, the variable stratification is used to perform the following calculations:
[0035]
[0036] In the formula, Indicates a change in layering. Indicates variable hierarchical input. express The OK, Indicates the first Layer On each quantum bit The learnable parameters of the gate, This indicates that the action occurs in adjacent qubits. and Controlled NOT gates between This represents a parameterized y-direction rotating door. This represents a parameterized z-direction rotating door. Indicates the first Layer On each quantum bit The learnable parameters of the gate, where n represents the number of rows in the input matrix, and is also the number of qubits. Indicates to Performing tensor product operations on 100 qubits, i.e., on 100 qubits A single-qubit gate acts as a parallel function of multiple qubits.
[0037] A computer program product includes a computer program that, when executed by a processor, implements the above-described method.
[0038] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described above.
[0039] Compared with existing technologies, the advantages of this invention are as follows: This invention replaces classical dot product calculation with quantum feature mapping technology, maps queries and keys to quantum Hilbert space through encoding and variational entanglement, introduces learnable quantum interference terms to capture quantum phase information and interference phenomena, and uses position quantum transformation for nonlinear feature enhancement. It can better characterize the superposition and entanglement characteristics of quantum gates in Hilbert space, effectively improve the expressive power, computational efficiency and feature extraction quality of architecture parameter encoding, and provide a more powerful encoding tool for quantum machine learning. Attached Figure Description
[0040] Figure 1 A schematic flowchart of a quantum-enhanced self-attention coding method based on parameterized quantum circuits provided in an embodiment of the present invention;
[0041] Figure 2 This is a structural diagram of the first parameterized quantum circuit provided in an embodiment of the present invention;
[0042] Figure 3 This is a structural diagram of the second parameterized quantum circuit provided in an embodiment of the present invention;
[0043] Figure 4A schematic diagram of the structure of the computing and device provided in the embodiments of the present invention. Detailed Implementation
[0044] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0045] Example 1
[0046] This invention provides a quantum-enhanced self-attention coding method based on parameterized quantum circuits, such as... Figure 1 As shown, it includes the following steps:
[0047] (1) Perform feature interaction transformation and position encoding information injection on the architecture parameter matrix of the quantum circuit, and linearly project it into query matrix Q, key matrix K and value matrix V.
[0048] This step specifically includes:
[0049] (1.1) Architectural parameter matrix of quantum circuits By employing feature interaction transformation, the enhanced feature matrix is obtained: ; through matrix multiplication Constructing second-order interaction items can capture complex dependencies between different depth positions and operation types;
[0050] (1.2) Enhancement of the feature matrix By superimposing the sine and cosine position codes (PE), we obtain the feature matrix containing the injected position information: ;in, for and ,in For depth location index, For dimensional indexing, For the model dimension, the absolute position information is encoded into the parameter representation using trigonometric functions of different frequencies;
[0051] (1.3) Inject the feature matrix of location information By pre-setting a linear transformation matrix , , Projection into a query matrix Key matrix ,value .
[0052] Taking a 3×4 dimensional architecture parameter matrix as an example, where 3 represents the maximum depth and 4 represents the operation pool size. Example:
[0053]
[0054] Apply feature interaction transformation to architecture parameters The enhanced feature matrix is obtained. Then, position encoding is superimposed. The line depth and location information are then injected into the parameter representation. The final result is... The query is obtained through linear projection. ,key ,value The matrices all have dimensions of 3×4.
[0055] (2) Using the first parameterized quantum circuit, the query matrix and the bond matrix are mapped to the quantum Hilbert space respectively to obtain the query quantum eigenvector and the bond quantum eigenvector.
[0056] The first parameterized quantum circuit is used to first encode the matrix into the rotation angle of the qubits, and then map it to the quantum Hilbert space after variational entanglement.
[0057] This step specifically includes:
[0058] (2.1) Obtain the first parameterized quantum circuit. Wherein, as... Figure 2 As shown, the first parameterized quantum circuit includes a data encoding layer, a variational entanglement layer, and a measurement layer.
[0059] The data encoding layer consists of a parameterized x-direction rotation gate and a z-direction rotation gate connected in sequence, as shown in the formula. In the formula, Indicates the data encoding layer. Represents the input matrix, This represents the i-th line of input. Indicates learnable parameters, Indicates the first On each quantum bit The learnable parameters of the gate, This represents a parameterized x-direction rotating door. This represents a rotation gate in the z-direction, where n represents the number of rows in the input matrix, which is also the number of qubits. Indicates to Performing tensor product operations on 100 qubits, i.e., on 100 qubits A single-qubit gate acts as a parallel function of multiple qubits. Achieve linear scaling encoding of input data, learnable parameters This allows the model to adaptively adjust the weights of each input component. Through the square term Introducing a second-order nonlinearity enhances the model's expressive power.
[0060] The variational entanglement layer includes a first layer connected in sequence. Chain, parameterized y-direction rotating gate and second The chain, specifically the formula is:
[0061]
[0062] in, This represents a variational entanglement layer. Represents the input matrix, This represents the i-th row of the input matrix. Indicates learnable parameters, Indicates the first On each quantum bit The learnable parameters of the gate, This represents a parameterized y-direction rotation gate, where n represents the number of rows in the input matrix, which is also the number of qubits. Implement linear scaling encoding of input data, before and after. The chain establishes entanglement between adjacent qubits.
[0063] The measurement layer is used to measure the expected value of the output of the variational entangled layer in the Pauli Z operator. As a quantum eigenvector .
[0064] (2.2) Input each row of the query matrix into the first parameterized quantum circuit to obtain the query quantum eigenvector. ;
[0065] (2.3) Input each row of the bond matrix into the first parameterized quantum circuit to obtain the bond quantum eigenvector. .
[0066] For example, such as Figure 2 As shown, the first parameterized quantum circuit pairs the query. The first line Perform quantum feature mapping. Data encoding layer parameters. Variational entanglement layer parameters After data encoding, After entanglement and parameterized rotation, the quantum eigenvectors are obtained by measuring the Pauli Z operator. .
[0067] (3) Calculate the quantum feature similarity and quantum interference term of the query quantum feature vector and the bond quantum feature vector, add them together and perform softmax normalization to obtain the attention weight, and perform weighted aggregation on the value matrix to obtain the aggregation result.
[0068] This step specifically includes:
[0069] (3.1) Calculate the quantum feature similarity between the query quantum feature vector and the bond quantum feature vector. , and The first The query quantum eigenvector and the first Two quantum eigenvectors are used to measure the similarity between two quantum eigenvectors in the n-dimensional real space through inner product operations, which has richer nonlinear feature interactions compared to the classical dot product.
[0070] (3.2) Calculate the quantum interference terms of the query quantum eigenvector and the bond quantum eigenvector. ,in For the number of attention heads, These are learnable phase parameters;
[0071] (3.3) Quantum feature similarity With quantum interference The attention score is obtained by adding them together. ;
[0072] (3.4) Attention score Attention weights are obtained by performing softmax normalization. Using attention weights Log-value matrix Weighted aggregation is performed to obtain an aggregated result that incorporates quantum feature information. .
[0073] Specifically, attention weights elements ,in For head dimension, This refers to the temperature parameter.
[0074] (4) The position quantum transformation of the aggregation result is performed through the second parameterized quantum circuit, and the layer normalization is performed after connecting it with the residual of the aggregation result to obtain the final enhanced quantum coding matrix.
[0075] The second parameterized quantum circuit is used to perform position quantum transformation on the aggregation result through spatial transformation, and its specific structure is as follows: Figure 3 As shown.
[0076] This step specifically includes:
[0077] (4.1) Aggregate the results The dimensionality is reduced to n dimensions, where n is the number of qubits;
[0078] (4.2) The aggregation results after dimensionality reduction The position quantum transformation is performed using a second-parameterized quantum circuit to obtain the transformation characteristics. The second parameterized quantum circuit includes a Hadamard gate initialization layer, several variable layers, and a measurement layer connected in sequence. The Hadamard gate initialization layer is used to employ... Will Prepared as a uniform superposition state, Describe the quantum Hilbert space of the nth tensor product. The ground state 0 represents the nth tensor product, and the variable layer comprises sequentially connected... Chain, parameterized y-direction rotation gate and parameterized z-direction rotation gate, the measurement layer is used to measure the expected value of the output of the last variable layer in the Pauli Z operator as a transformation feature. ;
[0079] The variable stratification is used to perform the following calculations:
[0080]
[0081] In the formula, Indicates a change in layering. Indicates variable hierarchical input. express The OK, Indicates the first Layer On each quantum bit The learnable parameters of the gate, This indicates that the action occurs in adjacent qubits. and Controlled NOT gates between This represents a parameterized y-direction rotating door. This represents a parameterized z-direction rotating door. Indicates the first Layer On each quantum bit The learnable parameters of the gate, where n represents the number of rows in the input matrix, and is also the number of qubits. Indicates to Performing tensor product operations on 100 qubits, i.e., on 100 qubits A single-qubit gate acts as a parallel function of multiple qubits.
[0082] (4.3) Transformation features After linear projection and aggregation results Residual connections are performed, and then layer normalization is used to obtain the final enhanced quantum encoding matrix. .
[0083] For example, using Figure 3 The quantum circuit pair aggregation result is shown. Perform position transformation. The circuit includes a Hadamard initialization layer and Layer to layer, layer parameters are as follows , , , The encoded architecture representation is obtained through residual connections and layer normalization.
[0084]
[0085] Compared to input , With richer feature representations, it can better capture the complex correlations between quantum gates, providing enhanced encoding representations for subsequent quantum architecture searches.
[0086] Example 2
[0087] This invention also provides a computer program product, such as an app on a mobile phone or tablet, or an installer on a computer. This product includes a computer program / instructions that, when executed by a processor, implement the method described in Embodiment 1. The code for the computer-executable program used to perform the operations of this invention can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as "C" or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0088] Example 3
[0089] Figure 4 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. The embodiments of the present invention provide services for implementing the method of the first embodiment of the present invention described above. Figure 4 As shown, the device may include: a memory 301 storing a computer-executable program; a processor 302 coupled to the memory 301; the processor 302 calls the computer-executable program stored in the memory 301 to perform the steps in the method described in Embodiment 1.
[0090] Memory 301 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory. The device may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, memory 301 may be used to read and write non-removable, non-volatile magnetic media (commonly referred to as a "hard disk drive"). A program / utility having a set (at least one) of program modules may be stored, for example, in memory 301. Such program modules include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. The computer-executable program of the program modules typically performs the functions and / or methods described in the embodiments of the present invention.
[0091] The processor 302 executes various functional applications and data processing by running programs stored in the memory 301, such as implementing the method provided in Embodiment 1 of the present invention.
[0092] The code of a computer executable program can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages.
[0093] It should be understood that the embodiments and descriptions above are only the principles, main features and advantages of the present invention. Various changes and modifications can be made to the present invention without departing from the spirit and scope of the invention, and all such changes and modifications fall within the protection scope of the present invention.
Claims
1. A quantum-enhanced self-attention coding method based on parameterized quantum circuits, characterized in that, Includes the following steps: (1) Perform feature interaction transformation and position encoding information injection on the architecture parameter matrix of the quantum circuit, and linearly project it into a query matrix, a key matrix and a value matrix; (2) Using the first parameterized quantum circuit, the query matrix and the bond matrix are mapped to the quantum Hilbert space respectively to obtain the query quantum eigenvector and the bond quantum eigenvector; wherein, the first parameterized quantum circuit is used to first encode the matrix into the rotation angle of the qubit, and then map it to the quantum Hilbert space after variational entanglement; (3) Calculate the quantum feature similarity and quantum interference term of the query quantum feature vector and the bond quantum feature vector, add them together and normalize them to obtain the attention weight, and then perform weighted aggregation on the value matrix to obtain the aggregation result; (4) The aggregation result is subjected to position quantum transformation through the second parameterized quantum circuit, and then the result is connected with the residual of the aggregation result and subjected to layer normalization to obtain the final enhanced quantum coding matrix; wherein, the second parameterized quantum circuit is used to perform position quantum transformation on the aggregation result through spatial transformation.
2. The quantum-enhanced self-attention coding method based on parameterized quantum circuits according to claim 1, characterized in that, Step (1) specifically includes: Architecture parameter matrix of quantum circuits By employing feature interaction transformation, the enhanced feature matrix is obtained: ; For the enhanced feature matrix By superimposing the sine and cosine position codes (PE), we obtain the feature matrix containing the injected position information: ; Feature matrix with injected location information By pre-setting a linear transformation matrix , , Projection into a query matrix Key matrix ,value .
3. The quantum-enhanced self-attention coding method based on parameterized quantum circuits according to claim 1, characterized in that, Step (2) specifically includes: Obtain a first parameterized quantum circuit, wherein the first parameterized quantum circuit includes a data encoding layer, a variational entanglement layer, and a measurement layer. The data encoding layer includes a parameterized x-direction rotation gate and a z-direction rotation gate connected in sequence. The variational entanglement layer includes a first parameterized quantum circuit connected in sequence. Chain, parameterized y-direction rotating gate and second The chain, the measurement layer is used to measure the expectation value of the output of the variational entanglement layer in the Pauli Z operator, as a quantum eigenvector; Input each row of the query matrix into the first parameterized quantum circuit to obtain the query quantum eigenvector; Input each row of the bond matrix into the first parameterized quantum circuit to obtain the bond quantum eigenvector.
4. The quantum-enhanced self-attention coding method based on parameterized quantum circuits according to claim 1, characterized in that, The data encoding layer specifically performs the following calculations: , In the formula, Indicates the data encoding layer. Represents the input matrix, Indicates the input number of the first... OK, Indicates learnable parameters, Indicates the first On each quantum bit Learnable parameters This represents a parameterized x-direction rotating door. This represents a rotation gate in the z-direction, where n represents the number of rows in the input matrix, which is also the number of qubits. Indicates to Performing tensor product operations on 100 qubits, i.e., on 100 qubits A single-qubit gate acts as a parallel function of multiple qubits.
5. The quantum-enhanced self-attention coding method based on parameterized quantum circuits according to claim 1, characterized in that, The variational entanglement layer specifically performs the following calculations: , in, This represents a variational entanglement layer. Represents the input matrix, This represents the i-th row of the input matrix. Indicates learnable parameters, Indicates the first On each quantum bit The learnable parameters of the gate, Indicates the action on adjacent qubits and Controlled NOT gates between This represents a parameterized y-direction rotation gate, where n represents the number of rows in the input matrix, which is also the number of qubits. Indicates to Performing tensor product operations on 100 qubits, i.e., on 100 qubits A single-qubit gate acts as a parallel function of multiple qubits.
6. The quantum-enhanced self-attention coding method based on parameterized quantum circuits according to claim 1, characterized in that, Step (3) specifically includes: Calculate the quantum feature similarity between the query quantum feature vector and the bond quantum feature vector. , and The first The query quantum eigenvector and the first Each bond quantum eigenvector; Calculate the quantum interference term for query quantum eigenvectors and bond quantum eigenvectors. ,in For the number of attention heads, These are learnable phase parameters; Quantum feature similarity With quantum interference The attention score is obtained by adding them together. ; Attention score Attention weights are obtained by performing softmax normalization. Using attention weights Log-value matrix Weighted aggregation is performed to obtain an aggregated result that incorporates quantum feature information. .
7. The quantum-enhanced self-attention coding method based on parameterized quantum circuits according to claim 1, characterized in that: Step (4) specifically includes: Aggregation results The dimensionality is reduced to n dimensions, where n is the number of qubits; The aggregation result after dimensionality reduction The position quantum transformation is performed using a second-parameterized quantum circuit to obtain the transformation characteristics. The second parameterized quantum circuit includes a Hadamard gate initialization layer, several variable layers, and a measurement layer connected in sequence. The Hadamard gate initialization layer is used to employ... Will Prepared as a uniform superposition state, Describe the quantum Hilbert space of the nth tensor product. The ground state 0 represents the nth tensor product, and the variable layer comprises sequentially connected... Chain, parameterized y-direction rotation gate and parameterized z-direction rotation gate, the measurement layer is used to measure the expected value of the output of the last variable layer in the Pauli Z operator as a transformation feature. ; Transform features After linear projection and aggregation results Residual connections are performed, and then layer normalization is used to obtain the final enhanced quantum encoding matrix.
8. The quantum-enhanced self-attention coding method based on parameterized quantum circuits according to claim 7, characterized in that: The variable stratification is used to perform the following calculations: , In the formula, This indicates that the l-th layer is a variable layer. Indicates variable hierarchical input. express The OK, Indicates the first Layer change layering On each quantum bit Learnable parameters This indicates that the action occurs in adjacent qubits. and Controlled NOT gates between This represents a parameterized y-direction rotating door. This represents a parameterized z-direction rotating door. Indicates the first Layer change layering On each quantum bit The learnable parameters, where n represents the number of rows in the input matrix and is also the number of qubits. Indicates to Performing tensor product operations on 100 qubits, i.e., on 100 qubits A single-qubit gate acts as a parallel function of multiple qubits.
9. A computer program product, comprising a computer program, characterized in that: When the computer program is executed by a processor, it implements the method of any one of claims 1-8.
10. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: The processor executes the computer program to implement the method as described in any one of claims 1-8.
Citation Information
Patent Citations
Classification method and device based on quantum Transform, medium and equipment
CN119807863A