Mass spectrometer adaptive tuning method and application apparatus

By constructing a neural network model and a local bias prediction model, combined with a Bayesian optimization strategy, the model-reality gap and noise interference problems in mass spectrometer tuning are solved, achieving high-precision and fast adaptive tuning, which is suitable for mass spectrometer hardware systems.

CN122043977BActive Publication Date: 2026-06-19SHANGHAI DEV CENT OF COMP SOFTWARE TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANGHAI DEV CENT OF COMP SOFTWARE TECH
Filing Date
2026-04-20
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing mass spectrometer tuning techniques face challenges such as the model-reality gap, difficulties in cold start-up, and noise interference, resulting in insufficient tuning accuracy and low efficiency.

Method used

A neural network model and a local deviation prediction model are constructed, and a Bayesian optimization strategy is combined to select the optimal measurement and control parameters through physical guidance features and theoretical response values, so as to achieve adaptive tuning of the mass spectrometer.

Benefits of technology

It improves the accuracy and efficiency of mass spectrometer tuning, reduces data acquisition costs, enables cross-instrument compatibility, and allows for rapid convergence to the optimal operating point under small sample conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122043977B_ABST
    Figure CN122043977B_ABST
Patent Text Reader

Abstract

This application discloses an adaptive tuning method and application device for a mass spectrometer, relating to the fields of analytical instrument technology and artificial intelligence application technology. The method includes: constructing a local deviation prediction model; determining the corresponding physical guidance characteristics and theoretically expected response values ​​based on candidate measurement and control parameters; using the local deviation prediction model and the physical guidance characteristics to obtain a physical deviation characterization; obtaining a final predicted response value based on the physical deviation characterization and the theoretically expected response value; filtering candidate measurement and control parameters based on the final predicted response value to obtain optimal measurement and control parameters; using the mass spectrometer hardware system to perform measurements based on the optimal measurement and control parameters to obtain new measured data; updating the local deviation prediction model using the optimal measurement and control parameters and the new measured data, and returning to execute the step of generating candidate measurement and control parameters using a Bayesian optimization strategy, until the new measured data meets the preset convergence conditions, thus completing the adaptive tuning of the mass spectrometer. This application can improve the accuracy and efficiency of mass spectrometer tuning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of analytical instrument technology and artificial intelligence application technology, and in particular to an adaptive tuning method and application device for a mass spectrometer. Background Technology

[0002] As a representative of high-end analytical instruments, the performance of mass spectrometers (such as sensitivity, resolution, peak shape symmetry, etc.) is highly dependent on the precise tuning of measurement and control parameters such as lens voltage, radio frequency parameters, and gas flow rate in the ion optics system. With the evolution of mass spectrometry technology, the hardware structure of modern mass spectrometers has become increasingly complex, with dozens or even hundreds of adjustable parameters, and strong nonlinear coupling relationships between these parameters, making the search for the globally optimal operating point an extremely challenging task.

[0003] In related technologies, the automatic tuning of mass spectrometers mainly follows the following three technical routes, but all of them have significant drawbacks:

[0004] 1. Simulation optimization method based on pure physical model: This method relies on idealized ion optics simulation software (such as SIMION) for calculation. Its core drawback lies in the existence of a "model-reality gap", that is, the theoretical model cannot accurately characterize the mechanical tolerances, surface contamination, edge field effects and electronic response nonlinearity in the actual instrument. As a result, the optimal parameters obtained by simulation are not optimal on the actual instrument, and a lot of manual intervention is still required.

[0005] 2. "Black-box" search methods based on traditional optimization algorithms: This method treats the mass spectrometer as a black box and uses model-free algorithms such as the simplex method and genetic algorithms for the search. Its drawbacks are: 1) Low search efficiency, prone to getting trapped in local optima. 2) Extremely lacking robustness; the inherent shot noise in the mass spectrometry signal can severely mislead the search direction, leading to oscillations in the tuning results. 3) Potentially outputting dangerous parameters that violate physical safety limits (such as exceeding the breakdown voltage).

[0006] 3. Purely data-driven deep learning methods: This approach attempts to learn control policies directly from data using deep models (such as deep reinforcement learning). It faces the "cold start" challenge: model training requires massive amounts of labeled data, while mass spectrometry experiments are time-consuming; simultaneously, "domain drift" exists between different instruments, making it difficult to directly transfer a model trained on one instrument to a new one, resulting in high engineering deployment costs and poor versatility.

[0007] In summary, mass spectrometer tuning technology faces three major challenges: 1) Model-reality gap: Models based on pure physical mechanisms (such as SIMION simulation) cannot characterize the mechanical tolerances and edge field effects of actual instruments, resulting in limited prediction accuracy; 2) Difficulty in cold start: Models based on pure deep learning are highly dependent on measured data, requiring a lot of time to collect data and retrain when migrating across different models; 3) Noise interference: Traditional optimization algorithms (such as the simplex method) are easily misled by shot noise in mass spectrometry signals, causing tuning results to oscillate in non-optimal regions or fall into local extrema (i.e., overfitting). Summary of the Invention

[0008] The purpose of this application is to provide an adaptive tuning method and application device for a mass spectrometer, which can improve the accuracy and efficiency of mass spectrometer tuning.

[0009] To achieve the above objectives, this application provides the following solution:

[0010] In a first aspect, this application provides an adaptive tuning method for a mass spectrometer, comprising:

