A task-adaptive quantum neural network ansatz construction method
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANTONG UNIV
- Filing Date
- 2026-02-02
- Publication Date
- 2026-06-09
Smart Images

Figure CN122175028A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of quantum machine learning technology, and in particular to a method for constructing a task-adaptive quantum neural network, Ansatz. Background Technology
[0002] Reference paper: Wang Jing. Research and Application Exploration Analysis of Quantum Computing Technology [R]. Beijing: China Academy of Information and Communications Technology, 2022. Quantum computing, as a cutting-edge field leading a new round of technological revolution, has shown great potential in the direction of quantum machine learning in recent years. Quantum Neural Network (QNN) is an important architecture for realizing quantum advantage. Reference paper: Cerezo M, Arrasmith A, Babbush R, et al. Variational quantum algorithms [J]. Nature Reviews Physics, 2021, 3(9): 625-644. The design quality of its core component, parameterized quantum circuit (Ansatz), directly determines the performance and practicality of the model. Reference paper: Lau J WZ, Lim KH, Shrotriya H, et al. NISQ computing: where are we and where do we wego?[J]. AAPPS bulletin, 2022, 32(1): 27. In the current era of Noisy Intermediate-Scale Quantum (NISQ), Hardware-Efficient Ansatz (HEA) has become one of the most widely adopted Ansatz architectures due to its high compatibility with quantum hardware topologies. Reference paper: Kandala A, Mezzacapo A, Temme K, et al. Hardware-efficient variational quantum eigensolver for small molecules and quantum magnets[J].nature, 2017, 549(7671): 242-246. HEA forms a circuit structure that is easy to implement on real devices by alternating between single-qubit rotation gates and entanglement gates of neighboring qubits.
[0003] In the early stages of quantum machine learning development, referencing the paper: Du B, Xiong W, Wu J, et al. Stacked convolutional denoising auto-encoders for feature representation[J]. IEEE transactions on cybernetics, 2016, 47(4): 1017-1027. Influenced by the conclusion in classical deep learning that "stacked convolutional denoising autoencoders can effectively learn hierarchical feature representations," researchers have extensively attempted to adopt multi-layered stacked hardware-efficient Ansatz structures. However, this simple stacking strategy has encountered severe challenges in quantum computing. As the number of Ansatz layers increases, the depth of the quantum circuit grows linearly, leading to a sharp increase in the circuit's sensitivity to noise, and the coherence time of the quantum state becomes a bottleneck restricting model performance. Further research indicates that, as shown in the referenced paper: Cerezo M, et al. Cost function dependent barren plateaus in shallow parametrized quantum circuits[J]. Nature Communications, 2021, 12: 1791, for parameterized quantum circuits with a certain depth, the model exhibits saturation of expressive power due to the limitations of the geometric characteristics of the parameter space, and even gradient vanishing due to the "barren plateaus" problem, which severely restricts the trainability of QNNs.
[0004] To overcome these limitations, researchers have begun to explore Ansatz design schemes with stronger structural priors. One solution is to use the mathematical structure of Tree Tensor Networks (TTNs) to constrain and guide the construction of Ansatz. Tree Tensor Networks (TTNs) have attracted attention due to their hierarchical entangled structure. They can effectively control the depth of circuits while maintaining strong expressive power through bottom-up recursive merging operations. (See: Sim S, Johnson PD, Aspuru‐Guzik A. Expressibility and entangling capability of parameterized quantum circuits for hybrid quantum‐classical algorithms[J].Advanced Quantum Technologies, 2019, 2(12): 1900070.) Theoretically, as the bond dimension D increases, the Hilbert space (the set of all quantum states) that TTNs can cover also expands; when D approaches infinity, TTNs can represent arbitrary quantum states. However, the advantages of this approach are severely limited in classical simulation environments—high bond dimensions lead to an exponential increase in computational complexity, making classical simulations infeasible for large-scale problems.
[0005] Besides the problem of the sharp increase in the sensitivity of quantum circuits to noise as the depth of the circuit continues to increase, another problem is that existing Ansatz structures generally lack the ability to adapt to specific tasks. Reference paper: Du Y, Hsieh MH, Liu T, et al. A quantum circuit architecture search algorithm for variational quantum algorithms[J]. Quantum Science and Technology, 2023, 8(4): 045030. When constructing quantum circuits, the importance of different qubits to specific tasks often varies significantly. Taking image classification as an example, different pixel regions contribute differently to the final classification result. If this difference is not fully considered in the construction of Ansatz, and qubits are randomly selected or uniformly processed, it is easy to lose key discriminative information. The lack of this information selection mechanism makes it difficult for existing methods to achieve optimal performance in complex tasks.
[0006] Based on the above analysis, the current Ansatz design of QNN faces multiple challenges: it needs to maintain sufficient expressive power while controlling the line depth and noise sensitivity, and achieve task-oriented qubit optimization selection.
[0007] In summary, existing technologies for Ansatz design of quantum neural networks (QNNs) for NISQ hardware have the following two main limitations:
[0008] (1) Existing Ansatz designs struggle to achieve an effective balance between expressive power, circuit depth, and noise robustness. Multi-layer stacking schemes, such as Hardware Efficient Ansatz (HEA), while increasing depth to enhance expressive power, linearly exacerbate the circuit's sensitivity to noise and cause the "barren plateau" problem, leading to model training failure. While schemes based on tree tensor networks (TTN) with structured priors can theoretically control depth, their high-dimensional expansion faces an exponential complexity bottleneck in classical simulations, and their fixed structure cannot adapt to the diverse noise characteristics and task requirements of quantum hardware.
[0009] (2) Existing solutions generally lack adaptive qubit selection mechanisms for specific machine learning tasks. Whether it is a randomly stacked HEA or a fixed-structure TTN, the way qubits are used is task-independent. It is impossible to dynamically identify and prioritize the retention of qubits or feature information that contribute the most to the current task during the construction process, resulting in low utilization of quantum computing resources. In complex tasks such as image classification, key information is easily submerged or lost.
[0010] How to resolve the appeal issue is the problem that this invention aims to solve. Summary of the Invention
[0011] The purpose of this invention is to provide a task-adaptive quantum neural network (ANSAtz) construction method, aiming to achieve task-adaptive quantum circuit structure optimization. This method first uses pre-processed qubit partitions as leaf nodes, recursively constructing a full binary merge tree from bottom to top. At each non-leaf node, a subset of qubits is selected for information merging, thereby controlling the overall system circuit depth and resource overhead. Furthermore, to overcome the shortcomings of traditional random or static selection strategies, an Ansatz construction method based on a full binary merge tree (FBMT) and simulated annealing (SA) is introduced to optimize the selection of qubit combinations participating in merging at each layer, maximizing their local discriminative power and ensuring that the most informative subset of bits for the classification task is retained during the construction process. This invention inherits the hierarchical advantages of tree-structured tensor networks and combines optimization algorithms to achieve intelligent bit selection, thus achieving a better-performing Ansatz design under NISQ constraints.
[0012] To achieve the aforementioned objectives, the present invention employs the following technical solution: a method for constructing a task-adaptive quantum neural network (Ansatz), comprising the following steps:
[0013] Step S1: Use PCA (Principal Component Analysis) to reduce dimensionality and directly output quantum ready states for data preprocessing; when performing data preprocessing with PCA, the retained dimension is adaptively determined based on the number of qubits (ensuring it is a power of 2), and the normalized quantum state amplitude vector is output. While matching the requirements of the circuit encoding in dimensionality reduction, the variance of the principal components is maximized, providing high-quality input for the quantum neural network.
[0014] Step S11: Load the original dataset of N samples (e.g., the Iris 0-1 binary classification task dataset) to obtain the feature matrix. With the label vector y∈{0,…,K−1} N The centered matrix is obtained by taking the mean of X column by column. As shown in formula (1):
[0015] (1)
[0016] Where R is all real numbers, N is the total number of samples, d is the original feature dimension, and K represents the total number of categories in the classification task. Let μ represent a column vector of all 1s, where μ ∈ R. d This is a vector of mean values for each dimension. Let μ be the transpose of μ. Repeat the mean vector N times;
[0017] Step S12: Calculate the covariance matrix Σ, as shown in formula (2):
[0018] (2)
[0019] Then, eigenvalue decomposition is performed on it to obtain the orthogonal matrix Q and the diagonal matrix Λ, as shown in formula (3):
[0020] Σ=QΛQᵀ (3)
[0021] in: Let Σ be a diagonal matrix of eigenvalues, where λ is the eigenvalue of the covariance matrix Σ. For the corresponding eigenvector matrix, and the eigenvalues are arranged according to... Sort in descending order;
[0022] Step S13: Based on the number of qubits Determine the dimensions to retain ,in⌊⌋ This represents the floor function, which takes the eigenvectors corresponding to the m largest eigenvalues to form the projection matrix. Perform linear transformation = This maximizes the variance of each principal component after transformation and makes the dimension m a power of 2, thus meeting the amplitude encoding requirements of subsequent quantum circuits.
[0023] Step S14: Project the sample vector Calculate the normalization coefficient for each item. As shown in formula (4):
[0024] (4)
[0025] Generate quantum state amplitude vectors using formula (4) As shown in formula (5):
[0026] (5)
[0027] This results in the direct encoding as set ,in quantum bit state, This indicates rounding up. It performs an end-to-end conversion from classical high-dimensional data to quantum-ready low-dimensional representations.
[0028] Step S2: Construct a structured qubit organization method full binary merge tree: FBMT;
[0029] Classical data is partitioned and encoded into corresponding quantum states, and Ansatz is designed for the partitioning circuit. HEA (Head-Ended Algorithm) is a widely used general architecture in QNNs. Especially in classification tasks, HEA is simple in structure and highly practical on existing quantum hardware. To improve the expressive power of the model, QNNs typically employ multi-layered stacked HEA structures.
[0030] Classical Convolutional Neural Networks (CNNs) extract multi-level features and enhance the model's ability to fit complex functions by stacking multiple convolutional layers. However, QNNs differ significantly from classical networks in their structural expansion. In quantum neural networks (QNNs), the number of Ansatz layers is approximately proportional to the network depth; excessive stacking significantly increases the network depth, exacerbating noise sensitivity and reducing model trainability. Furthermore, research indicates that an expressive capacity bottleneck occurs after the number of Ansatz layers reaches a certain threshold. Therefore, this invention constructs a Full Binary Merge Tree (FBMT) structure to achieve hierarchical information merging while controlling network depth, thereby alleviating the noise sensitivity and expressive capacity bottleneck problems caused by multi-layer HEA structures.
[0031] Full Binary Merge Tree (FBMT) recursively merges partitioned qubit information in a bottom-up manner. It defines cross-layer information connection paths through "merged qubits", thereby determining the quantum subsystem to which each node belongs, which is then used to place locally parameterized quantum circuits.
[0032] Tree-structured tensor networks, as a form of tensor network with a hierarchical topology, are used to construct quantum circuit structures that are consistent with their connection methods. This structure can compress qubit resources and circuit depth while maintaining model performance.
[0033] As the bond dimension D increases, the state space that a tree tensor network can represent gradually expands; when the bond dimension approaches infinity, a TTN can theoretically cover the entire state space. However, a high bond dimension significantly increases the computational resource overhead of classical simulations, limiting their applicability on classical computing platforms. In contrast, implementing tensor networks as parameterized quantum circuits on quantum devices promises to overcome the computational complexity limitations of classical methods, thereby efficiently handling larger-scale quantum states.
[0034] To realize a predefined circuit construction framework for Ansatz, this invention proposes a "full binary merge tree structure" as a structured qubit organization method. This tree recursively merges the partitioned qubit information in a bottom-up manner, defines cross-layer information connection paths through "merged qubits," and thus determines the quantum subsystem to which each node belongs for subsequent placement of locally parameterized quantum circuits.
[0035] Step S21: FBMT Structural Constraints and Block Partitioning
[0036] Step S211: Full binary tree structure constraints and bottom-up merge logic: The number of leaf nodes in FBMT is 2. p , where p∈N + , where N + The integer domain is positive; each non-leaf node is connected to exactly two child nodes.
[0037] FBMT construction follows a bottom-up merging principle. First, the leaf nodes and their constituent sub-nodes are determined. Then, non-leaf nodes are constructed layer by layer upwards until a unique root node is generated.
[0038] Step S212: Load Balancing: Before constructing the FBMT, the original quantum circuit is divided into K sub-blocks, satisfying the load balancing condition, where K = 2. p d represents the total number of qubits in the quantum circuit. The difference in the number of qubits contained in each block does not exceed 1. The leaf nodes correspond to the local set of qubits in each block.
[0039] Step S22: Definition and selection mechanism of merged qubits
[0040] Define the merged quantum bit Q merged At non-leaf nodes: Q N From its left: Q 2N And right Q 2N+1 The set of qubits selected from each of the two child nodes will together constitute the quantum subsystem associated with the non-leaf node, as shown in equation (6):
[0041] (6)
[0042] Among them, Choose_Left (Q 2N (, Param) represents selecting V qubits from the set of qubits of the left child node; Choose_Right (Q 2N+1 R_combined(Q, Param) represents selecting V qubits from the set of qubits of the right child node; N ) is a set of qubits of size 2V, used in the current node Q N Locally parameterized quantum circuits are constructed on top of this. The size of V determines the Hilbert space dimension defined when multiple qubits participate in a unitary operation, and the bond dimension D in the tensor network structure. When a unitary operation acts on 2V qubits, the corresponding tensor bond dimension D=2. 2V .
[0043] Step S23: Construct a full binary merge tree
[0044] Step S231: Store the information of the set of qubits in each partition as leaf nodes.
[0045] Step S232: Select V qubits from the set of child node qubits in a bottom-up, left-to-right order and merge them to form a new node.
[0046] Finally, the entire full binary merge tree is completed once the root node is established.
[0047] Based on a full binary merge tree (V=2), the value of V is set to 2 to reduce the integer Ansatz complexity. Furthermore, the quantum neural network classification task studied in this paper does not involve higher-order many-body correlations; the Hilbert space formed by V=2 is sufficient to capture fundamental quantum correlations, thus requiring less complex computation. value.
[0048] The tree structure is transformed into a complete Ansatz training loop. A hardware-efficient Ansatz structure is selected; this invention chooses a ring-shaped Ansatz architecture, where the topology forms a ring from the first qubit to the last qubit.
[0049] During the construction of FBMT, the quantum system continuously merges quantum states from different sub-partitions. Each merge selects V qubits from the participating nodes to construct the qubit combinations for the new layer, while the remaining unselected qubits are either discarded or ignored. If this selection process employs a random strategy, qubits carrying important task information may be discarded, severely impacting the final model performance. For example, in the MNIST image classification task, the features corresponding to different pixel regions have varying importance for identifying digit categories. Discarding qubits carrying key contour information may lead to a decrease in the model's discriminative power, ultimately resulting in lower classification accuracy. Therefore, effectively identifying and prioritizing the retention of qubit combinations with discriminative power is crucial for improving the performance of interactive Ansatz layers.
[0050] After merging, a complete FBMT is formed;
[0051] Step S3: Construct Ansatz based on Full Binary Merge Tree (FBMT) and Simulated Annealing (SA);
[0052] This invention proposes a qubit selection strategy based on simulated annealing optimization. The core idea of this strategy is to treat each round of merging operations as a combinatorial optimization problem, aiming to maximize the contribution of a finite number of qubits to the current task's discrimination within the constraint of retaining that qubit. Specifically, the algorithm evaluates the impact of different qubit combinations on task relevance and, through the random search mechanism of simulated annealing, seeks a subset of qubits with greater global optimum while avoiding getting trapped in local optima. Ultimately, this strategy effectively guides each merging operation to select the qubits with the highest information retention value during the construction of the FBMT structure, thereby achieving a task-oriented, structurally optimized tree-like Ansatz design.
[0053] In each layer of FBMT construction, select from the left and right child nodes respectively. One qubit is used for merging. Since the task-related information (such as classification ability) carried by the qubits varies, random or static selection may lead to the loss of key discriminative information, thus affecting model performance.
[0054] Therefore, this invention transforms the problem into a combinatorial optimization problem, the objective of which is to select a set of qubits with the strongest discriminative power under given constraints. This set should maximize the discriminative power expressed by the local Ansatz block.
[0055] Step S31: Combinatorial optimization problem modeling: In the construction process of each layer of FBMT, the merging selection of left and right child node qubits is modeled as a combinatorial optimization problem. Under the constraint that the number of qubits selected at each node is fixed at V, the discrimination ability of the local Ansatz sub-circuit on the training samples is maximized.
[0056] Step S32, Simulated Annealing Global Search: The Simulated Annealing (SA) algorithm performs a global search on the combinatorial optimization problem. In each iteration, it applies a perturbation to the current qubit combination to generate a new combination, and evaluates the classification performance of the Ansatz structure constructed by the combination in the local sub-circuit on the training samples according to the objective function. During the search process, it accepts suboptimal solutions and escapes local optima in a probabilistic manner, thereby finding the most discriminative subset (optimal qubit combination) in the qubit combination space.
[0057] The specific objective function B is defined as shown in formula (7):
[0058] (7)
[0059] Where U=(Q) L Q R ) represents the combination of subsets of qubits selected from the left and right nodes. It is the classification loss value of the local Ansatz sub-circuit trained based on this combination on the validation set.
[0060] At the leaf node level, the combination of qubits is already fixed and does not need to be selected;
[0061] At each non-leaf node, simulated annealing starts from an initial combination of qubits; before constructing the first new node, at the left node Q... 2N There are a total of m qubits, so the possible choices are: kind, and Let each represent a combination of qubits selected from the left and right nodes, assuming... Values One of the integers, ∈N + Different integers represent different combinations of qubits, for example =1 indicates Q L For [q0, q1]; then select the right node Q. 2N+1 Similarly, there are m qubits, and the possible combinations are also... Seed, set The value is taken as the ... One of the integers, ∈N + ,when =1 indicates Q R For [q] m+1 ,q m+2 After the left and right nodes are selected, the new node's qubit combination is [q0, q1, q]. m+1 ,q m+2 ].
[0062] Whenever a new node is constructed, the two independent variables in the simulated annealing algorithm... and Through continuous optimization and The selection process involves performing domain perturbation, acceptance criteria, and temperature reduction operations, ultimately outputting a combination of qubits that optimizes local performance. This combination is then used to construct the Ansatz array for the current node, minimizing the classification loss of the Ansatz array constructed in the local sub-circuit for the training samples.
[0063] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0064] (1) An efficient end-to-end conversion from classical high-dimensional data to quantum-ready states was achieved. Principal component analysis (PCA) was used for data preprocessing, and the retained dimension was adaptively determined based on the number of qubits (ensuring it is a power of 2). The normalized quantum state amplitude vector was output, which maximized the variance of the principal components while matching the dimensionality reduction requirements of the circuit encoding, providing high-quality input for the quantum neural network. Furthermore, the FBMT structure was implemented on a quantum device in the form of parameterized quantum circuits, utilizing the advantages of quantum computing to handle high-dimensional Hilbert space operations. This avoided the exponential growth problem of classical computing resources caused by the high bond dimension of traditional tree tensor networks (TTN), providing a feasible path for larger-scale quantum machine learning tasks.
[0065] (2) It solves the technical bottleneck of existing Ansatz in balancing expressive power, line depth and noise robustness; By constructing a full binary merge tree (FBMT) structure, a bottom-up hierarchical merging strategy is adopted to replace the traditional multi-layer stacked hardware efficient Ansatz (HEA). While maintaining strong expressive power, the line depth is effectively controlled, avoiding the sharp increase in noise sensitivity and the "barren plateau" problem caused by the linear growth of line depth, and significantly improving the trainability of the model in the NISQ era.
[0066] (3) It overcomes the deficiency of traditional quantum neural networks in lacking task adaptation capability; it introduces a qubit combinatorial optimization strategy based on simulated annealing (SA), models each layer's merging operation as a combinatorial optimization problem, dynamically identifies and prioritizes the retention of the subset of qubits that contribute the most to the current classification task, avoids the loss of key discrimination information, and realizes task-oriented intelligent bit selection. At the same time, by globally searching for the optimal combination at each non-leaf node of FBMT using the validation set classification loss as the evaluation index, it ensures that the discrimination capability of local Ansatz is maximized under limited bit resources (only V bits are selected per node), significantly improving the utilization efficiency and information retention capability of qubits.
[0067] (4) Improve the performance of practical tasks; For example, in the Iris 0-1 binary classification task, through the collaborative optimization of FBMT and SA algorithms, the optimal combination of qubits finally selected reduced the local classification loss to 0.09, which verified that the method has strong task discrimination ability while maintaining the shallowness of the circuit, and provides a high-performance Ansatz design scheme for practical quantum machine learning applications. Attached Figure Description
[0068] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof.
[0069] Figure 1This is a schematic diagram of the multilayer HEA circuit of the present invention;
[0070] Figure 2 This is a schematic diagram of a full binary merge tree with V=2 according to the present invention;
[0071] Figure 3 This is a schematic diagram of the annular Ansatz structure of the present invention;
[0072] Figure 4 This is a schematic diagram of the optimal qubit combination example based on FBMT and SA algorithms in Embodiment 2 of the present invention (Iris 0-1 binary classification task dataset);
[0073] Figure 4 This is a schematic diagram of the optimal combination of qubits selected in Embodiment 2 of the present invention; wherein: (1) is a schematic diagram of the tree structure of the selection process; (2) is a schematic diagram of the quantum circuit structure of the selection process;
[0074] Figure 5 This is a schematic diagram of the Iris dataset sample partitioning in Embodiment 2 of the present invention;
[0075] Figure 6 This is a schematic diagram of the four leaf nodes constructed based on the "bottom-up, layer-by-layer merging" logic of FBMT in Embodiment 2 of the present invention;
[0076] Figure 7 This is a schematic diagram of the annular Ansatz structure in Embodiment 2 of the present invention;
[0077] Figure 8 This is a schematic diagram of the Ansatz circuit constructed using the Iris 0-1 binary classification dataset in Embodiment 2 of the present invention.
[0078] Figure 9 This is a schematic diagram of the optimal qubit combination example based on the FBMT and SA algorithms in Embodiment 2 of the present invention (Iris 0-1 binary classification task dataset). Detailed Implementation
[0079] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. Of course, the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0080] Example 1: This example provides a method for constructing a task-adaptive quantum neural network Ansatz, including the following steps:
[0081] Step S1: Use PCA (Principal Component Analysis) to reduce dimensionality and directly output quantum ready states for data preprocessing; when performing data preprocessing with PCA, the retained dimension is adaptively determined based on the number of qubits (ensuring it is a power of 2), and the normalized quantum state amplitude vector is output. While matching the requirements of the circuit encoding in dimensionality reduction, the variance of the principal components is maximized, providing high-quality input for the quantum neural network.
[0082] Step S11: Load the original dataset of N samples (e.g., the Iris 0-1 binary classification task dataset) to obtain the feature matrix. With the label vector y∈{0,…,K−1} N The centered matrix is obtained by taking the mean of X column by column. As shown in formula (1):
[0083] (1)
[0084] Where R is all real numbers, N is the total number of samples, d is the original feature dimension, and K represents the total number of categories in the classification task. Let μ represent a column vector of all 1s, where μ ∈ R. d This is a vector of mean values for each dimension. Let μ be the transpose of μ. Repeat the mean vector N times;
[0085] Step S12: Calculate the covariance matrix Σ, as shown in formula (2):
[0086] (2)
[0087] Eigenvalue decomposition is performed on it, as shown in formula (3):
[0088] Σ=QΛQᵀ (3)
[0089] in: Let Σ be a diagonal matrix of eigenvalues, where λ is the eigenvalue of the covariance matrix Σ. For the corresponding eigenvector matrix, and the eigenvalues are arranged according to... Sort in descending order;
[0090] Step S13: Based on the number of qubits Determine the dimensions to retain ,in This represents the floor function, which takes the eigenvectors corresponding to the m largest eigenvalues to form the projection matrix. Perform linear transformation = This maximizes the variance of each principal component after transformation and makes the dimension m a power of 2, thus meeting the amplitude encoding requirements of subsequent quantum circuits.
[0091] Step S14: Project the sample vector Calculate the normalization coefficient for each item. As shown in formula (4):
[0092] , (4)
[0093] The quantum state amplitude generated by formula (4) is directed towards As shown in formula (5):
[0094] (5)
[0095] This results in the direct encoding as set ,in quantum bit state, This indicates rounding up. It performs an end-to-end conversion from classical high-dimensional data to quantum-ready low-dimensional representations.
[0096] Step S2: Construct a structured qubit organization method full binary merge tree: FBMT;
[0097] Classical data is partitioned and encoded into corresponding quantum states, and Ansatz is designed for the partitioning circuit. HEA (Head-Ended Algorithm) is a widely used general architecture in QNNs. Especially in classification tasks, HEA is simple in structure and highly practical on existing quantum hardware. To improve the expressive power of the model, QNNs typically employ multi-layered stacked HEA structures, such as... Figure 1 As shown.
[0098] Classical Convolutional Neural Networks (CNNs) extract multi-level features and enhance the model's ability to fit complex functions by stacking multiple convolutional layers. However, QNNs differ significantly from classical networks in their structural expansion. In quantum neural networks (QNNs), the number of Ansatz layers is approximately proportional to the network depth; excessive stacking significantly increases the network depth, exacerbating noise sensitivity and reducing model trainability. Furthermore, research indicates that an expressive capacity bottleneck occurs after the number of Ansatz layers reaches a certain threshold. Therefore, this invention constructs a Full Binary Merge Tree (FBMT) structure to achieve hierarchical information merging while controlling network depth, thereby alleviating the noise sensitivity and expressive capacity bottleneck problems caused by multi-layer HEA structures.
[0099] Full Binary Merge Tree (FBMT) recursively merges partitioned qubit information in a bottom-up manner. It defines cross-layer information connection paths through "merged qubits", thereby determining the quantum subsystem to which each node belongs, which is then used to place locally parameterized quantum circuits.
[0100] Tree-structured tensor networks, as a form of tensor network with a hierarchical topology, are used to construct quantum circuit structures that are consistent with their connection methods. This structure can compress qubit resources and circuit depth while maintaining model performance.
[0101] As the bond dimension D increases, the state space that a tree tensor network can represent gradually expands; when the bond dimension approaches infinity, a TTN can theoretically cover the entire state space. However, a high bond dimension significantly increases the computational resource overhead of classical simulations, limiting their applicability on classical computing platforms. In contrast, implementing tensor networks as parameterized quantum circuits on quantum devices promises to overcome the computational complexity limitations of classical methods, thereby efficiently handling larger-scale quantum states.
[0102] To realize a predefined circuit construction framework for Ansatz, this invention proposes a "full binary merge tree structure" as a structured qubit organization method. This tree recursively merges the partitioned qubit information in a bottom-up manner, defines cross-layer information connection paths through "merged qubits," and thus determines the quantum subsystem to which each node belongs for subsequent placement of locally parameterized quantum circuits.
[0103] Step S21: FBMT Structural Constraints and Block Partitioning
[0104] Step S211: Full binary tree structure constraints and bottom-up merge logic: The number of leaf nodes in FBMT is 2. p , where p∈N + , where N + The integer domain is positive; each non-leaf node is connected to exactly two child nodes.
[0105] FBMT construction follows a bottom-up merging principle. First, the leaf nodes and their constituent sub-nodes are determined. Then, non-leaf nodes are constructed layer by layer upwards until a unique root node is generated.
[0106] Step S212: Block Balancing: Before constructing the FBMT, the original quantum circuit is divided into K sub-blocks, satisfying the load balancing condition.
[0107] Where K = 2 p d represents the total number of qubits in the quantum circuit. The difference in the number of qubits contained in each block does not exceed 1. The leaf nodes correspond to the local set of qubits in each block.
[0108] Step S22: Definition and selection mechanism of merged qubits
[0109] Define the merged quantum bit Qmerged At non-leaf nodes: Q N From its left: Q 2N And right Q 2N+1 The set of qubits selected from each of the two child nodes will together constitute the quantum subsystem associated with the non-leaf node, as shown in equation (6):
[0110] (6)
[0111] Among them, Choose_Left (Q 2N (, Param) represents selecting V qubits from the set of qubits of the left child node; Choose_Right (Q 2N+1 R_combined(Q, Param) represents selecting V qubits from the set of qubits of the right child node; N ) is a set of qubits of size 2V, used in the current node Q N Locally parameterized quantum circuits are constructed on top of this. The size of V determines the Hilbert space dimension defined when multiple qubits participate in a unitary operation, and the bond dimension D in the tensor network structure. When a unitary operation acts on 2V qubits, the corresponding tensor bond dimension D=2. 2V .
[0112] Step S23: Construct a full binary merge tree
[0113] Step S231: Store information as leaf nodes for the set of qubits in each partition, for example... Figure 2 The set of qubits contained in the leaf nodes representing 2N is [q0, q1, ... q]. m ].
[0114] Step S232: Select V qubits from the set of child node qubits in a bottom-up, left-to-right order and merge them to form a new node.
[0115] Figure 2 The 2N nodes in Q are newly constructed nodes. 2N The set of qubits contained in a node is determined by selecting [q0, q1] and Q from the 2N leaf node qubit set. 2N+1 [q] in the set of leaf node qubits (m+1) ,q (m+2) It is formed by merging, built from bottom to top, from left to right, in a continuous cycle.
[0116] Finally, the entire full binary merge tree is completed once the root node is established.
[0117] Based on a full binary merge tree (V=2), let... The value is set to 2 to reduce the integer Ansatz complexity. Furthermore, the quantum neural network classification task studied in this paper does not involve higher-order many-body correlations; the Hilbert space formed by V=2 is sufficient to capture fundamental quantum correlations, thus a large value is not required. value.
[0118] The tree structure is transformed into a complete Ansatz training loop. A hardware-efficient Ansatz structure is selected; this invention chooses a ring-shaped Ansatz architecture, where the topology forms a ring from the first qubit to the last qubit, such as... Figure 3 As shown.
[0119] After obtaining the qubit information, according to the selected Figure 3 The Ansatz entanglement structure shown acts on the acquired qubits. Training circuits are built layer by layer from the bottom up. In the interactive Ansatz training layer, each Ansatz module needs to select multiple qubits from the previous layer for entanglement according to a certain strategy. This selection behavior is essentially closely related to the qubit selection process in the FBMT structure.
[0120] During the construction of FBMT, the quantum system continuously merges quantum states from different sub-partitions. Each merge selects V qubits from the participating nodes to construct the qubit combinations for the new layer, while the remaining unselected qubits are either discarded or ignored. If this selection process employs a random strategy, qubits carrying important task information may be discarded, severely impacting the final model performance. For example, in the MNIST image classification task, the features corresponding to different pixel regions have varying importance for identifying digit categories. Discarding qubits carrying key contour information may lead to a decrease in the model's discriminative power, ultimately resulting in lower classification accuracy. Therefore, effectively identifying and prioritizing the retention of qubit combinations with discriminative power is crucial for improving the performance of interactive Ansatz layers.
[0121] After merging, a complete FBMT is formed.
[0122] Step S3: Construct Ansatz based on Full Binary Merge Tree (FBMT) and Simulated Annealing (SA);
[0123] This invention proposes a qubit selection strategy based on simulated annealing optimization. The core idea of this strategy is to treat each round of merging operations as a combinatorial optimization problem, aiming to maximize the contribution of a finite number of qubits to the current task's discrimination within the constraint of retaining that qubit. Specifically, the algorithm evaluates the impact of different qubit combinations on task relevance and, through the random search mechanism of simulated annealing, seeks a subset of qubits with greater global optimum while avoiding getting trapped in local optima. Ultimately, this strategy effectively guides each merging operation to select the qubits with the highest information retention value during the construction of the FBMT structure, thereby achieving a task-oriented, structurally optimized tree-like Ansatz design.
[0124] In each layer of FBMT construction, select from the left and right child nodes respectively. One qubit is used for merging. Since the task-related information (such as classification ability) carried by the qubits varies, random or static selection may lead to the loss of key discriminative information, thus affecting model performance.
[0125] Therefore, this invention transforms the problem into a combinatorial optimization problem, the objective of which is to select a set of qubits with the strongest discriminative power under given constraints. This set should maximize the discriminative power expressed by the local Ansatz block.
[0126] Step S31: Combinatorial optimization problem modeling: In the construction process of each layer of FBMT, the merging selection of left and right child node qubits is modeled as a combinatorial optimization problem. Under the constraint that the number of qubits selected at each node is fixed at V, the discrimination ability of the local Ansatz sub-circuit on the training samples is maximized.
[0127] Step S32: Simulated Annealing Global Search: The Simulated Annealing (SA) algorithm performs a global search on the combinatorial optimization problem. In each iteration, it applies a perturbation to the current qubit combination to generate a new combination, and evaluates the classification performance of the Ansatz structure constructed by the combination in the local sub-circuit on the training samples according to the objective function. During the search process, it accepts suboptimal solutions and escapes local optima in a probabilistic manner, thereby finding the most discriminative subset (optimal qubit combination) in the qubit combination space.
[0128] The specific objective function B is defined as shown in formula (7):
[0129] B(U)=L.context(U) (7)
[0130] Where U=(Q) L Q R ) represents the combination of subsets of qubits selected from the left and right nodes. It is the classification loss value of the local Ansatz sub-circuit trained based on this combination on the validation set.
[0131] At the leaf node level, the combination of qubits is already fixed and does not need to be selected;
[0132] At each non-leaf node, simulated annealing starts from an initial combination of qubits; combined with Figure 2 For example, in the second layer, before constructing the first new node, in the left node Q... 2N In this example, there are m qubits in total, and given that V=2, the possible choices are: kind, and Let each represent a combination of qubits selected from the left and right nodes, assuming... Values One of the integers, ∈N + Different integers represent different combinations of qubits, for example =1 indicates Q L For [q0, q1]; then select the right node Q. 2N+1 Similarly, there are m qubits, and the possible combinations are also... Seed, set The value is taken as the ... One of the integers, ∈N + ,when =1 indicates Q R For [q] m+1 ,q m+2 After the left and right nodes are selected, the new node's qubit combination is [q0, q1, q]. m+1 ,q m+2 ].
[0133] Whenever a new node is constructed, there are two independent variables in the simulated annealing algorithm. and Through continuous optimization and The selection process involves performing domain perturbation, acceptance criteria, and temperature reduction operations, ultimately outputting a combination of qubits that optimizes local performance. This combination is then used to construct the Ansatz array for the current node, minimizing the classification loss of the Ansatz array constructed in the local sub-circuit for the training samples.
[0134] Example 2: Based on Example 1, taking the Iris 0-1 binary classification task as an example, the optimal qubit combination obtained by FBMT and SA algorithm (8 qubits) in this type of experiment is as follows: Figure 4 As shown.
[0135] The detailed Ansatz optimization steps are as follows:
[0136] S1: Data preprocessing and FBMT construction;
[0137] S11: Use PCA (Principal Component Analysis) to reduce the dimensionality of the Iris 0-1 binary classification dataset (100 training samples + 50 validation samples, each sample containing 4 original features: sepal length, sepal width, petal length, petal width) to 8 dimensions (to match the subsequent 8-qubit encoding requirements). Let the i-th sample (i = 1, 2, ..., 150) of the dimensionality-reduced Iris dataset be as shown in Equation (8):
[0138] (8)
[0139] Where, x ij (j=1,2,…,8) represents the j-th principal component feature of the i-th sample after dimensionality reduction by PCA, and all principal component features have been normalized to the [0,1] interval by Min-Max, satisfying the input requirements of quantum state encoding. After dimensionality reduction, as shown... Figure 5 As shown:
[0140] S12: In this embodiment, the construction of FBMT follows the logic of "bottom-up, layer-by-layer merging". The leaf node layer is initialized, and the encoded 8 qubits are divided into 4 leaf nodes according to the principle of "uniform partitioning". Each leaf node corresponds to a local quantum subsystem. The specific partitioning result is as follows: Figure 6 As shown:
[0141] The leaf node layer does not require qubit selection operations and directly serves as the bottom-level input of FBMT, providing initial quantum state information for subsequent regression.
[0142] S2: The Ansatz circuit transformation is performed in three layers from bottom to top: taking the 8-qubit Iris task as an example, there are 4 leaf nodes (each containing 2 qubits), 2 middle nodes (each containing 4 qubits), and 1 root node (containing 4 qubits). | This transforms the tree structure into a complete Ansatz training circuit. A hardware-efficient Ansatz structure is chosen; this paper selects a ring-shaped Ansatz architecture. A ring-shaped architecture is a topology that forms a ring from the first qubit to the last qubit, such as... Figure 7 As shown.
[0143] The complete training path will be constructed from bottom to top according to the hierarchical structure of a full binary merge tree, as follows: Figure 8 As shown.
[0144] S3: Root node layer merging (SA core optimization)
[0145] S31: Set the initial temperature T0=10.0 (to ensure that suboptimal solutions are accepted in the early stage and to cover most combinations), the temperature decay coefficient α=0.95, and iterate 50 times at each temperature;
[0146] S32: Randomly generate the initial qubit set S initial (For example, selecting {q0, q1} from node 1 and {q4, q5} from node 2), denoted as S. initial ={q0,q1,q4,q5}
[0147] S33: The temperature is successively decreased according to T = α × T. The process stops when the temperature drops to 0.1 and the loss change is < 0.001 for 10 consecutive iterations. The optimal combination is then output (e.g., S in the Iris task). opt ={q0,q1,q6,q7}), the corresponding Local value drops to 0.09, which is significantly lower than 0.1, indicating that the model has learned effective classification features, which is far better than the random level.
[0148] S34: Taking the Iris flower 0-1 binary classification experiment as an example, the optimal qubit combination (8 qubits) obtained by the Ansatz construction of FBMT and SA algorithm proposed in this invention in this type of experiment is as follows: Figure 9 As shown.
[0149] In summary, taking the Iris flower 0-1 binary classification task as an example, this algorithm fully verifies the feasibility and superiority of the Ansatz construction method based on Full Binary Merge Tree (FBMT) and Simulated Annealing (SA). The algorithm first expands the four original features of the dataset to eight dimensions using PCA dimensionality reduction to match the encoding requirements of 8 qubits. Then, Min-Max normalization ensures the input adaptability of the quantum state encoding. Next, following a bottom-up, layer-by-layer merging logic, FBMT is constructed, dividing the eight encoded qubits into four leaf nodes, each corresponding to a different feature encoding state. These are directly used as the bottom-level input without requiring additional qubit selection. Finally, the tree structure is transformed into a circular Ansatz training circuit, constructing a complete three-layer circuit from bottom to top, containing four leaf nodes, two intermediate nodes, and one root node.
[0150] In the core optimization phase, a global search for qubit combinations at the root node layer is performed using the simulated annealing (SA) algorithm. After multiple rounds of iterative cooling, the optimal qubit combination (such as S) is finally selected. opt ={q0,q1,q6,q7}), reducing the local classification loss to 0.09. This method effectively controls the line depth and reduces noise sensitivity through the hierarchical merging logic of FBMT, while using the SA algorithm to achieve task-oriented adaptive selection of qubits, avoiding the loss of key discriminative information.
[0151] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for constructing a task-adaptive quantum neural network, Ansatz, characterized in that, Includes the following steps: Step S1: Use PCA (Principal Component Analysis) to reduce dimensionality and directly output quantum-ready states for data preprocessing; Step S2: Construct a structured qubit organization method full binary merge tree: FBMT; Step S3: Construct Ansatz based on full binary merge tree and simulated annealing.
2. The method for constructing a task-adaptive quantum neural network Ansatz according to claim 1, characterized in that, The specific steps of step S1 are as follows: Step S11: Load the original dataset of N samples to obtain the feature matrix. With label vector The centered matrix is obtained by taking the mean of X column by column. As shown in formula (1): (1); Where R is all real numbers, N is the total number of samples, d is the original feature dimension, and K represents the total number of categories in the classification task. Let μ represent a column vector of all 1s, where μ ∈ R. d μᵀ is the mean vector for each dimension. Let μ be the transpose of μ. Repeat the mean vector N times; Step S12: Calculate the covariance matrix Σ, as shown in formula (2): (2); Then, eigenvalue decomposition is performed on it to obtain the orthogonal matrix Q and the diagonal matrix Λ, as shown in formula (3): Σ=QΛQᵀ (3; in: Let Σ be a diagonal matrix of eigenvalues, where λ is the eigenvalue of the covariance matrix Σ. For the corresponding eigenvector matrix, and the eigenvalues are arranged according to... Sort in descending order; Step S13: Based on the number of qubits n q Determine the dimensions to retain ,in⌊⌋ This represents the floor function, which takes the eigenvectors corresponding to the m largest eigenvalues to form the projection matrix. Perform linear transformation = This maximizes the variance of each principal component after transformation and makes the dimension m a power of 2, thus meeting the amplitude encoding requirements of subsequent quantum circuits. Step S14: Project the sample vector Calculate the normalization coefficient for each item. As shown in formula (4): (4) ; Generate quantum state amplitude vectors using formula (4) As shown in formula (5): (5); This results in the direct encoding as set ,in for quantum bit state, This indicates rounding up to the nearest integer.
3. The method for constructing a task-adaptive quantum neural network Ansatz according to claim 1, characterized in that, The specific steps of step S2 are as follows: Step S21: FBMT structural constraints and block partitioning; Step S22: Definition and selection mechanism of merged qubits; Step S23: Construct a full binary merge tree.
4. The method for constructing a task-adaptive quantum neural network Ansatz according to claim 3, characterized in that, The specific steps of step S21 are as follows: Step S211: Full binary tree structure constraints and bottom-up merge logic: The number of leaf nodes in FBMT is 2. p , where p∈N + , where N + The integer domain is positive; each non-leaf node is connected to exactly two child nodes. FBMT construction follows a bottom-up merging principle. First, the leaf nodes and their constituent sub-nodes are determined. Then, non-leaf nodes are constructed layer by layer upwards until a unique root node is generated. Step S212: Load Balancing: Before constructing the FBMT, the original quantum circuit is divided into K sub-blocks, satisfying the load balancing condition where K = 2. p d represents the total number of qubits in the quantum circuit. Each block contains approximately the same number of qubits, and the leaf nodes correspond to the local set of qubits in each block.
5. The method for constructing a task-adaptive quantum neural network Ansatz according to claim 3, characterized in that, The specific steps of step S22 are as follows: Define the merged quantum bit Q merged At non-leaf nodes: Q N From its left: Q 2N And right: Q 2N+1 The set of qubits selected from each of the two child nodes will together constitute the quantum subsystem associated with the non-leaf node, as shown in equation (6): (6); Among them, Choose_Left (Q 2N (, Param) represents selecting V qubits from the set of qubits of the left child node; Choose_Right (Q 2N+1 R_combined(Q, Param) represents selecting V qubits from the set of qubits of the right child node; N ) is a set of qubits with a size of 2V.
6. The method for constructing a task-adaptive quantum neural network Ansatz according to claim 3, characterized in that, The specific steps of step S23 are as follows: Step S231: Store the information of the set of qubits in each partition as leaf nodes; Step S232: Select the child node qubits from the set in a bottom-up, left-to-right order. A new node is formed by merging qubits.
7. The method for constructing a task-adaptive quantum neural network Ansatz according to claim 1, characterized in that, The specific steps of step S3 are as follows: Step S31: Combinatorial optimization problem modeling: In the construction process of each layer of FBMT, the merging selection of left and right child node qubits is modeled as a combinatorial optimization problem. Under the constraint that the number of qubits selected at each node is fixed at V, the discrimination ability of the local Ansatz sub-circuit on the training samples is maximized. Step S32: Simulated Annealing Global Search: Simulated Annealing Algorithm: SA performs a global search on the combinatorial optimization problem. In each iteration, it applies a perturbation to the current qubit combination to generate a new combination, and evaluates the classification performance of the Ansatz structure constructed by the combination in the local sub-circuit on the training samples according to the objective function. During the search process, it accepts suboptimal solutions and escapes local optima in a probabilistic manner, thereby finding the most discriminative subset in the qubit combination space. The specific objective function B is defined as shown in formula (7): B(U) = L.context(U) (7); Where U=(Q) L Q R L(U) represents the combination of a subset of qubits selected from the left and right nodes, and L.context(U) is the classification loss value of the local Ansatz sub-circuit trained based on this combination on the validation set.
8. The method for constructing a task-adaptive quantum neural network Ansatz according to claim 4, characterized in that, In step S212, each block contains approximately the same number of qubits, meaning the difference in the number of qubits contained in each block does not exceed 1.
9. The method for constructing a task-adaptive quantum neural network Ansatz according to claim 7, characterized in that, The simulated annealing algorithm in step S32, SA, is specifically as follows: At each non-leaf node, simulated annealing starts from an initial combination of qubits; before constructing the first new node, in the left node, there are a total of m qubits, and the possible choices are: kind, and Let these represent the combinations of qubits selected from the left and right nodes, respectively. Values One of the integers, ∈N + Different integers represent different combinations of qubits; Next, select the right node, which also has m qubits, and the possible combinations are also... Seed, set The value is taken as the ... One of the integers, ∈N + Once the left and right nodes have been selected, a new combination of qubits is formed.
10. The method for constructing a task-adaptive quantum neural network Ansatz according to claim 9, characterized in that, The two independent variables in the simulated annealing algorithm when a new node is constructed. and Through continuous optimization and The selection process involves performing domain perturbation, acceptance criteria, and temperature reduction operations, ultimately outputting a combination of qubits that optimizes local performance. This combination is then used to construct the Ansatz array for the current node, minimizing the classification loss of the Ansatz array constructed in the local sub-circuit for the training samples.