Comparison learning sequence recommendation method based on large language model view enhancement
By introducing a comparison learning method with enhanced view of large language model in the recommendation system, the problem of dynamic evolution of user interests and difficult to capture timing dependencies is solved, and more accurate user behavior representation and recommendation effect improvement are achieved.
Patent Information
- Application Number
- CN202510625192.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2045-05-15
AI Technical Summary
The prior art is difficult to effectively capture the dynamic evolution of user interests and the timing dependencies in behavior sequences, resulting in limited recommendation effects in scenarios such as interest drift and scene migration.
The view-enhanced contrast learning sequence recommendation method based on large language models is adopted, and enhanced views are generated through the dynamic importance scoring mechanism and adaptive sequence cropping method. Combined with the two-grained contrast learning method of multimodal dual-view enhancement, the comparison loss is optimized to enhance the model's perception of user behavior.
This has achieved more accurate representation of user behavior and improved recommendation results, especially in scenarios where user behavior is sparse or implicit feedback, which has significantly improved the accuracy and robustness of recommendations.
Smart Images

Figure CN120123600A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of recommendation systems, and particularly relates to a contrastive learning sequential recommendation method based on large language model view enhancement. Background Art
[0002] The sequential recommendation model is a deep learning method widely used in the field of personalized recommendation, and has made remarkable progress in multiple scenarios such as user purchase prediction, web content recommendation, and point of interest navigation, becoming a core part of modern recommendation system research.
[0003] The execution paradigm of traditional recommendation systems is mainly based on static feature modeling, and its core logic is to achieve recommendations through the association and matching of user portraits and item features. Such methods rely on two stages: offline training and online inference of static data. In the training stage, fixed patterns of user interests are learned through historical interaction data, and in the inference stage, recommendation results are generated based on real-time inputs. However, this static modeling method fails to fully consider the dynamic evolution characteristics of user interests and the temporal dependencies in the behavior sequence, resulting in limited recommendation effects in practical scenarios such as interest drift and scenario migration. For example, in the e-commerce platform scenario, users may exhibit completely different shopping patterns on weekdays and weekends, and traditional methods are difficult to capture such short-term interest fluctuations.
[0004] In recent years, large language pre-trained models can capture potential semantic associations across domains through pre-training on massive behavioral data. Their multi-level attention mechanisms can simultaneously model long-term interest preferences and short-term behavioral motivations, providing a new paradigm for refined user portraits. However, directly applying large language models to sequential recommendation still faces significant challenges: First, there are essential differences between the spatio-temporal sparsity of user behavior sequences and the dense semantics of natural language texts; Second, the contradiction between the model parameter scale and real-time inference requirements is particularly prominent in mobile scenarios; Third, how to effectively fuse context features and real-time behavior signals still needs to be explored in depth.
[0005] Recommendation methods based on contrastive learning have effectively improved the representation quality of user behavior sequences and alleviated the data sparsity problem. Although existing research has optimized the data distribution to a certain extent, it is difficult to dynamically adapt to complex and changing recommendation scenarios. Traditional methods are limited by the artificially designed generation logic and have insufficient ability to capture potential deep semantic associations and cross-scenario generalization features in user behavior, resulting in limited robustness of the model in sparse data and cold start scenarios.
[0006] Therefore, how to construct an adaptive contrastive view generation mechanism based on large language models, break through the constraints of preset rules, and achieve semantic-driven dynamic enhancement has become the core breakthrough point for improving sequential recommendation performance. Summary of the Invention
[0007] Objective of the Invention: Aiming at the deficiencies of the prior art, the technical problem to be solved by the present invention is to provide a contrastive learning sequence recommendation method based on large language model view enhancement, including the following steps: Step 1, establish a dynamic importance scoring mechanism, use a large language model, calculate the importance and generate a dynamic adjustment factor according to the hidden layer state of the historical interaction sequence of users and items; Step 2, establish an adaptive sequence cropping method, use the attention mechanism for sequence data enhancement, dynamically adjust the cropping position through semantic understanding, and generate an enhanced view containing negative sample pairs according to the dynamic adjustment factor; Step 3, construct a sequence and item dual-granularity contrastive learning method under multi-modal dual-view enhancement, build a contrastive learning task based on the enhanced view generated in Step 2, and optimize the contrastive loss to strengthen the contrastive learning method's perception ability of key behavior differences by narrowing the representation distance of positive sample pairs and pushing away the similarity of negative sample pairs; Step 4, input the original historical interaction sequence of users and items into a linear recurrent unit LRU (Linear Recurrent Units), extract the dynamic interest representation of users and predict the probability distribution of the next interaction item, and synchronously calculate the loss function of conventional sequence recommendation; Step 5, dynamically fuse the contrastive learning method and the conventional sequence recommendation method, optimize through weighted combination of loss functions, and jointly train the model through backpropagation.
[0008] Step 1 includes: constructing the historical interaction sequence of users and items , where represents the i-th element in the sequence, is the sequence length; Process the historical interaction sequence S of users and items through a pre-trained large language model BERT to establish a dynamic importance scoring mechanism, and the dynamic importance scoring mechanism performs the following operation process: Step 1-1, convert the historical interaction sequence S of users and items into word vectors, including: Input data: Input the historical interaction records of users; Clean data: Remove invalid interactions (such as duplicates, outliers); Sequence segmentation: Split the long sequence into fixed-length segments of 256; Construct a global item pool: Count all the items that have appeared and generate unique IDs; Vocabulary mapping: Assign an index to each item ID; Initialize the embedding matrix: Create a random matrix with a shape of (B 1 , B 2 ), where B1 denotes the vocabulary size, B 2 denotes the embedding dimension; Sequence vectorization: Convert the user and item historical interaction sequence S into a list of indices, and then map it to a vector sequence through the embedding matrix to obtain a normalized vector; Input to the embedding layer: Input the normalized vector sequence into the embedding layer; Step 1-2, extract the hidden layer state through multiple layers of Transformer, Step 1-3, calculate the position importance score along the feature dimension for subsequent information cropping; A large variance of the hidden layer state in different layers indicates a high importance score, and a small fluctuation of the hidden layer state indicates a low importance score; Step 1-4, generate a dynamic adjustment factor through the aggregation of multiple layers of hidden layer states, which essentially fuses features at different abstraction levels and indirectly reflects the position importance. The formula is: , where, denotes the dynamic adjustment factor of the i-th sample, denotes the hidden layer state matrix output by the k-th layer of the pre-trained large language model BERT, and d is the number of layers of the BERT model.
[0009] Step 2 includes: Apply the adjustment factor directly to the position encoding to obtain the cropped dynamic starting position and the elastic cropping length : , , , where, denotes the cropping ratio parameter, denotes the original sequence length; denotes uniform distribution random sampling, denotes the position encoding matrix of the augmented sequence; denotes a sequence of integers from 1 to ; Then, through the calculated cropped dynamic starting position and the elastic cropping length calculate the augmented sequence , and the formula is: , where denotes the original user and item historical interaction sequence; denotes the interception starting from Start with a sequence part of length .
[0010] Step 3 includes: Use the original sequence S and the enhanced sequence as positive and negative samples respectively for contrastive learning; The sequence-level alignment method captures the global temporal pattern of user behavior (such as the interest evolution path) by extracting the end position embedding of the enhanced sequence. The loss function of sequence-level alignment is given by the formula: , where N represents the total number of samples in a training batch, is the sequence-level embedding vector, represents the positive example-level embedding of the i-th sample, represents the negative example embedding vector of the j-th sample, is an adjustable temperature coefficient, is the cosine similarity, exp represents the natural exponential function, and K represents the total number of negative examples to be contrasted for each anchor ; Adopt the SASRec model as the basic model and use the position encoding matrix and the enhanced sequence as parameters and input them into the SASRec model to obtain the vector embedding of the enhanced sequence; SASRec (Self-Attention-based Sequential Recommendation) model: This model uses the self-attention mechanism to comprehensively consider the entire sequence information and can effectively capture the long-term dependencies in user behavior.
[0011] Use the Transformer encoding layer in the SASRec model to implicitly learn the relationships between items, achieve item-level alignment, and construct a local item similarity matrix through attention weights. The loss function of item-level alignment is: , where represents the length of the interaction sequence between the user and the item, is the hidden state output by the Transformer for the q-th item, is the local contrastive representation of the q-th item; is the hidden state after Transformer encoding of the same enhanced variant generated by sequence shuffling; Attn(x,y) is the attention function used to calculate the similarity between x and y; represents and Similarity; Finally, the dual-granularity contrastive loss is jointly optimized to obtain the loss of contrastive learning : , where , represent weight coefficients used to balance the contributions of global and local losses.
[0012] Step 4 includes: Initializing the hidden state with the original sequence S as the input, setting the initial state , and updating the hidden state: , where is the input vector at time step t, has a dimension of , is the hidden layer state vector at time step t, has a dimension of , is the weight matrix of the hidden state, is the input weight matrix, is the bias; represents the real number space; Obtain the interest at each time step. T represents the total number of time steps of the input interaction sequence. Take the final state as the user's final interest for predicting the next interaction; Map the hidden state to the item space: , where is the mapping result in the item space corresponding to time step t, is the weight matrix, is the bias term; Generate the predicted probability that the user will interact with each item next through the Softmax function .
[0013] Step 4 also includes: Calculating the loss function for conventional sequence recommendation : , where is the true label, is the number of candidate items, represents the indicator value corresponding to item c in the true label, is the predicted probability of the output, represents the weight coefficient of the c-th item.
[0014] Step 5 includes: Dynamically integrating the contrastive learning method and the conventional sequential recommendation method, the total loss function has the following calculation formula: , where is the weight hyperparameter of the contrastive loss.
[0015] Step 5 also includes: updating the model parameters by the gradient descent method to minimize the total loss: , where represents the optimal model parameters obtained after optimization, represents finding the parameters that minimize the expression value in .
[0016] The present invention also provides an electronic device, including a processor and a memory, where the memory stores program codes, and when the program codes are executed by the processor, the processor executes the steps of the above method.
[0017] The present invention also provides a storage medium storing a computer program or instructions, and when the computer program or instructions are run on a computer, the steps of the above method are executed.
[0018] The present invention has the following beneficial effects: (1) The contrastive learning sequential recommendation method based on large language model view enhancement proposed by the present invention combines the semantic understanding ability of the large language model through a dynamic importance scoring mechanism, quantifies the key differences in user historical behaviors in real time, and effectively filters out noise interference. Compared with the traditional static weight allocation method, this method can adaptively identify the significant change nodes of user interests, improve the representation accuracy of behavior sequences, and is especially suitable for scenarios where user behaviors are sparse or there are implicit feedbacks.
[0019] (2) The adaptive sequence cropping and dual-view contrastive learning framework designed by the present invention generates diverse enhanced views through a semantic-driven dynamic cropping strategy and constructs sequence-level and item-level contrast tasks. Compared with the traditional uniform sampling method, this framework significantly enhances the model's ability to capture user long-term and short-term interests, and at the same time solves the data sparsity problem through contrastive loss optimization, improving the recommendation accuracy.
[0020] (3) The linear recurrent unit (LRU) and temporal hidden state extraction technology introduced in this paper accurately models the dynamic evolution of user interests by integrating time-sensitive feature encoding with the semantic enhancement representation of a large language model. Compared with traditional RNN or Transformer architectures, this method reduces the computational overhead by 30% in terms of training efficiency and improves the adaptability to user interest drift scenarios by more than 40%.
[0021] (4) The dynamic multi-task fusion mechanism implemented by the present invention adaptively balances the self-supervision signal and the supervision signal by weighted joint optimization of contrast learning loss and recommendation task loss. Compared with the fixed weight strategy, this mechanism improves resource utilization while ensuring the robustness of the model in cold-start item recommendation and long-tail distribution scenarios, providing an efficient and stable solution for dynamic recommendation systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 The figure is a flow chart of the method of the present invention. DETAILED DESCRIPTION
[0023] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments, and the above and / or other advantages of the present invention will become more clear.
[0024] The embodiment of the present invention provides a contrastive learning sequence recommendation method based on large language model view enhancement, such as Figure 1 As shown, the specific steps include: Step 1: Establish a dynamic importance scoring mechanism, using a large language model to calculate the importance and generate a dynamic adjustment factor based on the hidden state of the historical interaction sequence between users and items; Step 2: Establish an adaptive sequence cropping method, use the attention mechanism to enhance the sequence data, dynamically adjust the cropping position through semantic understanding, and generate an enhanced view containing negative sample pairs according to the dynamic adjustment factor; Step 3: construct a sequence and item dual-granularity contrastive learning method under multimodal dual-view enhancement. Based on the enhanced view generated in step 2, a contrastive learning task is constructed. By shortening the representation distance of positive sample pairs and extending the similarity of negative sample pairs, the contrastive loss is optimized to enhance the contrastive learning method's ability to perceive key behavioral differences. Step 4: Input the original historical interaction sequence of users and items into the Linear Recurrent Units (LRU), extract the user's dynamic interest representation and predict the probability distribution of the next interaction item, and simultaneously calculate the loss function of the conventional sequence recommendation; Step 5: Dynamically fuse the contrastive learning method and the conventional sequence recommendation method, optimize through the weighted combination loss function, and jointly train the model through back propagation.
[0025] Step 1 includes: Construct the historical interaction sequence of users and items , where represents the i-th element in the sequence, is the sequence length; Process the historical interaction sequence S of users and items through the pre-trained large language model BERT to establish a dynamic importance scoring mechanism. The dynamic importance scoring mechanism performs the following operation process: Step 1-1: Convert the historical interaction sequence S of users and items into word vectors, including: Input data: Input the historical interaction records of users; Clean data: Remove invalid interactions (such as duplicates and outliers); Sequence segmentation: Split the long sequence into fixed-length segments of 256; Construct a global item pool: Count all the items that have appeared and generate unique IDs; Vocabulary mapping: Assign an index to each item ID; Initialize the embedding matrix: Create a random matrix with a shape of (B 1 , B 2 ), where B 1 represents the vocabulary size, and B 2 represents the embedding dimension; Sequence vectorization: Convert the historical interaction sequence S of users and items into a list of indices, and then map it to a vector sequence through the embedding matrix to obtain the standardized vectors; Input to the embedding layer: Input the standardized vector sequence into the embedding layer; Step 1-2: Extract the hidden layer states through multiple layers of Transformer Step 1-3: Calculate the position importance scores along the feature dimension for subsequent information pruning; A large variance of the hidden layer states in different layers indicates a high importance score, and a small fluctuation of the hidden layer states indicates a low importance score; Step 1-4: Generate a dynamic adjustment factor through the aggregation of multiple layers of hidden layer states. Essentially, it is to fuse features at different abstraction levels and indirectly reflect the position importance. The formula is: , where represents the dynamic adjustment factor of the i-th sample, represents the hidden layer state matrix output by the k-th layer of the pre-trained large language model BERT, and d is the number of layers of the BERT model.
[0026] Step 2 includes: Directly apply the adjustment factor to the position encoding to obtain the cropped dynamic starting position and the elastic cropping length : , , , Among them, represents the cropping ratio parameter, represents the length of the original sequence; represents uniform distribution random sampling, represents the position encoding matrix of the augmented sequence; represents an integer sequence from 1 to ; Then, through the calculated dynamic start position of cropping and the elastic cropping length the augmented sequence is calculated, and the formula is: , where represents the original user and item historical interaction sequence.
[0027] Step 3 includes: Using the original sequence S and the augmented sequence as positive and negative samples respectively for contrastive learning; The sequence-level alignment method captures the global temporal pattern of user behavior (such as the interest evolution path) by extracting the end position embedding of the augmented sequence. The loss function of sequence-level alignment is as follows: , where N represents the total number of samples in a training batch, is the sequence-level embedding vector, represents the positive example-level embedding of the i-th sample, represents the j-th negative example embedding vector, is the adjustable temperature coefficient, is the cosine similarity, exp represents the natural exponential function, and K represents the total number of negative examples to be contrasted for each anchor point; Using the SASRec model as the basic model, using the position encoding matrix and the augmented sequence as parameters, and inputting them into the SASRec model to obtain the vector embedding of the augmented sequence; SASRec (Self-Attention-based Sequential Recommendation) model: This model uses the self-attention mechanism to comprehensively consider the entire sequence information and can effectively capture the long-term dependencies in user behavior.
[0028] Using the Transformer encoding layer in the SASRec model, learn the relationships between items implicitly, achieve item-level alignment, construct a local item similarity matrix through attention weights, and the loss function for item-level alignment is: , where represents the length of the interaction sequence between the user and the item, is the hidden state output by the Transformer for the q-th item, is the local contrast representation of the q-th item; is the hidden state after Transformer encoding of the same augmented variant generated by sequence shuffling; Attn(x,y) is the attention function used to calculate the similarity between x and y; represents and similarity; Finally, adopt joint optimization of the dual-granularity contrast loss to obtain the contrast learning loss : , where, , represent weight coefficients used to balance the contributions of the global and local losses.
[0029] Step 4 includes: Initialize the hidden state with the original sequence S as the input, set the initial state , and update the hidden state: , where, is the input vector at time step t, has a dimension of , is the hidden layer state vector at time step t, has a dimension of , is the weight matrix of the hidden state, is the input weight matrix, is the bias; represents the real number space; Obtain the interest at each time step, T represents the total number of time steps of the input interaction sequence, and take the final state As the ultimate interest of the user, it is used to predict the next interaction; Map the hidden state to the item space: , where, is the mapping result in the item space corresponding to time step t, is the weight matrix, is the bias term; Generate the predicted probability of the user's next interaction with each item through the Softmax function : .
[0030] Step 4 also includes: calculating the loss function of the regular sequence recommendation : , where is the true label, c is the number of candidate items, represents the indicator value corresponding to item c in the true label, is the output predicted probability, represents the weight coefficient of the c-th item.
[0031] Step 5 includes: Dynamically fuse the contrastive learning method and the regular sequence recommendation method, and the formula for the total loss function is: , where is the weight hyperparameter of the contrastive loss.
[0032] Step 5 also includes: updating the model parameters through the gradient descent method , minimizing the total loss: , where, represents the optimal model parameters obtained after optimization, represents finding the parameters that minimize the expression in .
[0033] To evaluate the performance of the method of the present invention, three publicly available multi-domain datasets, namely ml-1m, Beaut, and Steam, are selected for training. The main evaluation metrics include normalized discounted cumulative gain at K (NDCG@K) and recall at K (Recall@K). Experimental data shows that the CLLMRec model of the present invention achieves the best results in all evaluation metrics. For example, compared with the traditional sequential model LRURec, CLLMRec achieves a 5.09% improvement in NDCG@10 and a 1.84% improvement in Recall@20 on the ml-1m dataset; for the attention-based SASRec model, the improvement rate of NDCG@20 reaches 6.8% and Recall@10 improves by 4.2% on the Beauty sparse dataset; compared with the self-supervised learning framework HSTU, NDCG@10 and Recall@10 are improved by 3.7% and 5.1% respectively in the Steam long-tail scenario. Generally speaking, the CLLMRec model of the present invention achieves a significant improvement in recommendation accuracy and scenario adaptability compared with existing recommendation models. Through semantic enhancement and contrast learning framework, its comprehensive performance in dense interaction, sparse data, and long-tail scenarios is significantly improved, verifying the breakthrough advantages of the technical solution.
[0034] The present invention provides a contrast learning sequence recommendation method based on large language model view enhancement. There are many methods and ways to specifically implement this technical solution. The above is only the preferred embodiment of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention. Each component not clearly defined in this embodiment can be implemented by existing technologies.
Claims
1. A contrastive learning sequence recommendation method based on large language model view enhancement, characterized in that: The following steps are involved: Step 1: Establish a dynamic importance scoring mechanism, using a large language model to calculate the importance and generate a dynamic adjustment factor based on the hidden state of the historical interaction sequence between users and items; Step 2: Establish an adaptive sequence cropping method, use the attention mechanism to enhance the sequence data, dynamically adjust the cropping position through semantic understanding, and generate an enhanced view containing negative sample pairs according to the dynamic adjustment factor; Step 3: construct a sequence and item dual-granularity contrastive learning method under multimodal dual-view enhancement. Based on the enhanced view generated in step 2, a contrastive learning task is constructed. By shortening the representation distance of positive sample pairs and extending the similarity of negative sample pairs, the contrastive loss is optimized to enhance the contrastive learning method's ability to perceive key behavioral differences. Step 4: Input the original historical interaction sequence of users and items into the linear recursive unit LRU, extract the user's dynamic interest representation and predict the probability distribution of the next interaction item, and simultaneously calculate the loss function of the conventional sequence recommendation; Step 5: Dynamically fuse the contrastive learning method and the conventional sequence recommendation method, optimize through the weighted combination loss function, and jointly train the model through back propagation.
2. The method according to claim 1, characterized in that Step 1 includes: constructing the historical interaction sequence between users and items ,in represents the i-th element in the sequence, is the sequence length; The user and item historical interaction sequence S is processed by the pre-trained large language model BERT to establish a dynamic importance scoring mechanism, which performs the following operation process: Step 1-1, convert the user and item historical interaction sequence S into a word vector, including: Input data: input the user's historical interaction records; Clean data: remove invalid interactions; Sequence segmentation: split long sequences into fixed lengths; Build a global item pool: count all items that have appeared and generate a unique ID; Vocabulary mapping: assign an index to each item ID; Initialize the embedding matrix: Create a random matrix of shape (B1, B2) where B1 represents the vocabulary size and B2 represents the embedding dimension. Sequence vectorization: Convert the historical interaction sequence S of users and items into an index list, and then map it into a vector sequence through the embedding matrix to obtain a standardized vector; Embedding layer input: Input the standardized vector sequence into the embedding layer; Step 1-2, extract the hidden layer state through multi-layer Transformer, Steps 1-3, calculate the position importance score along the feature dimension for subsequent information clipping; Steps 1-4 generate dynamic adjustment factors by aggregating multiple hidden layer states. The formula is: , in, represents the dynamic adjustment factor of the i-th sample, It represents the hidden state matrix of the k-th layer output of the pre-trained large language model BERT, and d is the number of model layers of BERT.
3. The method according to claim 2, characterized in that Step 2 includes: The adjustment factor Directly act on the position code to get the dynamic starting position of the crop and elastic cut length : , , , in, Represents the cropping ratio parameter, Indicates the original sequence length; represents uniformly distributed random sampling, The position encoding matrix representing the enhanced sequence; Represents a value from 1 to sequence of integers; Then, the calculated dynamic starting position of the clipping and elastic cut length Calculate the enhanced sequence , the formula is: , in Represents the original historical interaction sequence between users and items; Indicates interception from Start with a length of sequence part.
4. The method according to claim 3, characterized in that Step 3 includes: The original sequence S is enhanced Use them as positive and negative samples for contrastive learning respectively; The sequence-level alignment method is to extract the end position embedding of the enhanced sequence to capture the global temporal pattern of user behavior. The loss function of sequence-level alignment is The formula is: , Where N represents the total number of samples contained in a training batch. is the sequence-level embedding vector, represents the positive example level embedding of the i-th sample, represents the j-th negative example embedding vector, is the adjustable temperature coefficient, is the cosine similarity, exp represents the natural exponential function, and K represents each anchor point The total number of negative examples to be compared; The SASRec model is used as the basic model, using the position encoding matrix and enhanced sequence As a parameter, it is input into the SASRec model to obtain the vector embedding of the enhanced sequence; The Transformer encoding layer in the SASRec model is used to implicitly learn the relationship between items and achieve item-level alignment. The local item similarity matrix is constructed through attention weights. The loss function of item-level alignment for: , in represents the length of the interaction sequence between users and items, is the hidden state of the qth item Transformer output, is the local contrast representation of the qth item; It is the hidden state of the same enhanced variant generated by sequence shuffling after being encoded by Transformer; express and similarity; Finally, the dual-granularity contrast loss is used for joint optimization to obtain the contrastive learning loss : , in, , Represents the weight coefficient.
5. The method according to claim 4, characterized in that Step 4 includes: taking the original sequence S as input to initialize the hidden state, setting the initial state , update the hidden state: , in, is the input vector at time step t, The dimension is , is the hidden state vector at time step t, The dimension is , is the weight matrix of the hidden state, is the input weight matrix, is bias; represents the real number space; Get the interest at each time step , T represents the total number of time steps of the input interaction sequence, and the final state is taken As the user's final interest, used to predict the next interaction; Map the hidden state to item space: , in, is the mapping result in the item space corresponding to time step t, is the weight matrix, is the bias term; Generate the predicted probability of the user's next interaction with each item through the Softmax function : 。 6. The method according to claim 5, characterized in that Step 4 also includes: calculating the loss function of conventional sequence recommendation : , in is the true label, is the number of candidate items, represents the indicator value of the corresponding item c in the true label, is the predicted probability of the output, Represents the weight coefficient of the cth item.
7. The method according to claim 6, characterized in that Step 5 includes: Dynamic fusion contrastive learning method and conventional sequence recommendation method, total loss function The calculation formula is: , in is the weight hyperparameter of the contrastive loss.
8. The method according to claim 7, characterized in that Step 5 also includes: updating the model parameters by gradient descent , minimize the total loss: , in, represents the optimal model parameters obtained after optimization, Indicates that the The expression in the expression with the smallest value is the parameter .
9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores program codes, and when the program codes are executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 8.
10. A storage medium, characterized in that: A computer program or instruction is stored, and when the computer program or instruction is run on a computer, the steps of the method according to any one of claims 1 to 8 are executed.
Citation Information
Patent Citations
Commodity sequence recommendation method based on time sequence perception self-attention and comparative learning
CN117196763A
Sequence recommendation method and system based on multi-view data enhancement and graph contrast learning
CN117932158A
Memory retrieval method based on large language model and related device
CN119903125A
Sequence recommendation method based on comparative learning and variational auto-encoder
CN119939036A
Cross-domain recommendation via contrastive learning of user behaviors in attentive sequence models
US20240161165A1
Cited By
Sequence recommendation method for extracting user intention based on large model in combination with variational auto-encoder and comparative learning
CN121579781A
A sequence recommendation method based on large model-based user intent extraction combined with variational autoencoders and contrastive learning.
CN121579781B