CN116739100A - Vulnerability detection method of quantum neural network and automatic driving vulnerability detection method - Google Patents
Vulnerability detection method of quantum neural network and automatic driving vulnerability detection method Download PDFInfo
- Publication number
- CN116739100A CN116739100A CN202310845001.5A CN202310845001A CN116739100A CN 116739100 A CN116739100 A CN 116739100A CN 202310845001 A CN202310845001 A CN 202310845001A CN 116739100 A CN116739100 A CN 116739100A
- Authority
- CN
- China
- Prior art keywords
- quantum
- neural network
- entanglement
- optimization target
- network model
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 56
- 238000013528 artificial neural network Methods 0.000 title claims abstract description 55
- 238000005457 optimization Methods 0.000 claims abstract description 87
- 238000003062 neural network model Methods 0.000 claims abstract description 71
- 238000012545 processing Methods 0.000 claims abstract description 18
- 238000012549 training Methods 0.000 claims abstract description 17
- 238000004364 calculation method Methods 0.000 claims abstract description 15
- 238000000034 method Methods 0.000 claims description 31
- 238000012360 testing method Methods 0.000 claims description 21
- 230000006870 function Effects 0.000 claims description 13
- 238000005259 measurement Methods 0.000 claims description 12
- 230000001174 ascending effect Effects 0.000 claims description 4
- 230000006399 behavior Effects 0.000 claims description 4
- 230000007613 environmental effect Effects 0.000 claims description 4
- 238000013507 mapping Methods 0.000 claims description 4
- 239000011159 matrix material Substances 0.000 claims description 4
- 238000000691 measurement method Methods 0.000 claims description 4
- 230000035772 mutation Effects 0.000 claims description 4
- 239000002245 particle Substances 0.000 claims description 4
- 239000002096 quantum dot Substances 0.000 claims description 4
- 230000009466 transformation Effects 0.000 claims description 4
- 230000003042 antagnostic effect Effects 0.000 claims 1
- 238000010586 diagram Methods 0.000 description 7
- 230000008485 antagonism Effects 0.000 description 3
- 238000010801 machine learning Methods 0.000 description 3
- 238000013461 design Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N10/00—Quantum computing, i.e. information processing based on quantum-mechanical phenomena
- G06N10/70—Quantum error correction, detection or prevention, e.g. surface codes or magic state distillation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N10/00—Quantum computing, i.e. information processing based on quantum-mechanical phenomena
- G06N10/20—Models of quantum computing, e.g. quantum circuits or universal quantum computers
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02T—CLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
- Y02T10/00—Road transport of goods or passengers
- Y02T10/10—Internal combustion engine [ICE] based vehicles
- Y02T10/40—Engine management systems
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Evolutionary Computation (AREA)
- Data Mining & Analysis (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Artificial Intelligence (AREA)
- Condensed Matter Physics & Semiconductors (AREA)
- Mathematical Analysis (AREA)
- Mathematical Optimization (AREA)
- Pure & Applied Mathematics (AREA)
- Computational Mathematics (AREA)
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses a vulnerability detection method of a quantum neural network, which comprises the steps of obtaining original input data and an initial quantum neural network model, and constructing a quantum state data set through coding processing; determining an optimization target for the challenge sample search by calculating the gradient direction; determining an optimization target of quantum entanglement coverage through a quantum state entanglement coverage calculation method of the model; defining a joint optimization target, and generating a target disturbance operator through optimization processing; adopting an initial network model and a target disturbance operator to finish vulnerability detection of the model; the invention also discloses an automatic driving vulnerability detection method, which comprises the steps of acquiring environment image data of an automatic driving system in a driving scene and an initial quantum neural network model applicable to the automatic driving system; training by a vulnerability detection method of a quantum neural network; and (5) completing vulnerability detection of the automatic driving system by adopting a training result. The reliability of the vulnerability detection method is improved, and the reliability of automatic driving is also improved.
Description
Technical Field
The invention belongs to the technical field of quanta, and particularly relates to a leak detection method of a quantum neural network and an automatic driving leak detection method.
Background
The quantum neural network model is a mixed quantum-classical machine learning model proposed for recent noisy medium-scale quantum computing equipment, and solves some specific supervised and unsupervised learning tasks including classification and regression and modeling task generation by optimizing a loss function on a parameter vector to be reduced to convergence; with the development of quantum computers, the quantum neural network model has a wide release space in terms of potential quantum advantages of learning ability and resource consumption.
The quantum neural network model plays an important role in the field of quantum technology, so that in practical application, requirements are put on the reliability of the quantum neural network model, vulnerability detection is carried out on the quantum neural network model, and the reliability of the model is very necessary.
At present, a leak detection method for a quantum neural network model does not exist.
When the classical machine learning technology adopted in the current automatic driving field is used for model training, a large amount of data sample support is often required, and meanwhile, huge training expenditure is also faced, the quantum neural network model is applied to an automatic driving system, so that the problems of high resource expenditure and low learning efficiency during machine learning model training can be effectively solved through parallelism and coherence, and the automatic driving performance is improved; however, the automatic driving system using the quantum neural network model still has the problem that the reliability cannot fully meet the required requirements, and the system is still easily interfered by influencing factors, so that the accuracy of the whole system is reduced.
In summary, most of the existing quantum neural network models still need to solve the problem of insufficient reliability, and meanwhile, the use of the quantum neural network in the automatic driving system also has an influence on the automatic driving system.
Disclosure of Invention
The invention aims to provide a vulnerability detection method of a quantum neural network, which has the advantages of improved reliability and increased accuracy.
The second objective of the present invention is to provide an automatic driving vulnerability detection method with enhanced reliability and improved robustness.
The vulnerability detection method of the quantum neural network provided by the invention comprises the following steps:
s1, acquiring original input data and an initial quantum neural network model, and performing coding processing on the acquired data to construct a quantum state data set;
s2, determining an optimization target for searching an countermeasure sample by adopting the quantum state data set constructed in the step S1 and an initial quantum neural network model and calculating a gradient direction;
s3, determining an optimization target of quantum entanglement coverage by adopting the quantum state data set constructed in the step S1 and an initial quantum neural network model and a quantum state entanglement coverage calculation method of the model;
s4, adopting the countermeasure sample search optimization target determined in the step S2 and the quantum entanglement coverage optimization target determined in the step S3 to define a joint optimization target, and generating a target disturbance operator through optimization;
s5, adopting the initial quantum neural network model obtained in the step S1 and the target disturbance operator generated in the step S4 to finish leak detection of the quantum neural network model.
The step S1 of obtaining the original input data and the initial quantum neural network model, performing coding processing on the obtained data, and constructing a quantum state data set, specifically comprising:
the initial quantum neural network model is a well-trained neural network to be tested, and specifically comprises the following steps:
"training completion" is expressed as: the quantum neural network model to be tested is characterized in that through the learning of training data, all learning indexes are converged in a set range in the test data, and model parameters are fixed based on training results;
the quantum neural network is designed to be a parameterized quantum circuit consisting of a coding circuit and a variation circuit, and specifically comprises the following components:
variational circuitThe system consists of a group of parameter-containing revolving doors and fixed doors which are arranged in a specific model, wherein the parameter-containing revolving doors are used for traversing unitary transformation existing in Hilbert space, and the fixed doors are controlled doors for providing coherence;
the structure of the coding line is determined by selecting a state preparation scheme for coding the environmental image data into a quantum state; determining a state preparation scheme based on the relation of the dimensions and the computing resources of the data set;
selecting an angle code as a state preparation scheme; the coding line is composed of a plurality of revolving doors with parameters, wherein the parameters of the revolving doors are determined by the information of the image data;
the width of the whole quantum neural network is designed to depend on the number of quantum bits required for encoding an input data set, and the higher the dimension of the input data is, the larger the scale of a circuit is;
the quantum state data set constructed by the step S1 and the initial quantum neural network model in the step S2 are used for determining an optimization target for the challenge sample search by calculating the gradient direction, and the method specifically comprises the following steps:
(2-1) performing observation projection processing on the quantum system through measurement operation to obtain a prediction tag;
(2-2) acquiring a gradient between an input quantum state in the model and the prediction label acquired in the step (2-1) and a gradient direction of each classification result;
(2-3) selecting a gradient direction corresponding to the first n categories having the highest observation probability and different from the original prediction category obtained by the observation processing, and determining an optimization target for the challenge sample search by adding up the gradient directions of the first n categories and subtracting the direction of the original prediction category to obtain a tensor expression of the prediction difference, wherein the optimization target for the challenge sample search is expressed by the following formula:
wherein ,yi For the first n label categories with highest prediction probability and different from the original prediction category, y is the original label input by the test;
(2-4) calculating a loss function for the predictive label:
the calculation of the loss function is represented by the following formula:
wherein ,<x|k representing the kth data in the quantum state dataset; y is k Representing a label corresponding to the kth data in the quantum state data set; e represents an identity matrix;
the loss function values of the original class labels and the quantum neural network model are improved through a gradient ascending algorithm, and the loss values of other class labels are reduced through a gradient descending algorithm, so that the maximization of the differential behaviors is realized;
the quantum state data set constructed by the step S1 and the initial quantum neural network model in the step S3 are used for determining an optimization target of the quantum entanglement coverage rate through a quantum state entanglement coverage rate calculation method of the model, and the method specifically comprises the following steps:
selecting a polynomial global measurement method of multi-particle entanglement, calculating quantum entanglement coverage rate of a quantum neural network model, and recording the polynomial global measurement as entanglement measurement Q;
the linear mapping process acting on the computation basis is expressed using the following formula:
wherein j=1, …, n;indicating that the first qubit is missing; delta represents a kronecker symbol;
the entanglement metric Q for the quantum state |ψ > is calculated using the following formula:
wherein Q is more than or equal to 0 and less than or equal to 1, and the larger the value of Q is, the higher the corresponding entanglement degree is; d represents the generalized distance, and for a given quantum state |u > and |v >, the corresponding generalized distance D is calculated as follows:
|u>=∑u i |i>
|v>=Σv i |i>
calculating a difference value between the quantum state entanglement amount before the quantum neural network is input and the quantum state entanglement amount after the quantum neural network is input, and simultaneously solving a gradient direction of the quantum entanglement coverage rate by taking the increased difference value as a target, so as to determine an optimization target of the quantum entanglement coverage rate, wherein the optimization target is expressed by adopting the following formula:
wherein ,representing degree of entanglement of quantum states output from quantum neural network;Q(|x>) Representing entanglement of quantum states input from the quantum neural network;
the step S4 of adopting the antagonism sample search optimization target determined in the step S2 and the quantum entanglement coverage optimization target determined in the step S3 to define a joint optimization target, and generating a target disturbance operator through optimization processing, specifically comprises the following steps:
adopting the countermeasure sample search optimization target determined in the step S2 and the quantum entanglement coverage optimization target determined in the step S3, and adopting the following formula to define a gradient search joint optimization target for mutation:
obj=λ 1 ×obj a +λ 2 ×obj e
wherein obj represents a gradient search joint optimization target; obj a Representing an optimization objective against the sample search portion, lambda 1 A superparameter representing a control weight; obj e Representing an optimization objective of the quantum entanglement coverage portion; lambda (lambda) 2 A hyper-parameter representing an optimization target weight that balances the two parts;
searching perturbation operator U through gradient ascent algorithm p Continuously mutating the original test input |x>Until the iteration is finished, the optimization target is subjected to maximization;
the step S5 is to complete the leak detection of the quantum neural network model by adopting the initial quantum neural network model obtained in the step S1 and the target disturbance operator generated in the step S4, and specifically comprises the following steps:
the target disturbance operator U generated in the step S4 is processed p Acting on the original input |x>The variation input |x 'is obtained'>Will |x'>Re-inputting the predicted result and the original input |x into the initial quantum neural network model obtained in the step S1>Is inconsistent with the predicted result of (a), and indicates that the input |x is generated for the original input>Is a challenge test input; if the output prediction result is equal to the original input |x>The predicted results of the quantum entanglement coverage rate can be improved in the outputted predicted results, and the variation input with the disturbance size meeting the preset requirement is stored in a seed queue for continuous variation; completion of quantum neural network model by determining whether to generate challenge test inputVulnerability detection, if an countermeasure test input is generated, indicating that a model has vulnerabilities;
the invention also provides an automatic driving vulnerability detection method, which comprises the following steps:
A1. acquiring environment image data of an automatic driving system in a driving scene, and acquiring an initial quantum neural network model applicable to the automatic driving system;
A2. adopting the image data and the initial model obtained in the step A1, and carrying out vulnerability detection of the initial model by a vulnerability detection method of a quantum neural network;
A3. and (3) completing the vulnerability detection of the automatic driving system by adopting the result obtained after the detection in the step (A2).
According to the vulnerability detection method of the quantum neural network, provided by the invention, the initial quantum neural network model is trained and optimized to determine the target disturbance operator, so that the vulnerability detection of the model is completed; according to the automatic driving vulnerability detection method provided by the invention, the vulnerability detection method of the quantum neural network is applied to an automatic driving system, so that the vulnerability detection aiming at the automatic driving system is completed; the vulnerability detection method of the quantum neural network provided by the invention has high reliability and high accuracy; the loophole detection method for the automatic driving also improves the reliability and the robustness of an automatic driving system.
Drawings
Fig. 1 is a schematic flow chart of a method for detecting a vulnerability of a quantum neural network in the present invention.
Fig. 2 is an algorithm pseudo-code schematic diagram of a vulnerability detection method of a quantum neural network in the present invention.
Fig. 3 is a schematic circuit structure diagram of a quantum neural network model to be tested in the vulnerability detection method of the quantum neural network in the invention.
Fig. 4 is a schematic flow chart of a method for detecting loopholes in automatic driving according to the present invention.
Fig. 5 is a schematic design diagram of a method for detecting a vulnerability of automatic driving in the present invention.
Detailed Description
A schematic process flow diagram of the method of the present invention is shown in fig. 1: the vulnerability detection method of the quantum neural network provided by the invention comprises the following steps:
s1, acquiring original input data and an initial quantum neural network model, and performing coding processing on the acquired data to construct a quantum state data set; the method specifically comprises the following steps:
the initial quantum neural network model is a well-trained neural network to be tested, and specifically comprises the following steps:
"training completion" is expressed as: the quantum neural network model to be tested is characterized in that through the learning of training data, all learning indexes are converged in a set range in the test data, and model parameters are fixed based on training results;
the quantum neural network is designed to be a parameterized quantum circuit consisting of a coding circuit and a variation circuit, and specifically comprises the following components:
variational circuitThe system consists of a group of parameter-containing revolving doors and fixed doors which are arranged in a specific model, wherein the parameter-containing revolving doors are used for traversing unitary transformation existing in Hilbert space, and the fixed doors are controlled doors for providing coherence;
the structure of the coding line is determined by selecting a state preparation scheme for coding the environmental image data into a quantum state; determining a state preparation scheme based on the relation of the dimensions and the computing resources of the data set;
selecting an angle code as a state preparation scheme; the coding line is composed of a plurality of revolving doors with parameters, wherein the parameters of the revolving doors are determined by the information of the image data;
the width of the whole quantum neural network is designed to depend on the number of quantum bits required for encoding an input data set, and the higher the dimension of the input data is, the larger the scale of a circuit is;
s2, determining an optimization target for searching an countermeasure sample by adopting the quantum state data set constructed in the step S1 and an initial quantum neural network model and calculating a gradient direction; the method specifically comprises the following steps:
(2-1) performing observation projection processing on the quantum system through measurement operation to obtain a prediction tag;
(2-2) acquiring a gradient between an input quantum state in the model and the prediction label acquired in the step (2-1) and a gradient direction of each classification result;
(2-3) selecting a gradient direction corresponding to the first n categories having the highest observation probability and different from the original prediction category obtained by the observation processing, and determining an optimization target for the challenge sample search by adding up the gradient directions of the first n categories and subtracting the direction of the original prediction category to obtain a tensor expression of the prediction difference, wherein the optimization target for the challenge sample search is expressed by the following formula:
wherein ,yi For the first n label categories with highest prediction probability and different from the original prediction category, y is the original label input by the test;
(2-4) calculating a loss function for the predictive label:
the calculation of the loss function is represented by the following formula:
wherein ,<x|k representing the kth data in the quantum state dataset; y is k Representing a label corresponding to the kth data in the quantum state data set; e represents an identity matrix;
the loss function values of the original class labels and the quantum neural network model are improved through a gradient ascending algorithm, and the loss values of other class labels are reduced through a gradient descending algorithm, so that the maximization of the differential behaviors is realized;
s3, determining an optimization target of quantum entanglement coverage by adopting the quantum state data set constructed in the step S1 and an initial quantum neural network model and a quantum state entanglement coverage calculation method of the model; the method specifically comprises the following steps:
selecting a polynomial global measurement method of multi-particle entanglement, calculating quantum entanglement coverage rate of a quantum neural network model, and recording the polynomial global measurement as entanglement measurement Q;
the linear mapping process acting on the computation basis is expressed using the following formula:
wherein j=1, …, n;indicating that the first qubit is missing; delta represents a kronecker symbol;
the entanglement metric Q is calculated using the following formula:
wherein Q is more than or equal to 0 and less than or equal to 1, and the larger the value of Q is, the higher the corresponding entanglement degree is; d represents the generalized distance, and for a given quantum state |u > and |v >, the corresponding generalized distance D is calculated as follows:
|u>=∑u i |i>
|v>=∑v i |i>
calculating a difference value between the quantum state entanglement amount before the quantum neural network is input and the quantum state entanglement amount after the quantum neural network is input, and simultaneously solving a gradient direction of the quantum entanglement coverage rate by taking the increased difference value as a target, so as to determine an optimization target of the quantum entanglement coverage rate, wherein the optimization target is expressed by adopting the following formula:
wherein ,representing entanglement of quantum states output from the quantum neural network; q (|x)>) Representing entanglement of quantum states input from the quantum neural network;
s4, adopting the countermeasure sample search optimization target determined in the step S2 and the quantum entanglement coverage optimization target determined in the step S3 to define a joint optimization target, and generating a target disturbance operator through optimization; the method specifically comprises the following steps:
adopting the countermeasure sample search optimization target determined in the step S2 and the quantum entanglement coverage optimization target determined in the step S3, and adopting the following formula to define a gradient search joint optimization target for mutation:
obj=λ 1 ×obj a +λ 2 ×obj e
wherein obj represents a gradient search joint optimization target; obj a Representing an optimization objective against the sample search portion, lambda 1 A superparameter representing a control weight; obj e Representing an optimization objective of the quantum entanglement coverage portion; lambda (lambda) 2 A hyper-parameter representing an optimization target weight that balances the two parts;
searching perturbation operator U through gradient ascent algorithm p Continuously mutating the original test input |x>Until the iteration is finished, the optimization target is subjected to maximization;
s5, adopting the initial quantum neural network model obtained in the step S1 and the target disturbance operator generated in the step S4 to finish leak detection of the quantum neural network model; the method specifically comprises the following steps:
the target disturbance operator U generated in the step S4 is processed p Acting on the original input |x>The variation input |x 'is obtained'>Will |x'>Re-inputting the predicted result and the original input |x into the initial quantum neural network model obtained in the step S1>Is inconsistent with the predicted result of (a), and indicates that the input |x is generated for the original input>Is a challenge test input; if the output prediction result is equal to the original input |x>The prediction results of the (a) are identical, and quantum entanglement can be improved in the output prediction resultsThe variation input with the cover rate and the disturbance size meeting the preset requirement is stored in a seed queue to continue variation; completing leak detection of the quantum neural network model by judging whether to generate countermeasure test input, and if so, indicating that the model has a leak;
two measures are proposed to generate an index of robustness against the sample, including:
(1) For the raw input dataset, an Average Fidelity Metric (AFM) is defined that generates an challenge sample, the calculation formula is as follows:
wherein ,xi Representing raw input data;representing the resulting variant input; f (·) represents fidelity; for the target quantum states ρ and σ, the corresponding calculation formulas for fidelity are as follows:
(2) For the original input dataset, an Average Trace Distance (ATD) is defined to generate the challenge sample, the calculation formula is as follows:
wherein D (·) represents the trace distance, and the calculation formula is as follows:
the degree of similarity between the antagonism sample and the original data sample is reflected by the indexes AFM and ATD, and the higher the degree of similarity is, the stronger the robustness of the antagonism sample is, and the higher the corresponding quality is.
FIG. 2 is a schematic diagram of algorithm pseudo code of the vulnerability detection method of quantum neural network according to the present invention; fig. 3 is a schematic circuit structure diagram of a quantum neural network model to be tested in the vulnerability detection method of the quantum neural network according to the present invention;
fig. 4 is a schematic flow chart of a method for detecting loopholes in automatic driving according to the present invention:
the invention also provides an automatic driving vulnerability detection method, which comprises the following steps:
A1. acquiring environment image data of an automatic driving system in a driving scene, and acquiring an initial quantum neural network model applicable to the automatic driving system;
A2. adopting the image data and the initial model obtained in the step A1, and carrying out vulnerability detection of the initial model by a vulnerability detection method of a quantum neural network; the method specifically comprises the following steps:
s1, acquiring original input data and an initial quantum neural network model, and performing coding processing on the acquired data to construct a quantum state data set; the method specifically comprises the following steps:
the initial quantum neural network model is a well-trained neural network to be tested, and specifically comprises the following steps:
"training completion" is expressed as: the quantum neural network model to be tested is characterized in that through the learning of training data, all learning indexes are converged in a set range in the test data, and model parameters are fixed based on training results;
the quantum neural network is designed to be a parameterized quantum circuit consisting of a coding circuit and a variation circuit, and specifically comprises the following components:
the quantum neural network is designed to be a parameterized quantum circuit consisting of a coding circuit and a variation circuit, and specifically comprises the following components:
variational circuitIs composed of a group of rotary gates with parameters for traversing the Hilbert space and fixed gates arranged in a specific modelUnitary transformation, fixed gates are controlled gates that provide coherence;
the structure of the coding line is determined by selecting a state preparation scheme for coding the environmental image data into a quantum state; determining a state preparation scheme based on the relation of the dimensions and the computing resources of the data set;
selecting an angle code as a state preparation scheme; the coding line is composed of a plurality of revolving doors with parameters, wherein the parameters of the revolving doors are determined by the information of the image data;
the width of the whole quantum neural network is designed to depend on the number of quantum bits required for encoding an input data set, and the higher the dimension of the input data is, the larger the scale of a circuit is;
s2, determining an optimization target for searching an countermeasure sample by adopting the quantum state data set constructed in the step S1 and an initial quantum neural network model and calculating a gradient direction; the method specifically comprises the following steps:
(2-1) performing observation projection processing on the quantum system through measurement operation to obtain a prediction tag;
(2-2) acquiring a gradient between an input quantum state in the model and the prediction label acquired in the step (2-1) and a gradient direction of each classification result;
(2-3) selecting a gradient direction corresponding to the first n categories having the highest observation probability and different from the original prediction category obtained by the observation processing, and determining an optimization target for the challenge sample search by adding up the gradient directions of the first n categories and subtracting the direction of the original prediction category to obtain a tensor expression of the prediction difference, wherein the optimization target for the challenge sample search is expressed by the following formula:
wherein ,yi For the first n label categories with highest prediction probability and different from the original prediction category, y is the original label input by the test;
(2-4) calculating a loss function for the predictive label:
the calculation of the loss function is represented by the following formula:
wherein ,<x|k representing the kth data in the quantum state dataset; y is k Representing a label corresponding to the kth data in the quantum state data set; e represents an identity matrix;
the loss function values of the original class labels and the quantum neural network model are improved through a gradient ascending algorithm, and the loss values of other class labels are reduced through a gradient descending algorithm, so that the maximization of the differential behaviors is realized;
s3, determining an optimization target of quantum entanglement coverage by adopting the quantum state data set constructed in the step S1 and an initial quantum neural network model and a quantum state entanglement coverage calculation method of the model; the method specifically comprises the following steps:
selecting a polynomial global measurement method of multi-particle entanglement, calculating quantum entanglement coverage rate of a quantum neural network model, and recording the polynomial global measurement as entanglement measurement Q;
the linear mapping process acting on the computation basis is expressed using the following formula:
wherein j=1, …, n;indicating that the first qubit is missing; delta represents a kronecker symbol;
the entanglement metric Q is calculated using the following formula:
wherein Q is more than or equal to 0 and less than or equal to 1, and the larger the value of Q is, the higher the corresponding entanglement degree is; d represents the generalized distance, and for a given quantum state |u > and |v >, the corresponding generalized distance D is calculated as follows:
|u>=∑u i |i>
|v>=∑v i |i>
calculating a difference value between the quantum state entanglement amount before the quantum neural network is input and the quantum state entanglement amount after the quantum neural network is input, and simultaneously solving a gradient direction of the quantum entanglement coverage rate by taking the increased difference value as a target, so as to determine an optimization target of the quantum entanglement coverage rate, wherein the optimization target is expressed by adopting the following formula:
wherein ,representing entanglement of quantum states output from the quantum neural network; q (|x)>) Representing entanglement of quantum states input from the quantum neural network;
s4, adopting the countermeasure sample search optimization target determined in the step S2 and the quantum entanglement coverage optimization target determined in the step S3 to define a joint optimization target, and generating a target disturbance operator through optimization; the method specifically comprises the following steps:
adopting the countermeasure sample search optimization target determined in the step S2 and the quantum entanglement coverage optimization target determined in the step S3, and adopting the following formula to define a gradient search joint optimization target for mutation:
obj=λ 1 ×obj a +λ 2 ×obj e
wherein obj represents a gradient search joint optimization target; obj a Representing an optimization objective against the sample search portion, lambda 1 A superparameter representing a control weight; obj e Representing an optimization objective of the quantum entanglement coverage portion; lambda (lambda) 2 Representing balance twoSuper parameters of the optimization target weights of the individual parts;
searching perturbation operator U through gradient ascent algorithm p Continuously mutating the original test input |x>Until the iteration is finished, the optimization target is subjected to maximization;
s5, adopting the initial quantum neural network model obtained in the step S1 and the target disturbance operator generated in the step S4 to finish leak detection of the quantum neural network model; the method specifically comprises the following steps:
the target disturbance operator U generated in the step S4 is processed p Acting on the original input |x>The variation input |x 'is obtained'>Will |x'>Re-inputting the predicted result and the original input |x into the initial quantum neural network model obtained in the step S1>Is inconsistent with the predicted result of (a), and indicates that the input |x is generated for the original input>Is a challenge test input; if the output prediction result is equal to the original input |x>The predicted results of the quantum entanglement coverage rate can be improved in the outputted predicted results, and the variation input with the disturbance size meeting the preset requirement is stored in a seed queue for continuous variation; completing leak detection of the quantum neural network model by judging whether to generate countermeasure test input, and if so, indicating that the model has a leak;
A3. b, completing vulnerability detection of the automatic driving system by adopting the result obtained after the detection in the step A2;
fig. 5 is a schematic design diagram of a method for detecting a vulnerability of automatic driving according to the present invention.
Claims (7)
1. A leak detection method of a quantum neural network comprises the following steps:
s1, acquiring original input data and an initial quantum neural network model, and performing coding processing on the acquired data to construct a quantum state data set;
s2, determining an optimization target for searching an countermeasure sample by adopting the quantum state data set constructed in the step S1 and an initial quantum neural network model and calculating a gradient direction;
s3, determining an optimization target of quantum entanglement coverage by adopting the quantum state data set constructed in the step S1 and an initial quantum neural network model and a quantum state entanglement coverage calculation method of the model;
s4, adopting the countermeasure sample search optimization target determined in the step S2 and the quantum entanglement coverage optimization target determined in the step S3 to define a joint optimization target, and generating a target disturbance operator through optimization;
s5, adopting the initial quantum neural network model obtained in the step S1 and the target disturbance operator generated in the step S4 to finish leak detection of the quantum neural network model.
2. The method for detecting a vulnerability of a quantum neural network according to claim 1, wherein the step S1 of obtaining the original input data and the initial quantum neural network model, performing encoding processing on the obtained data, and constructing a quantum state data set, specifically includes:
the initial quantum neural network model is a well-trained neural network to be tested, and specifically comprises the following steps:
"training completion" is expressed as: the quantum neural network model to be tested is characterized in that through the learning of training data, all learning indexes are converged in a set range in the test data, and model parameters are fixed based on training results;
the quantum neural network is designed to be a parameterized quantum circuit consisting of a coding circuit and a variation circuit, and specifically comprises the following components:
variational circuitThe system consists of a group of parameter-containing revolving doors and fixed doors which are arranged in a specific model, wherein the parameter-containing revolving doors are used for traversing unitary transformation existing in Hilbert space, and the fixed doors are controlled doors for providing coherence;
the structure of the coding line is determined by selecting a state preparation scheme for coding the environmental image data into a quantum state; determining a state preparation scheme based on the relation of the dimensions and the computing resources of the data set;
selecting an angle code as a state preparation scheme; the coding line is composed of a plurality of revolving doors with parameters, wherein the parameters of the revolving doors are determined by the information of the image data;
the width of the entire quantum neural network is designed to depend on the number of qubits required to encode the input data set, the higher the dimension of the input data, the larger the scale of the line.
3. The method for detecting the vulnerability of the quantum neural network according to claim 2, wherein the quantum state data set constructed by the step S1 and the initial quantum neural network model in the step S2 determine an optimization target for the challenge sample search by calculating the gradient direction, specifically comprising:
(2-1) performing observation projection processing on the quantum system through measurement operation to obtain a prediction tag;
(2-2) acquiring a gradient between an input quantum state in the model and the prediction label acquired in the step (2-1) and a gradient direction of each classification result;
(2-3) selecting a gradient direction corresponding to the first n categories having the highest observation probability and different from the original prediction category obtained by the observation processing, and determining an optimization target for the challenge sample search by adding up the gradient directions of the first n categories and subtracting the direction of the original prediction category to obtain a tensor expression of the prediction difference, wherein the optimization target for the challenge sample search is expressed by the following formula:
wherein ,yi For the first n label categories with highest prediction probability and different from the original prediction category, y is the original label input by the test;
(2-4) calculating a loss function for the predictive label:
the calculation of the loss function is represented by the following formula:
wherein ,<x|k representing the kth data in the quantum state dataset; y is k Representing a label corresponding to the kth data in the quantum state data set; e represents an identity matrix;
the loss function values of the original class labels and the quantum neural network model are improved through a gradient ascending algorithm, and the loss values of other class labels are reduced through a gradient descending algorithm, so that the maximization of the differential behaviors is realized.
4. The method for detecting a vulnerability of a quantum neural network according to claim 3, wherein the quantum state data set constructed in step S1 and the initial quantum neural network model in step S3 determine an optimization target of quantum entanglement coverage by a quantum state entanglement coverage calculation method of the model, specifically comprising:
selecting a polynomial global measurement method of multi-particle entanglement, calculating quantum entanglement coverage rate of a quantum neural network model, and recording the polynomial global measurement as entanglement measurement Q;
the linear mapping process acting on the computation basis is expressed using the following formula:
wherein j=1, …, n;indicating that the first qubit is missing; delta represents a kronecker symbol;
the entanglement metric Q is calculated using the following formula:
wherein Q is more than or equal to 0 and less than or equal to 1, and the larger the value of Q is, the higher the corresponding entanglement degree is; d represents the generalized distance, and for a given quantum state |u > and |v >, the corresponding generalized distance D is calculated as follows:
|u>=∑u i |i>
|v>=∑v i |i>
calculating a difference value between the quantum state entanglement amount before the quantum neural network is input and the quantum state entanglement amount after the quantum neural network is input, and simultaneously solving a gradient direction of the quantum entanglement coverage rate by taking the increased difference value as a target, so as to determine an optimization target of the quantum entanglement coverage rate, wherein the optimization target is expressed by adopting the following formula:
wherein ,representing entanglement of quantum states output from the quantum neural network; q (|x)>) Indicating the entanglement of the quantum states input from the quantum neural network.
5. The method for detecting the loophole of the quantum neural network according to claim 4, wherein the step S4 is characterized in that the step S2 is adopted to search the optimization target for the challenge sample and the step S3 is adopted to determine the optimization target for the quantum entanglement coverage, the joint optimization target is defined, and the target disturbance operator is generated through the optimization process, and the method specifically comprises the following steps:
adopting the countermeasure sample search optimization target determined in the step S2 and the quantum entanglement coverage optimization target determined in the step S3, and adopting the following formula to define a gradient search joint optimization target for mutation:
obj=λ 1 ×obj a +λ 2 ×obj e
wherein obj represents a gradient search joint optimization target; obj a Representing an antagonistic sample searchOptimization objective of cable portion lambda 1 A superparameter representing a control weight; obj e Representing an optimization objective of the quantum entanglement coverage portion; lambda (lambda) 2 A hyper-parameter representing an optimization target weight that balances the two parts;
searching perturbation operator U through gradient ascent algorithm p Continuously mutating the original test input |x>And (5) until the iteration is finished, completing the maximization processing on the optimization target.
6. The method for detecting the vulnerability of the quantum neural network according to claim 5, wherein the initial quantum neural network model obtained in step S1 and the target disturbance operator generated in step S4 in step S5 are adopted to complete the vulnerability detection of the quantum neural network model, and specifically comprises the following steps:
the target disturbance operator U generated in the step S4 is processed p Acting on the original input |x>The variation input |x 'is obtained'>Will |x'>Re-inputting the predicted result and the original input |x into the initial quantum neural network model obtained in the step S1>Is inconsistent with the predicted result of (a), and indicates that the input |x is generated for the original input>Is a challenge test input; if the output prediction result is equal to the original input |x>The predicted results of the quantum entanglement coverage rate can be improved in the outputted predicted results, and the variation input with the disturbance size meeting the preset requirement is stored in a seed queue for continuous variation; and (3) completing the leak detection of the quantum neural network model by judging whether the countermeasure test input is generated, and if so, indicating that the model has the leak.
7. An automated driving vulnerability detection method comprising the vulnerability detection method of one of claims 1 to 6, comprising the steps of:
A1. acquiring environment image data of an automatic driving system in a driving scene, and acquiring an initial quantum neural network model applicable to the automatic driving system;
A2. adopting the image data and the initial model obtained in the step A1, and carrying out vulnerability detection of the initial model by the vulnerability detection method of the quantum neural network according to one of claims 1 to 6;
A3. and (3) completing the vulnerability detection of the automatic driving system by adopting the result obtained after the detection in the step (A2).
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310845001.5A CN116739100A (en) | 2023-07-11 | 2023-07-11 | Vulnerability detection method of quantum neural network and automatic driving vulnerability detection method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310845001.5A CN116739100A (en) | 2023-07-11 | 2023-07-11 | Vulnerability detection method of quantum neural network and automatic driving vulnerability detection method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116739100A true CN116739100A (en) | 2023-09-12 |
Family
ID=87901175
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310845001.5A Pending CN116739100A (en) | 2023-07-11 | 2023-07-11 | Vulnerability detection method of quantum neural network and automatic driving vulnerability detection method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116739100A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117649563A (en) * | 2024-01-29 | 2024-03-05 | 量子科技长三角产业创新中心 | Quantum recognition method, system, electronic device and storage medium for image category |
-
2023
- 2023-07-11 CN CN202310845001.5A patent/CN116739100A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117649563A (en) * | 2024-01-29 | 2024-03-05 | 量子科技长三角产业创新中心 | Quantum recognition method, system, electronic device and storage medium for image category |
CN117649563B (en) * | 2024-01-29 | 2024-05-10 | 量子科技长三角产业创新中心 | Quantum recognition method, system, electronic device and storage medium for image category |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Schuld et al. | Circuit-centric quantum classifiers | |
Sun et al. | Evolving deep convolutional neural networks for image classification | |
Springenberg et al. | Improving deep neural networks with probabilistic maxout units | |
US11650968B2 (en) | Systems and methods for predictive early stopping in neural network training | |
CN115618296B (en) | Dam monitoring time sequence data anomaly detection method based on graph attention network | |
CN116049719B (en) | Fault detection and estimation method, system and medium based on migration type generation model | |
Luleci et al. | Generative adversarial networks for labeled acceleration data augmentation for structural damage detection | |
CN110766060B (en) | Time series similarity calculation method, system and medium based on deep learning | |
CN114565021A (en) | Financial asset pricing method, system and storage medium based on quantum circulation neural network | |
CN116739100A (en) | Vulnerability detection method of quantum neural network and automatic driving vulnerability detection method | |
CN111858328A (en) | Software defect module severity prediction method based on ordered neural network | |
Liu et al. | Residual useful life prognosis of equipment based on modified hidden semi-Markov model with a co-evolutional optimization method | |
CN118035866A (en) | Fault diagnosis method for aluminum extrusion equipment based on expert network | |
Lo | Early software reliability prediction based on support vector machines with genetic algorithms | |
CN117437507A (en) | Prejudice evaluation method for evaluating image recognition model | |
CN116383747A (en) | Anomaly detection method for generating countermeasure network based on multi-time scale depth convolution | |
Lounis et al. | Machine-learning techniques for software product quality assessment | |
CN115512214A (en) | Indoor visual navigation method based on causal attention | |
Zha et al. | Recognizing plans by learning embeddings from observed action distributions | |
CN113792776A (en) | Interpretation method of deep learning model in network security anomaly detection | |
Jiang | Research on software defect prediction technology based on deep learning | |
CN113821401A (en) | WT-GA-GRU model-based cloud server fault diagnosis method | |
Zhou | Deep learning algorithms in enterprise accounting management analysis | |
Mishra | Application of Neural Networks to Nuclear Safeguards | |
CN118070682B (en) | Spiral bolt hanging ring damage assessment method and device based on artificial intelligence |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |