Quantum key distribution parameter optimization method and system based on dynamic adaptive loss

By using a dynamic adaptive loss-based quantum key distribution parameter optimization method, and leveraging a dynamic loss weighting strategy based on gradient normalization and expected gradient updates, the imbalance problem in multi-objective optimization in QKD systems is solved, improving system performance and stability, and making it suitable for complex communication environments.

CN120710674BActive Publication Date: 2025-11-18QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511181345.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-22
Publication Date
2025-11-18
Estimated Expiration
2045-08-22

AI Technical Summary

Technical Problem

Existing methods for optimizing quantum key distribution (QKD) system parameters rely on fixed loss functions and manually set weights, which makes it difficult to achieve dynamic balance of multiple objectives in complex and ever-changing communication environments, affecting key generation rate and system stability. Furthermore, these methods are costly and inefficient.

Method used

A quantum key distribution parameter optimization method based on dynamic adaptive loss is adopted. By using a dynamic loss weighting strategy of gradient normalization and expected gradient update, the loss weight of each parameter task is automatically adjusted in each iteration to achieve an adaptive balance of objectives such as bit error rate, dark count rate, and pulse count.

Benefits of technology

It significantly improves the accuracy and efficiency of QKD system parameter optimization, enhances the model's adaptability to dynamic communication conditions, reduces the workload of manual parameter tuning, and is suitable for complex QKD system scenarios with multiple parameters and high dimensions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120710674B_ABST
    Figure CN120710674B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of quantum key distribution and discloses a quantum key distribution parameter optimization method and system based on a dynamic adaptive loss, which acquires quantum key distribution system parameters to be optimized and a protocol type, and carries out pretreatment; inputs the pretreated data into a trained QKD parameter model, outputs optimized quantum key distribution system parameters, and optimizes the configuration of the quantum key distribution system to optimize the generation of quantum keys; in the training process of the QKD parameter model, based on the real-time contribution and gradient change of each parameter to the system performance at different iteration stages, the weight corresponding to each parameter optimization task in the loss function is automatically allocated in the iteration process of each step, and each step of the loss function is iteratively trained based on adaptive weight updating. Through the introduction of the dynamic adaptive loss weight allocation mechanism, the accuracy and efficiency of the QKD system parameter optimization are significantly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of quantum key distribution technology, and more specifically, to a method and system for optimizing quantum key distribution parameters based on dynamic adaptive loss. Background Technology

[0002] The statements in this section provide only background information related to the present invention and do not necessarily constitute prior art.

[0003] Quantum Key Distribution (QKD) systems can achieve information security at the physical level and are one of the core infrastructures for future secure communication. To improve the key generation rate and communication security of QKD systems, it is necessary to jointly optimize several key system parameters, including the number of pulses, communication distance, bit error rate, dark count rate, and the strength of the signal state and decoy state and their corresponding transmission probabilities. These parameters are subject to complex nonlinear coupling relationships: for example, increasing the number of pulses helps improve signal transmission efficiency but may simultaneously increase the bit error rate; while extending the communication distance can expand the system's application range, it can also lead to signal attenuation and increased dark count, thus affecting system security and quantum key generation performance. Therefore, achieving a dynamic balance among multiple objectives and finding the globally optimal solution is a key technical challenge in the current design of QKD systems.

[0004] Existing QKD parameter optimization methods mainly rely on fixed loss function design or manually set optimization weights. These methods have several problems: First, the gradient change scales of different optimization objectives vary significantly, and fixed weight mechanisms can easily lead to certain objectives dominating the optimization direction during training, while other objectives are ignored, ultimately affecting the overall system performance. Second, QKD systems face dynamic changes such as channel loss, device jitter, and environmental disturbances during operation. Fixed optimization strategies lack adaptability and struggle to respond to fluctuations in the actual communication environment, leading to a decrease in key generation rate or even communication interruption. Furthermore, traditional methods often rely on manual parameter adjustment based on experience, resulting in high tuning costs, low efficiency, and difficulty in scaling to complex or large-scale QKD applications. Summary of the Invention

[0005] To address the aforementioned issues, this invention proposes a quantum key distribution parameter optimization method and system based on dynamic adaptive loss. Based on a dynamic loss weighting strategy using gradient normalization and expected gradient updates, the loss weights of each parameter task are dynamically adjusted in each iteration, achieving an adaptive balance across multiple objectives such as bit error rate, dark count rate, pulse count, and communication distance. This method automatically balances the importance of different parameter tasks according to the current optimization state, thereby enabling efficient parameter adjustment in complex and dynamic network environments and significantly improving the performance and stability of the QKD system.

[0006] To achieve the above objectives, the present invention adopts the following technical solution:

[0007] The first aspect of this invention provides a method for optimizing quantum key distribution parameters based on dynamic adaptive loss, comprising the following steps:

[0008] Obtain the parameters and protocol type of the quantum key distribution system to be optimized, and perform preprocessing;

[0009] The preprocessed data is input into the trained QKD parameter model, and the optimized quantum key distribution system parameters are output. The quantum key distribution system is then optimized to improve the generation of quantum keys.

[0010] In the QKD parameter model training process, based on the real-time contribution and gradient change of each parameter to the system performance at different iteration stages, the weights corresponding to the parameter optimization tasks in the loss function are automatically assigned in each iteration step, and the loss function is updated in each step based on the adaptive weights for iterative training.