[0011] Build a neural network model;

[0012] A local deviation prediction model is constructed based on the neural network model and the adaptation module;

[0013] Candidate measurement and control parameters are generated using a Bayesian optimization strategy;

[0014] Based on the candidate measurement and control parameters, the corresponding physical guidance characteristics and theoretical expected response values ​​are determined;

[0015] The physical deviation characterization is obtained by using the local deviation prediction model based on the physical guidance characteristics.

[0016] The final predicted response value is obtained based on the physical deviation characterization and the theoretical expected response value.

[0017] Based on the final predicted response value, the candidate measurement and control parameters are filtered to obtain the optimal measurement and control parameters;

[0018] The newly added measured data were obtained by using a mass spectrometer hardware system based on the optimal measurement and control parameters.

[0019] The local deviation prediction model is updated using the optimal measurement and control parameters and the newly added measured data, and the step of generating candidate measurement and control parameters using a Bayesian optimization strategy is returned until the newly added measured data meets the preset convergence condition, thus completing the adaptive tuning of the mass spectrometer.

[0020] In one embodiment, constructing a neural network model includes:

[0021] Acquire mass spectrometry data of the first sample; the first sample mass spectrometry data includes historical measurement and control parameters and historical response values ​​corresponding to the historical measurement and control parameters;

[0022] Historical physical guidance characteristics and historical theoretical response values ​​are determined based on the historical measurement and control parameters; historical physical deviation characteristics are determined based on the historical response values ​​and historical theoretical response values.

[0023] Based on the historical physical deviation characterization and the historical physical guidance features, a first sample pair is constructed to obtain the first sample mass spectrometry dataset;

[0024] An initial neural network model is constructed using a deep neural network.

[0025] The initial neural network model is trained using the first loss function based on the first sample mass spectrometry dataset to obtain the neural network model.

[0026] In one embodiment, the process of constructing a local bias prediction model based on the neural network model and the adaptation module includes:

[0027] Freeze the neural network model, and add the adaptation module to the frozen neural network model to construct an initial local bias prediction model;

[0028] Acquire measured sample mass spectrometry data from the mass spectrometer hardware system; the measured sample mass spectrometry data includes sample measurement and control parameters and sample response values ​​corresponding to the sample measurement and control parameters.

[0029] Based on the sample measurement and control parameters, determine the sample physical guidance characteristics and the sample theoretical response value; based on the sample response value and the sample theoretical response value, determine the sample physical deviation characterization;

[0030] A second sample pair is constructed based on the sample physical deviation characterization and the sample physical guidance features to obtain the second sample mass spectrometry dataset;

[0031] The initial local bias prediction model is trained using the second loss function based on the second sample mass spectrometry dataset to obtain the local bias prediction model.

[0032] In one embodiment, the process of adding the adapter module to the frozen neural network model includes:

[0033] The adapter module can be inserted serially between layers of the frozen neural network model, connected to each hidden layer of the frozen neural network model in a bypass parallel manner, or injected into the weight matrix of the frozen neural network model in the form of low-rank matrix decomposition.

[0034] In one embodiment, an ion optical analysis rule is used to determine the corresponding physical guidance characteristics and theoretical expected response values ​​based on the candidate measurement and control parameters; the ion optical analysis rule is constructed through a joint numerical simulation of the motion equation of ions in an electromagnetic field and the gas dynamics equation.

[0035] In one embodiment, the candidate measurement and control parameters are filtered based on the final predicted response value to obtain the optimal measurement and control parameters, including:

[0036] Obtain preset physical feasibility domain constraints; the preset physical feasibility domain constraints include: voltage-gas pressure product constraints, potential gradient constraints, and power density constraints;

[0037] The candidate measurement and control parameters are selected based on the preset physical feasibility domain constraints and the final predicted response value to obtain the optimal measurement and control parameters.

[0038] In one embodiment, the physical guidance feature includes a dimensionless physical feature; the dimensionless physical feature includes at least one of the following: focusing coefficient, Mach number analogy factor, space charge parameter, reduced electric field strength, and time-of-flight dispersion coefficient.

[0039] In one embodiment, the second loss function is an uncertainty-aware loss function.

[0040] Secondly, this application provides an application device, which includes a tuning system and a mass spectrometer hardware system; the tuning system is connected to the mass spectrometer hardware system; the tuning system is used to implement the steps of the mass spectrometer adaptive tuning method described in any one of the above.

[0041] In one embodiment, the mass spectrometer hardware system includes: an ion source subsystem, an ion transport and lens subsystem, a mass analyzer, a detector, and a controller;

[0042] The tuning system is connected to both the controller and the detector.

[0043] The ion source subsystem, the ion transmission and lens subsystem, the mass analyzer, and the detector are arranged sequentially along the ion optical axis; the controller is connected to the ion source subsystem, the ion transmission and lens subsystem, and the mass analyzer respectively.

[0044] According to the specific embodiments provided in this application, this application has the following technical effects:

