A method and device for error analysis based on context and topological feature extraction
By randomly walking in the quantum circuit to generate paths and extract gate feature vectors, combining dimensionality reduction and standard vector matching, efficient analysis and correction of quantum circuit errors is achieved, and error detection time and high false alarm rate in the existing technology are solved. The problem of the analysis improves the efficiency and accuracy of the analysis.
Patent Information
- Application Number
- CN202311224800.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-21
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2043-09-21
Smart Images

Figure CN117350392B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of quantum computing technology, and in particular relates to an error analysis method and device based on context and topological feature extraction. Background Art
[0002] In recent decades, quantum computing has developed rapidly. Compared with classical computing, quantum computing has achieved exponential or polynomial acceleration in various fields. Quantum circuits are a widely used and easy-to-implement programming model that uses quantum gates to represent operators to operate quantum computers. The literature (Preskill J. Quantum computing in the NISQera and beyond [J]. Quantum, 2018, 2: 79.) points out that the noisy intermediate-scale quantum (NISQ) era is the norm for quantum computers at this stage and in the foreseeable future. Noisy means that quantum bits have strong instability. In the existing superconducting material quantum computer implementation, there is only a stable duration of 80us. Beyond this time, the quantum superposition state stored in the quantum bit has a high probability of collapse. Intermediate-Scale means that existing quantum computers can only achieve a maximum of one hundred quantum bits. The limitations of existing physical implementations (maintaining the superconducting state, the difficulty of realizing quantum entanglement) hinder the possibility of creating large-scale (thousands of quantum bits) quantum computers that can maintain a stable state. Quantum circuits will inevitably produce many computational defects, such as hardware noise and circuit errors. Due to the semantic gap between the circuit programming model and the mathematical abstraction of quantum algorithms, errors (bugs) caused by the mismatch between quantum circuits and algorithms are prone to occur. In order to reduce the risk of errors (bugs) and mitigate their impact, it is necessary to build a model that can effectively analyze quantum circuits and guide the design optimization process.
[0003] However, debugging quantum programs is considerably more difficult than debugging classical programs because programmers have limited ability to probe the internal states of quantum programs; even when observations exist, those states are difficult to interpret. Most importantly, programmers have no guidelines on what to check when building quantum programs.
[0004] The paper (Huang Y, Martonosi M. Statistical assertions for validating patterns and finding bugs in quantum programs [C] / / Proceedings of the 46th International Symposium on Computer Architecture. 2019: 541-553.) proposed quantum program assertions based on classical observation statistical tests. It allows programmers to determine whether the state of a quantum program matches the expected value of one of its classical, superposition or entangled states. Their work also extends the existing quantum programming language to enable the specification of quantum assertions, which are then checked in the quantum program simulator. They used these assertions to debug three benchmark quantum programs in decomposition, search, and chemistry, shared the types of errors that may occur, and developed strategies for using quantum programming patterns to place assertions and prevent errors.
[0005] The above methods have two main disadvantages. First, methods including statistical assertions and dynamic assertions can only assert a limited number of types of states, namely classical, superposition, and specific entangled states. Second, the use cases of these assertions are limited because the programmer must know the precise state to be asserted, that is, when and where to assert in the circuit. In order to overcome the above two points, the literature (Liu J, Zhou H. Systematic approaches for precise and approximate quantum state runtime assertion [C] / / 2021 IEEE International Symposium on High-Performance Computer Architecture (HPCA). IEEE, 2021: 179-193.) proposed two systematic methods for dynamic quantum state assertions, which can assert a wider range of quantum states, including pure states and mixed states. They also introduced an approximate quantum state assertion method for situations where programmers have limited knowledge of quantum states. Approximate quantum state assertions can check whether a quantum state is a set of states {|ψ i ,|φ i ,...}. While exact quantum state assertions can check for a specific quantum state, approximate assertions provide a way to check whether a qubit of interest is in a superset of some expected states, analogous to Bloom filters used for membership checking in classical computing.
[0006] Some works start from another perspective. They expect to ensure the correct behavior of quantum programs through systematic and automated testing. To this end, the literature (Ali S, Arcaini P, Wang X, et al. Assessing the effectiveness of input and output coverage criteria for testing quantum programs [C] / / 2021 14th IEEE Conference on Software Testing, Verification and Validation (ICST). IEEE, 2021: 13-23.) proposed a method called QUantum InpuT Output coverage, which includes three coverage criteria and test case generation strategies defined on the input and output of quantum programs. The literature (Honarvar S, Mousavi MR, Nagarajan R. Property-based testing of quantum programs in Q# [C] / / Proceedings of the IEEE / ACM 42nd International Conference on Software Engineering Workshops. 2020: 430-435.) proposed a property-based structured testing framework.
[0007] All of the above work relies on classical simulation, which requires checking intermediate quantum states during the operation of a simulator or a real quantum computer. In addition, assertion-based methods cannot save circuit information in mathematical form for reuse, and require instant re-execution of similar quantum programs, which makes these methods very time-consuming - it takes a thousand years to simulate a 50-qubit circuit. On the other hand, false positives may occur due to noise in quantum hardware. Summary of the invention
[0008] In view of the above, an object of the present invention is to provide an error analysis method and device based on context and topological feature extraction to realize error analysis of quantum circuits.
[0009] To achieve the above-mentioned object of the invention, an embodiment of the present invention provides an error analysis method based on context and topological feature extraction, comprising the following steps:
[0010] Generate gate paths through random walks in quantum circuits. Paths represent chain relationships between gates. Chain relationships in paths represent topological features of circuits. Path types represent contextual information.
[0011] The gate feature vector is obtained by matching the path with the path table;
[0012] Reduce the dimension of the gate feature vector;
[0013] The gate features are labeled by matching the reduced gate feature vectors with a list of standard vectors;
[0014] Door error analysis is achieved by detecting the similarity of the door function to the door functions of adjacent doors.
[0015] In one embodiment, the path of performing random walk generation gate in a quantum circuit includes:
[0016] Taking each gate as the starting point, the path between the starting gate and the adjacent gates is constructed through random walk. According to the different positional relationships between gates, the path types include forward path, backward path and parallel path.
[0017] In one embodiment, obtaining the gate feature vector by matching the path with the path table includes:
[0018] The gate feature vector is obtained by matching the path with the path table. Each vector element in the gate feature vector corresponds to a path in the path table. The dimension of the gate feature vector is equal to the size of the path table. The elements of the path table are initialized to 0. If there is a path generated by k-step walks in the path table, the corresponding vector element value is set to α k , α≤1 represents the attenuation parameter, which is used to quantify each path to obtain the gate feature vector of each path. The gate feature vector evaluates the degree of interaction between gates.
[0019] In one embodiment, the dimensionality reduction of the gate feature vector includes:
[0020] The dimension of the gate feature vector is reduced by applying a linear transformation matrix to the gate feature vector, and the linear transformation matrix is obtained through training.
[0021] In one embodiment, the marking of gate functions by matching the reduced gate feature vector with a standard vector list comprises:
[0022] Calculate the distance between the reduced gate feature vector and each standard vector in the standard vector list, filter all standard vectors whose distance is less than the threshold, and mark the gate functions corresponding to all standard vectors as the gate functions corresponding to the gate feature vector.
[0023] In one embodiment, the standard vector list is pre-generated, wherein each standard vector has a corresponding gate function.
[0024] In one embodiment, the door error analysis is performed by detecting the similarity between the door function and the door functions of adjacent doors, including:
[0025] Assuming that the error gate only occurs in a subcircuit of the quantum circuit, each gate is first considered as an error gate, and the maximum number of gates that the error may involve is set to N b , collected in (N b +1) Adjacent gate G visited within step nb , adjacent gate G nb The shared gate function is m func , determine any gate function of the gate feature vector. If any of the following conditions is met, the gate is considered not to be an error gate, and the error analysis of the gate is realized;
[0026] Condition 1: The gate function of the gate exists in m func middle;
[0027] Condition 2: Adjacent door G nb There are more than N b The functions of the sub-circuits of the gates are the same, that is, num>N b .
[0028] In one embodiment, the error analysis method further includes repairing the error, modifying the gate function of the error gate to the gate function with the highest frequency among adjacent gates, including:
[0029] By tracing the path of the gate vector, the subcircuit where the erroneous gate is located is replaced with the correct form circuit in the circuit dataset. During the replacement process, the vector distance between the subcircuit where the original erroneous gate is located and the correct form circuit is aimed at minimizing while retaining the correct gate function.
[0030] To achieve the above-mentioned purpose of the invention, the embodiment further provides an error analysis device based on context and topological feature extraction, including a path generation module, a vectorization module, a dimension reduction module, a gate function marking module, and an error analysis module;
[0031] The path generation module is used to generate a path of gates by random walk in a quantum circuit, wherein the path represents a chain relationship between gates, the chain relationship in the path represents a topological feature of the circuit, and the path type represents context information;
[0032] The vectorization module is used to obtain a gate feature vector by matching the path with the path table;
[0033] The dimension reduction module is used to reduce the dimension of the door feature vector;
[0034] The gate function labeling module is used to label the gate function by matching the gate feature vector with the standard vector list;
[0035] The error analysis module is used to implement door error analysis by detecting similarity between door functions and door functions of adjacent doors.
[0036] In one embodiment, the device further includes an error repair module, which is used to modify the gate function of the error gate to the gate function with the highest frequency among adjacent gates, including:
[0037] By tracing the path of the gate vector, the subcircuit where the erroneous gate is located is replaced with the correct form circuit in the circuit dataset. During the replacement process, the vector distance between the subcircuit where the original erroneous gate is located and the correct form circuit is aimed at minimizing while retaining the correct gate function.
[0038] Compared with the prior art, the present invention has the following beneficial effects:
[0039] The present invention considers the dependency of a gate on its adjacent gates by combining the context information and topological structure of the gate by constructing a path, and extracts the gate feature vector by matching the path with the path table. In this way, the extraction of a single gate not only covers its gate type and the quantum bits involved, but also meticulously tracks its connection mode with other gates and the types of these gates, thereby improving the accuracy of error analysis. The gate feature vector is extracted by matching the path with the path table, and the gate feature vector is expressed in a unified data mathematical form, thereby avoiding repeated backtracking analysis of the original quantum circuit and improving the efficiency of error analysis. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0041] Figure 1 is a flow chart of an error analysis method based on context and topology feature extraction provided by an embodiment;
[0042] Figure 2 is an example diagram of a quantum circuit provided by an embodiment;
[0043] Figure 3 is a schematic diagram of the conversion process of a quantum circuit provided in an embodiment;
[0044] Figure 4 is a schematic diagram of a random walk provided by an embodiment;
[0045] Figure 5 is a schematic diagram of quantum circuit vectorization provided by an embodiment;
[0046] Figure 6 is a schematic diagram of vector dimensionality reduction provided by an embodiment;
[0047] Figure 7 is a schematic diagram of error detection and error repair provided by an embodiment;
[0048] Figure 8 is another flow chart of the error analysis method based on context and topology feature extraction provided by the embodiment;
[0049] Fig. 9 is a structural schematic diagram of an error analysis device based on context and topology feature extraction provided by an embodiment;
[0050] Fig.10 It is another structural schematic diagram of the error analysis device based on context and topological feature extraction provided by the embodiment. DETAILED DESCRIPTION
[0051] To make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific implementation methods described herein are only used to explain the present invention and do not limit the scope of protection of the present invention.
[0052] The inventive concept of the present invention is: the embodiment of the present invention provides an error analysis method and device based on context and topological feature extraction, which performs linear transformation on all gates in the quantum circuit, that is, after the gates are vectorized, the context information and topological structure of the quantum circuit are fully extracted, the characteristics of the quantum circuit are formulated, and a method for realizing automatic error detection by calculating the distance between the input gate vector and the standard vector from the algorithm data set is proposed for the first time, and a corresponding error correction scheme is provided.
[0053] like Figure 1 As shown, an embodiment provides an error analysis method based on context and topological feature extraction, comprising the following steps:
[0054] S110, a random walk is performed in a quantum circuit to generate a path of gates.
[0055] In an embodiment, a layer is defined as a basic unit for executing a quantum circuit. Each layer has at most one gate on the qubit state timeline, where gates on the same layer but from different qubit timelines are executed in parallel. Spatial noise is defined as the interaction noise between gates from the same layer, and temporal noise is defined as the interaction noise between gates from different layers. Figure 2 A circuit is shown with four layers, where the second layer has two gates. In quantum programs, the layers are executed sequentially. If equivalence is satisfied, the position of the gates can be changed. For example, the RX gate of the second layer can be moved to the third layer. Although the functionality of this circuit remains the same, the hardware behavior varies depending on the technology and topology, which provides optimization opportunities for noise analysis through circuit analysis.
[0056] In the embodiment, the path represents the chain relationship between gates, and the random walk method is used to generate the path. Each path is specific to the starting point. Specifically, starting from the target gate, the path to the adjacent gate is constructed by random selection. According to the different positional relationships between gates, there are three types of paths: forward path, backward path and parallel path. The chain relationship in the path represents the topological characteristics of the circuit, and the path type represents context information.
[0057] by Figure 3 We take quantum circuit as an example for specific analysis. We select the CX gates on the third-layer logic bits q2 and q3 as the target gate g i , apply random walks to generate multiple paths. Assuming the maximum number of steps outward is 2, the first random walk can generate the following paths:
[0058] Step = 0. Path 1: CX q3,q2
[0059] Step = 1. Path 2:
[0060] Step = 2. Path 3:
[0061] The second random walk yields the following path:
[0062] Step = 0. Path 4: CX q3,q2
[0063] Step = 1. Path 5:
[0064] Step = 2. Path 6:
[0065] Among them, parallel means parallel walk, former means forward walk, next means adjacent walk, gate types include RX, RY, RZ, CX, and the subscript of the gate indicates the position of the gate. Two random walks generate a total of 6 paths, such as Figure 4 As shown, each path records the circuit characteristics around the gate at the starting point. walk and the maximum number of steps N for each outward walk step is a hyperparameter that can be set. The upper limit of the number of paths of the gate is determined by the number of walks N walk and the maximum number of steps N step In addition, in the same walk, it is not allowed to traverse the same gate repeatedly.
[0066] S120, obtaining a gate feature vector by matching the path with the path table.
[0067] In an embodiment, a global path table is generated offline by applying random walks to all gates in the circuit dataset, such as Figure 5 As shown. The path table stores a large number of static paths, covering almost all structures of quantum circuits. The gate feature vector is obtained by matching the path generated in S110 with the path table. Each vector element in the gate feature vector corresponds to a path in the path table. The dimension of the gate feature vector is equal to the size of the path table. The elements of the path table are initialized to 0. For the above example, assuming that there are N paths in the path table, the dimension of the gate vector corresponding to the CX gate is N. Because 6 different paths were generated by 2 random walks of the CX gate, there are 6 non-zero elements in the gate vector, and the elements corresponding to the remaining unmatched paths are all 0. The value of the non-zero element is related to the length of the path. If there is a path generated by a k-step walk in the path table, the corresponding vector element value is set to α k , α≤1 represents the attenuation parameter, which is used to quantify each path to obtain the gate feature vector of each path. The gate feature vector evaluates the degree of interaction between gates.
[0068] Figure 5 This indicates that the third path (path 3) of the CX gate matches a path in the path table, and the corresponding element is set to α 2 Obviously, shorter paths will be assigned larger values in the vector, which follows the intuition that more attention should be paid to neighboring gates because they are more likely to exhibit higher interactions.
[0069] S130, reducing the dimension of the gate feature vector.
[0070] In the embodiment, the size of the gate feature vector determined by the size of the path table grows exponentially with the number of walks. For example, on a 5-bit quantum circuit, a maximum of two steps outward will generate more than 9,000 paths in the data set, which will increase the computational cost of subsequent analysis. After analysis, most of the more than 9,000 dimensional vectors are zero elements, with only a few non-zero elements. This is because the paths generated by a gate walk are very limited, and they only match a very small number of paths in the path table, so the gate vector is sparse in nature. Therefore, in the present invention, by adding a gate feature vector v path Apply the linear transformation matrix R (Reduction matrix) to reduce the dimension of the gate vector and obtain the gate feature vector v after dimensionality reduction i ,like Figure 6 As shown. The linear transformation matrix is obtained by training to minimize the difference between the matrix before and after dimensionality reduction, and the specific methods used are principal component analysis PCA and singular value decomposition SVD. Between contrast and balancing distance loss and computational complexity, dimensionality reduction to 100 dimensions is selected as an implementation of the present invention.
[0071] S140 , labeling gate functions by matching the reduced gate feature vector with a list of standard vectors.
[0072] Unlike traditional debugging methods that require repeated processing of a large number of samples, the error detection method of the present invention provides a one-time solution by using gate feature vectors from the upstream of the model. Since the gate feature vector involves multiple paths, it can be regarded as an abstraction of the module in the circuit. A quantum circuit utilizes many reusable modules that make up the algorithm. Usually, a quantum algorithm can be used to solve a class of problems, for example, quantum Fourier transform is often used to find the best decision strategy, and Grover algorithm is often used to estimate the expectation of discrete random processes. This makes it possible to infer the gate function by comparing the gate feature vector with a list of standard vectors derived from the quantum algorithm. This list of standard vectors is an algorithm data set generated offline from 17 widely used algorithms, where each standard vector is labeled with a gate function. Specifically, 17 widely used quantum algorithms were collected as data sets, and their vectorized representations were obtained using the above-mentioned vectorization method to correspond to the quantum algorithms from which they came, and the gate function was determined.
[0073] In order to infer the gate function of the target gate, the distance between the reduced gate feature vector and each standard vector in the standard vector list is calculated. The distance represents the difference between the input circuit and its correct form. All standard vectors with a distance less than the threshold are screened, and the gate functions corresponding to all standard vectors are marked as the gate functions corresponding to the feature vector. Figure 7 As shown in the figure, the standard vector list consists of two vectors marked as QFT function and QSVM function, and one vector marked as Grover function. When inferring what function the CZ gate of the third layer is, the distance is calculated using its corresponding gate feature vector and the standard vector in the standard vector list. Here, the threshold is set to 0.7, so the CZ gate is marked as QFT function and QSVM function.
[0074] S150, performing door error analysis by detecting similarity between the door function and the door functions of adjacent doors.
[0075] After marking all the gates in the circuit, we then apply an algorithm to detect gates that may have errors. The idea of the algorithm is that if the function of a gate is consistent with the functions of most of the gates around it, then this gate has a high probability of not being a bug. Based on the idea of the algorithm, the specific process includes:
[0076] Assuming that the error gate only occurs in a subcircuit of the quantum circuit, each gate is first considered as an error gate, and the maximum number of gates that the error may involve is set to N b , collected in (N b +1) Adjacent gate G visited within step nb , adjacent gate G nbThe gate function shared by most gates in is m func , determine any gate function of the gate feature vector. If any of the following conditions is met, the gate is considered not to be an error gate, and the error analysis of the gate is realized;
[0077] Condition 1: The function of the door is consistent with the most common function of most adjacent doors, that is, the door function of the door exists in m func Middle; Condition 2: Adjacent gate G nb There are more than N b The functions of the sub-circuits of the gates are the same, that is, num>N b .
[0078] In another embodiment, if Figure 8 As shown, the error analysis method based on context and topological feature extraction also includes:
[0079] S160, modifying the door function of the wrong door to the door function with the highest frequency among the adjacent doors.
[0080] In an embodiment, an effective method is to replace the subcircuit where the erroneous gate is located with the correct form circuit in the circuit data set by tracing the path of the gate vector. During the replacement process, the vector distance between the subcircuit where the original erroneous gate is located and the correct form circuit is minimized while retaining the correct gate function.
[0081] Figure 7 shows an example of analyzing a QFT circuit with a bug, where N b Set to 4, N b is the maximum number of gates that may be involved in an error. The error detection method marks the 5th, 6th, and 7th layers of the illustrated circuit as inverse quantum Fourier transform (invQFT) functions and analyzes them as potential errors. These gates can then be replaced with a subcircuit with QFT functions, which also shows the highest similarity to the original circuit.
[0082] Based on the same inventive concept, the embodiment also provides an error analysis device based on context and topological feature extraction, such as Fig. 9 As shown, the device 900 includes a path generation module 910, a vectorization module 920, a dimension reduction module 930, a gate function labeling module 940, and an error analysis module 950;
[0083] Among them, the path generation module 910 is used to generate the path of the gate by random walk in the quantum circuit; the vectorization module 920 is used to obtain the gate feature vector by matching the path with the path table; the dimension reduction module 930 is used to reduce the dimension of the gate feature vector; the gate function marking module 940 is used to mark the gate function by matching the reduced dimension gate feature vector with the standard vector list; the error analysis module 950 is used to implement the error analysis of the gate by detecting the similarity between the gate function and the gate function of the adjacent gate.
[0084] In another embodiment, Fig.10 As shown, the error analysis device 900 based on context and topology feature extraction further includes an error repair module 960, which is used to modify the gate function of the error gate to the gate function with the highest frequency among adjacent gates.
[0085] It should be noted that the error analysis device based on context and topology feature extraction provided in the above embodiment should be illustrated with the division of the above functional modules when performing error analysis, and the above functions can be assigned to different functional modules as needed, that is, the internal structure of the terminal or server is divided into different functional modules to complete all or part of the functions described above. In addition, the error analysis device based on context and topology feature extraction provided in the above embodiment belongs to the same concept as the error analysis method embodiment based on context and topology feature extraction. The specific implementation process is detailed in the error analysis method embodiment based on context and topology feature extraction, which will not be repeated here.
[0086] The error analysis method and device based on context and topological feature extraction provided in the above embodiment, in the experimental example, predict and debug a circuit with 1000 gates in only about 650 milliseconds and 100 seconds respectively (using Intel E5-2630CPU), which is much shorter than the assertion-based method. In addition, the present invention proposes that the error detection model can be extended to 300 qubits. In terms of error detection, the error detection model showed a success rate of 73.39% and a false alarm rate of 1.71% in 2024 benchmark tests of 17 algorithms.
[0087] The specific implementation methods described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. An error analysis method based on context and topological feature extraction, It is characterized in that The following steps are involved: Generate gate paths through random walks in quantum circuits. Paths represent chain relationships between gates. Chain relationships in paths represent topological features of circuits. Path types represent contextual information. The gate feature vector is obtained by matching the path with the path table. Each vector element in the gate feature vector corresponds to a path in the path table. The dimension of the gate feature vector is equal to the size of the path table. The elements of the path table are initialized to 0. If there is a path generated by k-step walks in the path table, the corresponding vector element value is set to α k , α≤1 represents the attenuation parameter, which is used to quantify each path to obtain the gate feature vector of each path. The gate feature vector evaluates the degree of interaction between gates. A global path table is generated offline by applying random walks on all gates in the circuit dataset; Reduce the dimension of the gate feature vector; The gate features are labeled by matching the reduced gate feature vectors with a list of standard vectors; The gate error analysis is achieved by detecting the similarity of the gate function with the gate functions of the neighboring gates, including: assuming that the erroneous gate occurs only in a subcircuit of the quantum circuit, each gate is first considered as an erroneous gate, Set the maximum number of gates N that may be involved in the error b , collected in (N b +1) Adjacent gate G visited within step nb , adjacent gate G nb The shared gate function is m func , determine any gate function of the gate feature vector. If any of the following conditions is met, the gate is considered not to be an error gate, and the error analysis of the gate is realized; Condition 1: The gate function of the gate exists in m func middle; Condition 2: Adjacent door G nb There are more than N b The functions of the sub-circuits of the gates are the same.
2. The error analysis method based on context and topological feature extraction according to claim 1, It is characterized in that The path of performing random walk generation gate in the quantum circuit includes: Taking each gate as the starting point, the path between the starting gate and the adjacent gates is constructed through random walk. According to the different positional relationships between gates, the path types include: forward path, backward path and parallel path.
3. The error analysis method based on context and topological feature extraction according to claim 1, It is characterized in that The step of reducing the dimension of the gate feature vector comprises: The dimension of the gate feature vector is reduced by applying a linear transformation matrix to the gate feature vector, and the linear transformation matrix is obtained through training.
4. The error analysis method based on context and topological feature extraction according to claim 1, It is characterized in that The gate features are labeled by matching the reduced gate feature vector with a list of standard vectors, including: Calculate the distance between the reduced gate feature vector and each standard vector in the standard vector list, filter all standard vectors whose distance is less than the threshold, and mark the gate functions corresponding to all standard vectors as the gate functions corresponding to the gate feature vector.
5. The error analysis method based on context and topological feature extraction according to claim 4, It is characterized in that The standard vector list is pre-generated, wherein each standard vector has a corresponding gate function.
6. The error analysis method based on context and topological feature extraction according to claim 1, It is characterized in that The error analysis method further includes repairing the error, modifying the gate function of the error gate to the gate function with the highest frequency among the adjacent gates, including: By tracing the path of the gate vector, the subcircuit where the erroneous gate is located is replaced with the correct form circuit in the circuit dataset. During the replacement process, the vector distance between the subcircuit where the original erroneous gate is located and the correct form circuit is aimed at minimizing while retaining the correct gate function.
7. An error analysis device based on context and topological feature extraction, It is characterized in that It includes path generation module, vectorization module, dimension reduction module, gate function marking module and error analysis module; The path generation module is used to generate a path of gates by random walk in a quantum circuit, wherein the path represents a chain relationship between gates, the chain relationship in the path represents a topological feature of the circuit, and the path type represents context information; The vectorization module is used to obtain a gate feature vector by matching the path with the path table. Each vector element in the gate feature vector corresponds to a path in the path table. The dimension of the gate feature vector is equal to the size of the path table. The elements of the path table are initialized to 0. If there is a path generated by k-step walks in the path table, the corresponding vector element value is set to α k , α≤1 represents the attenuation parameter, which is used to quantify each path to obtain the gate feature vector of each path. The gate feature vector evaluates the degree of interaction between gates. A global path table is generated offline by applying random walks on all gates in the circuit dataset; The dimension reduction module is used to reduce the dimension of the door feature vector; The gate function labeling module is used to label the gate function by matching the gate feature vector with the standard vector list; The error analysis module is used to implement gate error analysis by detecting the similarity between the gate function and the gate function of adjacent gates, including: assuming that the error gate only occurs in the subcircuit of the quantum circuit, each gate is first regarded as an error gate, Set the maximum number of gates N that may be involved in the error b , collected in (N b +1) Adjacent gate G visited within step nb , adjacent gate G nb The shared gate function is m func , determine any gate function of the gate feature vector. If any of the following conditions is met, the gate is considered not to be an error gate, and the error analysis of the gate is realized; Condition 1: The gate function of the gate exists in m func middle; Condition 2: Adjacent door G nb There are more than N b The functions of the sub-circuits of the gates are the same.
8. The error analysis device based on context and topological feature extraction according to claim 7, It is characterized in that The system further includes an error repair module, which is used to modify the gate function of the error gate to the gate function with the highest frequency among the adjacent gates, including: By tracing the path of the gate vector, the subcircuit where the erroneous gate is located is replaced with the correct form circuit in the circuit dataset. During the replacement process, the vector distance between the subcircuit where the original erroneous gate is located and the correct form circuit is aimed at minimizing while retaining the correct gate function.