[0011] A second aspect of the present invention provides a quantum key distribution parameter optimization system based on dynamic adaptive loss, comprising:

[0012] Data preprocessing module: configured to acquire the parameters and protocol type of the quantum key distribution system to be optimized, and perform preprocessing;

[0013] Parameter optimization module: It is configured to input preprocessed data into the trained QKD parameter model, output optimized quantum key distribution system parameters, and optimize the configuration of the quantum key distribution system to optimize the generation of quantum keys;

[0014] In the QKD parameter model training process, based on the real-time contribution and gradient change of each parameter to the system performance at different iteration stages, the weights corresponding to the parameter optimization tasks in the loss function are automatically assigned in each iteration step, and the loss function is updated in each step based on the adaptive weights for iterative training.

[0015] A third aspect of the present invention provides a quantum key distribution parameter optimization system based on dynamic adaptive loss, including a parameter acquisition device and a processor;

[0016] The parameter acquisition device is used to acquire QKD parameter data and protocol type of the quantum key distribution system;

[0017] The processor is configured to perform the steps of the above-described quantum key distribution parameter optimization method based on dynamic adaptive loss.

[0018] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0019] This invention significantly improves the accuracy and efficiency of QKD system parameter optimization by introducing a dynamic adaptive loss weight allocation mechanism. The adaptive loss weight dynamically adjusts the weights of the loss function by detecting the gradient changes of each optimization objective in real time, making the optimization process more balanced and efficient. Compared with traditional methods that rely on fixed weights or manual experience, this method has the following advantages: First, by monitoring the gradient dynamics of each parameter optimization task in real time, it ensures the balance of multiple optimization objectives during the training process, effectively avoiding the problem of local optima or the neglect of a certain objective; second, the adaptive mechanism can automatically adjust the optimization strategy according to changes in the system environment (such as channel noise, device status, etc.), enhancing the model's adaptability to dynamic communication conditions; in addition, the automated optimization process reduces the workload and cost of manual parameter tuning, has good scalability and generalization, and is especially suitable for complex QKD system scenarios with multiple parameters and high dimensions.

[0020] The advantages of the present invention, as well as its additional advantages, will be described in detail in the following specific embodiments. Attached Figure Description

[0021] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute a limitation thereof.

[0022] Figure 1 This is a flowchart of the quantum key distribution parameter optimization method according to Embodiment 1 of the present invention;

[0023] Figure 2 This is a schematic diagram of the QKD parameter model training in Embodiment 1 of the present invention;

[0024] Figure 3 This is a flowchart of the adaptive weight update process in Embodiment 1 of the present invention;

[0025] Figure 4 This is a graph showing the weight change trend of quantum key distribution parameter optimization as the number of iterations changes during the training process of Embodiment 1 of the present invention.

[0026] Figure 5 This is a histogram comparing the key rates of the Final-XGBoost model and LSA in Embodiment 1 of the present invention.

[0027] Figure 6 This is a histogram comparing the key rates of the Final-XGBoost model with the adaptive mechanism constructed according to Embodiment 1 of the present invention with those without the constructed key rate. Detailed Implementation

[0028] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0029] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0030] It should be noted that the terminology used herein is for describing particular embodiments only and is not intended to limit the exemplary embodiments of the present invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof. It should be noted that, without conflict, the various embodiments and features within those embodiments can be combined with each other. The embodiments will now be described in detail with reference to the accompanying drawings.

[0031] Example 1

[0032] In one or more of the technical solutions disclosed in the embodiments, such as Figures 1 to 6 As shown, a quantum key distribution parameter optimization method based on dynamic adaptive loss includes the following steps:

[0033] Step 1: Obtain the parameters and protocol type of the quantum key distribution system to be optimized, and perform preprocessing;

[0034] Step 2: Input the preprocessed data into the trained QKD parameter model, output the optimized quantum key distribution system parameters, and optimize the configuration of the quantum key distribution system to optimize the generation of quantum keys;

[0035] In the QKD parameter model training process, based on the real-time contribution and gradient change of each parameter to the system performance at different iteration stages, the weights corresponding to the parameter optimization tasks in the loss function are automatically assigned in each iteration step, and the loss function is updated in each step based on the adaptive weights for iterative training.

[0036] This embodiment of the method optimizes the configuration of quantum key distribution (QKD) system parameters by constructing a dynamic adaptive loss mechanism. First, the system parameters to be optimized are collected, such as the number of pulses, communication distance, bit error rate, dark count rate, strength of the signal state and decoy state, and their transmission probabilities. The raw data is then standardized in conjunction with the QKD protocol used (e.g., BB84, decoy-state, etc.). Subsequently, the standardized input data is fed into a pre-trained QKD parameter model, which is built on a deep learning framework and possesses multi-objective learning capabilities. During model training, a dynamic adaptive loss function mechanism is introduced. In each iteration, this mechanism allocates the weights of each objective in the loss function in real time based on the marginal contribution of each objective (e.g., maximizing the key generation rate, minimizing the bit error rate, etc.) to the overall performance index and the magnitude of its gradient change. This dynamic allocation process adjusts the optimization intensity of each task by analyzing the gradient norm of each optimization objective, ensuring that gradient updates remain balanced across different objectives, preventing a single objective from dominating the optimization direction, and enhancing the stability and generalization ability of the model training. Ultimately, the trained model can be used to infer new QKD system configurations, output optimized system parameters, and improve key generation performance and system security.