[0045] This application provides an adaptive tuning method and application device for a mass spectrometer. Based on candidate measurement and control parameters, the corresponding physical guidance characteristics and theoretically expected response values ​​are determined. A local deviation prediction model is then used to obtain a physical deviation characterization based on these physical guidance characteristics. This method incorporates physical priors, ensuring that the model's prediction trend in sparse data regions conforms to physical laws. It effectively combines the universality of physical mechanisms with the accuracy of data-driven approaches, solving the problems of limited prediction accuracy due to purely physical mechanisms, the strong dependence of pure deep learning models on measured data, and the overfitting issues common in traditional optimization algorithms. The optimal measurement and control parameters are obtained by filtering candidate measurement and control parameters using the final predicted response values. The mass spectrometer hardware system then performs measurements based on these optimal parameters. The local deviation prediction model is updated based on newly added measured data, forming a closed-loop optimization. This achieves cross-instrument adaptation with extremely low data costs, further improving the accuracy and efficiency of mass spectrometer tuning. Attached Figure Description

[0046] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0047] Figure 1 This is a flowchart of an adaptive tuning method for a mass spectrometer according to one embodiment of this application;

[0048] Figure 2 A schematic diagram illustrating the principle of the uncertainty-perceived loss function provided in an embodiment of this application;

[0049] Figure 3 This is a schematic diagram of the application device structure provided in an embodiment of this application. Detailed Implementation

[0050] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0051] In view of the above-mentioned technical status, the purpose of this application is to overcome the three major challenges of insufficient accuracy of pure physical models, difficulty in cold start of pure data models, and poor noise resistance and lack of security of traditional black-box optimization algorithms, and to provide a high-precision, fast-transfer, and robust adaptive tuning method for mass spectrometers.

[0052] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0053] In one exemplary embodiment, such as Figure 1 As shown, an adaptive tuning method for a mass spectrometer is provided, including:

[0054] Step S1: Construct a neural network model. Based on the neural network model and the adaptation module, construct a local bias prediction model.

[0055] Step S2: A Bayesian optimization strategy is used to generate candidate control parameters. Based on the candidate control parameters, the corresponding physical guidance characteristics and theoretical expected response values ​​are determined.

[0056] Step S3: Using a local deviation prediction model, the physical deviation characterization is obtained based on the physical guidance features.

[0057] Step S4: Based on the physical deviation characterization and the theoretical expected response value, the final predicted response value is obtained. Candidate control parameters are then selected based on the final predicted response value to obtain the optimal control parameters.

[0058] Step S5: The mass spectrometer hardware system is used to perform measurements based on the optimal measurement and control parameters to obtain the new measured data.

[0059] Step S6: Update the local deviation prediction model with the optimal measurement and control parameters and the newly added measured data, and return to execute the step of generating candidate measurement and control parameters using the Bayesian optimization strategy until the newly added measured data meets the preset convergence condition, thus completing the adaptive tuning of the mass spectrometer (i.e., realizing the closed-loop optimization of the measurement and control parameters of the mass spectrometer hardware system).

[0060] In one embodiment, ion optical analysis rules can be employed to determine the corresponding physical guidance characteristics and theoretically expected response values ​​based on candidate measurement and control parameters. These ion optical analysis rules are constructed through joint numerical simulations of the ion's motion equations in an electromagnetic field and the gas dynamics equations. The joint numerical simulation simulates the ion's trajectory in the electromagnetic field and the dynamic behavior of the background gas, aiming to deduce the theoretically expected response value under ideal conditions at the physical level.

[0061] In this embodiment, symbolic regression can also be performed based on benchmark calibration data of similar mass spectrometers or mass spectrometer hardware systems to extract the display function relationship between measurement and control parameters (such as voltage and air pressure) and theoretical expected response values ​​(such as transmission efficiency and resolution).

[0062] Physical guidance features include dimensionless physical features. These include at least one of the following: focusing coefficient, Mach number analogy factor, space charge parameter, reduced electric field strength, and time-of-flight dispersion coefficient. The focusing coefficient characterizes the ratio of applied voltage to the mass-to-charge ratio of the target ion. The Mach number analogy factor characterizes the ratio of background gas velocity to local sound velocity. The space charge parameter characterizes the normalized Coulomb repulsion effect related to the geometry of the ion current intensity. The reduced electric field strength characterizes the ratio of electric field strength to gas number density. The time-of-flight dispersion coefficient characterizes the ratio of the time-of-flight broadening of the ion in the drift region to the accelerating electric field.

[0063] For example, the original candidate measurement and control parameters can be converted into dimensionless physical characteristics by using ion optical analysis rules, so as to eliminate dimensional differences and introduce physical priors.

[0064] 1) Focusing Coefficient: The calculation formula is as follows In the formula, For focusing coefficient, The voltage of the lens. To accelerate voltage, For ion mass, The mass number is the charge number. This feature eliminates the influence of mass-to-charge ratio variations on lens focusing ability. In the construction of the local deviation prediction model, this allows the model to learn universal focusing rules across mass numbers.

[0065] 2) Mach Number Analogy: The calculation formula is as follows . Mach number analogy factor; The macroscopic flow rate of the background gas; The heat capacity ratio of the gas; Boltzmann's constant; This refers to the local absolute temperature. The molecular mass is the background gas.

[0066] 3) Space Charge Parameter: The calculation formula is as follows: .in, For space charge parameters; This represents the total ion current intensity. This refers to the transmission path length. It is the vacuum permittivity; It is the reciprocal of the mass-to-charge ratio of the ion; To accelerate voltage; r denoted as the characteristic radius of the ion beam.

[0067] 4) Reduced Electric Field: The calculation formula is as follows In the formula, To reduce the electric field strength, The voltage difference between the electrodes Interpole distance (hardware constant, e.g.) ), For air pressure, Boltzmann's constant, Temperature. This feature is used to characterize the mobility of ions in the background gas.

