A method for preparing a quantum state of a custom probability distribution based on neural network regulation
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUAYI BOAO (HUNAN) QUANTUM TECHNOLOGY CO LTD
- Filing Date
- 2026-02-25
- Publication Date
- 2026-05-29
Smart Images

Figure CN122114213A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of quantum computing, and more specifically to a method for preparing custom probability distribution quantum states based on neural network control. Background Technology
[0002] Quantum state preparation is a fundamental step in quantum computing and plays a core role in algorithms that require specific probability distributions, such as quantum Monte Carlo simulation, quantum machine learning, and financial risk analysis. These applications typically require the efficient loading of classical probability distributions onto the amplitude of quantum states in order to utilize quantum parallelism for subsequent calculations.
[0003] Traditional quantum state preparation methods, such as decomposition and synthesis based on elementary gates, aim to encode an arbitrary, known normalized state vector into a qubit. However, the quantum circuit depth and the number of logic gates required by such methods usually increase exponentially with the number of qubits, or require a large number of auxiliary qubits. This high resource overhead makes it difficult to implement traditional methods on current noisy medium-scale quantum (NISQ) devices, severely limiting their scalability and practical applications.
[0004] To adapt to the characteristics of devices in the NISQ era, state preparation schemes based on parameterized quantum circuits (PQC) have emerged in recent years. These methods adjust the parameters in a quantum circuit with a fixed structure to make the output state approximate the target state. The circuit depth is relatively controllable. However, most existing PQC schemes are trained and optimized for a single, fixed target state. Once the shape of the target distribution changes, even if only its distribution parameters change, the entire PQC needs to be retrained, lacking the ability to generalize to different target states.
[0005] Furthermore, even within the framework of learning-based fabrication, the expressive power of a single PQC may be limited as the complexity of the required distribution or the number of qubits increases, leading to a decrease in fabrication accuracy. Existing methods typically rely on a single loop to fit the entire distribution, which often falls short when faced with complex distributions such as multi-peak or asymmetric structures. It is difficult to achieve high-fidelity approximation within a limited circuit depth, thus restricting the application of this method in complex real-world scenarios.
[0006] Therefore, how to design a method for preparing custom probability distribution quantum states based on neural network control that can both adapt to the resource constraints of NISQ devices and efficiently generate a series of quantum states with different target probability distributions according to classical parameters is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0007] In view of this, the present invention provides a method for preparing custom probability distribution quantum states based on neural network control, which aims to overcome the limitations of traditional quantum state preparation methods in terms of flexibility, scalability and resource consumption. It solves the problems that existing learning methods cannot adapt to changing target distributions and that accuracy decreases with the increase of the number of qubits. It can quickly and accurately prepare corresponding probability distribution quantum states on a quantum processor according to the distribution parameters specified by the user, and provides a reliable and efficient state preparation tool.
[0008] To achieve the above objectives, the present invention adopts the following technical solution:
[0009] A method for preparing custom probability distribution quantum states based on neural network control includes the following steps: S1. Define the target discrete probability distribution family, the shape of which is determined by a set of parameters, and convert the continuous probability distribution into a discrete probability distribution to obtain a parameterized set of discrete probability distributions. S2. Based on the set of discrete probability distributions, sample multiple sets of parameters in a preset distribution parameter space, calculate their corresponding discrete probability distributions, and generate a training sample set. S3. Construct multiple parallel parameterized quantum loops, each of which is used to prepare quantum states. The target probability distribution is generated by weighted superposition of the output probability distributions of each quantum loop. S4. Construct and train a neural network model, output the parameters and weight coefficients of each quantum circuit, and optimize the generated quantum state probability distribution to approximate the target distribution by minimizing the loss function. S5. By introducing auxiliary qubits, multiple quantum circuits are merged into a single quantum circuit. Weighted superposition is achieved through control gates to generate the final probability distribution quantum state.
[0010] Preferably, in step S1, converting a continuous probability distribution into a discrete probability distribution includes: For a continuous probability distribution, take values within the fixed interval [a, b]. There are discrete preset points, with an interval of [number]. n is the number of qubits used for loading distribution, a is the lower bound of the interval, and b is the upper bound of the interval; Through probability density model Calculate the probability of each preset point. The probability is:
[0011] in, For distribution parameters, .
[0012] Preferably, the probability density model The normal distribution density function is:
[0013] Among them, parameters μ is the mean, σ is the standard deviation, and the discretization interval is set to... .
[0014] Preferably, S2 includes: In distribution parameters N sets of parameter values are uniformly sampled within the preset space. ; For each set of parameters Discrete probability distributions are calculated through numerical integration or random sampling. ; The parameters and their corresponding probability distributions are combined to form a training sample set for neural network training.
[0015] Preferably, S3 includes: Construct M parameterized quantum circuits, each defined on n qubits, and prepare the quantum state of the m-th quantum circuit. Represented as:
[0016] in, For parameterized unitary operators, Let be the parameters of the m-th quantum circuit. To calculate the ground state The amplitude; Through weighting coefficients The probability distributions of each quantum circuit are weighted and superimposed, and a preset point is obtained in the target probability distribution. The probability is: , .
[0017] Preferably, S4 includes: Construct a neural network N, with the input being the distribution parameters. The output is a set of quantum circuit parameters. and weighting coefficients , is represented as:
[0018] in, For neural network parameters; Define loss function Measure the generation distribution With target distribution The difference is such that the training objective is to minimize the average loss:
[0019] Update neural network parameters using backpropagation and optimization algorithms. The gradient of the generation distribution with respect to the quantum loop parameters is estimated using the parameter translation rule.
[0020] Preferably, the generated distribution Calculated in the following way: In an ideal state, when the number of samples , ; Under finite sampling, estimation is performed by sampling each quantum circuit according to its weight ratio.
[0021] Preferably, the neural network includes multiple fully connected layers, with the output of the last layer divided into two parts: Part 1 Output Weighting Coefficients Use the Softmax activation function to ensure =1; Part Two: Output Quantum Circuit Parameters ,use As an activation function, the parameter values are restricted to Within the range.
[0022] Preferably, the loss function KL divergence:
[0023] Specifically, by minimizing the KL divergence, the generated distribution is made... Approximating the target distribution .
[0024] Preferably, S5 includes: Introduction The preparation state of the auxiliary qubits is represented as follows:
[0025] in, This represents the computational ground state of the auxiliary bits; By merging quantum circuits through control gates, the overall quantum operation can be represented as:
[0026] in, and They are respectively peacekeeping The unit operator for dimensions.
[0027] As can be seen from the above technical solution, compared with the prior art, the technical solution of the present invention has the following beneficial effects: 1. This method uses the classical parameters that determine the shape of the distribution as input to a neural network, and outputs the corresponding quantum loop parameters and weight coefficients from the neural network. It realizes an end-to-end mapping from the classical parameter space to the quantum state space. It can dynamically generate the corresponding probability distribution quantum state according to the input distribution parameters, overcoming the limitation that it can only be prepared for a single fixed state.
[0028] 2. By using a weighted superposition of multiple parallel parameterized quantum circuits to fit the target probability distribution, and introducing auxiliary qubits when necessary to merge multiple sub-circuits into a single quantum circuit, it reduces the requirements for the number of qubits and quantum gates while ensuring the ability to express complex distributions, making it more suitable for medium-scale quantum devices with limited resources and noise.
[0029] 3. By jointly training a classical neural network and a parameterized quantum circuit, and optimizing the neural network parameters through gradient descent, the generated quantum state probability distribution can approximate the target distribution with indices such as KL divergence. This training mechanism optimizes the quantum process through classical computation, effectively improving the accuracy of preparing the target probability distribution state and the model generalization ability in the case of multiple qubits. Attached Figure Description
[0030] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0031] Figure 1 A flowchart illustrating the method for preparing custom probability distribution quantum states based on neural network control provided by this invention; Figure 2 The present invention provides a standard normal distribution and its discretized probability distribution diagram; Figure 3 The parameterized quantum loop circuit diagram provided for this invention; Figure 4 This is a schematic diagram of the neural network model structure provided by the present invention; Figure 5 The graph showing how the loss function provided by this invention decreases with increasing training rounds; Figure 6 A circuit diagram for auxiliary quantum bit state preparation provided by the present invention; Figure 7 The comparison results between the quantum state probability distribution generated by the model and the target distribution when the standard deviation σ of the target normal distribution is 0.7 are provided for this invention.
[0032] Figure 8 The comparison results between the quantum state probability distribution generated by the model and the target distribution when the standard deviation σ of the target normal distribution is 1.3 are provided for this invention.
[0033] Figure 9 The comparison results between the quantum state probability distribution generated by the model and the target distribution when the standard deviation σ of the target normal distribution is 1.8, provided by this invention. Detailed Implementation
[0034] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0035] like Figure 1 As shown, this embodiment provides a method for preparing custom probability distribution quantum states based on neural network control, including the following steps: S1. Define the target discrete probability distribution family, the shape of which is determined by a set of parameters, and convert the continuous probability distribution into a discrete probability distribution to obtain a parameterized set of discrete probability distributions. S2. Based on the set of discrete probability distributions, sample multiple sets of parameters in a preset distribution parameter space, calculate their corresponding discrete probability distributions, and generate a training sample set. S3. Construct multiple parallel parameterized quantum loops, each of which is used to prepare quantum states. The target probability distribution is generated by weighted superposition of the output probability distributions of each quantum loop. S4. Construct and train a neural network model, output the parameters and weight coefficients of each quantum circuit, and optimize the generated quantum state probability distribution to approximate the target distribution by minimizing the loss function. S5. By introducing auxiliary qubits, multiple quantum circuits are merged into a single quantum circuit. Weighted superposition is achieved through control gates to generate the final probability distribution quantum state.
[0036] This method achieves conditional quantum state preparation for a family of parameterized probability distributions through the collaborative design of neural networks and parameterized quantum circuits. It uses the weighted superposition of multiple parallel sub-circuits to fit the target distribution, reducing the demand for quantum resources while maintaining the ability to represent complex distributions. Furthermore, it learns the mapping from distribution parameters to quantum circuit parameters through a classical neural network model, effectively improving the accuracy of state preparation and the generalization ability of the model under different parameter conditions.
[0037] The following provides a further detailed explanation of each step in the above method; In this embodiment, S1, a target discrete probability distribution family is defined, the shape of which is determined by a set of parameters, and the continuous probability distribution is converted into a discrete probability distribution to obtain a parameterized set of discrete probability distributions. Given a class of univariate discrete probability distributions, defined in At a set of discrete preset points, the specific form of this type of distribution is determined by a set of parameters. For a continuous discrete probability distribution, it is determined within a fixed interval. Internal extraction A fixed interval is Discrete preset points, intervals The discrete preset points can be naturally determined by the probability density model and its parameters, or set according to the specific application task requirements. The probability is:
[0038] in, It is a parameterized probability density model whose output distribution is determined by parameters. Decide; Furthermore, taking the normal distribution as a specific implementation example, its probability density function is:
[0039] Take the upper and lower bounds of the interval as Since b=3σ, and the normal distribution does not affect the shape when translated, the discretized distribution is determined only by the parameters. Decision, and with The value is irrelevant; setting That is, in the interval Take 32 equally spaced discrete points within the inner area, with an interval of [missing information]. ,like Figure 2 As shown, the standard normal distribution and its discretized probability distribution are illustrated. ,when When The corresponding probability is ; It should be noted that this uses 100 bits, and utilized all of them. The quantum computing ground state can actually also qubits ( Instead of utilizing all ground states, the preset number of points is used. It will be rewritten as ( ).
[0040] In this embodiment S2, based on the set of discrete probability distributions, multiple sets of parameters are sampled in a preset distribution parameter space, and their corresponding discrete probability distributions are calculated to generate a training sample set. In this step, for a given target distribution, selection is made within its parameter space or a preset range. Group parameter combination For each set of parameters, based on its defined probability density model, the discrete probability distribution is obtained through numerical integration or random sampling:
[0041] As training samples, in this embodiment, Uniform sampling within the interval Parameter values To construct training samples with a normal distribution, the discrete probability distribution corresponding to each parameter. Obtained by the adaptive Gauss–Kronrod numerical integration method.
[0042] In this embodiment S3, multiple parallel parameterized quantum circuits are constructed, each quantum circuit is used to prepare quantum states, and the target probability distribution is generated by weighted superposition of the output probability distributions of each quantum circuit; Specifically, building A quantum parameterized circuit, each circuit defined in On each of the qubits, different structures are allowed, allowing the qubit to have different structures. The quantum states prepared by each loop are:
[0043] in, This represents a parameterized unitary operator. For parameters, To calculate the ground state The amplitude; The normalization condition ensures that the measurement results obtained from each loop are accurate. The weighted sum of the probabilities is:
[0044] It represents the preset point of the classical probability distribution. The probability, This represents the weighting coefficient of each loop. In this embodiment, for example... Figure 3 As shown, using A parameterized quantum circuit, the parameterized unitary operator structure contains 10 adjustable parameters.
[0045] In this embodiment, S4, a neural network model is constructed and trained, the parameters and weight coefficients of each quantum circuit are output, and the probability distribution of the generated quantum state is optimized by minimizing the loss function to approximate the target distribution. Build a neural network model to learn from the distribution parameters to loop parameters With loop weight coefficient The mapping makes the neural network... Its output is:
[0046] in, This represents the set of adjustable parameters of the neural network, and defines the loss function. Measuring usage The difference between the generated probability distribution and the true distribution can, in one implementation example, be achieved by minimizing the average loss during the training process:
[0047] Alternatively, minimizing other similar loss functions (measuring the target distribution and the existing distribution) can achieve the same goal; Furthermore, generate distribution This can be estimated by sampling each sub-loop according to its weight ratio:
[0048] This indicates the pre-set total number of samples. and They are respectively the sampling number The total number of loops and measurements are used to calculate the ground state. The number of times, when When it approaches infinity, that is, in the ideal state, ; Furthermore, such as Figure 4 As shown, a 3-layer neural network can be constructed. The mapping to loop parameters and loop weight coefficients, where the output of the last layer is divided into two parts, one part being the output weight coefficients. Using Softmax as the activation function, the sum of the weight coefficients is equal to 1; let a portion of the output parameters of the four loops be used... As an activation function:
[0049] It limits the range of output values to Within the interval, KL divergence is used as the loss function during training:
[0050] The training was performed using the AMSGrad optimizer for 2400 epochs, with a batch size of 16 and a learning rate of [value missing]. By directly obtaining the state vector corresponding to the loop through the simulator, the distribution corresponding to the loop under ideal conditions can be obtained, which is equivalent to setting the total number of samplings to 1. ,like Figure 5 As shown, the training loss (KL divergence) decreases, and the final average loss value of the training set is 0.00008.
[0051] In addition, to optimize the parameters of the neural network The gradient can be calculated through backpropagation, where the partial derivatives of the generated distribution with respect to the quantum loop parameters are estimated using the parameter translation rule.
[0052] In this embodiment S5, an auxiliary qubit is introduced to merge multiple quantum circuits into a single quantum circuit. Weighted superposition is achieved through a control gate to generate the final probability distribution quantum state. In this step, sub-loops are merged into a single loop by introducing auxiliary bits, thereby achieving the generation of a unified quantum state probability distribution. First, states are prepared on the auxiliary bits:
[0053] in, To represent different computational ground states, at least... One auxiliary qubit, and A quantum gate implementation Then, the sub-circuits are merged through control gates:
[0054] in, Indicates size is unit array, The number of auxiliary bits used, such as Figure 6 As shown, this illustrates the preparation , When preparing The circuit.
[0055] Furthermore, to verify the generalization ability of the trained model, its generation performance under target normal distributions with different standard deviations σ outside the training set was examined, such as... Figure 7 (σ=0.7) Figure 8 (σ=1.3) and Figure 9 As shown in (σ=1.8), for these unseen distribution parameters, the quantum state probability distribution (Fake) generated by the model maintains a high degree of consistency with the theoretical target distribution (Real) in terms of distribution shape and distribution scale. This result fully demonstrates that the proposed method can accurately respond to changes in distribution parameters and has reliable condition generation and generalization capabilities.
[0056] The method for preparing custom probability distribution quantum states based on neural network control provided in this embodiment integrates classical neural networks and parameterized quantum circuits. By defining a family of parameterized distributions, constructing parallel sub-circuits, and training the neural network to achieve parameter mapping, and finally merging them into a unified quantum circuit, it achieves efficient and scalable quantum state preparation for a class of probability distributions. This provides a feasible state preparation solution for quantum algorithms in scenarios that require custom probability distributions.
[0057] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.
[0058] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for preparing custom probability distribution quantum states based on neural network control, characterized in that, Includes the following steps: S1. Define the target discrete probability distribution family, the shape of which is determined by a set of parameters, and convert the continuous probability distribution into a discrete probability distribution to obtain a parameterized set of discrete probability distributions. S2. Based on the set of discrete probability distributions, sample multiple sets of parameters in a preset distribution parameter space, calculate their corresponding discrete probability distributions, and generate a training sample set. S3. Construct multiple parallel parameterized quantum loops, each of which is used to prepare quantum states. The target probability distribution is generated by weighted superposition of the output probability distributions of each quantum loop. S4. Construct and train a neural network model, output the parameters and weight coefficients of each quantum circuit, and optimize the generated quantum state probability distribution to approximate the target distribution by minimizing the loss function. S5. By introducing auxiliary qubits, multiple quantum circuits are merged into a single quantum circuit. Weighted superposition is achieved through control gates to generate the final probability distribution quantum state.
2. The method for preparing a custom probability distribution quantum state based on neural network control according to claim 1, characterized in that, In step S1, converting a continuous probability distribution into a discrete probability distribution includes: For a continuous probability distribution, take values within the fixed interval [a, b]. There are discrete preset points, with an interval of [number]. n is the number of qubits used for loading distribution, a is the lower bound of the interval, and b is the upper bound of the interval; Through probability density model Calculate the probability of each preset point. The probability is: in, For distribution parameters, .
3. The method for preparing a custom probability distribution quantum state based on neural network control according to claim 2, characterized in that, The probability density model The normal distribution density function is: Among them, parameters μ is the mean, σ is the standard deviation, and the discretization interval is set to... .
4. The method for preparing a custom probability distribution quantum state based on neural network control according to claim 1, characterized in that, S2 includes: In distribution parameters N sets of parameter values are uniformly sampled within the preset space. ; For each set of parameters Discrete probability distributions are calculated through numerical integration or random sampling. ; The parameters and their corresponding probability distributions are combined to form a training sample set for neural network training.
5. The method for preparing a custom probability distribution quantum state based on neural network control according to claim 1, characterized in that, S3 includes: Construct M parameterized quantum circuits, each defined on n qubits, and prepare the quantum state of the m-th quantum circuit. Represented as: in, For parameterized unitary operators, Let be the parameter of the m-th quantum circuit. To calculate the ground state The amplitude; Through weighting coefficients The probability distributions of each quantum circuit are weighted and superimposed, and a preset point is obtained in the target probability distribution. The probability is: , .
6. The method for preparing a custom probability distribution quantum state based on neural network control according to claim 1, characterized in that, S4 includes: Construct a neural network N, with the input being the distribution parameters. The output is a set of quantum circuit parameters. and weighting coefficients , is represented as: in, For neural network parameters; Define loss function Measure the generation distribution With target distribution The difference is such that the training objective is to minimize the average loss: Update neural network parameters using backpropagation and optimization algorithms. The gradient of the generation distribution with respect to the quantum loop parameters is estimated using the parameter translation rule.
7. The method for preparing a custom probability distribution quantum state based on neural network control according to claim 6, characterized in that, The generated distribution Calculated in the following way: In an ideal state, when the number of samples , ; Under finite sampling, estimation is performed by sampling each quantum circuit according to its weight ratio.
8. The method for preparing a custom probability distribution quantum state based on neural network control according to claim 6, characterized in that, The neural network consists of multiple fully connected layers, with the output of the last layer divided into two parts: Part 1 Output Weighting Coefficients Using the Softmax activation function ensures =1; Part Two: Output Quantum Circuit Parameters ,use As an activation function, the parameter values are restricted to Within the range.
9. The method for preparing a custom probability distribution quantum state based on neural network control according to claim 6, characterized in that, The loss function KL divergence: Specifically, by minimizing the KL divergence, the generated distribution is made... Approximating the target distribution .
10. The method for preparing a custom probability distribution quantum state based on neural network control according to claim 1, characterized in that, S5 includes: Introduction The preparation state of the auxiliary qubits is represented as follows: in, This represents the computational ground state of the auxiliary bits; By merging quantum circuits through control gates, the overall quantum operation can be represented as: in, and They are respectively peacekeeping The unit operator for dimensions.