Sequence recommendation method and system based on conformal prediction
By combining conformal prediction theory with deep neural networks, a composite loss function and a large language model are constructed to solve the problem of insufficient confidence perception in sequence recommendation systems. This enables the generation of highly confident and personalized recommendation lists, thereby improving the reliability and efficiency of the recommendation system.
Patent Information
- Application Number
- CN202511072442.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-31
- Publication Date
- 2025-11-18
AI Technical Summary
Existing sequence recommendation systems lack confidence awareness during training, resulting in a disconnect between online deployment goals and training goals, and an inability to dynamically adjust the size and quality of the prediction set based on user status.
By combining conformal prediction theory with deep neural networks, a composite loss function is constructed by dividing the training subsequence and calibration subsequence, and the model parameters are optimized to generate a high-confidence prediction set. Finally, a large language model is used to encode user information for personalized clustering recommendations.
It achieves the unification of model training and confidence calibration, generating a high-confidence, compact, and personalized recommendation list, thus improving the reliability and efficiency of recommendations.
Smart Images

Figure CN120975880A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of sequence recommendation, and in particular to a sequence recommendation method and system based on conformal prediction. BACKGROUND
[0002] With the rapid development of information technology and the advent of the big data era, recommendation systems have become a core component of online services such as social media and content streaming platforms. Sequential recommendation systems (SRecsys) analyze the behavior sequences of user historical interactions, such as clicks, views, and purchase records, to predict the next or next few items of interest to the user, which is crucial for capturing user purchase intent, enhancing user stickiness, and improving business value.
[0003] Currently, most mainstream sequential recommendation systems are based on deep algorithms, such as recurrent neural networks or variants of the Transformer structure (such as Transformers4Rec proposed by NVIDIA) to capture dynamic dependencies in user behavior sequences. During model training, these systems generally use cross-entropy (CE) loss as the optimization objective. The core of the cross-entropy loss function is to maximize the predicted probability of the next real interaction item and rank it first in the recommendation list. In the field of statistics, conformal prediction (CP) algorithms are often used in the inference stage after model training, and the purpose is not to predict a single most likely item, but to generate a "prediction set" containing multiple candidate items. Conformal prediction can provide a statistically valid guarantee for the prediction set, ensuring that the real interaction item falls into the prediction set with a preset probability (such as 95%). The size of the prediction set is considered a measure of model uncertainty: the larger the prediction set, the less certain the model is about the current interaction item; conversely, the smaller the prediction set, the higher the model confidence.
[0004] Although the above existing technologies solve the sequential recommendation problem to some extent, there are still the following main defects:
[0005] 1. Lack of confidence awareness in the training process. The traditional cross-entropy loss function only focuses on improving the prediction score of the real label item, making the prediction score of the correct label higher than that of the negative sample, while ignoring the calibration constraint of the model's prediction probability. For example, the model can rank the correct item first, but the probability value of its output cannot truly reflect its confidence level. This mechanism leads to the model not being motivated to produce high-confidence and reliable recommended items during training, making the recommendation results unstable.
[0006] 2. The online deployment goals are disconnected from the training goals. In practical applications, the core objective is to present users with a compact and high-quality recommendation list (a small prediction set with high confidence). This improves system efficiency and avoids information overload for users. However, conformal prediction techniques are typically used only as a post-processing tool during the inference phase to assess model uncertainty. While they can identify low model confidence (generating a large prediction set), they cannot pass the ideal goal of "minimizing the prediction set size" back to the model for optimization during training. The training process and the final inference / application goal are separated.
[0007] 3. Inability to dynamically adjust the prediction set based on user status and behavior. Existing methods lack a direct algorithm to dynamically and differentially optimize the size and quality of the prediction set during deployment based on the user's historical behavior (new or experienced user, whether the behavior pattern is variable or fixed).
[0008] Therefore, how to effectively integrate the optimization objectives of prediction set size and confidence into the model training stage, so that the sequential recommendation model itself can learn a kind of "confidence awareness" and generate more accurate, reliable and compact prediction sets based on user characteristics, is a key technical problem that urgently needs to be solved. Summary of the Invention
[0009] In view of this, and to address the shortcomings of existing technologies, this invention provides a sequence recommendation method and system based on conformal prediction. It creatively proposes a hybrid modeling framework that combines mechanism-driven models and data-driven models, which can deeply mine the value of the intermediate computation process of the mechanism model, and dynamically introduce the key intermediate variables generated by it as candidate explanatory features into the training process of the machine learning model, thus providing an understandable explanation path for the model's prediction results based on domain mechanisms.
[0010] In a first aspect, the present invention provides a sequence recommendation method based on conformal prediction, comprising:
[0011] S1, Select a preset deep neural network architecture as the basic recommendation model;
[0012] S2, obtain historical interaction subsequence data for each user, and divide the historical interaction subsequence data into training subsequence and calibration subsequence, wherein the training subsequence is used for model training and the calibration subsequence is used for confidence calibration.
[0013] S3, based on conformal prediction theory, calculate a prediction set containing candidate items using calibration subsequences or training subsequences, the prediction set containing all items with inconsistency scores below a dynamic threshold;
[0014] S4. Construct a composite loss function that includes the basic recommendation loss and the prediction set size loss. Combine the backpropagation algorithm to optimize all trainable parameters of the basic recommendation model until the model converges or reaches the preset number of fine-tuning rounds. Then, use the preset performance index to verify the model performance.
[0015] S5 utilizes a large language model to encode multi-dimensional user information in all training data, generating corresponding comprehensive state vectors.
[0016] S6 clusters users based on their comprehensive state vectors, and dynamically generates personalized prediction sets as recommendation lists based on the clustering results and the trained model.
[0017] The sequence recommendation method based on conformal prediction provided in this invention combines conformal prediction theory with deep neural networks, achieving a unified model training and confidence calibration. The composite loss function balances recommendation accuracy and prediction set compactness. The large language model encodes user information and clusters it to generate personalized recommendations, solving the problems of disconnect between training and deployment goals and the inability to dynamically adjust the prediction set in traditional methods, thus improving the reliability and personalization of recommendations.
[0018] In one alternative implementation, the training subsequence is represented as The calibration subsequence is represented as Where, N train and N calib These represent the number of samples in the training set and the calibration set, respectively. This represents the interaction item for user i, and the corresponding actual interaction item is... The corresponding real-world interactive project is
[0019] This invention clearly defines the division method between training and calibration subsequences and their corresponding project objectives, enabling the model to simultaneously optimize both basic recommendation accuracy and prediction set quality. This division requires no additional annotation, utilizing historical user interaction data to transform it into learning signals, improving data utilization, laying the foundation for subsequent composite loss function calculation and conformal prediction set generation, and enhancing the targeted nature of model training.
[0020] In one optional implementation, step S3 specifically includes:
[0021] Generation probability distribution: for calibration subsequence Generate the initial recommendation subsequence probability distribution using the current model. K c This is a list of all candidate projects to be recommended, |K c| represents the total number of candidate projects to be recommended;
[0022] Calculating Inconsistency Scores: Based on the Inconsistency Score Function Perform the calculation of the inconsistency fraction function, where Represents the probability distribution of the initial recommended subsequence. Extract interactive items The corresponding probability value;
[0023] Determine the dynamic threshold: Set the confidence parameter α for conformal prediction, calculate the inconsistency score for each sample across the entire calibration set, and find the (1-α)(1+1Ncalib quantiles) of all sample scores based on conformal learning theory to obtain the dynamic threshold. Where quantile is the quantile function;
[0024] Construct the prediction set: Use all items whose inconsistency scores for the next candidate item are below a threshold q as the prediction set.
[0025]
[0026] Prediction set This is the final recommendation list presented to the user, which is a set containing one or more recommended items. The element s in the set comes from the set K of all candidate items. c .
[0027] This invention provides detailed specifications for the calculation steps of the prediction set. Candidate items are filtered using inconsistency scores and dynamic thresholds to ensure that the probability of the prediction set containing real interaction items meets a pre-set confidence level. This process is based on conformal prediction theory, enabling the size of the prediction set to reflect the model's confidence level. It solves the problem of traditional recommendation systems that only rank items without confidence guarantees, providing a scientific basis for generating reliable recommendation lists.
[0028] In one alternative implementation, the basic recommendation loss L ce Represented as:
[0029]
[0030] It uses training subsequences and its goals Calculate the cross-entropy loss;
[0031] The prediction set size loss L cp Represented as:
[0032]
[0033] It will use the prediction set calculated in step S3 The size of the loss is taken as the loss;
[0034] The composite loss function is:
[0035]
[0036] Here, β is a hyperparameter used to balance the importance of the two loss terms.
[0037] The composite loss function constructed in this embodiment combines cross-entropy loss and prediction set size loss, balancing the two through hyperparameters to simultaneously optimize recommendation accuracy and prediction set compactness during model training. Compared to a single loss function, it incentivizes the model to generate prediction sets with high confidence and small size, avoiding the shortcomings of traditional models that only focus on ranking and ignore confidence, thus improving recommendation quality and efficiency.
[0038] In one optional implementation, step S6 specifically includes:
[0039] Users are clustered using an unsupervised learning algorithm based on their semantic vectors;
[0040] The comprehensive state vector of the target user is mapped to the corresponding category, and step S3 is performed on the user's group based on the trained subsequence recommendation model. A prediction set is dynamically generated based on the group threshold as a personalized recommendation list.
[0041] This invention, based on user semantic vector clustering, generates personalized prediction sets within groups, achieving dynamic adaptation of recommendations. By mapping users to corresponding categories and using intra-group thresholds, users with different behavioral patterns receive matching recommendation list sizes and content. This solves the problem that existing methods cannot adjust prediction sets according to user status, enhancing the personalization and accuracy of recommendations.
[0042] In one optional implementation, the preset performance indicators include:
[0043] Marginal coverage, used to verify whether the calibration process has successfully reduced the model's empirical error rate, is calculated using the following formula: Where I is an indicator function whose value is close to the preset target 1-α;
[0044] The average prediction set size is used to measure the prediction accuracy of the model while satisfying the marginal coverage guarantee. Its calculation formula is as follows:
[0045]
[0046] This invention explicitly uses marginal coverage and average prediction set size as performance metrics, which can quantify and verify the model's confidence guarantee and recommendation accuracy. Marginal coverage ensures that the model's empirical error rate meets the preset limit, while the average prediction set size measures the compactness of the recommendations. The combination of the two can comprehensively evaluate model performance, provide a clear direction for model optimization, and ensure the reliability and efficiency of the recommendation results.
[0047] Secondly, the present invention provides a sequence recommendation system based on conformal prediction, the system comprising: a model training module and a model deployment module, wherein:
[0048] The model training module includes:
[0049] The basic model selection unit is used to select a preset deep neural network architecture as the basic recommendation model.
[0050] An interaction data acquisition unit is used to acquire historical interaction subsequence data for each user, and divide the historical interaction subsequence data into training subsequences and calibration subsequences, wherein the training subsequences are used for model training and the calibration subsequences are used for confidence calibration.
[0051] The prediction set calculation unit is used to calculate a prediction set containing candidate items based on conformal prediction theory using calibration subsequences or training subsequences. The prediction set contains all items with inconsistency scores below a dynamic threshold.
[0052] The model training unit is used to construct a composite loss function that includes the basic recommendation loss and the prediction set size loss. It combines the backpropagation algorithm to optimize all trainable parameters of the basic recommendation model until the model converges or reaches the preset number of fine-tuning rounds, and uses preset performance metrics to verify the model performance.
[0053] The model deployment module includes:
[0054] The user state vector generation unit is used to encode the multi-dimensional information of users in all training data using a large language model, and generate the corresponding comprehensive state vector.
[0055] The recommendation list generation unit is used to cluster users based on their comprehensive state vectors, and dynamically generate personalized prediction sets as recommendation lists based on the clustering results and a trained model.
[0056] Thirdly, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the sequence recommendation method based on conformal prediction described in the first aspect or any corresponding embodiment thereof.
[0057] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to perform the conformal prediction-based sequence recommendation method of the first aspect or any corresponding embodiment thereof.
[0058] Fifthly, the present invention provides a computer program product, including computer instructions for causing a computer to execute the conformal prediction-based sequence recommendation method of the first aspect or any corresponding embodiment thereof. Attached Figure Description
[0059] 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.
[0060] Figure 1 This is a flowchart illustrating a sequence recommendation method based on conformal prediction according to an embodiment of the present invention.
[0061] Figure 2 This is a structural block diagram of a sequence recommendation system based on conformal prediction according to an embodiment of the present invention;
[0062] Figure 3 A schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Detailed Implementation
[0063] 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.
[0064] This embodiment provides a sequence recommendation method based on conformal prediction. Figure 1 This is a flowchart of a sequence recommendation method based on conformal prediction according to an embodiment of the present invention. The process includes a model training phase (steps S1-S4) and a model deployment phase (steps S5-S6), and the specific steps are as follows:
[0065] Step S1: Select a preset deep neural network architecture as the basic recommendation model.
[0066] Specifically, the base recommendation model *f* can be any mainstream sequential recommendation model, such as SASRec or BERT4Rec based on Transformers, or GRU4Rec based on recurrent neural networks. The purpose of this step is to obtain a model with basic recommendation capabilities, serving as the starting point for subsequent conformal loss training. In practice, this can be done by training a completely new model or by directly loading a pre-trained model for checkpointing, in order to save computational resources.
[0067] Step S2: Obtain historical interaction subsequence data for each user, and divide the historical interaction subsequence data into training subsequences and calibration subsequences, wherein the training subsequences are used for model training and the calibration subsequences are used for confidence calibration.
[0068] Specifically, during the training phase, for each user's interaction sequence in the training batch... Implement a time-based data partitioning strategy. Divide the sequence into two parts: a training subsequence and a calibration subsequence. The training subsequence is represented as follows: The calibration subsequence is represented as Where, N train and N calib These represent the number of samples in the training set and the calibration set, respectively.
[0069] Training subsequences: Let represent the interaction items of user i. This subsequence is used to calculate the standard supervised learning loss, and its corresponding ground truth interaction item is .
[0070] Calibration subsequence: This subsequence is used to calculate the conformal loss-based approach proposed in this invention. Its corresponding real-world interactive item is...
[0071] The data partitioning strategy provided in this invention utilizes the user's last interaction data for verification, transforming it into a learning signal for the training phase without any additional data labeling, thus improving data utilization. This enables the model to optimize... While improving the accuracy of predictions, we learn how to... The prediction generates a high-confidence prediction set.
[0072] Step S3: Based on conformal prediction theory, a prediction set containing candidate items is calculated using calibration subsequences or training subsequences. The prediction set contains all items with inconsistency scores below a dynamic threshold.
[0073] The present invention, using calibration subsequences as an example, specifically includes the following steps for calculating the conformal prediction set:
[0074] S31, Generation probability distribution: for calibration subsequence Generate the initial recommendation subsequence probability distribution using the current model. K c This is a list of all candidate projects to be recommended, |K c | represents the total number of candidate projects to be recommended.
[0075] S32, Calculate the inconsistency score: Based on the inconsistency score function Perform the calculation of the inconsistency fraction function, where Represents the probability distribution of the initial recommended subsequence. Extract interactive items The corresponding probability value;
[0076] S33, Determine the dynamic threshold: Set the confidence parameter α for conformal prediction (e.g., α = 0.1, representing a 90% confidence level), calculate the inconsistency score for each sample across the entire calibration set, and find the threshold for all sample scores based on conformal learning theory. Quantiles (defined from Vork's conformal learning theory) are used to obtain dynamic thresholds. Where quantile is the quantile function, preferably torchsort implemented by Blondel et al., or the quantile function built into the PyTorch framework. It is a set of inconsistency scores, containing the "inconsistency score" calculated for the true next item of each sequence in the calibration set; the dynamic threshold q represents any candidate recommendation item that is considered a "reasonable" recommendation if its "inconsistency score" is lower than this q value. It is calculated during the calibration phase and used as a judgment criterion during the inference phase.
[0077] S34, Construct the prediction set: Use all items whose inconsistency scores for the next candidate item are below the threshold q as the prediction set.
[0078]
[0079] Prediction set This is the final recommendation list presented to the user, which is a set containing one or more recommended items. The element s in the set comes from the set K of all candidate items. c Prediction set The size of the value directly reflects the confidence level of the model; a large value... This means the model is highly uncertain and needs to include a large number of projects to reliably cover real-world interactive projects; a compact... This indicates that the model has high confidence and can accurately identify a few candidate items. Therefore, The properties become the direct objects of optimization.
[0080] The above is based on the calibration calculation prediction set. The process can also be repeated to calculate the prediction set based on the training subsequences. I will not go into details here.
[0081] This invention employs inconsistency scores and dynamic thresholds to filter candidate items, ensuring that the probability of the predicted set containing the true target meets a pre-set confidence level. This process, based on conformal prediction theory, allows the size of the predicted set to reflect the model's confidence level, solving the problem of traditional recommendation systems that only rank items without confidence guarantees, and providing a scientific basis for generating reliable recommendation lists.
[0082] Step S4: Construct a composite loss function that includes the basic recommendation loss and the prediction set size loss. Combine the backpropagation algorithm to optimize all trainable parameters of the basic recommendation model until the model converges or reaches the preset number of fine-tuning rounds. Then, use preset performance metrics to verify the model performance.
[0083] This invention designs a composite loss function, which is a weighted sum of the basic recommendation loss and the prediction set size loss, aiming to simultaneously optimize the accuracy and confidence of the recommendations. Specifically:
[0084] a) The basic recommendation loss is expressed as: Using training subsequences and its goals The purpose of calculating the traditional cross-entropy loss is to maintain the basic recommendation accuracy of the model.
[0085] b) The prediction set size loss is expressed as: The prediction set calculated in step S3 is directly used Size (i.e., the number of items contained) ) as the loss term. Minimize L cp This will directly force the model to learn how to generate smaller prediction sets, thereby improving the confidence and efficiency of its predictions.
[0086] c) The final composite loss function is: Its β is a hyperparameter used to balance the importance of the two loss terms (in practice, it is usually taken as 0.5). The calculation of q depends on the steps in S3, and the estimation of q depends on the current training batch.
[0087] The composite loss function constructed in this invention combines cross-entropy loss and prediction set size loss. By balancing these two through hyperparameters, the model can directly learn how to generate smaller, more confident prediction sets during the training phase. This fundamentally solves the problem of the disconnect between training objectives and practical application objectives in existing technologies, enabling the model to simultaneously optimize recommendation accuracy and prediction set compactness during training. Compared to a single loss function, it incentivizes the model to generate high-confidence, small-size prediction sets, avoiding the shortcomings of traditional models that only focus on ranking while ignoring confidence, thus improving recommendation quality and efficiency.
[0088] Based on the calculated composite loss function L cp4rec The model updates all trainable parameters (such as Transformer weights and embedding matrices) of the defined model f using the backpropagation algorithm and iteratively fine-tunes it until the model converges or reaches a preset number of fine-tuning rounds. Furthermore, after model f is trained, its performance at a specific confidence parameter α is determined. Key performance indicators are calculated based on the trained model, preferably using test sequences from the actual online deployment of the model or calibration sub-sequences. Taking calibration sub-sequences as an example, key performance indicators include:
[0089] 1. Marginal coverage: This metric is used to verify whether our calibration process has successfully reduced the model's empirical error rate. The calculation formula is:
[0090] Where I is the indicator function, and its value should be very close to the preset target 1-α.
[0091] 2. Average set size: This metric measures the accuracy of the model's predictions while maintaining coverage. The formula is as follows:
[0092] Provided that the marginal coverage requirement is met, the smaller this value is, the better, as it indicates that the model's recommendations are more accurate and have higher confidence.
[0093] This invention uses marginal coverage and average prediction set size as performance metrics to quantitatively verify the model's confidence guarantee and recommendation accuracy. Marginal coverage ensures that the model's empirical error rate meets the preset limit, while the average prediction set size measures the compactness of the recommendations. The combination of these two metrics provides a comprehensive evaluation of model performance, offering a clear direction for model optimization and ensuring the reliability and efficiency of the recommendation results.
[0094] S5 uses a large language model to encode multi-dimensional user information in all training data and generate corresponding comprehensive state vectors.
[0095] In practical model deployment, to make recommendations more personalized and timely, it is necessary to encode the user's current state and long-term preferences. This step is not a simple replacement of the sequence model, but rather provides it with rich contextual information. Specifically:
[0096] 1. Collect multi-dimensional information about users, such as user profiles (age, gender, region), recent high-frequency behaviors (search terms, browsing categories), long-term preferences (favorites, historical purchase categories), etc. This information will be structured into text descriptions.
[0097] 2. Select a high-efficiency pre-trained large language model (such as the domestic DeepSeek and QWen3, or the foreign Llama 3.1, etc.) and use carefully designed prompts: "Generate a shopping intent description for the following users, highlighting their core needs. User information: Age [Item1] years, Gender [Item2], Region [Item3], Recent search terms [Item4], User stickiness [Item5], Recent clicks [Item6], Previous purchases [Item7], Previous purchase conversion rate [Item8]." Items 1-8 are anonymized user information.
[0098] 3. Input the descriptive text generated by LLM into the model and extract the hidden state vector (Embedding) of its last layer or a specific layer. This vector V user This becomes a high-dimensional semantic code that includes the user's overall state.
[0099] The above process greatly enriches the model's input information. Traditional sequence recommendation models mainly rely on item ID sequences, which may ignore user intent outside the sequence. By introducing an LLM-encoded user state vector V... user The model can better dynamically adjust the recommendation direction, achieving accurate capture of users' real-time intentions and model calibration.
[0100] S6 clusters users based on their comprehensive state vectors, and dynamically generates personalized prediction sets as recommendation lists based on the clustering results and the trained model.
[0101] Specifically, first utilize the comprehensive state vector V generated for each user in step S5. user As input, users in all training data are clustered using an unsupervised learning algorithm (such as KMeans), ensuring that the number of samples in each group is greater than or equal to the conformal prediction calibration set size of 500 proposed by angelopoulos et al.; assuming that user click information at deployment time is S K First, based on the user's behavior code, the user is mapped to the corresponding group, such as... Based on the model trained in step S4, step S3 is then executed for the user's group, dynamically generating a prediction set based on the intra-group threshold, where the intra-group threshold is calculated by grouping the calibration sequence in step S3.
[0102] This invention introduces a dynamic encoding and calibration mechanism for user states based on Large Language Model (LLM). By performing deep semantic encoding on users' multi-dimensional historical and real-time behaviors and combining it with user clustering, this invention achieves dynamic and personalized generation of prediction sets. The system can map users to corresponding groups during deployment for users with different states (e.g., new users / experienced users) and different behavioral patterns, generating prediction sets based on intra-group thresholds, enabling the recommendation list to adapt to the behavioral patterns of different user groups. This dynamic grouping mechanism overcomes the limitations of traditional "one-size-fits-all" recommendations, allowing the size and content of the prediction set to deeply match user characteristics, adaptively adjusting the size and content of the recommendation list, and significantly improving the personalized experience and recommendation quality while ensuring statistical confidence.
[0103] The method provided by this invention achieves end-to-end confidence-aware recommendation and offers statistical guarantees. Instead of treating conformal prediction as an isolated post-processing tool, its core idea is integrated into the entire model lifecycle. The final generated recommendation list is not only accurate but also comes with explicit statistical confidence guarantees (e.g., "95% certainty"), providing users with more reliable and noise-free recommendation results and offering a high-quality candidate pool for downstream tasks.
[0104] In one application scenario, a large online video platform needs to recommend videos that users may watch next.
[0105] User background: User B, whose recent viewing history sequence is ["Science Fiction Movie Trailers", "Space Exploration Documentaries", "Interstellar Analysis"].
[0106] Traditional method (Top-3 recommendation): A model trained only with cross-entropy loss might predict the probability distribution of the next video to watch: "Mars Life Documentary": 15%, "Another Sci-Fi Movie Trailer": 12%, "Popular Funny Shorts": 8%, "Food Making Videos": 7%... The system would recommend ["Mars Life Documentary", "Another Sci-Fi Movie Trailer", "Popular Funny Shorts"] to user B.
[0107] Problem: While the first two items are relevant, the third item, "Popular Funny Short Shows," is completely irrelevant; it only received a good prediction score due to its high overall popularity. This recommendation pollutes the user experience because the model "lacks confidence" in its own recommendations and simply populates the list in order.
[0108] The process and results after using the method provided by this invention:
[0109] Training phase: During training, the model f (e.g., SASRec) learns prediction accuracy (L... ce It also minimizes the loss term (L) by minimizing the size of the prediction set. cp It has learned to provide a more "sharp" probability distribution when it is confident.
[0110] Deployment and Reasoning:
[0111] After user B finishes watching, the system receives their latest viewing sequence. Model f performs inference, and due to optimizations during training, it now assigns a much higher probability to videos highly relevant to the "science fiction, space" theme than to other videos. For example, "Documentary about life on Mars": 45%, "Trailer for another science fiction film": 30%, "Documentary on the history of AI": 10%, while the sum of probabilities for all other videos is compressed to a very low level. The system sets a confidence level of 95% (i.e., α = 0.05). Based on a pre-calculated global threshold q, the system begins constructing a prediction set.
[0112] Final result: After calculation, the system found that only the inconsistency scores of "Mars Life Documentary" and "Another Sci-Fi Movie Trailer" were below the threshold q. Ultimately, the system generated the following recommendation set for user B.
[0113] Advantages: This recommendation list is not only highly relevant and noise-free, but the system also includes a statistical promise: "We are 95% confident that the next video you want to watch is in this list." This result provides a better user experience and offers a high-quality, high-confidence candidate pool for downstream tasks such as advertising and ranking, greatly improving the overall platform's operational efficiency and commercial value.
[0114] This embodiment also provides a sequence recommendation system based on conformal prediction, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the systems described in the following embodiments are preferably implemented in software, hardware implementations, or a combination of software and hardware, are also possible and contemplated.
[0115] This embodiment provides a sequence recommendation system based on conformal prediction, such as... Figure 2 As shown, it includes: a model training module and a model deployment module, wherein:
[0116] The model training module includes:
[0117] The basic model selection unit 21 is used to select a preset deep neural network architecture as the basic recommendation model;
[0118] The interaction data acquisition unit 22 is used to acquire historical interaction subsequence data for each user and divide the historical interaction subsequence data into training subsequences and calibration subsequences, wherein the training subsequences are used for model training and the calibration subsequences are used for confidence calibration.
[0119] The prediction set calculation unit 23 is used to calculate a prediction set containing candidate items based on conformal prediction theory using calibration subsequences or training subsequences. The prediction set contains all items with inconsistency scores below a dynamic threshold.
[0120] Model training unit 24 is used to construct a composite loss function including basic recommendation loss and prediction set size loss, and to optimize all trainable parameters of the basic recommendation model in combination with backpropagation algorithm until the model converges or reaches the preset number of fine-tuning rounds, and to verify the model performance using preset performance indicators.
[0121] The model deployment module includes:
[0122] User state vector generation unit 25 is used to encode the multi-dimensional information of users in all training data using a large language model to generate the corresponding comprehensive state vector.
[0123] The recommendation list generation unit 26 is used to cluster users based on their comprehensive state vectors, and dynamically generate personalized prediction sets as recommendation lists based on the clustering results and the trained model.
[0124] In some optional implementations, the training subsequence in the interactive data acquisition unit 212 is represented as follows: The calibration subsequence is represented as Where, N train and N calib These represent the number of samples in the training set and the calibration set, respectively. This represents the interaction item for user i, and the corresponding actual interaction item is... The corresponding real-world interactive project is
[0125] In some optional implementations, the prediction set computation unit 213 includes:
[0126] The probability distribution calculation subunit is used to generate the probability distribution: for the calibration subsequence Generate the initial recommendation subsequence probability distribution using the current model. K c This is a list of all candidate projects to be recommended, |K c | represents the total number of candidate projects to be recommended;
[0127] The inconsistency score calculation subunit is used to calculate the inconsistency score: based on the inconsistency score function. Perform the calculation of the inconsistency fraction function, where Represents the probability distribution of the initial recommended subsequence. Extract interactive items The corresponding probability value;
[0128] The dynamic threshold calculation subunit is used to determine the dynamic threshold: it sets the confidence parameter α for conformal prediction, calculates the inconsistency score for each sample across the entire calibration set, and finds the score for all samples based on conformal learning theory. Quantiles are used to obtain the dynamic threshold. Where quantile is the quantile function;
[0129] The prediction set computation subunit is used to construct the prediction set: all items whose inconsistency scores for the next candidate item are below a threshold q are included in the prediction set.
[0130]
[0131] Prediction set This is the final recommendation list presented to the user, which is a set containing one or more recommended items. The element s in the set comes from the set K of all candidate items. c .
[0132] In some alternative implementations, the base recommendation loss L in model training unit 214 ce Represented as:
[0133]
[0134] It uses training subsequences and its goals Calculate the cross-entropy loss;
[0135] Prediction set size loss L cp Represented as:
[0136]
[0137] It will use the prediction set calculated in step S3 The size of the loss is taken as the loss;
[0138] The composite loss function is:
[0139]
[0140] Here, β is a hyperparameter used to balance the importance of the two loss terms.
[0141] In some optional implementations, the recommendation list generation unit 26 includes:
[0142] The user clustering subunit is used to cluster users based on user semantic vectors using an unsupervised learning algorithm;
[0143] The personalized recommendation list generation unit maps the comprehensive state vector of the target user to the corresponding category, and performs a prediction set calculation unit on the user's group based on the trained subsequence recommendation model, and dynamically generates the prediction set as the personalized recommendation list based on the group threshold.
[0144] In one optional implementation, the model training unit presets performance metrics, including:
[0145] Marginal coverage is used to verify whether the calibration process has successfully reduced the model's empirical error rate.
[0146] The average prediction set size is used to measure the accuracy of the model's predictions while satisfying the marginal coverage guarantee.
[0147] Further functional descriptions of the various modules and units described above are the same as those in the corresponding embodiments described above, and will not be repeated here. This system achieves full automation of the subsequence recommendation process based on conformal prediction through the division of labor and collaboration between the model training module and the deployment module. The training module ensures that the model possesses both accuracy and confidence, while the deployment module utilizes user coding and clustering to generate personalized recommendations. Each unit has a clearly defined function and works efficiently together, enabling the system to stably output high-quality recommendations, making it suitable for various sequence recommendation scenarios.
[0148] In this embodiment, the sequence recommendation system based on conformal prediction is presented in the form of functional units. Here, a unit refers to an ASIC (Application Specific Integrated Circuit), a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0149] This invention also provides a computer device having the above-described features. Figure 2 The example shown is a sequence recommendation system based on conformal prediction.
[0150] Please see Figure 3 , Figure 3 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present invention, such as... Figure 3As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 3 Take a processor 10 as an example.
[0151] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.
[0152] The memory 20 stores instructions executable by at least one processor 10 to cause at least one processor 10 to perform the method shown in the above embodiments.
[0153] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0154] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.
[0155] The computer device also includes a communication interface 30 for communicating with other devices or communication networks.
[0156] 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 computer code that can be recorded on a storage medium, or implemented as computer code downloaded over a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. 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, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.
[0157] 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.
[0158] 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 conformal prediction, characterized in that, include: S1, Select a preset deep neural network architecture as the basic recommendation model; S2, obtain historical interaction subsequence data for each user, and divide the historical interaction subsequence data into training subsequence and calibration subsequence, wherein the training subsequence is used for model training and the calibration subsequence is used for confidence calibration. S3, based on conformal prediction theory, calculate a prediction set containing candidate items using calibration subsequences or training subsequences, the prediction set containing all items with inconsistency scores below a dynamic threshold; S4. Construct a composite loss function that includes the basic recommendation loss and the prediction set size loss. Combine the backpropagation algorithm to optimize all trainable parameters of the basic recommendation model until the model converges or reaches the preset number of fine-tuning rounds. Then, use the preset performance index to verify the model performance. S5 utilizes a large language model to encode multi-dimensional user information in all training data, generating corresponding comprehensive state vectors. S6 clusters users based on their comprehensive state vectors, and dynamically generates personalized prediction sets as recommendation lists based on the clustering results and the trained model.
2. The method according to claim 1, characterized in that, The training subsequence is represented as follows: The calibration subsequence is represented as Where, N train and N calib These represent the number of samples in the training set and the calibration set, respectively. This represents the interaction item for user i, and the corresponding actual interaction item is... The corresponding real-world interactive project is 3. The method according to claim 2, characterized in that, Step S3 specifically includes: Generation probability distribution: for calibration subsequence Generate the initial recommendation subsequence probability distribution using the current model. K c This is a list of all candidate projects to be recommended, |K c | represents the total number of candidate projects to be recommended; Calculating Inconsistency Scores: Based on the Inconsistency Score Function Perform the calculation of the inconsistency fraction function, where Represents the probability distribution of the initial recommended subsequence. Extract interactive items The corresponding probability value; Determine the dynamic threshold: Set the confidence parameter α for conformal prediction, calculate the inconsistency score for each sample across the entire calibration set, and find the (1-α)(1+1Ncalib quantiles) of all sample scores based on conformal learning theory to obtain the dynamic threshold. Where quantile is the quantile function; Construct the prediction set: Use all items whose inconsistency scores for the next candidate item are below a threshold q as the prediction set. Prediction set This is the final recommendation list presented to the user, which is a set containing one or more recommended items. The element s in the set comes from the set K of all candidate items. c .
4. The method according to claim 2, characterized in that, The basic recommendation loss L ce Represented as: It uses training subsequences and its goals Calculate the cross-entropy loss; The prediction set size loss L cp Represented as: It will use the prediction set calculated in step S3 The size of the loss is taken as the loss; The composite loss function is: Here, β is a hyperparameter used to balance the importance of the two loss terms.
5. The method according to claim 1, characterized in that, Step S6 specifically includes: Users are clustered using an unsupervised learning algorithm based on their semantic vectors; The comprehensive state vector of the target user is mapped to the corresponding category, and step S3 is performed on the user's group based on the trained subsequence recommendation model. A prediction set is dynamically generated based on the group threshold as a personalized recommendation list.
6. The method according to claim 3, characterized in that, The preset performance indicators include: Marginal coverage is used to verify whether the calibration process has successfully reduced the model's empirical error rate. The average prediction set size is used to measure the accuracy of the model's predictions while satisfying the marginal coverage guarantee.
7. A sequence recommendation system based on conformal prediction, characterized in that, include: The model training module and the model deployment module, wherein: The model training module includes: The basic model selection unit is used to select a preset deep neural network architecture as the basic recommendation model. An interaction data acquisition unit is used to acquire historical interaction subsequence data for each user, and divide the historical interaction subsequence data into training subsequences and calibration subsequences, wherein the training subsequences are used for model training and the calibration subsequences are used for confidence calibration. The prediction set calculation unit is used to calculate a prediction set containing candidate items based on conformal prediction theory using calibration subsequences or training subsequences. The prediction set contains all items with inconsistency scores below a dynamic threshold. The model training unit is used to construct a composite loss function that includes the basic recommendation loss and the prediction set size loss. It combines the backpropagation algorithm to optimize all trainable parameters of the basic recommendation model until the model converges or reaches the preset number of fine-tuning rounds, and uses preset performance metrics to verify the model performance. The model deployment module includes: The user state vector generation unit is used to encode the multi-dimensional information of users in all training data using a large language model, and generate the corresponding comprehensive state vector. The recommendation list generation unit is used to cluster users based on their comprehensive state vectors, and dynamically generate personalized prediction sets as recommendation lists based on the clustering results and a trained model.
8. A computer device, characterized in that, include: A memory and a processor are communicatively connected, the memory storing computer instructions, and the processor executing the computer instructions to perform the sequence recommendation method based on conformal prediction 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 a computer to perform the sequence recommendation method based on conformal prediction 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 conformal prediction as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Conformal optimal selection method based on priority mining
CN110222269A
User analysis method and device based on large model, equipment and medium
CN119311958A
Conformal training of machine- learning models
US20240394541A1