[0068] 5) Time Dispersion Coefficient: .in, The time-of-flight dispersion coefficient; This refers to the time-of-flight deviation of the ions; This refers to the mass-to-charge ratio deviation. To increase the field strength; This represents the center flight time under ideal conditions.

[0069] In the process of constructing the neural network model and the local bias prediction model, in order to accelerate the convergence of the neural network, the historical physical orientation features in the first sample mass spectrometry dataset and the physical orientation features of the second sample mass spectrometry dataset were both Z-Score standardized (i.e., the mean was subtracted and the standard deviation was divided).

[0070] Meanwhile, the theoretical response value is calculated based on the SIMION ion optics simulation engine (i.e., ion optics analytical rules) as the physical baseline for the local bias prediction model. However, this theoretical response value is calculated based on ideal geometry, uniform electromagnetic field distribution, and a simplified ion-molecule interaction model. It cannot accurately characterize the inherent mechanical assembly tolerances, potential distortions caused by lens surface contamination, statistical fluctuations in the ion-neutral particle collision cross-section, and non-ideal effects such as power supply ripple that inevitably exist in actual mass spectrometer hardware systems. These complex factors not covered by the theoretical model are the root cause of the "model-reality gap." Therefore, the core task of the local bias prediction model introduced in this application is not to directly predict the response of the mass spectrometer hardware system, but to accurately predict the difference between the theoretical response calculated by the theoretical model and the actual response—the physical residual (i.e., the physical bias representation). In this way, the neural network (i.e., the neural network model and the local bias prediction model) focuses on learning the parts that the theory "does not know," thereby achieving complementarity and deep integration of physical priors and data-driven capabilities.

[0071] In one embodiment, this application proposes a hybrid modeling framework of "physical theoretical benchmark + data-driven residual learning". Its core idea is to decompose the complex instrument response (i.e., mass spectrometer hardware system) into an analytical theoretical part and a data-driven residual part (i.e., neural network model and adaptation module). To better learn global physical characteristics, the neural network model construction process in step S1 includes:

[0072] S111, Obtain the first sample mass spectrometry data. The first sample mass spectrometry data includes historical measurement and control parameters and historical response values ​​corresponding to the historical measurement and control parameters. In this embodiment, the first sample mass spectrometry data can be obtained from ion optics simulation data or the historical debugging logs of similar instruments (i.e., mass spectrometers).

[0073] S112, determine historical physical guidance characteristics and historical theoretical response values ​​based on historical measurement and control parameters. Determine historical physical deviation characteristics based on historical response values ​​and historical theoretical response values.

[0074] S113, construct the first sample pair based on historical physics deviation characterization and historical physics guidance features to obtain the first sample mass spectrometry dataset.

[0075] S114 uses a deep neural network to construct the initial neural network model.

[0076] S115, using the first loss function, train the initial neural network model based on the first sample mass spectrometry dataset to obtain the neural network model. The first loss function is the mean squared error loss function.

[0077] For example, the neural network model serves as the backbone of the local bias prediction model. The neural network model employs a fully connected deep neural network structure, including four hidden layers. The number of neurons in each hidden layer is [128, 256, 256, 128]. The activation function used is the Swish activation function (…). To alleviate the vanishing gradient problem in deep networks, Dropout layers (with a dropout rate of 0.1 in this embodiment) and Batch Normalization layers are introduced between adjacent hidden layers to prevent overfitting. To enable the initial neural network model to learn the historical physics-bias representation relationship under ideal conditions more quickly, the first loss function is the mean squared error loss function, expressed as: In the formula, This is the mean squared error loss value. This represents the number of first sample pairs in the first sample mass spectrometry dataset. The first sample in the mass spectrometry dataset A historical physical deviation characterization, The first predicted output of the initial neural network model A physical deviation characterization The first sample in the mass spectrometry dataset Physical orientation characteristics of each sample.

[0078] Furthermore, to support the transfer of physical characteristics across mass spectrometer hardware systems, the input layer of the neural network model is configured to receive physical guidance features and instrument context encoding. The instrument context encoding contains an identifier vector used to distinguish mass spectrometer families, models, or ion source types to support the transfer of physical characteristics across models. After training the neural network model, its weight parameters are frozen and do not participate in the subsequent training and updates of the local bias prediction model.

[0079] Step S1, which involves constructing a local bias prediction model based on a neural network model and an adaptation module, includes:

[0080] S121, Freeze the neural network model. Add an adapter module to the frozen neural network model to construct an initial local bias prediction model. Specifically, the process of adding an adapter module to the frozen neural network model includes: inserting the adapter module sequentially between layers of the frozen neural network model; connecting the adapter module to each hidden layer of the frozen neural network model in a bypass parallel manner; or injecting the adapter module into the weight matrix of the frozen neural network model in the form of low-rank matrix factorization.

[0081] S122, acquire the measured sample mass spectrometry data of the mass spectrometer hardware system. The measured sample mass spectrometry data includes the sample measurement and control parameters and the sample response values ​​corresponding to the sample measurement and control parameters.

[0082] S123, determine the physical guidance characteristics and theoretical response value of the sample based on the sample measurement and control parameters. Determine the physical deviation characterization of the sample based on the sample response value and the theoretical response value.