[0037] This embodiment significantly improves the accuracy and efficiency of QKD system parameter optimization by introducing a dynamic adaptive loss weight allocation mechanism. The adaptive loss weight dynamically adjusts the weights of the loss function by detecting the gradient changes of each optimization objective in real time, making the optimization process more balanced and efficient. Compared with traditional methods that rely on fixed weights or manual experience, this method has the following advantages: First, by monitoring the gradient dynamics of each parameter optimization task in real time, it ensures the balance of multiple optimization objectives during the training process, effectively avoiding the problem of local optima or the neglect of a certain objective; second, the adaptive mechanism can automatically adjust the optimization strategy according to changes in the system environment (such as channel noise, device status, etc.), enhancing the model's adaptability to dynamic communication conditions; in addition, the automated optimization process reduces the workload and cost of manual parameter tuning, has good scalability and generalization, and is especially suitable for complex QKD system scenarios with multiple parameters and high dimensions.

[0038] In some embodiments, the QKD parameter model for multi-task optimization can employ a neural network, including:

[0039] Input layer: used to obtain parameters of the quantum key distribution system;

[0040] Data preprocessing layer: preprocesses the input parameters of the quantum key distribution system;

[0041] Hidden layers: have weights W1, W2, ..., Wn (multi-layer structure of a neural network);

[0042] Output layer: Used to output optimized parameters for the quantum key distribution system;

