Sequence recommendation method and device based on uncertainty quantization and antagonism calibration
By introducing lightweight uncertainty quantization and adversarial calibration methods into the sequence recommendation system, the high confidence error problem is solved, the robustness and reliability of the model are improved, and it can adapt to the deployment requirements of large-scale industrial recommendation scenarios.
Patent Information
- Application Number
- CN202511516491.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-22
- Publication Date
- 2026-02-10
AI Technical Summary
Existing sequence recommendation systems have shortcomings in dealing with the Highly Confident Wrong (HCW) problem and lack lightweight and efficient uncertainty quantification solutions, making them difficult to adapt to the deployment of large-scale industrial recommendation scenarios and the dynamic changes in user preferences.
A two-stage approach based on uncertainty quantization and adversarial calibration is adopted. By loading a pre-trained model and adding a lightweight uncertainty quantization module, high-confidence error samples are identified. The model is then fine-tuned and optimized through adversarial calibration, and an adversarial calibration loss function is constructed. The model is iteratively optimized to correct the error confidence.
It effectively reduces technology migration and computation costs, accurately identifies and corrects high-confidence errors, improves the robustness and reliability of the model, adapts to changes in user preferences, and achieves continuous learning capabilities.
Smart Images

Figure CN121502069A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of sequence recommendation system technology, and specifically to a sequence recommendation method and apparatus based on uncertainty quantification and adversarial calibration. Background Technology
[0002] With the explosive growth of internet information, recommender systems have become a core technology for alleviating information overload and improving user experience. Among them, sequence recommendation systems, by analyzing users' historical interaction sequences (such as clicks, browsing, and purchases), can dynamically capture the evolution of users' interests and predict their next potential interests, playing a crucial role in e-commerce, social media, and online entertainment.
[0003] In recent years, deep learning models, represented by Transformer and its variants, as well as large language models based on fine-tuning, have achieved significant breakthroughs in the accuracy of sequence recommendation. However, industry and academia have gradually realized that simply pursuing prediction accuracy is far from sufficient. When recommender systems are applied to high-risk decision-making scenarios such as finance, healthcare, and content security, their reliability, robustness, and the trustworthiness of their output become more critical indicators. To this end, researchers have begun to introduce uncertainty quantification techniques into recommender systems, aiming to enable models not only to output "what to recommend," but also to assess "how confident they are in making this recommendation."
[0004] Currently, the main technical approaches to achieving uncertainty quantification are as follows: 1. Ensemble methods based on multiple inferences: such as deep ensembles and Monte Carlo Dropout. These methods train multiple models or perform multiple random forward propagations on a single model to estimate the variance of the prediction results as an estimate of uncertainty. Although relatively simple to implement, they often lack a solid theoretical foundation and heavily rely on stacking models or inference times.
[0005] 2. Bayesian methods: such as Bayesian neural networks and variational Bayesian inference. These methods theoretically provide more rigorous uncertainty estimations by assigning probability distributions to network weights. However, their complex computational processes and high training costs make them unsuitable for large-scale industrial recommendation scenarios with hundreds of millions of users and projects.
[0006] Besides the challenges of implementing uncertainty quantification techniques, existing sequence recommendation systems also suffer from two major flaws: 1. Highly Confident Wrong (HCW) is a prominent issue: Even if some models can output uncertainty, "low uncertainty" prediction errors may still occur—the model shows high confidence in erroneous recommendations, causing the platform to push completely irrelevant items to users (especially in cold start scenarios, when new user / item data is sparse). Such errors directly reduce user stickiness, damage user experience, and even lead to user churn, while existing technologies lack specific identification and mitigation mechanisms for HCW samples.
[0007] 2. Lack of a closed-loop optimization mechanism: After the existing model is trained, its knowledge and capability boundaries are basically fixed. After deployment, the model cannot actively identify its own weaknesses (such as the knowledge blind spots corresponding to HCW samples), and can only rely on large-scale full data retraining to achieve optimization. This is not only inefficient (consuming a lot of computing resources and time), but also has a vague retraining goal (it cannot specifically fix specific defects), making it difficult to adapt to the actual scenario of dynamically changing user preferences.
[0008] In summary, designing a lightweight and efficient uncertainty quantification scheme for large-scale pre-trained sequence recommendation models to alleviate the high confidence error problem and reduce the cost of technology migration and deployment has become a key technical challenge that urgently needs to be solved in the current sequence recommendation field. Summary of the Invention
[0009] To address the challenges of designing lightweight and efficient uncertainty quantification schemes for large-scale pre-trained sequence recommendation models, thereby mitigating high-confidence errors and reducing technology migration and deployment costs, this invention provides a sequence recommendation method and apparatus based on uncertainty quantification and adversarial calibration. It offers a two-stage approach of lightweight uncertainty quantification and adversarial closed-loop calibration to achieve low-cost uncertainty estimation for sequence recommendation models (such as SASRec, BERT4Rec, etc.), proactively identify high-confidence errors, and improve model robustness and reliability through adversarial fine-tuning.
[0010] In a first aspect, the present invention provides a sequence recommendation method based on uncertainty quantification and adversarial calibration, comprising: Model Loading and Uncertainty Quantization Steps: Load a pre-trained sequence recommendation model and attach a lightweight uncertainty quantization module to the model. The pre-trained sequence recommendation model outputs a user representation vector based on the user's historical interaction sequence. The uncertainty quantization module quantifies the uncertainty of the user representation vector to generate a mean vector of predicted scores and a predicted uncertainty vector. High-Confidence Error Sample Identification Steps: Based on the predicted uncertainty vector and an adaptive threshold, identify high-confidence error samples from the dataset. These high-confidence error samples are those where the model makes a prediction error and its predicted uncertainty is lower than the adaptive threshold. Adversarial Calibration Fine-tuning Steps: Construct an adversarial calibration loss function and fine-tune the uncertainty quantization module using the identified high-confidence error samples to correct the model's error confidence. Iterative Optimization Steps: Iteratively execute the high-confidence error sample identification step and the adversarial calibration fine-tuning step until the high-confidence error rate calculated based on the predicted uncertainty vector meets a preset convergence condition.
[0011] The sequence recommendation method based on uncertainty quantification and adversarial calibration provided in this invention effectively addresses the key pain points of existing sequence recommendation technologies through a four-step closed-loop design: "model loading and uncertainty quantification - high-confidence error sample identification - adversarial calibration fine-tuning - iterative optimization". It eliminates the need for full retraining of deployed pre-trained models, requiring only the addition of a lightweight uncertainty quantification module, significantly reducing technology migration and computational costs, and adapting to the deployment needs of industrial scenarios with hundreds of millions of data points. It accurately identifies high-confidence error samples with "prediction errors and low uncertainty," overcoming the limitation of traditional methods in capturing model "false confidence" behavior. Through iterative optimization, it specifically corrects erroneous confidence, avoiding the waste of resources from indiscriminate retraining. While ensuring recommendation accuracy, it significantly improves model reliability and robustness, laying the foundation for subsequent online continuous learning. Balancing theoretical rigor with industrial practicality, it promotes the development of sequence recommendation systems towards higher reliability.
[0012] In one optional implementation, the uncertainty quantification module employs Gaussian process theory based on stochastic Fourier feature approximation to map the user representation vector to a stochastic Fourier feature vector, and estimates the prediction uncertainty using the stochastic Fourier feature vector, which is expressed as:
[0013] in, It is the dimension of the random feature space; Represents the weight matrix. This is the phase offset vector. and They are respectively and The element in the i-th row, Each row of elements has a mean of 0 and a variance of . The samples were obtained from a Gaussian distribution. The elements are sampled from a uniform distribution in the range [0, 2π]. For kernel bandwidth hyperparameters, It is an identity matrix of dimension d; This represents the normalization coefficient, used to ensure the stability of the L2 norm of the eigenvectors; Indicates to Applying the cosine function independently in each dimension generates 3D feature vectors.
[0014] The core implementation of the uncertainty quantification module provided by this invention adopts the Gaussian process theory of random Fourier feature approximation, which has significant advantages over existing technologies. On the one hand, it effectively solves the problem of high computational complexity of traditional Gaussian processes by mapping user representation vectors to random Fourier feature vectors, reducing computational complexity and adapting to large-scale data scenarios in recommendation systems. On the other hand, the sampling rules for the weight matrix and phase bias vector are clear, and the stability of the feature vector is ensured by combining normalization coefficients. This retains the accurate uncertainty estimation capability supported by Gaussian process theory while avoiding the high training cost of methods such as Bayesian neural networks, achieving a balance between "lightweight and efficient" and "accurate estimation," and providing reliable uncertainty data support for subsequent identification of high-confidence error samples.
[0015] In one optional implementation, the mean of the predicted scores is represented as:
[0016] in, The vector represents the mean score of each recommended item, where V is the total number of recommended items. For the weight matrix, Projecting 3D features onto V-dimensional space, This is the bias vector used to adjust the intercept in the output space; The expression for the prediction uncertainty vector is:
[0017] in, Recommended projects The vector of prediction uncertainty; To determine the covariance matrix of the group to which the recommended item i belongs, This is the grouping mapping result for recommended item i.
[0018] This invention projects random Fourier features onto the recommended item dimension using a weight matrix, ensuring the output meets the core requirement of the recommendation system to "rank by score," while balancing uncertainty quantification and recommendation accuracy. In predicting the uncertainty vector, it innovatively employs a grouped shared covariance matrix design, reducing covariance matrix storage costs and addressing the issue of high storage pressure in large-scale recommendation scenarios. Simultaneously, the grouping mapping logic aligns with the characteristic of recommending items being categorized by type in actual business, improving computational and storage efficiency while ensuring the rationality of uncertainty estimation, providing accurate quantitative evidence for identifying high-confidence erroneous samples.
[0019] In one optional implementation, the adversarial calibration loss function is:
[0020] in, For safety margin; For the i-th sample, there are the actual recommended items; Let be the predicted top - 1 items for the i-th sample, denoted as ; The adaptive threshold is defined as the α-quantile of the prediction uncertainty of all candidate recommendation items for the current user, where α is a preset percentage parameter. To predict the grouping mapping results for the top - 1 items; This is the penalty coefficient.
[0021] The adversarial calibration loss function defined in this invention addresses the core shortcomings of existing technologies through a composite design of "standard ranking hinge loss + adversarial uncertainty penalty term". The standard ranking hinge loss term, by setting a safety margin, widens the score gap between correct items and Top-1 incorrect items, directly optimizing the recommendation ranking accuracy. The adversarial uncertainty penalty term, through a secondary penalty mechanism, forces the model to increase the uncertainty of predictions for "low-uncertainty errors", accurately correcting the model's "false confidence" behavior and reducing the high-confidence error rate at its source. Furthermore, the introduction of adaptive thresholds and grouping mapping results in the loss function ensures that the penalty logic is highly compatible with the aforementioned uncertainty quantification and sample identification logic, avoiding model performance degradation caused by over-calibration. This achieves the dual goals of "correcting erroneous confidence" and "maintaining recommendation performance", significantly improving the model's reliability.
[0022] In one optional implementation, the high-confidence error rate is expressed as:
[0023] in, To achieve a high confidence error rate, express It is a sample from the validation set. These are genuine recommended projects. The top-1 recommended items predicted by the model. To predict the forecast uncertainty corresponding to the top-1 project, This is a high-confidence error sample. This represents the total number of samples in the validation set.
[0024] The definition of high-confidence error rate provided in this invention offers a precise and quantifiable evaluation basis for uncertainty calibration and closed-loop optimization of sequence recommendation models, effectively addressing the pain point of existing technologies lacking a unified standard for measuring "false confidence" behavior. Using the validation set as the evaluation carrier, it explicitly defines samples where "the predicted top-1 items are inconsistent with the actual recommended items" and "the prediction uncertainty corresponding to the predicted top-1 items is low" as high-confidence error samples. This not only aligns with the actual recommendation scenario of the model (with the top-1 items as the core recommendation result) but also accurately identifies the "false confidence" behavior that needs to be corrected, avoiding the shortcomings of traditional evaluation indicators (such as accuracy) that only focus on recommendation correctness and ignore the reasonableness of confidence. Simultaneously, through the calculation logic of "number of high-confidence error samples / total number of samples in the validation set," it achieves a quantitative measurement of the model calibration effect, providing a clear convergence criterion for iterative optimization, ensuring that the model fine-tuning direction is clear and the optimization effect is verifiable. This significantly improves the controllability and effectiveness of the reliability optimization of sequence recommendation models, providing key technical indicator support for model version comparison in subsequent online continuous learning.
[0025] In one alternative implementation, after the iterative optimization step, the method further includes: deploying the model and implementing an online continuous learning step, including: online detection of high-confidence error samples, periodically using accumulated high-confidence error samples to perform incremental fine-tuning of the model, and managing model versions based on business metrics.
[0026] This invention constructs a complete technical chain of "offline optimization - online iteration," overcoming the limitation of fixed capabilities after deployment of existing models. Online high-confidence error sample detection dynamically labels potential negative samples through user feedback (such as skipping or short stays), and combines this with model uncertainty to achieve real-time sample collection, solving the problem that offline data cannot cover dynamic user preferences. Periodic incremental fine-tuning uses cumulative sample iterative optimization to avoid the waste of resources from full retraining and improve the model's adaptability to changes in user preferences. Model version management based on business metrics (such as CTR and retention rate) ensures that the optimized model balances technical metrics (high-confidence error rate) and business value through A / B testing, avoiding a disconnect between technical optimization and actual business. The overall design enables the model to "learn for life," ensuring that the recommendation system maintains high reliability and high business adaptability during long-term deployment, significantly enhancing its industrial application value.
[0027] Secondly, the present invention provides a sequence recommendation device based on uncertainty quantification and adversarial calibration, the device comprising: The model loading and uncertainty quantification module is used to load a pre-trained sequence recommendation model and attach a lightweight uncertainty quantification module to the model. The pre-trained sequence recommendation model outputs a user representation vector based on the user's historical interaction sequence. The uncertainty quantification module quantifies the uncertainty of the user representation vector to generate a mean vector of predicted scores and a predicted uncertainty vector. The high-confidence error sample identification module is used to identify high-confidence error samples from the dataset based on the predicted uncertainty vector and an adaptive threshold. These high-confidence error samples are those where the model makes a prediction error and its predicted uncertainty is lower than the adaptive threshold. The adversarial calibration fine-tuning module is used to construct an adversarial calibration loss function and fine-tune the uncertainty quantification module using the identified high-confidence error samples to correct the model's error confidence. The iterative optimization module iteratively executes the high-confidence error sample identification step and the adversarial calibration fine-tuning step until the high-confidence error rate calculated based on the predicted uncertainty vector meets a preset convergence condition.
[0028] Thirdly, the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the sequence recommendation method based on uncertainty quantization and adversarial calibration described in the first aspect or any corresponding embodiment thereof.
[0029] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to execute the sequence recommendation method based on uncertainty quantization and adversarial calibration described in the first aspect or any corresponding embodiment thereof.
[0030] Fifthly, the present invention provides a computer program product, including computer instructions for causing a computer to execute the sequence recommendation method based on uncertainty quantization and adversarial calibration described in the first aspect or any corresponding embodiment thereof. Attached Figure Description
[0031] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0032] Figure 1 This is a flowchart illustrating a sequence recommendation method based on uncertainty quantification and adversarial calibration according to an embodiment of the present invention. Figure 2 This is a flowchart illustrating another sequence recommendation method based on uncertainty quantification and adversarial calibration according to an embodiment of the present invention; Figure 3 This is a structural block diagram of a sequence recommendation device based on uncertainty quantization and adversarial calibration according to an embodiment of the present invention; Figure 4 This is a structural block diagram of another sequence recommendation device based on uncertainty quantization and adversarial calibration according to an embodiment of the present invention; Figure 5 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0033] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0034] It is understood that before using the technical solutions disclosed in the various embodiments of the present invention, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in the present invention and their authorization should be obtained in accordance with relevant laws and regulations through appropriate means.
[0035] According to an embodiment of the present invention, a sequence recommendation method based on uncertainty quantification and adversarial calibration is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here. Figure 1 This is a flowchart of a sequence recommendation method based on uncertainty quantization and adversarial calibration according to an embodiment of the present invention, as shown below. Figure 1 As shown, the process includes the following steps: Step S1, Model Loading and Uncertainty Quantization Step: Load the pre-trained sequence recommendation model and attach a lightweight uncertainty quantization module to the model. The pre-trained sequence recommendation model outputs a user representation vector based on the user's historical interaction sequence. The uncertainty quantization module performs uncertainty quantization on the user representation vector to generate a predicted score mean vector and a predicted uncertainty vector.
[0036] Specifically, in this embodiment of the invention, it is assumed that the user's historical interaction sequence is as follows: , express Given a set of recommended items, the final user representation vector output by the pre-trained sequence recommendation model for the user's historical interaction sequence is:
[0037] in, For the pre-trained sequence recommendation model, its parameters are: d is the dimension of the user representation vector, and the purpose of formula (1) is to obtain the user representation vector. This serves as input for the subsequent uncertainty quantification module. This step is fundamental to the recommendation system process and aims to transform the user's complex historical behavior into a numerical representation that the model can use for prediction and uncertainty quantification.
[0038] Since training data in real-world recommender systems typically encompasses hundreds of millions of samples, using traditional Gaussian processes for computation is impractical (their computational complexity is generally low). , (where the sample size is 1). Therefore, this embodiment of the invention employs the Random Fourier Feature Approximated Gaussian Process (RFF-GP) theory to map the user representation vector to a random Fourier feature vector, and estimates the prediction uncertainty through the random Fourier feature vector, which is expressed as:
[0039] in, It is the dimension of the random feature space; Represents the weight matrix. This is the phase offset vector. and They are respectively and The element in the i-th row, Each row of elements has a mean of 0 and a variance of . The samples were obtained from a Gaussian distribution. The elements are sampled from a uniform distribution in the range [0, 2π]. For kernel bandwidth hyperparameters, It is an identity matrix of dimension d; This represents the normalization coefficient, used to ensure the stability of the L2 norm of the eigenvectors; Indicates to Applying the cosine function independently in each dimension generates 3D feature vectors.
[0040] The purpose of providing the above formula (2) in this invention is to efficiently approximate a Gaussian process for uncertainty quantification. By approximating the user representation vector with stochastic Fourier features, a feature space that can be more easily used for linear regression or classification is mapped, thereby estimating the uncertainty of the prediction.
[0041] At this point, assuming there are V recommended items, the average predicted score is...
[0042] in, The vector represents the mean score of each recommended item, where V is the total number of recommended items. For the weight matrix, Projecting 3D features onto V-dimensional space, This is the bias vector used to adjust the intercept in the output space; The purpose of the above formula (3) provided in this embodiment of the invention is to predict the user's liking for all candidate items (the average predicted score) based on the user's representation vector, which serves as the core ranking basis for the recommendation system. In the recommendation system, a higher score usually means that the user is more likely to be interested in the item.
[0043] To improve the stability of reasoning and training in large-scale recommendation systems, this invention proposes a method for quantifying the uncertainty of grouping, which categorizes different types of goods into... For each group (e.g., home appliances, books), the covariance matrix is shared within the group. The expression for the prediction uncertainty vector of each recommended item is: (4)
[0044] in, Recommended projects The vector of prediction uncertainty; To determine the covariance matrix of the group to which the recommended item i belongs, This is the grouping mapping result for recommended item i.
[0045] The purpose of the above formula (4) provided in the embodiments of the present invention is to calculate all Prediction uncertainty vector of candidate recommendation items This uncertainty estimation is crucial for identifying Highly Confident Wrong (HCW) samples, helping the model understand its own knowledge boundaries and thus improving the reliability and robustness of the recommender system. In this step, lightweight uncertainty estimation specifically manifests in: reducing computational complexity from... Reduced to Furthermore, by sharing the covariance matrix of recommended items, the memory required to store the covariance matrix is significantly reduced. Reduced to .
[0046] Step S2, High Confidence Error Sample Identification Step: Based on the prediction uncertainty vector and an adaptive threshold, identify high confidence error samples from the dataset, wherein the high confidence error samples are samples in which the model prediction is wrong and its prediction uncertainty is lower than the adaptive threshold.
[0047] Specifically, this invention divides the user interaction sequence dataset into a training set, a validation set, and a test set. The training set is used for training in step S1, and the validation set... Each sample Top-1 projects used to calculate model predictions ,
[0048] if And satisfy If the sample is a high confidence error (HCW) sample, then the sample is labeled as an HCW sample. It is the prediction uncertainty vector for each recommended item in formula (5). Indicates obtaining for the first The project's model prediction uncertainty, among which It is a grouping mapping function that maps the item corresponding to the predicted maximum score to the index of the uncertain vector group.
[0049] The purpose of formula (6) in this invention is to determine the best recommendation given by the model based on its prediction score. This is because determining whether the model has made a high-confidence error requires knowing which item the model actually recommended. Furthermore, this step defines samples of high-confidence errors, providing a sample basis for subsequent adversarial fine-tuning and closed-loop optimization.
[0050] Step S3, Adversarial calibration fine-tuning step: Construct an adversarial calibration loss function and fine-tune the uncertainty quantification module using the identified high-confidence error samples to correct the model's error confidence.
[0051] Specifically, the adversarial calibration loss function provided in this embodiment of the invention is: (7) The first term is the standard ranking hinge loss, used to widen the score gap between correct and Top-1 incorrect items. The second term is the adversarial uncertainty penalty term, which aims to apply a secondary penalty when the variance of incorrect items is less than a threshold, forcing the model to recognize its capability boundaries. The penalty coefficient is... The parameter settings can be adjusted based on a small portion of the calibration set; in this embodiment, the default value is 2.0.
[0052] Specifically, For safety margin, the default is 1.0; For the i-th sample, there are the actual recommended items; Let be the predicted top - 1 items for the i-th sample, denoted as ; An adaptive threshold is defined as the α-quantile of the prediction uncertainty of all candidate recommended items for the current user, where α is a preset percentage parameter, defaulting to... = 0.1, meaning only the 10% of most "confident" incorrect predictions are considered; To predict the grouping mapping results for the top - 1 items.
[0053] The loss function provided by this invention can simultaneously constrain the prediction score and prediction confidence, guiding the model to learn to reasonably express uncertainty and its own capability boundaries when encountering difficult samples, rather than confidently giving incorrect answers.
[0054] Step S4, Iterative optimization step: Iteratively execute the high-confidence error sample identification step and the adversarial calibration fine-tuning step until the high-confidence error rate calculated based on the prediction uncertainty vector satisfies the preset convergence condition.
[0055] Specifically, the embodiments of the present invention use As a loss function, the uncertainty module of the model is fine-tuned. This step is to repair the model’s “false belief” behavior with minimal training while maintaining the stability of the core knowledge.
[0056] In this embodiment of the invention, stochastic gradient descent is used with the AdamW optimizer, a weight decay of 1e-4, a batch size of 512, and a learning rate of 3e-4. The high-confidence error rate is used as the evaluation metric, and its expression is as follows:
[0057] in, To achieve a high confidence error rate, express It is a sample from the validation set. These are genuine recommended projects. The top-1 recommended items predicted by the model. To predict the forecast uncertainty corresponding to the top-1 project, This is a high-confidence error sample. This represents the total number of samples in the validation set.
[0058] In this embodiment of the invention, the high confidence error rate defined by formula (8) is used to measure the model's performance on the validation set. The evaluation metric for the proportion of high-confidence errors is based on an automatic convergence decision to ensure deployment stability and avoid performance degradation caused by overcalibration. An adversarial calibration loop for high-confidence errors was designed and implemented, creating a closed-loop system that proactively identifies and corrects high-confidence errors. This fundamentally enhances the model's self-awareness and calibration capabilities, representing a crucial step towards a more trustworthy recommendation system. By constructing a closed-loop optimization process of "identifying weaknesses - targeted repair," this method, compared to traditional large-scale indiscriminate retraining, can more accurately locate and repair model defects, significantly improving the model's ability to continuously learn and evolve after deployment.
[0059] In one example, the maximum number of iterations is set to 5. The corresponding iterative closed-loop optimization and convergence determination process is shown below:
[0060] In practical applications, if fine-tuning only the uncertainty quantification module is not effective, you can simultaneously fine-tune the uncertainty quantification module and the last 1-2 layers of the main Transformer (if it is a Transformer-based model) to improve recommendation performance and robustness.
[0061] The sequence recommendation method based on uncertainty quantification and adversarial calibration provided by this invention addresses three key pain points of existing technologies through a four-step closed-loop design: model loading and uncertainty quantification, high-confidence error sample identification, adversarial calibration fine-tuning, and iterative optimization. First, it eliminates the need for full retraining of pre-trained sequence recommendation models, requiring only the addition of a lightweight uncertainty quantification module, significantly reducing technology migration costs and adapting to the deployment needs of industrial scenarios with hundreds of millions of data points. Second, it accurately identifies high-confidence error samples with "prediction errors and low uncertainty," overcoming the limitation of traditional methods in identifying model "misbelief" behavior. Third, it iterative optimization specifically corrects error confidence, avoiding the waste of resources from indiscriminate retraining, while significantly improving the reliability and robustness of the model while maintaining recommendation accuracy, laying the foundation for subsequent online continuous learning and balancing theoretical rigor with practical industrial application.
[0062] In another embodiment, such as Figure 2 As shown, the sequence recommendation method based on uncertainty quantification and adversarial calibration provided by this invention further includes: Step S5 involves deploying the model and implementing online continuous learning, including: online detection of high-confidence error samples, periodic incremental fine-tuning of the model using accumulated high-confidence error samples, and model version management based on business metrics.
[0063] Specifically, the purpose of this step is to enable the system to dynamically collect HCW samples in an online environment, achieving lifelong learning. It consists of three parts: 1. Online HCW (High Confidence Error) Detection: User feedback (such as skipping or dwell time < threshold) is marked as a potential negative sample. Combined with the model's low uncertainty prediction, HCW (High Confidence Error) samples are added to the database.
[0064] 2. Incremental fine-tuning: Perform S4 fine-tuning (policy A / B) once a day / week using accumulated HCW (high confidence error) samples, with learning rate decay scheduling.
[0065] 3. Model version management: A / B testing comparison We will select the best performers to launch, based on business metrics such as CTR and retention rate.
[0066] By constructing a complete technology chain of "offline optimization - online iteration," the limitations of fixed capabilities after deployment of existing models are overcome. Online high-confidence error sample detection dynamically labels potential negative samples based on user feedback (such as skipping or short stays), and combines this with model uncertainty to achieve real-time sample collection, solving the problem that offline data cannot cover dynamic user preferences. Regular incremental fine-tuning uses cumulative sample iterative optimization to avoid the waste of resources from full retraining and improve the model's adaptability to changes in user preferences. Model version management based on business metrics (such as CTR and retention rate) ensures that the optimized model balances technical metrics (high-confidence error rate) and business value through A / B testing, avoiding a disconnect between technical optimization and actual business. The overall design enables the model to "learn for life," ensuring that the recommendation system maintains high reliability and high business adaptability during long-term deployment, significantly enhancing its industrial application value.
[0067] This embodiment also provides a sequence recommendation device based on uncertainty quantization and adversarial calibration. This device is used to implement the above embodiments and preferred embodiments, and details already described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0068] This embodiment provides a sequence recommendation device based on uncertainty quantization and adversarial calibration, such as... Figure 3 As shown, it includes: The model loading and uncertainty quantification module 31 is used to load a pre-trained sequence recommendation model and attach a lightweight uncertainty quantification module to the model. The pre-trained sequence recommendation model outputs a user representation vector based on the user's historical interaction sequence. The uncertainty quantification module performs uncertainty quantification on the user representation vector to generate a mean vector of predicted scores and a predicted uncertainty vector. The high-confidence error sample identification module 32 is used to identify high-confidence error samples from the dataset based on the predicted uncertainty vector and an adaptive threshold. The high-confidence error samples are samples where the model makes a prediction error and its prediction uncertainty is lower than the adaptive threshold. The adversarial calibration fine-tuning module 33 is used to construct an adversarial calibration loss function and fine-tune the uncertainty quantification module using the identified high-confidence error samples to correct the model's error confidence. The iterative optimization module 34 is used to iteratively execute the high-confidence error sample identification step and the adversarial calibration fine-tuning step until the high-confidence error rate calculated based on the predicted uncertainty vector meets a preset convergence condition.
[0069] In some optional implementations, the uncertainty quantification module in the model loading and uncertainty quantification module 31 employs Gaussian process theory based on stochastic Fourier feature approximation to map the user representation vector to a stochastic Fourier feature vector, and estimates the prediction uncertainty through the stochastic Fourier feature vector, which is expressed as:
[0070] in, It is the dimension of the random feature space; Represents the weight matrix. This is the phase offset vector. and They are respectively and The element in the i-th row, Each row of elements has a mean of 0 and a variance of . The samples were obtained from a Gaussian distribution. The elements are sampled from a uniform distribution in the range [0, 2π]. For kernel bandwidth hyperparameters, It is an identity matrix of dimension d; This represents the normalization coefficient, used to ensure the stability of the L2 norm of the eigenvectors; Indicates to Applying the cosine function independently in each dimension generates 3D feature vectors.
[0071] In some alternative implementations, the mean prediction score is represented as:
[0072] in, The vector represents the mean score of each recommended item, where V is the total number of recommended items. For the weight matrix, Projecting 3D features onto V-dimensional space, This is the bias vector used to adjust the intercept in the output space; The expression for the prediction uncertainty vector is:
[0073] in, Recommended projects The vector of prediction uncertainty; To determine the covariance matrix of the group to which the recommended item i belongs, This is the grouping mapping result for recommended item i.
[0074] In some optional implementations, the adversarial calibration loss function in the adversarial calibration fine-tuning module 33 is:
[0075] in, For safety margin; For the i-th sample, there are the actual recommended items; Let be the predicted top - 1 items for the i-th sample, denoted as ; The adaptive threshold is defined as the α-quantile of the prediction uncertainty of all candidate recommendation items for the current user, where α is a preset percentage parameter. To predict the grouping mapping results for the top - 1 items; This is the penalty coefficient.
[0076] In some optional implementations, the high-confidence error rate in the iterative optimization module 34 is represented as:
[0077] Among them, its To achieve a high confidence error rate, express It is a sample from the validation set. These are genuine recommended projects. The top-1 recommended items predicted by the model. To predict the forecast uncertainty corresponding to the top-1 project, This is a high-confidence error sample. This represents the total number of samples in the validation set.
[0078] The apparatus provided by the present invention, such as Figure 4 As shown, it also includes: an application deployment module 35, used to deploy the model and implement online continuous learning steps, including: online detection of high-confidence error samples, periodically using accumulated high-confidence error samples to perform incremental fine-tuning of the model, and model version management based on business metrics.
[0079] The sequence recommendation device based on uncertainty quantization and adversarial calibration provided in this embodiment of the invention can execute the sequence recommendation method based on uncertainty quantization and adversarial calibration provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects for executing the method. Further functional descriptions of the above modules and units are the same as in the corresponding embodiments described above, and will not be repeated here.
[0080] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0081] The following is a detailed reference. Figure 5 The diagram illustrates a structural schematic suitable for implementing an electronic device according to embodiments of the present invention. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 501, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 502 or a program loaded from memory 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the electronic device. The processor 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0082] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.
[0083] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 509, or installed from a memory 508, or installed from a ROM 502. When the computer program is executed by the processor 501, it performs the functions defined in the sequence recommendation method based on uncertainty quantization and adversarial calibration according to embodiments of the present invention.
[0084] Figure 5 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.
[0085] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code originally stored on a remote storage medium or a non-transitory machine-readable storage medium and subsequently stored on a local storage medium after being downloaded via a network. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the sequence recommendation method based on uncertainty quantization and adversarial calibration shown in the above embodiments is implemented.
[0086] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0087] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A sequence recommendation method based on uncertainty quantification and adversarial calibration, characterized in that, include: Model loading and uncertainty quantization steps: Load the pre-trained sequence recommendation model and attach a lightweight uncertainty quantization module to the model. The pre-trained sequence recommendation model outputs a user representation vector based on the user's historical interaction sequence. The uncertainty quantization module performs uncertainty quantization on the user representation vector to generate a predicted score mean vector and a predicted uncertainty vector. High confidence error sample identification steps: Based on the predicted uncertainty vector and an adaptive threshold, identify high confidence error samples from the dataset. The high confidence error samples are those in which the model makes a prediction error and whose prediction uncertainty is lower than the adaptive threshold. Adversarial calibration fine-tuning steps: Construct an adversarial calibration loss function and fine-tune the uncertainty quantification module using the identified high-confidence error samples to correct the model's error confidence; Iterative optimization steps: Iteratively execute the high-confidence error sample identification step and the adversarial calibration fine-tuning step until the high-confidence error rate calculated based on the prediction uncertainty vector satisfies the preset convergence condition.
2. The method according to claim 1, characterized in that, The uncertainty quantification module employs Gaussian process theory based on stochastic Fourier feature approximation to map the user representation vector to a stochastic Fourier feature vector, and estimates the uncertainty of the prediction using the stochastic Fourier feature vector. The stochastic Fourier feature vector is expressed as: in, It is the dimension of the random feature space; Represents the weight matrix. This is the phase offset vector. and They are respectively and The element in the i-th row, Each row of elements has a mean of 0 and a variance of . The samples were obtained from a Gaussian distribution. The elements are sampled from a uniform distribution in the range [0, 2π]. For kernel bandwidth hyperparameters, It is an identity matrix of dimension d; This represents the normalization coefficient, used to ensure the stability of the L2 norm of the eigenvectors; Indicates to Applying the cosine function independently in each dimension generates 3D eigenvectors.
3. The method according to claim 2, characterized in that, The mean of the predicted scores is expressed as: in, The vector represents the mean score of each recommended item, where V is the total number of recommended items. For the weight matrix, Projecting 3D features onto V-dimensional space, This is the bias vector used to adjust the intercept in the output space; The expression for the prediction uncertainty vector is: in, Recommended projects The vector of prediction uncertainty; To determine the covariance matrix of the group to which the recommended item i belongs, This is the grouping mapping result for recommended item i.
4. The method according to claim 3, characterized in that, The adversarial calibration loss function is: in, For safety margin; For the i-th sample, there are the actual recommended items; Let be the predicted top -1 items for the i-th sample, denoted as ; The adaptive threshold is defined as the α-quantile of the prediction uncertainty of all candidate recommendation items for the current user, where α is a preset percentage parameter. To predict the grouping mapping results for the top - 1 items; This is the penalty coefficient.
5. The method according to claim 1 or 3, characterized in that, The high-confidence error rate is expressed as: in, To achieve a high confidence error rate, express It is a sample from the validation set. These are genuine recommended projects. The top-1 recommended items predicted by the model. To predict the forecast uncertainty corresponding to the top-1 project, This is a high-confidence error sample. This represents the total number of samples in the validation set.
6. The method according to claim 1, characterized in that, Following the iterative optimization step, the process also includes: deploying the model and implementing online continuous learning, including: online detection of high-confidence error samples, periodically using accumulated high-confidence error samples to perform incremental fine-tuning of the model, and managing model versions based on business metrics.
7. A sequence recommendation device based on uncertainty quantification and adversarial calibration, characterized in that, The device includes: The model loading and uncertainty quantification module is used to load a pre-trained sequence recommendation model and attach a lightweight uncertainty quantification module to the model. The pre-trained sequence recommendation model outputs a user representation vector based on the user's historical interaction sequence. The uncertainty quantification module quantifies the uncertainty of the user representation vector to generate a mean vector of predicted scores and a predicted uncertainty vector. The high-confidence error sample identification module is used to identify high-confidence error samples from the dataset based on the predicted uncertainty vector and an adaptive threshold. These high-confidence error samples are those where the model makes a prediction error and its predicted uncertainty is lower than the adaptive threshold. The adversarial calibration fine-tuning module is used to construct an adversarial calibration loss function and fine-tune the uncertainty quantification module using the identified high-confidence error samples to correct the model's error confidence. The iterative optimization module iteratively executes the high-confidence error sample identification step and the adversarial calibration fine-tuning step until the high-confidence error rate calculated based on the predicted uncertainty vector meets a preset convergence condition.
8. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the computer instructions to perform the sequence recommendation method based on uncertainty quantization and adversarial calibration as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to execute the sequence recommendation method based on uncertainty quantization and adversarial calibration as described in any one of claims 1 to 6.
10. A computer program product, characterized in that, Includes computer instructions for causing a computer to perform the sequence recommendation method based on uncertainty quantization and adversarial calibration as described in any one of claims 1 to 6.