[0083] S124, a second sample pair is constructed based on the sample physical deviation characterization and sample physical guidance features to obtain a second sample mass spectrometry dataset. In this embodiment, the number of second sample pairs in the second sample mass spectrometry dataset is less than the number of first sample pairs in the first sample mass spectrometry dataset.

[0084] S125, using the second loss function, trains the initial local bias prediction model based on the second sample mass spectrometry dataset to obtain the local bias prediction model. The second loss function is an uncertainty-aware loss function. The local bias prediction model can characterize the mapping relationship between input parameters (i.e., physical guidance features) and physical bias representations.

[0085] In this embodiment, the adaptation module can be a lightweight bottleneck fine-tuning sub-network, which is connected in parallel to each hidden layer of the backbone network (i.e., the neural network model). The lightweight bottleneck fine-tuning sub-network is a bottleneck architecture, including a dimensionality reduction layer, a non-linear activation layer, and a dimensionality increase layer; that is, the input data sequentially passes through the dimensionality reduction layer, the non-linear activation layer, and the dimensionality increase layer. The non-linear activation layer has a dimension of 8, which, compared to the backbone network's 256 dimensions, achieves a maximum parameter compression ratio of 32:1. Therefore, during the initial training phase of the local bias prediction model, only a very small number of parameters in the adaptation module need to be updated, greatly reducing the demand for computing resources and making it suitable for embedded or edge computing environments.

[0086] To achieve precise adaptation to the target instrument (i.e., the mass spectrometer hardware system) while preserving general physical laws, this embodiment adopts a training strategy of "backbone freezing - adaptation module fine-tuning," the specific process of which is as follows: Implementation of the constraint mechanism (freezing the backbone): The set of weight parameters of the neural network model (backbone network) is defined as... Define the set of weight parameters for the adaptation module as follows: Before training using the second sample mass spectrometry dataset, explicitly... Set to a non-trainable / frozen state. This means that during backpropagation, The gradient will be forced to zero, thus strictly constraining its parameter update magnitude to 0. This operation ensures that the model will not "forget" the general ion optical physics laws learned in the pre-training phase (i.e., the historical physics guidance feature-historical physics deviation representation relationship) due to overfitting to small sample data. Joint inference and independent update: Iterative training is performed using a second sample mass spectrometry dataset obtained from the mass spectrometer hardware system. In each forward pass, the input data flows simultaneously through the frozen backbone network and the trainable adapter module, and the outputs of both are linearly superimposed to form a complete prediction of the physics deviation. After calculating the second loss function, backpropagation is performed. The optimizer is configured to target only... The gradient is calculated and updated. In this way, the adaptation module is forced to specifically learn the "residual part that the backbone network failed to predict," that is, the nonlinear hardware bias unique to the mass spectrometer hardware system, thereby efficiently completing the training of the local bias prediction model.

[0087] Optimizer configuration: The AdamW optimizer is used during training, and the initial learning rate is set to [value missing]. The learning rate is decayed using a cosine annealing strategy. The batch size is set to 32 to accommodate the characteristics of localized small sample data.

[0088] In this embodiment, in order to know the inherent shot noise in the mass spectrometry signal, the output layer of the local bias prediction model is configured as a dual-head output: simultaneously outputting the mean and uncertainty (i.e., variance) of the predicted physical bias characterization.