[0043] In step 1, the parameters of the quantum key distribution system to be optimized are obtained ( , The protocol type is determined and preprocessed.

[0044] The parameters of the quantum key distribution system include: system condition vector. and system response vector ;

[0045] System response vector This includes signal strength, decoy strength, and transmission probability;

[0046] System condition vector These include bit error rate (ed), dark count rate (dc), pulse count (np), and communication distance (td).

[0047] The obtained quantum key distribution system parameters are preprocessed by normalization, i.e., the QKD parameters ( , The normalization process is performed using the Z-score standardization method as a preprocessing step, as shown in the following formula:

[0048] (1);

[0049] Where mean(x) represents the mean of input feature x, σ represents the variance of feature x, and the standardized data conforms to the standard normal distribution, effectively eliminating the interference caused by the difference in units, so that the weight parameters can converge quickly.

[0050] Protocol type features are obtained through one-hot encoding, and protocol classification information is incorporated into the input vector of the QKD parameter model as part of the features in the input space.

[0051] In step 2, the prediction for each system parameter is constructed as a task to predict the corresponding system parameter, and the QKD parameters ( , The encoded protocol type features are input into the QKD parameter model, and the predicted value for the i-th task is obtained through the forward computation of the QKD parameter model. ;

[0052] During the training of the QKD parameter model, the loss weights for different optimization objectives are first initialized, so that the weights at the t-th training iteration are... =1.0 to maintain balance among tasks, and calculate the error between the target value and the predicted value based on the loss function of N tasks to obtain the loss term for different tasks. , represented as:

[0053] (2);

[0054] in, The model parameters of the QKD parameter model at the t-th training iteration are represented. Let pi represent the expected value of the i-th task, where pi is an adjustable exponential parameter. Preferably, p is taken as p. i =2 is used as the squared loss;

[0055] Furthermore, the overall loss function for training the QKD parameter model can be expressed as:

[0056] (3);

[0057] in, The overall loss function of the QKD parameter optimization model is determined at the t-th training iteration. These are the weights of the i-th and j-th tasks at the t-th training iteration, respectively, and their values ​​are dynamically updated by the gradient balancing mechanism. This represents the single-task loss function of the model on task i; during training, The parameters will be dynamically adjusted based on changes in loss to adapt to the degree of influence of different optimization objectives, making QKD parameter optimization more accurate.

[0058] To enhance the stability and expressive power of the multi-task loss function in response to changes in task weights, the loss function constructed by formula (3) in this embodiment improves upon the traditional weighted summation form. Specifically, the Softmax function is used to normalize the task weights, thereby avoiding training instability caused by excessively large or small weights for a single task.

[0059] A further technical solution, based on the real-time contribution and gradient changes of each parameter to the system performance at different iteration stages, automatically assigns weights to the parameters in the loss function corresponding to the optimization task during each iteration, and adaptively updates the weights, including the following steps:

[0060] Step 21: Based on the loss term obtained for the i-th task The gradient of the loss term for the corresponding task is obtained through the backpropagation algorithm and used as the initial gradient.

[0061] The initial gradient of the i-th task can be calculated as follows:

[0062] (4);

[0063] in, Let represent the gradient of the i-th task at the t-th iteration.

[0064] Step 22: Normalize the initial gradient for each task, as follows:

[0065] (5);

[0066] in, The L2 norm of the gradient is represented. It is a very small value (≈10) set. -8 ), used to prevent numerical instability caused by zero gradient.

[0067] (6);

[0068] in, Represents the gradient vector The square of the j-th component.

[0069] In this embodiment, to ensure consistent gradient scales across different tasks and prevent excessively large gradients for a particular optimization objective from causing model training instability, the initial gradient is normalized based on the L2 norm. This ensures that gradients from different tasks are compared and measured on the same scale, reflecting the comparability of each task's contribution to optimization. In multi-task learning or multi-objective optimization, the gradient directions of different tasks may be inconsistent or even conflicting (gradients pointing in different or even opposite directions in the parameter space). Such parameter conflicts can cause some parameter update directions to cancel each other out, slowing down the optimization process and even degrading model performance on certain tasks. This embodiment introduces a gradient normalization mechanism to further improve the stability of the training process, accelerate model convergence, and effectively reduce the impact of parameter conflicts.

[0070] Step 23, Task-based The historical gradient of the previous iteration is used to calculate the expected gradient of the current iteration using the exponential moving average method;

[0071] The expected gradient is calculated using the exponential moving average method, specifically by selecting a smoothing coefficient. (Usually 0.9 or 0.99), used to control the degree of influence of past gradients on the current gradient, the formula is as follows:

[0072] (7);

[0073] in, It is the expected gradient of the current iteration. It is the expected gradient of the previous iteration. It is the normalized initial gradient of the current task i. For the set value, The influence of the new gradient is determined by its size. This makes the impact of historical gradients last longer.

[0074] Step 24: Based on the designed gradient balancing loss function, calculate the gradient difference of the i-th task as the gradient balancing loss according to the expected gradient of the i-th task. The gradient balancing loss function is expressed as:

[0075] (8);

[0076] in, This represents the initial gradient of the normalized i-th task loss term. This represents the expected gradient of the loss value for the i-th task.

[0077] The gradient balance loss constructed in this embodiment is used to measure the deviation between "expectation" and "actual". In step 23, "expected gradient" is introduced, which is the historical trend. In step 24, "gradient difference" represents the gap between the actual gradient and the expected gradient, reflecting whether the task deviates from the predetermined optimization trajectory at the current stage.

[0078] Step 25: Based on the gradient balance loss of the i-th task, calculate the gradient of the gradient balance loss with respect to the task weights, and update the task weights using gradient descent to obtain the weights corresponding to the parameter optimization tasks in the updated overall loss function.

[0079] Calculate the gradient of the loss function with respect to the task weights, and update the weights of the i-th task in the (t+1)-th iteration using the following formula.

[0080] First, calculate the gradient of the gradient balancing loss function with respect to the task weights:

[0081] (9);

[0082] The derivative here measures the task weight. The impact on gradient balancing loss.

[0083] Secondly, the task weights are updated using gradient descent, as shown in the following formula:

[0084] (10);

[0085] in, The set learning rate is preferred. Set to 0.01;

[0086] For each parameter optimization task i, repeat steps 21 to 25 to update the weights of the N task losses. Through the above weight update process, the weights of each task i can be gradually adjusted to make the task optimization more balanced.

[0087] In this embodiment, the weight update is achieved by monitoring the gradient dynamics of each parameter optimization task in real time, calculating its immediate impact on system performance improvement and its historical contribution trend, and adaptively adjusting the weights of each task in the overall loss function with gradient balancing loss as the optimization objective. This process realizes automatic allocation and dynamic balancing of task weights in multi-task training, significantly improving the stability of model training and final performance.

[0088] Furthermore, based on the weights of each optimization task updated after the current iteration number t, the overall loss function value is updated. Based on the obtained loss function value, the model parameters are updated, and the (t+1)th iteration (the next training iteration) of the QKD parameter model is executed. The model parameter update process includes the following steps:

[0089] Step 31: Based on the overall loss function of the QKD parameter model, and the weights of each optimization task updated after the current iteration number t, obtain the overall multi-task loss function of the QKD parameter model for the next (t+1) iteration.

[0090] The loss of each task is weighted using the following formula to obtain the overall multi-task loss function for the (t+1)th iteration.

[0091] (11);

[0092] Step 32: Calculate the gradient of the overall multi-task loss function with respect to the model parameters for the next (t+1) iteration;

[0093] To update the model parameters, the weighting function is calculated. For model parameters gradient:

[0094] (12);

[0095] After unfolding it:

[0096] (13);

[0097] Step 33: Update the model parameters using gradient descent, as shown in the following formula:

[0098] (14);

[0099] in, It's the learning rate. It is the gradient of the current overall multi-task loss.

[0100] Furthermore, during the training of the QKD parameter model, after each iteration, the current total loss value is recorded and compared with the loss value of the previous iteration. If, during a set number of iterations, such as 20 iterations, the total loss decreases below a preset threshold m, or shows a trend towards stabilization, an early stopping mechanism is triggered to terminate subsequent training. Through repeated iterations, until the model converges, the trained QKD parameter model is finally obtained.

[0101] Optionally, an early stopping mechanism can be used during the training of the QKD parameter model to improve training efficiency and avoid model overfitting. The specific steps are as follows:

[0102] Step 41: Set the hyperparameters for early stopping judgment, including the convergence threshold m and the maximum tolerance number of rounds K;

[0103] Specifically, the convergence threshold m is used to measure the minimum effective decrease in the loss function, and the value of the convergence threshold m can be set to 10. -6 ≤m≤10 -4 ;

[0104] The maximum tolerance number of iterations K is the maximum number of iterations that the loss function can be allowed to not decrease significantly for several consecutive iterations. The maximum tolerance number of iterations K can be set to a range of 5 ≤ K ≤ 20.

[0105] Step 42: After each iteration, record the current total loss value and calculate the difference between the current total loss value and the loss value of the previous iteration. :

[0106] ;

[0107] in, This represents the current total loss value. ) represents the loss value in the previous round.

[0108] Step 43: Determine if the current loss decrease is less than the threshold. If it is less than the threshold, increment the early stop counter by 1.

[0109] Specifically, determine: ΔL < m;

[0110] If true, it is considered "not significantly decreased" and the early stop counter C is incremented by 1; otherwise, the counter C is reset to 0.

[0111] Step 44: Determine whether the early stopping counter has reached the upper limit C≥K. If the condition is met, trigger the early stopping mechanism, terminate the training process, and output the current model as the final optimization result. If the upper limit has not been reached, execute step 41 to continue the next round of training, that is, to carry out the next t+1th iteration.

[0112] The ultimate goal of a quantum key distribution system is to achieve the optimal key generation rate based on the optimized strengths of the signal state and decoy state, the transmission probability, and system condition parameters. Taking the three-strength MDI-QKD protocol as an example, the sender needs to optimize the signal state strength μ and the decoy state strength ν, as well as the transmission probability (Pμ, Pν), where Pμ and Pν are the probabilities of selecting the signal state and the decoy state, respectively. These parameters are then unified as a vector. Response. Furthermore, in addition to the selection of signal and decoy state strengths and transmission probabilities, the calculation of the key generation rate r also depends on system conditions. : (ed, dc, np, td). Using the formula r = R( , The two conditions are represented by , which gives the key generation rate.

[0113] Furthermore, the QKD parameter model is set as a multi-task loss function. The overall loss function is shown in formula (3), which is the sum of losses for all tasks. The multi-task loss function includes a prediction key rate loss term and an auxiliary target loss term. The auxiliary target loss term is a loss term targeting each parameter of the quantum key distribution system, including the bit error rate loss function and the dark count rate loss function, etc.

[0114] The key rate prediction loss term is predicted using a pre-trained Final-XGBoost model. The QKD parameters are input into the pre-trained Final-XGBoost model to obtain the predicted key generation rate. The objective of the key rate prediction loss term is to maximize the key generation rate. Other auxiliary objective losses are calculated using the error between the target value and the predicted value.

[0115] Specifically, to maximize the key generation rate, a key rate objective function based on the QKD parameters is constructed, denoted as:

[0116] r = R( , (15);

[0117] (16);

[0118] Where R represents the formula for calculating the key generation rate. The total gain of the signal state; The total gain of the decoy state; The bit error rate of the corresponding state; It is a binary entropy function, representing information uncertainty; This is the information error correction efficiency factor, which is usually slightly greater than 1, such as 1.1.

[0119] Because formula (16) exhibits a complex nonlinear structure under different communication conditions, it is difficult to solve analytically using traditional methods. In this embodiment, a pre-trained Final-XGBoost model is used to approximate the model of R. During the optimization process, the parameters to be optimized ( , The parameters are combined into a complete input vector and then fed into the Final-XGBoost model to obtain the predicted key rate value under the optimal hyperparameter combination. Simultaneously, to balance the impact of different parameters on the final key rate,

[0120] This embodiment designs a multi-task loss function, with maximizing the key rate as the primary objective, and incorporates other auxiliary objectives into the loss function expression:

[0121] (17);

[0122] in, To predict the key rate, and The loss functions are the bit error rate and the dark count rate, respectively. Representing the remaining other loss items, (i=1,2,3,4) represent the loss weights for each objective. During each iteration, the system dynamically adjusts the weights based on the gradient changes of different tasks. The value of is determined to achieve adaptive adjustment of the multi-objective optimization direction. Finally, Final-XGBoost, which constructs a dynamic adaptive loss mechanism, achieves this. , An iterative search is performed to select the optimal parameter combination that minimizes the loss function L and maximizes the key rate R. The entire optimization process is controlled by an early stopping mechanism to ensure that the optimization result achieves a balance between convergence and generalization.

[0123] Furthermore, the QKD parameter model training process includes the following steps:

[0124] Step S1, Data Preprocessing: Preprocessing the original QKD parameters in the training set ( , Normalization preprocessing is performed, and the protocol type is encoded;

[0125] That is, the QKD parameters are preprocessed using the Z-score normalization method;

[0126] Specifically, a training set is constructed by generating QKD system parameter data; the QKD system parameter data generation method specifically involves using a quantum key distribution dataset downloaded from IEEE DataPort (including dark count rate ed, bit error rate dc, number of pulses np, and communication distance td) and denoting it as... Simultaneously, a dataset containing the strength of the signal state and the decoy state, as well as the transmission probability, was generated using a Python program, and denoted as... A dataset is constructed based on the generated QKD system parameter data, and the QKD parameter model is trained.

[0127] Step S2, QKD parameter optimization: Optimize the normalized QKD parameters ( , The encoded protocol type features are input into the QKD parameter model to obtain the optimized QKD parameters. The key generation rate under the optimized parameters is then predicted based on the trained final-XGBoost model.

[0128] Step S3, Loss Calculation: Define loss functions for different optimization objectives and dynamically calculate the loss value for each objective based on the current prediction results; optimization objectives include maximizing the key generation rate, improving the performance of each system parameter, etc.

[0129] Step S4, Weight Update: Based on the obtained loss values, and considering the real-time contribution and gradient changes of each parameter to the system performance at different iteration stages, the weights corresponding to the optimization tasks of each parameter in the loss function are automatically assigned during each iteration. The weight assignment method in this step is the same as the adaptive weight update method in steps 21 to 25.

[0130] In this embodiment, a dynamic adjustment mechanism is used to adaptively update the weight coefficients of each optimization objective based on the real-time feedback results of the loss function, thereby guiding the optimizer to achieve a trade-off among multiple objectives and improving the model's generalization ability and robustness in different scenarios.

[0131] Step S5: Weight the losses based on the updated weights to obtain the loss function value for the next iteration; update the model parameters of the QKD parameter model based on steps 31 to 32, iterate and train multiple times until the training stopping condition is met, and obtain the trained QKD parameter model.

[0132] The process of determining whether to stop iterative training may include the aforementioned early stopping mechanism, which executes steps 41 to 44 to determine whether to stop training.

[0133] Different protocols exhibit significant differences in their specific physical implementation and operational principles, leading to systematic variations in the characteristic distribution of key performance indicators such as channel loss and key generation rate. To address these issues and verify the good versatility and protocol adaptability of the proposed method in this embodiment, applicable to various mainstream quantum key distribution protocols, this embodiment introduces protocol type features when constructing the input of the optimization model. Specifically, each data sample is labeled with its corresponding protocol type (e.g., BB84, MDI, or E91), and this classification information is incorporated into the model input vector as a feature of the input space through one-hot encoding. This design enables the model to automatically learn the differences in feature distribution under different protocols during the training phase, thereby achieving adaptive adjustment and discrimination of protocols during the optimization phase, enhancing the system's adaptability to multi-protocol environments.

[0134] To verify the cross-protocol generalization performance of the proposed method, tests were conducted on datasets constructed based on the BB84, MDI, and E91 protocols. The results show that the proposed method exhibits extremely high prediction accuracy across all protocol types: the R² value for all test results exceeds 0.998, and the RMSE value is below 0.0001. The model achieved the lowest RMSE (0.000073) and the highest R² (0.99880) on the BB84 protocol dataset.

[0135] With the same training dataset and feature configuration, the method of this invention achieves a lower root mean square error (RMSE) and a higher coefficient of determination (R²) in the key rate prediction task. Specific experimental results are shown in Table 1. The RMSE of the model with the added dynamic weight mechanism on the dataset is reduced to 8.90004 × 10⁻⁶. -5 It outperforms the RMSE of the model without a dynamic weighting mechanism (9.14664 × 10⁻⁶). -5 The R² value improved to 0.9985, better than the comparative model's 0.9984, indicating that the proposed method has strong fitting accuracy and generalization ability. Furthermore, due to the introduction of the dynamic loss mechanism, the model focuses more intently on the target task and updates gradients more efficiently, resulting in an evaluation time of 1.031 seconds, better than the comparative method's 1.636 seconds, thus improving operational efficiency and making it suitable for quantum communication applications with high real-time requirements.

[0136] Table 1 compares the performance of the training model in this embodiment with existing training models using static loss functions;

[0137]

[0138] Traditional models use static loss functions, which can easily lead to a situation where one task dominates the training process during multi-task optimization.

[0139] like Figure 3 As shown, the trends of key rate weight and error rate weight as a function of iteration number are depicted during the optimization of quantum key distribution parameters. Figure 3 The two curves in the image represent the key rate weight (blue) and error rate weight (orange), respectively. They exhibit significant fluctuations during the iteration process, reflecting the dynamic adjustment of both weight coefficients during optimization. Although the weight coefficients are similar at some iteration points, indicating a relatively balanced relative importance of key rate and error rate at these points, their differences are substantial at other iteration points, suggesting that the relative importance of key rate or error rate may vary significantly at these points. Overall, the weight coefficients do not show a monotonically increasing or decreasing trend, suggesting that the adjustment of the weight coefficients may be to achieve different optimization objectives at different iteration stages.

[0140] like Figure 4 As shown, this figure displays a histogram of the distribution of a model performance evaluation metric. Figure 4 In the `Iteration` section, it indicates the number of iterations. In each iteration, the optimization algorithm re-evaluates and adjusts the weights of key rate and bit error rate based on the current model state. `Weight Coefficient` represents the optimization weight of key rate and bit error rate in that iteration. A larger weight indicates higher importance of that metric during optimization, and the model will be more inclined to optimize it. `Key Rate Weight` represents the key rate weight. `Error Rate Weight` represents the bit error rate weight.

[0141] like Figure 5 As shown in the figure, this graph compares the key rates of Final-XGBoost with and without an adaptive loss mechanism. final-XGBoost R represents the key rate of the final-XGBoost model; LSA The key rate R represents the local search algorithm. final-XGBoost / R LSA This represents the ratio of the two key rates. Proportion represents the proportion of the sample data. Mean represents the mean. Deviation represents the standard deviation. Figure 5 The medium-length bar chart shows that most ratios are concentrated between 0.98 and 1.0, meaning that in most cases, the Final-XGBoost model significantly outperforms the baseline model. The standard deviation is 0.0123, indicating that although there are some performance fluctuations, the overall performance improvement of the final model is stable and significant. In summary, this chart clearly illustrates that the final model outperforms the baseline model in most situations.

[0142] Figure 6 In the middle, R AdaptiveR represents the key rate of the final-XGBoost model, which incorporates an adaptive loss mechanism; LSA The key rate R represents the local search algorithm. Adaptive / R LSA This represents the ratio of the two key rates. Proportion represents the proportion of the sample data. Mean represents the mean. Deviation represents the standard deviation.

[0143] Figure 6 The mean value was 0.99890, and the standard deviation was only 0.00179, further confirming the central tendency and consistency of the performance ratios, indicating that the Final-XGBoost with the adaptive mechanism performs well in terms of stability and reliability. Overall, this demonstrates that the Final-XGBoost with the adaptive mechanism in this embodiment has superior performance.

[0144] It is evident that by introducing gradient normalization and dynamic weight adjustment mechanisms, an adaptive balance among multiple optimization objectives is achieved, enabling the model to achieve good synergy among various performance indicators such as bit error rate control, key rate improvement, and security assurance, thereby improving the overall system performance.

[0145] Example 2

[0146] Based on Example 1, this example provides a quantum key distribution parameter optimization system based on dynamic adaptive loss, including:

[0147] Data preprocessing module: configured to acquire the parameters and protocol type of the quantum key distribution system to be optimized, and perform preprocessing;

[0148] Parameter optimization module: It is configured to input preprocessed data into the trained QKD parameter model, output optimized quantum key distribution system parameters, and optimize the configuration of the quantum key distribution system to optimize the generation of quantum keys;

[0149] In the QKD parameter model training process, based on the real-time contribution and gradient change of each parameter to the system performance at different iteration stages, the weights corresponding to the parameter optimization tasks in the loss function are automatically assigned in each iteration step, and the loss function is updated in each step based on the adaptive weights for iterative training.

[0150] Furthermore, based on the real-time contribution and gradient changes of each parameter to the system performance at different iteration stages, the weights corresponding to the optimization tasks of each parameter in the loss function are automatically assigned during each iteration, and the process of adaptively updating the weights includes the following steps:

[0151] Based on the loss term obtained from the i-th task The gradient of the loss term for the corresponding task is obtained through the backpropagation algorithm and used as the initial gradient.

[0152] The initial gradient for each task is normalized.

[0153] Based on task The historical gradient of the previous iteration is used to calculate the expected gradient of the current iteration using the exponential moving average method;

[0154] Based on the designed gradient balance loss function, the gradient difference of the i-th task is calculated as the gradient balance loss according to the expected gradient of the i-th task.

[0155] Based on the gradient balancing loss of the i-th task, calculate the gradient of the gradient balancing loss with respect to the task weights, and use gradient descent to update the task weights, thus obtaining the weights corresponding to the parameter optimization tasks in the updated overall loss function.

[0156] It should be noted that each module in this embodiment corresponds one-to-one with each step in embodiment 1, and their specific implementation process is the same, so it will not be repeated here.

[0157] Example 3

[0158] Based on Example 1, this example provides a quantum key distribution parameter optimization system based on dynamic adaptive loss, including a parameter acquisition device and a processor;

[0159] The parameter acquisition device is used to acquire QKD parameter data and protocol type of the quantum key distribution system;

[0160] The processor is configured to perform the steps of the quantum key distribution parameter optimization method based on dynamic adaptive loss as described in Example 1.

[0161] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

[0162] While the specific embodiments of the present invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of the present invention are still within the scope of protection of the present invention.

Claims

1. A quantum key distribution parameter optimization method based on dynamic adaptive loss, characterized in that, Includes the following steps: Obtain the parameters and protocol type of the quantum key distribution system to be optimized, and perform preprocessing; The preprocessed data is input into the trained QKD parameter model, and the optimized quantum key distribution system parameters are output. The quantum key distribution system is then optimized to improve the generation of quantum keys. In the QKD parameter model training process, based on the real-time contribution and gradient change of each parameter to the system performance at different iteration stages, the weights corresponding to the parameter optimization tasks in the loss function are automatically assigned in each iteration step, and the loss function is updated in each step based on the adaptive weights for iterative training. The overall loss function for training the QKD parameter model is expressed as: ; in, The overall loss function of the QKD parameter optimization model is determined at the t-th training iteration. These are the weights of the i-th task and the j-th task at the t-th training iteration, respectively. This represents the single-task loss function of the model on task i; Based on the real-time contribution and gradient changes of each parameter to the system performance at different iteration stages, the weights corresponding to the optimization tasks of each parameter in the loss function are automatically assigned during each iteration, and the process of adaptively updating the weights includes the following steps: Based on the loss term obtained from the i-th task The gradient of the loss term for the corresponding task is obtained through the backpropagation algorithm and used as the initial gradient. The initial gradient for each task is normalized. Based on task The historical gradient of the previous iteration is used to calculate the expected gradient of the current iteration using the exponential moving average method; Based on the designed gradient balance loss function, the gradient difference of the i-th task is calculated as the gradient balance loss according to the expected gradient of the i-th task. Based on the gradient balancing loss of the i-th task, calculate the gradient of the gradient balancing loss with respect to the task weights, and use gradient descent to update the task weights, thus obtaining the weights corresponding to the parameter optimization tasks in the updated overall loss function.

2. The quantum key distribution parameter optimization method based on dynamic adaptive loss as described in claim 1, characterized in that: Based on the weights of each optimization task after the current iteration number t, update the overall loss function value. Based on the obtained loss function value, update the model parameters, including the following steps: Based on the overall loss function of the QKD parameter model, and the weights of each optimization task updated after the current iteration number t, the overall multi-task loss function of the QKD parameter model for the next iteration is obtained. Calculate the gradient of the overall multi-task loss function with respect to the model parameters for the next iteration; Gradient descent is used to update the model parameters.

3. The quantum key distribution parameter optimization method based on dynamic adaptive loss as described in claim 1, characterized in that: During the training of the QKD parameter model, after each iteration, the current total loss value is recorded and compared with the loss value of the previous iteration. If, during consecutive iterations of a set number of rounds, the total loss decreases by less than a preset threshold m, or if the system exhibits a trend towards stabilization, an early stop mechanism is triggered to terminate the training.

4. The quantum key distribution parameter optimization method based on dynamic adaptive loss as described in claim 1, characterized in that: The QKD parameter model is set to a multi-task loss function, which includes a key rate prediction loss term and an auxiliary target loss term. The auxiliary target loss term is the loss term with each parameter of the quantum key distribution system as the target; The key rate prediction loss term is predicted using a pre-trained Final-XGBoost model. The QKD parameters are input into the pre-trained Final-XGBoost model to obtain the predicted key generation rate. The objective of the key rate prediction loss term is to maximize the key generation rate. The auxiliary target loss is calculated using the error between the target value and the predicted value.

5. The quantum key distribution parameter optimization method based on dynamic adaptive loss as described in claim 1, characterized in that: The QKD parameter model training process includes the following steps: For the original QKD parameters in the training set ( , Normalization preprocessing is performed, and the protocol type is encoded; The normalized QKD parameters ( , The encoded protocol type features are input into the QKD parameter model to obtain the optimized QKD parameters. The key generation rate under the optimized parameters is then predicted based on the trained final-XGBoost model. Loss functions are defined for different optimization objectives, and the loss value for each objective is dynamically calculated based on the current prediction results. Based on the obtained loss values, and considering the real-time contribution and gradient changes of each parameter to the system performance at different iteration stages, the weights corresponding to the optimization tasks of each parameter in the loss function are automatically assigned during each iteration. The loss function value for the next iteration is obtained by weighting the various losses based on the updated weights. Update the model parameters of the QKD parameter model and iterate the training multiple times until the training stopping condition is met to obtain the trained QKD parameter model.

6. A quantum key distribution parameter optimization system based on dynamic adaptive loss, characterized in that, include: Data preprocessing module: configured to acquire the parameters and protocol type of the quantum key distribution system to be optimized, and perform preprocessing; Parameter optimization module: It is configured to input preprocessed data into the trained QKD parameter model, output optimized quantum key distribution system parameters, and optimize the configuration of the quantum key distribution system to optimize the generation of quantum keys; In the QKD parameter model training process, based on the real-time contribution and gradient change of each parameter to the system performance at different iteration stages, the weights corresponding to the parameter optimization tasks in the loss function are automatically assigned in each iteration step, and the loss function is updated in each step based on the adaptive weights for iterative training. The overall loss function for training the QKD parameter model is expressed as: ; in, The overall loss function of the QKD parameter optimization model is determined at the t-th training iteration. These are the weights of the i-th task and the j-th task at the t-th training iteration, respectively. This represents the single-task loss function of the model on task i; Based on the real-time contribution and gradient changes of each parameter to the system performance at different iteration stages, the weights corresponding to the optimization tasks of each parameter in the loss function are automatically assigned during each iteration, and the process of adaptively updating the weights includes the following steps: Based on the loss term obtained from the i-th task The gradient of the loss term for the corresponding task is obtained through the backpropagation algorithm and used as the initial gradient. The initial gradient for each task is normalized. Based on task The historical gradient of the previous iteration is used to calculate the expected gradient of the current iteration using the exponential moving average method; Based on the designed gradient balance loss function, the gradient difference of the i-th task is calculated as the gradient balance loss according to the expected gradient of the i-th task. Based on the gradient balancing loss of the i-th task, calculate the gradient of the gradient balancing loss with respect to the task weights, and use gradient descent to update the task weights, thus obtaining the weights corresponding to the parameter optimization tasks in the updated overall loss function.

7. The quantum key distribution parameter optimization system based on dynamic adaptive loss as described in claim 6, characterized in that: Based on the real-time contribution and gradient changes of each parameter to the system performance at different iteration stages, the weights corresponding to the optimization tasks of each parameter in the loss function are automatically assigned during each iteration, and the process of adaptively updating the weights includes the following steps: Based on the loss term obtained from the i-th task The gradient of the loss term for the corresponding task is obtained through the backpropagation algorithm and used as the initial gradient. The initial gradient for each task is normalized. Based on task The historical gradient of the previous iteration is used to calculate the expected gradient of the current iteration using the exponential moving average method; Based on the designed gradient balance loss function, the gradient difference of the i-th task is calculated as the gradient balance loss according to the expected gradient of the i-th task. Based on the gradient balancing loss of the i-th task, calculate the gradient of the gradient balancing loss with respect to the task weights, and use gradient descent to update the task weights, thus obtaining the weights corresponding to the parameter optimization tasks in the updated overall loss function.

8. A quantum key distribution parameter optimization system based on dynamic adaptive loss, characterized in that: Includes parameter acquisition devices and processors; The parameter acquisition device is used to acquire QKD parameter data and protocol type of the quantum key distribution system; The processor is configured to perform the steps of the quantum key distribution parameter optimization method based on dynamic adaptive loss as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Quantum key distribution parameter optimization method based on random forest algorithm

    CN110798314A

  • Bayesian-based quantum key distribution parameter optimization method and system

    CN119519945A