Distributed deployment method of quantum neural network based on quantum chip noise vector
By constructing and grouping the noise vectors of quantum chips, sharing gradients and performing accuracy calculations in ring units, the inconsistency of parameter caused by noise differences in distributed quantum neural network deployment is solved, and high-precision deployment and inference efficiency are achieved.
Patent Information
- Application Number
- CN202510111770.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-24
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2045-01-24
AI Technical Summary
In the distributed deployment, the parameters are inconsistent due to the noise differences between different devices, making it difficult to achieve high-precision deployment and reasoning.
By constructing the noise vector of each quantum chip, grouping based on the noise vector distance threshold, sharing the gradient to update the model weight parameters, and dimensionality reduction through the multi-dimensional scale change algorithm to perform inference accuracy calculation in the ring unit, achieving efficient allocation of tasks.
It realizes high-precision deployment of quantum neural network models in the training, inference and maintenance stages, improving the deployment efficiency and accuracy of the model.
Smart Images

Figure CN119558421B_ABST
Abstract
Description
Technical Field
[0001] The field of quantum neural networks, specifically involves the distributed deployment method of quantum neural networks based on quantum chip noise vectors. Background Art
[0002] At present, quantum neural networks have become a very promising quantum technology. The literature (SK Jeswal1, S. Chakraverty. Recent Developments and Applications in Quantum Neural Network: A Review[J]. Archives of Computational Methods in Engineering, 2019, 26: 793–807.) demonstrates its application in various practical tasks, including face recognition and breast cancer prediction.
[0003] Specifically, quantum neural networks are a new neural network paradigm for processing machine learning tasks. This method encodes classical features into quantum states, and evolves through quantum gates based on quantum superposition and entanglement, and converts them into target states for classification. Similar to traditional deep neural networks, quantum neural network models are composed of multiple quantum circuit modules, each of which learns the characteristics of data. Unlike traditional deep neural networks, quantum neural networks process data in an exponentially dimensional quantum state space, making it possible to learn data of higher complexity at the same model scale. At the same time, quantum neural networks can use the parallelism brought by quantum superposition to accelerate the reasoning process of the model.
[0004] However, the current scale of quantum chips hinders the realization of more complex quantum neural network models. The existing single quantum computer can only achieve a maximum of one thousand quantum bits. This constraint makes the deployment and training of large-scale quantum neural network models more challenging, and the training time using a single quantum computer is significantly extended. At present, distributed quantum computing is mainly used to improve computing power, and the training and reasoning of quantum neural networks are deployed on multiple quantum devices. The literature (T. Khare, R. Majumdar, et al. Parallelizing quantum-classical workloads: Profiling the impact of splitting techniques[J]. IEEE InternationalConference on Quantum Computing and Engineering, 2023, 1: 990-1000.) draws on different strategies of classical distributed machine learning, including model parallelism and data parallelism, and studies quantum and classical workloads in the task splitting process. The model parallel strategy divides a larger quantum circuit into multiple smaller circuits, and the data parallelism distributes the training data to different devices for model updating. These distributed training methods based on the parallel strategy of classical machine learning have improved the training speed of quantum neural network models to a certain extent. However, since current quantum devices are inevitably affected by various noises, such as environmental radiation, quantum bit crosstalk, etc., the deployment accuracy of quantum neural networks is reduced.
[0005] The paper (Hanrui Wang, Jiaqi Gu, et al. QuantumNAT: Quantum Noise-Aware Training with Noise Injection, Quantization and Normalization[J]. ACM / IEEE Design Automation Conference, 2022, 1-6.) applies the classical error mitigation method to the training of quantum neural network models, including noise injection, quantization and regularization. This method reduces the noise impact on the model during the single-machine training of the quantum neural network and improves the training accuracy of the model.
[0006] The paper (H. Wang, Z. Li, et al. QOC: Quantum on-chip training with parameter shift and gradient pruning [J]. ACM / IEEE Design Automation Conference, 2022, 655–660.) implements gradient calculation on quantum chips based on gradient shift technology, and uses pruning technology to remove gradient information affected by large noise. This method ensures that the results of forward propagation and backward propagation are affected by the same noise when updating the model, which is exponentially faster than using the finite differential law to calculate the gradient.
[0007] Both of the above noise mitigation methods have brought about improvements in training accuracy in single-machine quantum neural network training, but cannot be directly applied to distributed quantum neural network training. This is because the noise differences in different devices will cause the parameters to move in different directions, so there are certain conflicts between the calculation results of different devices, making it difficult to effectively train quantum neural network models applicable to all quantum chips. The literature (S. Stein, N. Wiebe, et al. EQC: Ensembled quantum computing for variational quantum algorithms [J]. International Symposium on Computer Architecture, 2022, 59–71.) implements a distributed quantum variational algorithm training framework that considers the noise of different devices. It uses weighted parameter updates based on the estimated error of the device. However, this method must run the quantum neural network model on all trained distributed quantum devices for inference. Current quantum devices need to be frequently online and offline due to updates and calibrations, and the same quantum device also has heterogeneity on the time scale, that is, gate fidelity drifts and device states change frequently. Therefore, the quantum neural network model trained on a specific quantum device cannot be redeployed on other quantum devices with high accuracy. Summary of the invention
[0008] The present invention provides a quantum neural network distributed deployment method based on quantum chip noise vectors. The deployment method can generate noise vectors with a unified format to characterize the noise relationship between quantum chips. In the corresponding noise space, the quantum neural network model can be deployed with high precision to perceive noise in the training, reasoning, and maintenance stages, and the deployment efficiency of the model can be improved.
[0009] The present invention provides a quantum neural network distributed deployment method based on quantum chip noise vector, comprising:
[0010] A quantum neural network model with the same model structure and different weight parameters is loaded on different quantum chips in the quantum chip cluster. The noise vector of each quantum chip is a one-dimensional vector composed of the cumulative error rate of the original gates of each layer and the cumulative error rate of the exchange gates of each layer.
[0011] The quantum chips are grouped based on the set noise vector distance threshold. At the same time, the noise vector distance between two quantum chips is used as the exponential power variable to construct the similarity between the quantum chips, thereby obtaining the similarity between the current quantum chip and other quantum chips in the same group. The gradient of each quantum chip is obtained after each iteration. The final gradient of the current quantum chip is obtained by adding the product of the gradients of other quantum chips in the same group and the corresponding similarity with the current quantum chip, and the local gradient of the current quantum chip is added. The weight parameters of the corresponding quantum neural network are updated based on the final gradient.
[0012] After reducing the dimension of the noise vector and model vector in the trained quantum chip through the multi-dimensional scaling algorithm, the noise vector and model vector after dimension reduction are used to compare with the set cycle period. T Construct an initial ring unit and map it to a T The ring is divided into multiple sub-units by equidistant partitioning, and the reasoning accuracy of each sub-unit is calculated. Based on the category-related probability of each task, each task is assigned to the sub-unit with the corresponding calculation accuracy, thereby realizing category judgment.
[0013] Preferably, the method for obtaining the noise vector of each quantum chip comprises:
[0014] Divide the quantum circuit into multiple layers according to the time step, and accumulate the error rate of the original gates of each layer to obtain the cumulative error rate of the original gates of each layer;
[0015] The error rate of the switching gates of each layer is accumulated to obtain the cumulative error rate of the switching gates of each layer;
[0016] The noise vector of the quantum chip is constructed based on the cumulative error rate of the original gates of each layer and the cumulative error rate of the exchange gates of each layer.
[0017] Preferably, the similarity between quantum chips is obtained by calculating the noise vector distance index of each quantum chip, including:
[0018] The distance between quantum chips is obtained based on the Euclidean norm of the noise vectors of the two quantum chips, and the similarity between quantum chips is obtained by taking the distance between quantum chips as the variable factor of the power of the natural exponential function.
[0019] Preferably, the loss of each quantum chip after each iteration is obtained through quantum measurement, and the gradient of each quantum chip is obtained based on the loss and parameter offset, and the gradient of each quantum chip includes the gradient of each original gate and the gradient of each exchange gate.
[0020] Preferably, the multi-dimensional noise vector and model vector are reduced to points on a one-dimensional straight line, and the noise vector and model vector points after dimensionality reduction are used to compare with the set cycle period. T Construct an initial ring unit and map it to a T On the ring, the cycle T for: , ,in, and are the noise vector sequence of each quantum chip and the model vector sequence of the quantum neural network model, is an imaginary unit, u is the index of the noise vector, v is the index of the weight vector, For the discrete Fourier transform The frequency subscript of each model weight vector after .
[0021] Preferably, the initial ring unit is divided into a plurality of subunits by equidistant partitioning, so that each subunit includes a quantum chip with a dissimilar noise vector.
[0022] Preferably, the inference accuracy of each subunit is the average accuracy of each quantum chip test data set in the unit.
[0023] Preferably, obtaining the category-related probability of each task includes:
[0024] Performing a set ratio of sampling numbers on the quantum chip cluster to collect class-related probabilities of the output;
[0025] The corresponding tasks are ranked by difficulty based on the category-related probabilities, and each task is assigned to a sub-unit of corresponding reasoning accuracy for reasoning based on the difficulty ranking.
[0026] Preferably, when a quantum chip is put online to a quantum chip cluster, the quantum chip adjacent to the online quantum chip in the quantum chip cluster is obtained by similarity of the noise vector. x The parameter vector of the quantum neural network model of a quantum chip for: ,in, For the newly introduced x The similarity between the noise vector of the quantum chip and the adjacent y-th quantum chip in the quantum chip cluster, For the yThe quantum neural network model parameters of each quantum chip; when a quantum chip is offline to the quantum chip cluster, the quantum neural network model parameter vector and noise vector of the offline quantum chip are cached through weights;
[0027] When calibrating a quantum chip, first take the quantum chip that needs to be calibrated offline, and retain the quantum neural network model parameter vector and noise vector of the offline quantum chip. Then, bring the offline quantum chip back online, and use the above-mentioned method for putting the quantum chip online to calculate the quantum neural network model parameter vector of the quantum chip that is back online.
[0028] Compared with the prior art, the present invention has the following beneficial effects:
[0029] The noise vector constructed by the present invention using the cumulative error rate of the original gates and the cumulative error rate of the exchange gates of each layer not only takes into account the noise size of the quantum chip, but also takes into account the influence of the additional noise of different topological structures. The present invention uses the noise vector to quantize the similarity between quantum chips to ensure that quantum chips with higher similarity can cooperate better. At the same time, the present invention forms a group of quantum chips with the current quantum chip and the adjacent quantum chips, and each group of quantum chips shares the gradient, so as to make full use of the parallelism of similar quantum chips and improve accuracy.
[0030] The present invention also allocates more difficult tasks, i.e., tasks with significant probabilities in multiple categories, to high-precision sub-units for reasoning based on category-related probabilities, and allocates easier tasks, i.e., tasks with fewer categories with significant probabilities, to low-precision sub-units for reasoning, thereby improving computational efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 A schematic diagram of a typical quantum neural network model provided for a specific embodiment of the present invention;
[0032] Figure 2 Schematic diagram of different quantum neural network models on heterogeneous quantum chips provided by specific embodiments of the present invention;
[0033] Figure 3 A flow chart of a quantum neural network distributed deployment method based on quantum chip noise vector provided by a specific embodiment of the present invention;
[0034] Figure 4 A schematic diagram of quantum chip noise vectorization provided for a specific embodiment of the present invention;
[0035] Figure 5 A schematic diagram of quantum chip similarity relationship and gradient sharing parallel training provided by a specific embodiment of the present invention;
[0036] Figure 6 A schematic diagram of large-scale reasoning task scheduling provided for a specific embodiment of the present invention;
[0037] Figure 7 A schematic diagram of model redeployment and fine-tuning provided in a specific embodiment of the present invention. DETAILED DESCRIPTION
[0038] In conjunction with the accompanying drawings, the specific embodiment of the present invention specifically describes the quantum neural network distributed deployment method based on quantum chip noise vector as follows:
[0039] like Figure 1 As shown, the typical quantum neural network model structure is mainly divided into encoding layer, learning layer and measurement layer.
[0040] Due to the semantic gap between classical information and quantum information, the encoding layer aims to convert classical data of machine learning tasks into quantum parameters. For example, the pixels of the input image are encoded into a set of parameters of the RY gate through amplitude encoding, i.e. R Y ( x 11), R Y ( x twenty one), R Y ( x 31), R Y ( x 41), R Y ( x 12), R Y ( x twenty two) R Y ( x 32), R Y ( x 42); The learning layer consists of several repeated quantum circuit blocks, each of which contains a controlled U-gate for generating quantum entanglement and a series of single gates, which serve as the backbone of the quantum neural network model, where the gate parameters can be regarded as trainable weights. The measurement layer generates the final output by measuring the probability distribution of quantum states. This probability distribution provides a prediction of the basic state corresponding to a category, and the model weights are updated by gradient calculation based on the predicted results. Unlike classical neural networks that perform only a single readout per iteration, the output probability of a quantum circuit is derived by repeatedly executing and measuring the circuit multiple times.
[0041] After obtaining the prediction of the latest iteration, the gate parameters of the learning layer, that is, the weights, are further updated through gradient calculation, and then the next iteration is performed.
[0042] The quantum neural network model provided by the specific embodiment of the present invention is deployed on a quantum chip, which is the basic hardware for deploying quantum gates on quantum bits. Quantum chips often contain different physical configurations, such as: the number of quantum bits, decoherence time, topology and fidelity. These characteristics lead to different performances when the same quantum neural network model is deployed on these heterogeneous quantum devices. Quantum devices will inevitably suffer from various noises that reduce the fidelity of quantum gates. Even for devices using the same technology, their fidelity may be different due to environmental interactions, hardware defects and different crosstalk, so the weights of quantum neural network models after optimization on different quantum devices are different. Secondly, the constraints of the topology require the addition of additional exchange (SWAP) gate operations to ensure that the two-bit quantum gate across quantum bits is effective, and the additional exchange (SWAP) gate will result in additional gate error rates, resulting in different final weights of the quantum neural network model.
[0043] Therefore, the key feature of the quantum neural network model is that its optimal weight parameters are closely related to quantum device properties such as noise and topology. Furthermore, the inherent heterogeneity of quantum chips makes it difficult for the parallelism of distributed computing to play a role. In order to solve this problem, the specific embodiment of the present invention applies a personalized quantum neural network model to each quantum chip, such as Figure 2 As shown in the figure, all quantum chips maintain a unified model structure, and different topological structures are realized by performing different exchange operations through exchange gates, thereby obtaining different quantum gate errors, different outputs, and different model optimal weights, while the controlled U(θ1), U(θ2), U(θ3), and U(θ4) are different original gates, and have different weight parameters in the quantum gates. In this way, the model parameters can better fit the properties of heterogeneous hardware, thereby achieving higher accuracy and robustness.
[0044] like Figure 3 As shown, a specific embodiment of the present invention provides a quantum neural network distributed deployment method based on quantum chip noise vector, including:
[0045] (1) Constructing a noise vector for each quantum chip: In order to obtain a personalized quantum neural network model, the specific embodiment of the present invention requires a method to quantify the influence of the noise and topological structure of the quantum chip, and the method is as follows:
[0046] After compiling the quantum neural network circuit under the constraints of a specific quantum chip, the specific embodiment of the present invention first vectorizes the executable circuit. During the vectorization process, the vector elements are arranged from the upper left to the lower right according to the execution order in the quantum neural network circuit, that is, the time step, to form multiple layers. Considering that multiple parallel quantum gates may be interchanged after compilation, the specific embodiment of the present invention unifies the order according to the order of the original quantum circuit.
[0047] After unifying the arrangement order of quantum circuits, the specific embodiment of the present invention splits the quantum circuits into two parts, namely, the quantum circuits of the original gates and the quantum circuits of the exchange gates due to topological structure restrictions, such as Figure 4 As shown, in the quantum circuit of the original gate, the corresponding element of the noise vector is the cumulative error rate of the original gate of each layer of the quantum circuit of the original gate, that is, the gate error. In the quantum circuit of the switching gate, the corresponding element of the noise vector is the cumulative error rate of the switching gate of each layer of the quantum circuit of the switching gate, that is, the switching error.
[0048] In the quantum circuit part of the original gate, since the optimized weight mainly depends on the error rate of the original gate, the p-th element value of the noise vector provided by the specific embodiment of the present invention is the cumulative error rate of the original gate of the p-th layer, as shown in formula (1):
[0049] , ,in, is the noise vector p element values, In the quantum circuit of the primitive gate p Tier q The error rate of the original gate, , , They are the quantum circuits of the original gates. p Tier q The runtime, decoherence time and fidelity of each primitive gate.
[0050] The vector length of the exchange gate part provided by the specific embodiment of the present invention is aligned with the vector generated by the original gate part. Specifically, the exchange gate is generated by a two-qubit gate composed of two non-adjacent qubits, which means that the error of the exchange gate will cause the parameter deviation of its corresponding two-qubit gate. Similarly, the specific embodiment of the present invention can calculate the corresponding element value of the exchange gate vector by formula (1), which means the connectivity of the quantum chip topology structure.
[0051] Finally, the vector generated by the original gate part and the vector generated by the exchange gate part are combined into a one-dimensional vector.
[0052] (2) Construct the similarity between quantum chips based on the noise vector, group the quantum chips based on the similarity, and each group of quantum chips shares the gradient to update the weight parameters of the quantum neural network: After the noise of each quantum chip is quantized, the distributed training of the quantum neural network model is performed next. Distributed training is based on all noise vectors. The key idea of the specific embodiment of the present invention is to treat quantum chips with similar noise vectors as a combination, which helps to fully utilize the parallelism of distributed devices and minimize the overhead of heterogeneity. In order to quantify this similarity, we define quantum chips x and quantum chips y The distance between them is the Euclidean norm of the noise vectors of the two , as follows formula (2): ,in, For the x The noise vector of a quantum chip, For the y The noise vector of a quantum chip, is the length of the noise vector.
[0053] The specific embodiment of the present invention groups quantum chips by setting a noise vector distance threshold. In addition, the specific embodiment of the present invention quantifies the similarity between every two quantum chip nodes to ensure that the devices with the highest similarity can better collaborate. The similarity between quantum chip i and quantum chip j The definition is as shown in the following formula (3): ,in, is a hyperparameter that determines the similarity range.
[0054] The similarity provided by the specific embodiment of the present invention decays exponentially as the distance between the two quantum chips increases. At this time, the influence of the shared gradient will be smaller. The similarity calculation provided by the specific embodiment of the present invention is as follows: Figure 5 As shown, QPU is a quantum chip, and different numbers represent different quantum chips. Based on the noise vector distance threshold, QPU5, QPU6, QPU7, and QPU8 are grouped together, and QPU1, QPU3, QPU7, and QPU9 are grouped together, and the similarity between each pair is calculated.
[0055] The specific embodiment of the present invention will show that quantum chips with similarities tend to prefer the same optimal weights, so the specific embodiment of the present invention allows quantum chips in the same group to share gradients. Specifically, in each iteration, the quantum chip will run the locally stored quantum neural network model, and by measuring the calculation loss, the specific embodiment of the present invention applies parameter offset to obtain the local gradient of the weight, which will be shared with other quantum chips in the same group. Therefore, each quantum chip will also cache the gradients from adjacent nodes, that is, other quantum chips in the same group, and use these gradients to update the local quantum neural network model. Ultimately, the final gradient is the cached shared gradient, that is, the gradient of other quantum chips in the same group multiplied by the corresponding similarity + local gradient to obtain the final gradient of the current quantum chip, so that the parallelism of similar quantum chips can be fully utilized.
[0056] In a specific embodiment, training and gradient sharing examples are as follows Figure 5 As shown, the loss value of 0.247 is obtained during the training process of the local quantum neural network model of QPU1 provided by the present invention, and the parameter offset is obtained based on the detected loss value. The local gradient (local grad) is obtained based on the parameter offset. The local gradient provided by the specific embodiment of the present invention includes the gradients of each original gate and each exchange gate, such as Figure 5 It is shown as [0.14 0.23 0.21 0.07]. The local gradient plus the gradient of other quantum chips in the same group multiplied by the sum of the corresponding similarities is the final gradient. It can be understood that the corresponding similarity is the similarity between other quantum chips in the same group and QPU1.
[0057] (3) Large-scale task scheduling based on trained quantum chip clusters: After the quantum neural network model is trained, the next step is to obtain prediction results through reasoning. In order to achieve low latency and high throughput, large-scale reasoning tasks usually need to be parallelized. However, traditional batch-based parallel methods may affect accuracy, especially in personalized quantum neural network models. The reasoning results of the quantum neural network model are obtained by multiple sampling to obtain probability distribution, which provides more opportunities for refining inference tasks. In addition, since quantum chips with similar noise vectors have similar noise patterns, reasoning bias may be introduced, resulting in loss of accuracy. In order to achieve high-precision large-scale reasoning, it is necessary to keep the noise patterns of quantum chips in a single reasoning quantum chip unit different. Based on this feature, the present invention improves the overall reasoning accuracy of reasoning tasks through two major technical solutions: noise balancing node grouping and reasoning task preference matching, and implements more flexible load balancing and task scheduling strategies based on task scheduling at the circuit repetition level.
[0058] The specific embodiment of the present invention first uses a multidimensional scaling algorithm to reduce the dimensionality of the noise vector space and the model parameter vector space of the quantum chip cluster, thereby converting the multidimensional connection relationship of the quantum chip cluster into points on a one-dimensional straight line, which is conducive to reducing the computational complexity caused by the sorting similarity. After the multidimensional scaling algorithm, the two adjacent nodes in the vector space still retain part of the connection information, but the algorithm deletes some other connection information, which may cause two elements in the sequence that are far apart to still have similarities. In order to capture this similarity, and considering the periodicity between the noise vector and the model vector, we apply the model sequence to group such distant similarities. Mathematically, considering the model sequence as a signal sequence that changes with the behavior node, the model node sequence transformation is shown in formula (4): ,in and are the noise vector sequence and the quantum neural network model weight vector sequence, is an imaginary unit, u is the index of the noise vector, v is the index of the weight vector, For the discrete Fourier transform The frequency subscript of each model weight vector after . The elements in the model vector sequence Pointing to the same quantum chip Next, we select the maximum frequency to calculate the cycle period of the noise vector T , the formula (5) for calculating the cycle period T is as follows: ,in For the discrete Fourier transform The frequency subscript of each model weight is then added. The period 𝑇 represents the maximum distance between nodes in the noise vector space. It can be understood that the noise vector space is constructed by multiple noise vectors, and the nodes are noise vectors. The specific embodiment of the present invention first constructs the noise vector sequence into an initial ring unit through the period T, that is, the sequence constructed by the noise vectors of the quantum chip cluster, and then constructs the initial ring unit (QPU ring) by mapping and aligning it to a ring with a circumference of 𝑇, that is, obtaining a ring noise space. Finally, the specific embodiment of the present invention divides the initial ring unit into multiple smaller sub-units by equidistant division, from Figure 6 It can be seen that the specific embodiment of the present invention selects a noise vector for every two nodes in the initial ring unit, that is, every two noise vectors, and divides it into a subunit, so that the noise vectors of each subunit have no similarity, and then calculates the reasoning accuracy of each subunit, and sorts the set according to their reasoning accuracy.
[0059] The reasoning accuracy of each subunit provided by the specific embodiment of the present invention is the average accuracy on the test data set.
[0060] The specific embodiment of the present invention also designs a warm-up phase, in which a small number of samples are performed on all quantum chips to collect output probabilities. Since the ideal output is a category of the classification task, if there is a significant probability associated with multiple categories, the task is considered difficult. At this time, the specific embodiment of the present invention defines the difficulty of reasoning as the ratio of the second largest probability value of each category obtained after warm-up to the maximum probability value. The smaller the ratio, the lower the difficulty. In order to ensure the realization of the global optimal solution, the sampling of difficult reasoning tasks is performed on high-precision quantum chip sub-units, while the sampling of simpler reasoning tasks is performed on quantum chip sub-units with lower precision, such as Figure 6 As shown, in one embodiment, based on the first reasoning task, 1% of the sampling number is executed on the quantum chip, and the probability of obtaining 80% is category I. Based on the second reasoning task, 1% of the sampling number is executed on the chip, and the probability of obtaining 60% is category II. In comparison, in the difficulty priority queue, the first reasoning task is easier than the second reasoning task. Therefore, the first reasoning task is assigned to the quantum chip subunit with a reasoning accuracy of 92%, that is, quantum chipset 3, and the second reasoning task is assigned to the quantum chip subunit with a reasoning accuracy of 97%, that is, quantum chipset 1, so as to achieve efficient and accurate calculations.
[0061] The specific embodiment of the present invention also balances the workload according to the sampling throughput of each unit, and the number of samplings executed per unit time can be calculated as shown in the following formula (6): ,in h is the number of layers of the quantum circuit, t is the running time of the original door, ts The time interval between each sampling is the process of returning to the initial state. Then, in the scheduling stage, the specific embodiment of the present invention allocates the sampling of the inference task in proportion to the sampling throughput of each quantum chip unit. In addition, in each unit, the specific embodiment of the present invention allocates the sampling according to the throughput of each quantum chip, thereby achieving a completely balanced workload scheduling.
[0062] like Figure 6 As shown, the present invention first constructs a quantum chip unit by reducing the dimension of the noise vector space through a multidimensional scaling algorithm, and then divides it into multiple smaller units through equidistant partitioning. The quantum chips involved in the same sub-unit have different noise vectors so that they can compensate for each other's noise. In addition, the present invention designs a warm-up phase to preliminarily outline the difficulty of the target task, that is, the loss of each task. Then, we use a fully balanced scheduling based on sampling throughput to more accurately allocate difficult tasks to quantum chip units.
[0063] Unlike neural networks on classical computers, the fragile capabilities of quantum chips inevitably require refreshing and calibration, causing the model weights to become outdated when various parameters of the quantum chip change. Due to the high update frequency, it is impractical to retrain the quantum neural network model. The key idea here is to observe that there is a correlation between the model parameter vector and the noise vector. Devices with similar noise vectors tend to have similar optimal weights. It has been experimentally demonstrated that for a typical quantum neural network model implemented on a set of quantum chips, there is an approximately linear correlation between the weight parameter vector and the noise vector of the quantum neural model.
[0064] The weight parameter vector and noise vector of the quantum neural model provided by the specific embodiment of the present invention have an approximately linear correlation formula: , where e is the error rate, is the gate parameter. Referring to the IBM Cario quantum computer, the range of e is between 1e-4 and 6e-4, so ;and ,so e; so and Keep the approximate linear ,in x and y Refers to the number of the quantum chip, v m is the model weight vector, v c refers to the noise vector and C is a constant.
[0065] Based on the above correlation, a specific embodiment of the present invention further provides a method for putting quantum chips online and offline in a quantum chip cluster, and calibrating quantum chips, including:
[0066] like Figure 7 As shown in (b), when a quantum chip is put online in the quantum chip cluster, a new quantum chip 6 is introduced. The specific embodiment of the present invention uses formula (3) to calculate the similarity between the noise vector of quantum chip 6 and other noise vectors. The noise vectors are grouped by similarity. Therefore, the quantum neural network model of the new quantum chip obtains its own weight by proportionally accumulating the weights of other quantum chips. A new quantum chip x After joining the cluster, we can initialize its model parameter vector according to the following formula (7): x The parameter vector of the quantum neural network model of a quantum chip for: ,in, For the newly introduced x The similarity between the noise vector of the quantum chip and the adjacent y-th quantum chip in the quantum chip cluster, For the y The quantum neural network model parameters of a quantum chip.
[0067] like Figure 7 (a) shows that when quantum chip 1 is taken offline from the quantum chip cluster, the quantum neural network model parameter vector and noise vector of the offline quantum chip are retained through the weight cache for fine-tuning.
[0068] like Figure 7 (c) shows that when calibrating the quantum chip 3, the quantum chip 3 that needs to be calibrated is first taken offline, and the quantum neural network model parameter vector and noise vector of the offline quantum chip are retained. Then the offline quantum chip 3 is put back online, and the above-mentioned method of putting the quantum chip online is used to regroup according to the new noise vector, and the quantum neural network model parameter vector of the quantum chip that is put back online is calculated.
Claims
1. A quantum neural network distributed deployment method based on quantum chip noise vector, characterized in that: include: A quantum neural network model with the same model structure and different weight parameters is loaded on different quantum chips in the quantum chip cluster. The noise vector of each quantum chip is a one-dimensional vector composed of the cumulative error rate of the original gates of each layer and the cumulative error rate of the exchange gates of each layer. The quantum chips are grouped based on the set noise vector distance threshold. At the same time, the noise vector distance between two quantum chips is used as the exponential power variable to construct the similarity between the quantum chips, thereby obtaining the similarity between the current quantum chip and other quantum chips in the same group. The gradient of each quantum chip is obtained after each iteration. The final gradient of the current quantum chip is obtained by adding the product of the gradients of other quantum chips in the same group and the corresponding similarity with the current quantum chip, and the local gradient of the current quantum chip is added. The weight parameters of the corresponding quantum neural network are updated based on the final gradient. After reducing the dimension of the noise vector and model vector in the trained quantum chip through the multi-dimensional scaling algorithm, the noise vector and model vector after dimension reduction are used to compare with the set cycle period. T Construct an initial ring unit and map it to a T The ring is divided into multiple sub-units by equidistant partitioning, and the reasoning accuracy of each sub-unit is calculated. Based on the category-related probability of each task, each task is assigned to the sub-unit with the corresponding calculation accuracy, thereby realizing category judgment.
2. The quantum neural network distributed deployment method based on quantum chip noise vector according to claim 1 is characterized in that: The method for obtaining the noise vector of each quantum chip includes: Divide the quantum circuit into multiple layers according to the time step, and accumulate the error rate of the original gates of each layer to obtain the cumulative error rate of the original gates of each layer; The error rate of the switching gates of each layer is accumulated to obtain the cumulative error rate of the switching gates of each layer; The noise vector of the quantum chip is constructed based on the cumulative error rate of the original gates of each layer and the cumulative error rate of the exchange gates of each layer.
3. The quantum neural network distributed deployment method based on quantum chip noise vector according to claim 1 is characterized in that: The similarity between quantum chips is obtained by calculating the noise vector distance index of each quantum chip, including: The distance between quantum chips is obtained based on the Euclidean norm of the noise vectors of the two quantum chips, and the similarity between quantum chips is obtained by taking the distance between quantum chips as the variable factor of the power of the natural exponential function.
4. The quantum neural network distributed deployment method based on quantum chip noise vector according to claim 1 is characterized in that: The loss of each quantum chip after each iteration is obtained through quantum measurement, and the gradient of each quantum chip is obtained based on the loss and parameter offset. The gradient of each quantum chip includes the gradient of each original gate and the gradient of each exchange gate.
5. The quantum neural network distributed deployment method based on quantum chip noise vector according to claim 1 is characterized in that: Reduce the multi-dimensional noise vector and model vector to points on a one-dimensional straight line, and use the reduced noise vector and model vector points and the set cycle T Construct an initial ring unit and map it to a T On the ring, the cycle T for: , ,in, and are the noise vector sequence of each quantum chip and the model vector sequence of the quantum neural network model, is an imaginary unit, u is the index of the noise vector, v is the index of the weight vector, For the discrete Fourier transform The frequency subscript of each model weight vector after .
6. The quantum neural network distributed deployment method based on quantum chip noise vector according to claim 1 is characterized in that: The initial ring unit is divided into a plurality of subunits by equidistant partitioning, so that each subunit includes a quantum chip with dissimilar noise vectors.
7. The quantum neural network distributed deployment method based on quantum chip noise vector according to claim 1 is characterized in that: The inference accuracy of each subunit is the average accuracy of each quantum chip test data set within the unit.
8. The quantum neural network distributed deployment method based on quantum chip noise vector according to claim 1 is characterized in that: Get the category-related probabilities for each task, including: Performing a set ratio of sampling numbers on the quantum chip cluster to collect class-related probabilities of the output; The corresponding tasks are ranked by difficulty based on the category-related probabilities, and each task is assigned to a sub-unit of corresponding reasoning accuracy for reasoning based on the difficulty ranking.
9. The quantum neural network distributed deployment method based on quantum chip noise vector according to claim 1 is characterized in that: When a quantum chip is put online in a quantum chip cluster, the quantum chip adjacent to the online quantum chip in the quantum chip cluster is obtained through the similarity of the noise vector. x The parameter vector of the quantum neural network model of a quantum chip for: ,in, For the newly introduced x The similarity between the noise vector of the quantum chip and the adjacent y-th quantum chip in the quantum chip cluster, For the y The quantum neural network model parameters of a quantum chip; When a quantum chip is offline in the quantum chip cluster, the quantum neural network model parameter vector and noise vector of the offline quantum chip are cached through weights; When calibrating a quantum chip, first take the quantum chip that needs to be calibrated offline, and retain the quantum neural network model parameter vector and noise vector of the offline quantum chip. Then, bring the offline quantum chip back online, and use the above-mentioned method for putting the quantum chip online to calculate the quantum neural network model parameter vector of the quantum chip that is back online.
Citation Information
Patent Citations
Heterogeneous graph neural network noise tolerance method based on Transform and comparative learning
CN117787379A
Quantum neural network training method and device for resisting quantum noise
CN118036699A