[0089] The second loss function is the uncertainty-aware loss function (including the heteroscedastic Gaussian negative log-likelihood loss function and the signal dependence loss function). The principle of the uncertainty-aware loss function is as follows: Figure 2 As shown ( Figure 2 Part A is a high-noise scene. Figure 2 Part B represents a low-noise scenario. In this embodiment, the Heteroscedastic NLL Loss function is used: In the formula, This represents the value of the loss function. This represents the number of second sample pairs in the second sample mass spectrometry dataset. Indicates the second sample mass spectrometry dataset. Physical deviation characterization of each sample This represents the first predicted output of the initial local deviation prediction model. The mean value representing each physical deviation. This represents the first predicted output of the initial local deviation prediction model. The variance characterized by a physical deviation For the second sample mass spectrometry dataset, the first Physical orientation characteristics of each sample.

[0090] When the measured sample mass spectrometry data contains strong noise, the model will output a large variance when the sample physical guidance features in the second sample mass spectrometry dataset are input into the model. For the prediction error term, This is the uncertainty regularization term. In the prediction error term, The denominator automatically reduces the weight of the error gradient generated by that sample, thus preventing the model from being misled by random noise with statistical fluctuation characteristics. The uncertainty regularization term prevents the model from amplifying infinitely. To evade punishment. Random noise includes shot noise that follows a Poisson distribution or thermal noise that follows a Gaussian distribution.

[0091] In addition, a signal-dependent loss function can be used to train a local bias prediction model, enabling it to simultaneously output the residual prediction mean and variance, and automatically suppress interference from high-noise samples using the variance.

[0092] Based on this, after selecting the optimal measurement and control parameters in step S4 above, the mass spectrometer hardware system performs measurements according to the optimal parameters, and the actual collected performance response index data (i.e., newly measured data) is obtained. Specific data types mainly include ion signal intensity, resolution, and peak shape parameters. These measured data are compared with the theoretically expected response values ​​to calculate the true physical deviation characterization, thus adding them as new training samples to the second sample mass spectrometry dataset for online updating of the parameters of the adaptation module in the local deviation prediction model.

[0093] As an optional implementation, in scenarios requiring high feature reconstruction capabilities, the adapter module can be inserted serially between layers of the backbone network. Specifically, the adapter module is placed between the output of the a-th hidden layer and the input of the (a+1)-th hidden layer of the backbone network. To ensure stability during the initial training phase, residual connections are typically used. This means that the output of the hidden layers of the backbone network is partly transformed by the nonlinear transformation of the adapter modules and then superimposed with another part, serving as the input to the next hidden layer. During training in this serial architecture: Freeze constraint: All original weights and bias parameters of the neural network model (backbone network) are strictly frozen and do not participate in gradient descent updates. Differential update: Input data flows through the entire serial link, and the prediction error is calculated using the second loss function. During backpropagation, although the gradient flows through the backbone network layers, it only updates the weight parameters of the adapter modules inserted within them. This mechanism allows the model to adapt to specific biases of the mass spectrometer hardware system by adjusting the feature transfer paths between layers while preserving general physical laws (carried by the backbone network).

[0094] As an optional implementation, to avoid adding any extra computational latency during the inference phase and to adapt to embedded controllers with limited computing power (such as ARM-based industrial control computers), the adaptation module can inject the weight matrix of the frozen neural network model in the form of low-rank matrix factorization. Unlike the parallel and serial adaptation modules in the above embodiments, this embodiment uses low-rank adaptation (LoRA) technology to achieve efficient parameter fine-tuning to obtain a local bias prediction model.

[0095] (1) Maintain the weight matrix of the backbone network Strict freeze. Parameter updates no longer occur in independent adaptation modules, but are instead implemented through... Inject a pair of low-rank decomposition matrices and To achieve: In the formula, The updated weight matrix, Update the matrix for weights; Initialize to 0; Initialization is performed using a Gaussian distribution; r is the rank, which is set in this embodiment. .

[0096] (2) Training and reasoning process. Training phase: only matrices are used. and The parameters in the equation participate in the gradient descent update. Because... The number of trainable parameters is reduced by more than 99% compared to full fine-tuning. Inference phase (reparameterization): When training the local bias prediction model using the second sample mass spectrometry dataset, the trained parameters are... The matrix is ​​directly added back to the original weights. Above, forming new weights This means that during actual inference, the network structure is the original deep neural network structure (i.e., the structure of the neural network model), without adding any extra layers or computational paths, thus ensuring nanosecond-level inference speed and fully meeting the real-time control requirements of the mass spectrometer hardware system.

[0097] Therefore, through this implementation method, the process of "adding an adapter module to the frozen neural network model and training an initial local bias prediction model to obtain a local bias prediction model" can be achieved not only through a physical adapter module but also through mathematical matrix low-rank constraints. This implementation method maintains the ability to solve the cold start problem while further optimizing deployment efficiency.

[0098] In one embodiment, step S4, which involves filtering candidate measurement and control parameters based on the final predicted response value to obtain the optimal measurement and control parameters, includes: acquiring preset physical feasibility domain constraints. These preset physical feasibility domain constraints include: voltage-gas pressure product constraints, potential gradient constraints, and power density constraints. The optimal measurement and control parameters are obtained by filtering candidate measurement and control parameters based on the preset physical feasibility domain constraints and the final predicted response value.

[0099] The physical feasibility domain constraints include: voltage breakdown protection: a built-in Paschen curve lookup table for a given geometry and current air pressure. Limiting the voltage difference between electrodes (Reserve a 20% safety margin); Indicates air pressure The breakdown voltage is determined by the electric field monotonicity constraint: the lens voltage along the ion optical axis is forced to satisfy... This creates a continuous accelerating electric field to prevent ion retention. , and These represent the voltages of the first lens, second lens, and third lens along the ion optical axis, respectively. Control increment limit: The voltage adjustment step size in a single iteration is limited to no more than... This is to prevent drastic voltage jumps from causing instability in plasma discharge.

[0100] Furthermore, for the Bayesian optimization strategy, the Bayesian optimizer employs a Gaussian process confidence upper bound strategy. It calculates the acquisition function value at each point in the parameter space using the acquisition function, performs a comprehensive score on each point, and selects the point with the highest score as the generated candidate measurement and control parameters. The acquisition function formula is as follows: .in, Indicates the value of the collected function. This represents the predicted mean. This represents the standard deviation of the forecast. Balance coefficient. Initialized to 2.0, the value gradually decays to 0.1 with each iteration. This strategy encourages the initial tuning to "explore" regions of high uncertainty, while later focusing on "developing" regions with optimal predicted response values. The acquisition function is configured to balance exploration and exploitation to evaluate the potential value of candidate control parameters.

[0101] The selected optimal measurement and control parameters are sent to the mass spectrometer hardware system. After obtaining the real response (i.e., the newly added measured data), they are added to the "second sample mass spectrometry dataset". This triggers the Adapter's online incremental learning (i.e., updating the local deviation prediction model) until the signal intensity improvement of the mass spectrometer hardware system is less than 2% after 5 consecutive iterations (i.e., the preset convergence condition).

[0102] In one exemplary embodiment, this application also provides an application apparatus, including a tuning system and a mass spectrometer hardware system. The tuning system is connected to the mass spectrometer hardware system. The tuning system is used to implement the adaptive tuning method for the mass spectrometer in the above embodiments.

[0103] The mass spectrometer hardware system includes an ion source subsystem, an ion transport and lens subsystem, a mass analyzer, a detector, and a controller. A tuning system (in this embodiment, this can be a host computer or computer device with an embedded adaptive tuning method for the mass spectrometer) is connected to both the controller and the detector. This enables the tuning system to establish bidirectional data communication connections with both the controller and the detector.

[0104] The ion source subsystem, ion transport and lens subsystem, mass analyzer, and detector are arranged sequentially along the ion optical axis. These components together constitute the vacuum ion optical path. A controller is connected to each of the ion source subsystem, ion transport and lens subsystem, and mass analyzer. Specifically, the controller is electrically connected to the power modules of each subsystem. The controller can apply and adjust voltage or radio frequency signals to the power modules of the ion source subsystem, ion transport and lens subsystem, and mass analyzer. Figure 3 As shown.

[0105] In the closed-loop communication architecture, the tuning system runs the above-mentioned adaptive tuning method for the mass spectrometer to generate optimal measurement and control parameters, and sends them to the controller in the form of digital commands. The controller converts the digital commands into analog voltage signals to drive the ion source subsystem, ion transport and lens subsystem, and mass analyzer to operate. The detector collects ion response signals and feeds them back to the tuning system (i.e., the newly obtained measured data) to update the local deviation prediction model, thereby completing the closed-loop adaptive tuning of "sensing-decision-execution".

[0106] The ion source subsystem converts the liquid sample into gaseous ions, serving as the starting point for mass spectrometry analysis. By applying a high-voltage electric field, the sample solution forms charged droplets that undergo Coulomb explosions, ultimately generating a stable ion stream. Detailed configuration: This embodiment employs an electrospray ionization (ESI) source with an adjustable spray voltage range of 0–5000V and an adjustment accuracy of 1V to accommodate sample analysis requirements of different polarities and flow rates.

[0107] Ion Transmission & Lens System: This subsystem mainly consists of an entrance lens, a focusing lens, and an exit lens. Its core function is to use an electrostatic field to focus, shape, and accelerate the diverging ion beam, efficiently transmitting ions to the next stage of the vacuum chamber. It is the primary control object for adaptive tuning. Detailed Configuration: To achieve precise control of the ion trajectory, the power controller employs a 16-bit high-precision DAC (digital-to-analog converter). This controller converts the digital commands generated by the adaptive tuning method into analog voltages, with the voltage output ripple strictly controlled within 5mVpp and a response time of less than 10ms. This supports high-frequency closed-loop iterative control and ensures the stability of ion transmission.

[0108] Mass Analyzer: This is the core of the mass spectrometer, used to screen and separate ions based on their mass-to-charge ratio (m / z). By adjusting the ratio of radio frequency (RF) to direct current (DC) voltage, only target ions with specific mass-to-charge ratios are allowed to pass through. Detailed configuration: This embodiment uses a quadrupole mass analyzer with an RF power supply operating frequency set to 1.2MHz and a maximum RF voltage (Vpp) of 6000V. The system has automatic impedance matching to ensure electric field stability at different scan rates.

[0109] Detector: Located at the end of the ion beam path, it converts arriving ions into electron pulse signals and outputs ion current intensity. This signal is fed back to the tuning system as measured response data (i.e., newly added measured data) to calculate the actual physical deviation characterization and update the local deviation prediction model. Detailed configuration: Employs an electron multiplier with high gain and low dark current characteristics, combined with a high-speed digital-to-analog converter circuit for signal acquisition.

[0110] Based on the architecture and detailed configuration of the aforementioned application device, this application constructs a tuning model (i.e., a local bias prediction model) with strong generalization ability by fusing ion optical analytical solutions with neural network residual correction. Compared with traditional manual tuning (which typically takes several hours) or the simplex method (which is prone to getting trapped in local extrema), the mass spectrometer adaptive tuning method provided in this application is configured to operate under small sample (Few-shot) conditions. In typical application scenarios, it only requires about 50 closed-loop iterations to converge to the optimal operating point, and the entire process is protected by physical boundaries, with no risk of hardware damage.

[0111] Based on the above embodiments, the mass spectrometer adaptive tuning method provided in this application constructs a hybrid prediction architecture of "physical benchmark + AI residual". First, in the global physical feature learning stage, a neural network model (backbone network) is constructed and pre-trained using simulation data or historical measured data (i.e., the first sample mass spectrometry dataset) to learn the general physical residual laws of ion optics systems. Second, in the target instrument localization adaptation stage, the backbone network is frozen, and a lightweight adaptation module (such as an Adapter or LoRA structure) is fine-tuned using only a small amount of measured data from the target instrument (i.e., the mass spectrometer hardware system) (i.e., the second sample mass spectrometry dataset). During this process, an uncertainty-aware loss function is introduced, and the error term is weighted using the variance of the model prediction, thereby dynamically suppressing the interference of shot noise on parameter updates. Finally, in the virtual optimization stage under physical constraints, candidate parameters are generated based on a Bayesian optimization strategy, and the final predicted response value is obtained by superimposing the physical theoretical value and the model prediction residual. Under the constraint of satisfying the physical feasibility domain, the optimal measurement and control parameters are selected and sent to the hardware closed loop.

[0112] Based on this, this application has the following beneficial effects: 1) High accuracy and strong generalization: By fusing physical priors, it ensures that the model's prediction trend in sparse data regions conforms to physical laws, solving the overfitting problem of pure black-box models. 2) Low cost and fast transfer: By adopting the Parameter-Efficient Fine-Tuning (PEFT) technique, only a small amount of data is needed to complete the adaptation to new instruments, significantly reducing the cold start cost. 3) Robust noise resistance: The heteroscedasticity bias correction mechanism enables the tuning method to "see through" noise, and it can still stably converge to the physical optimum in low signal-to-noise ratio environments.

[0113] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0114] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0115] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0116] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0117] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).

[0118] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, etc., and are not limited to these.

[0119] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0120] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for adaptive tuning of a mass spectrometer, characterized in that, The mass spectrometer adaptive tuning method includes: Construct a neural network model; A local bias prediction model is constructed based on the neural network model and the adaptation module. Specifically, the neural network model is frozen, and the adaptation module is added to the frozen model to construct an initial local bias prediction model. Measured sample mass spectrometry data from the mass spectrometer hardware system is acquired. This data includes sample measurement and control parameters and corresponding sample response values. Sample physical guidance features and theoretical response values ​​are determined based on the sample measurement and control parameters. Sample physical bias representations are determined based on the sample response values ​​and theoretical response values. A second sample pair is constructed based on the sample physical bias representations and the sample physical guidance features to obtain a second sample mass spectrometry dataset. A second loss function is used to train the initial local bias prediction model based on the second sample mass spectrometry dataset, resulting in the final local bias prediction model. Candidate measurement and control parameters are generated using a Bayesian optimization strategy; Based on the candidate measurement and control parameters, the corresponding physical guidance characteristics and theoretical expected response values ​​are determined; The physical deviation characterization is obtained by using the local deviation prediction model based on the physical guidance characteristics. The final predicted response value is obtained based on the physical deviation characterization and the theoretical expected response value. Based on the final predicted response value, the candidate measurement and control parameters are filtered to obtain the optimal measurement and control parameters; The newly added measured data were obtained by using a mass spectrometer hardware system based on the optimal measurement and control parameters. The local deviation prediction model is updated using the optimal measurement and control parameters and the newly added measured data, and the step of generating candidate measurement and control parameters using a Bayesian optimization strategy is returned until the newly added measured data meets the preset convergence condition, thus completing the adaptive tuning of the mass spectrometer.

2. The adaptive tuning method for a mass spectrometer according to claim 1, characterized in that, Building a neural network model includes: Acquire mass spectrometry data of the first sample; the first sample mass spectrometry data includes historical measurement and control parameters and historical response values ​​corresponding to the historical measurement and control parameters; Historical physical guidance characteristics and historical theoretical response values ​​are determined based on the historical measurement and control parameters; historical physical deviation characteristics are determined based on the historical response values ​​and historical theoretical response values. Based on the historical physical deviation characterization and the historical physical guidance features, a first sample pair is constructed to obtain the first sample mass spectrometry dataset; An initial neural network model is constructed using a deep neural network. The initial neural network model is trained using the first loss function based on the first sample mass spectrometry dataset to obtain the neural network model.

3. The adaptive tuning method for a mass spectrometer according to claim 1, characterized in that, The process of adding the adapter module to the frozen neural network model includes: The adapter module can be inserted serially between layers of the frozen neural network model, connected to each hidden layer of the frozen neural network model in a bypass parallel manner, or injected into the weight matrix of the frozen neural network model in the form of low-rank matrix decomposition.

4. The adaptive tuning method for a mass spectrometer according to claim 1, characterized in that, The physical guidance characteristics and theoretical expected response values ​​are determined based on the candidate measurement and control parameters using ion optical analysis rules. The ion optical analysis rules are constructed through joint numerical simulation of the motion equation of ions in the electromagnetic field and the gas dynamics equation.

5. The adaptive tuning method for a mass spectrometer according to claim 1, characterized in that, Based on the final predicted response value, the candidate measurement and control parameters are filtered to obtain the optimal measurement and control parameters, including: Obtain preset physical feasibility domain constraints; the preset physical feasibility domain constraints include: voltage-gas pressure product constraints, potential gradient constraints, and power density constraints; The candidate measurement and control parameters are selected based on the preset physical feasibility domain constraints and the final predicted response value to obtain the optimal measurement and control parameters.

6. The adaptive tuning method for a mass spectrometer according to claim 1, characterized in that, The physical guidance features include dimensionless physical features; The dimensionless physical characteristics include at least one of the following: focusing coefficient, Mach number analogy factor, space charge parameter, reduced electric field strength, and time-of-flight dispersion coefficient.

7. The adaptive tuning method for a mass spectrometer according to claim 1, characterized in that, The second loss function is the uncertainty-aware loss function.

8. An application device, characterized in that, The application device includes a tuning system and a mass spectrometer hardware system; the tuning system is connected to the mass spectrometer hardware system; the tuning system is used to implement the mass spectrometer adaptive tuning method according to any one of claims 1-7.

9. The application device according to claim 8, characterized in that, The mass spectrometer hardware system includes: an ion source subsystem, an ion transmission and lens subsystem, a mass analyzer, a detector, and a controller; The tuning system is connected to both the controller and the detector. The ion source subsystem, the ion transmission and lens subsystem, the mass analyzer, and the detector are arranged sequentially along the ion optical axis; the controller is connected to the ion source subsystem, the ion transmission and lens subsystem, and the mass analyzer respectively.