Automatic decoupling sequence recommendation method based on large language model

By decoupling user intent using a large language model and optimizing the self-attention layer architecture, and then reordering the recommendation results using the large language model, the problem of user intent coupling in sequence recommendation models is solved, thus improving the recommendation performance.

CN118410244BActive Publication Date: 2026-07-21TSINGHUA UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TSINGHUA UNIVERSITY
Filing Date
2024-05-09
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing sequence recommendation models cannot effectively decouple user intent, resulting in limited recommendation performance.

Method used

By using a large language model, user intent is decoupled and the architecture of the self-attention layer is optimized. The recommendation results are then re-ranked using the large language model, thereby achieving both decoupling of user intent and optimization of recommendation results.

Benefits of technology

It improves the recommendation performance of the sequence recommendation model, decouples the potential factors of user behavior, makes initial recommendations based on user intent, and adjusts the initial recommendation results through a large model to improve recommendation accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118410244B_ABST
    Figure CN118410244B_ABST
Patent Text Reader

Abstract

The application provides an automatic decoupling sequence recommendation method based on a large language model, relates to the technical field of large language models, and comprises the following steps: encoding a behavior sequence of an item clicked by a user by using a sequence recommendation model to obtain a representation of the behavior sequence, clustering the representation into a plurality of prototype intentions to obtain a first similarity degree, obtaining a future user intention according to a user intention at a last position in the representation of the behavior sequence, calculating a second similarity degree of the user intention and the future user intention, obtaining a decoupling representation of the user intention according to the first similarity degree, the second similarity degree and the representation of the behavior sequence, obtaining a preliminary recommendation result according to a third similarity degree between a representation of each candidate item and the decoupling representation of the user intention, and obtaining a rearranged recommendation result by using a large language model. The user intention can be used for preliminary recommendation, and the preliminary recommendation result output by the sequence recommendation model can be adjusted by using a large model, so that the recommendation effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of large language model technology, and in particular to an automatic decoupled sequence recommendation method based on a large language model. Background Technology

[0002] The goal of sequence recommendation is to recommend a series of items to a target user based on their historical behavior, such as clicks, views, comments, and likes. With the development of deep learning technology in recent years, many works have achieved great success in sequence recommendation tasks.

[0003] Traditional recommendation models typically employ collaborative filtering methods, such as matrix factorization. Inspired by deep learning models, recent sequence recommendation models have largely shifted towards deep neural networks, such as recurrent neural networks, convolutional neural networks, and Transformers. These models model user intent by stacking multiple layers of self-attention networks or employ a cloze test-like objective, utilizing left and right context to predict items that are masked.

[0004] However, the user representation obtained by the recommendation model in the above method is still coupled and does not take into account the potential factors under the user's intent, which affects the recommendation effect. Summary of the Invention

[0005] In view of this, embodiments of this application provide an automatic decoupled sequence recommendation method based on a large language model, in order to overcome the above problems or at least partially solve the above problems.

[0006] The first aspect of this application provides an automatic decoupled sequence recommendation method based on a large language model, the method comprising:

[0007] The sequence encoder in the sequence recommendation model encodes the behavioral sequence of the items clicked by the user to obtain a representation of the behavioral sequence, which includes multiple user intentions.

[0008] The representations of the behavioral sequences are clustered into multiple learnable prototype intentions to obtain multiple first similarities between the multiple user intentions and the multiple prototype intentions;

[0009] Based on the user intent at the last position in the representation of the behavior sequence, the future user intent is obtained;

[0010] Calculate a second similarity between the stated user intent and the future user intent;

[0011] Based on the first similarity, the second similarity, and the representation of the behavior sequence, a decoupled representation of the user intent is obtained;

[0012] Based on the third similarity between the representation of each candidate item and the decoupled representation of the user's intent, the preliminary recommendation results output by the sequence recommendation model are obtained.

[0013] The preliminary recommendation results and rearrangement instructions are input into the large language model to obtain the recommendation results after rearranging the preliminary recommendation results.

[0014] Optionally, the architecture of the self-attention layer in the sequence encoder of the sequence recommendation model is: the optimal architecture obtained by searching a predetermined search space, wherein the predetermined search space satisfies the following conditions:

[0015] Each self-attention layer has at least one input source connected to the layer above it.

[0016] The Key input source and Value input source are the same for each self-attention layer. The Key input source refers to the semantic features input to the Key projection layer, and the Value input source refers to the semantic features input to the Value projection layer.

[0017] Optionally, the optimal architecture obtained from the predetermined search space includes:

[0018] The hypernetwork is trained using the training set, in which each input source corresponds to a set of parameters;

[0019] The trained supernetwork was sampled using a genetic algorithm to obtain multiple candidate architectures, each of which inherited the parameters of the trained supernetwork.

[0020] Select the best-performing candidate architecture from multiple candidate architectures as the optimized architecture.

[0021] Optionally, the loss function of the sequence recommendation model is:

[0022]

[0023] in, This represents the loss function value on the validation set. Let arg min represent the loss function value on the training set, where a and a′ are any two distinct candidate architectures in the predetermined search space. θ Indicates in Next, random sampling is used to obtain a′, and a′ is used as the model architecture to minimize the loss function, thus obtaining the parameters θ of the optimal sequence recommendation model. This represents the distribution of the candidate architectures.

[0024] Optionally, the loss function value on the validation set include:

[0025] The loss function values ​​for sequence-to-item pairs and sequence-to-sequence pairs on the validation set;

[0026] loss function value on the training set include:

[0027] The loss function values ​​for sequence-to-item pairs and sequence-to-sequence pairs on the training set;

[0028] The loss function value for the sequence-to-sequence is determined according to the following steps:

[0029] Calculate the similarity between the decoupled representation of user intent based on the user's historical behavior sequence and the decoupled representation of user intent based on the user's future behavior sequence;

[0030] When the similarity is higher than the preset similarity, the loss function value of the sequence-to-sequence is calculated.

[0031] Optionally, inputting the preliminary recommendation result and the rearrangement instruction into the large language model to obtain the recommendation result after rearranging the preliminary recommendation result includes:

[0032] Obtain the confidence level of each candidate item in the preliminary recommendation results;

[0033] The confidence levels are arranged in descending order to obtain the ranking results;

[0034] Based on the sorting result, the rearrangement instruction is generated, which is used to rearrange the remaining candidate items except for the top N candidate items.

[0035] The preliminary recommendation results and the generated rearrangement instructions are input into the large language model to obtain the rearranged recommendation results.

[0036] A second aspect of this application provides an automatic decoupled sequence recommendation device based on a large language model, the device comprising:

[0037] The encoding module is used to encode the behavioral sequence of items clicked by the user through the sequence encoder in the sequence recommendation model to obtain a representation of the behavioral sequence, which includes multiple user intentions.

[0038] A clustering module is used to cluster the representations of the behavior sequence into multiple learnable prototype intentions to obtain multiple first similarities between the multiple user intentions and the multiple prototype intentions;

[0039] The acquisition module is used to obtain the future user intent based on the user intent at the last position in the representation of the behavior sequence;

[0040] The calculation module is used to calculate a second similarity between the user intent and the future user intent;

[0041] The user intent decoupling representation acquisition module is used to obtain the user intent decoupling representation based on the first similarity, the second similarity, and the representation of the behavior sequence.

[0042] The preliminary recommendation result acquisition module is used to obtain the preliminary recommendation results output by the sequence recommendation model based on the third similarity between the representation of each candidate item and the decoupled representation of the user's intent.

[0043] The module for obtaining rearranged recommendation results is used to input the preliminary recommendation results and rearrangement instructions into the large language model to obtain the recommendation results after rearranging the preliminary recommendation results.

[0044] A third aspect of this application provides an electronic device including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the automatic decoupling sequence recommendation method based on a large language model as described in the first aspect.

[0045] A fourth aspect of this application provides a computer program product, including a computer program, characterized in that, when executed by a processor, the computer program implements the automatic decoupling sequence recommendation method based on a large language model as described in the first aspect.

[0046] A fifth aspect of this application provides a computer-readable medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the automatic decoupling sequence recommendation method based on a large language model as described in the first aspect.

[0047] The beneficial effects of this application are:

[0048] This application provides an automatic decoupled sequence recommendation method based on a large language model, comprising: encoding the behavior sequence of items clicked by a user through a sequence encoder in the sequence recommendation model to obtain a representation of multiple user intent behavior sequences; clustering the behavior sequence representations into multiple learnable prototype intents; obtaining multiple first similarities between the multiple user intents and the multiple prototype intents; obtaining the future user intent based on the user intent at the last position in the behavior sequence representation; calculating the second similarity between the user intent and the future user intent; obtaining the decoupled representation of the user intent based on the first similarity, the second similarity, and the behavior sequence representation; obtaining the preliminary recommendation result output by the sequence recommendation model based on the third similarity between the representation of each candidate item and the decoupled representation of the user intent; and inputting the preliminary recommendation result and the reordering instruction into the large language model to obtain the recommendation result after reordering the preliminary recommendation result.

[0049] This allows the sequence recommendation model to decouple the potential factors driving user behavior, make initial recommendations based on user intent, and adjust the initial recommendation results output by the sequence recommendation model through a large model, thereby improving the recommendation effect. Attached Figure Description

[0050] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute an undue limitation of this application.

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

[0052] Figure 1 This is an overall framework diagram of an automatic decoupled sequence recommendation method based on a large language model provided in an embodiment of this application;

[0053] Figure 2 This is a flowchart of an automatic decoupling sequence recommendation method based on a large language model provided in an embodiment of this application;

[0054] Figure 3 This is a schematic diagram illustrating the reordering process using a large language model in an automatic decoupled sequence recommendation method based on a large language model, as provided in an embodiment of this application.

[0055] Figure 4 This is a schematic diagram of the framework of an automatic decoupling sequence recommendation device based on a large language model, provided in one embodiment of this application. Detailed Implementation

[0056] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other.

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

[0058] Figure 1 This is an overall framework diagram of an automatic decoupling sequence recommendation method based on a large language model provided in an embodiment of this application, such as... Figure 1 As shown in the embodiments of this application, the overall framework of an automatic decoupling sequence recommendation method based on a large language model includes three parts: sequence decoupling intent encoding, automatic attention representation search, and large model-guided sequence recommendation.

[0059] Figure 2 This is a flowchart of an automatic decoupling sequence recommendation method based on a large language model provided in an embodiment of this application, such as... Figure 2 As shown in the figure, an automatic decoupling sequence recommendation method based on a large language model provided in this application includes the following steps:

[0060] In step S101, the sequence encoder in the sequence recommendation model encodes the behavioral sequence of the items clicked by the user to obtain a representation of the behavioral sequence, which includes multiple user intentions.

[0061] In step S102, the representation of the behavior sequence is clustered into multiple learnable prototype intentions to obtain multiple first similarities between the user intention and the prototype intentions;

[0062] In step S103, the future user intent is obtained based on the user intent at the last position in the representation of the behavior sequence;

[0063] In step S104, a second similarity between the user intent and the future user intent is calculated;

[0064] In step S105, a decoupled representation of the user intent is obtained based on the first similarity, the second similarity, and the representation of the behavior sequence.

[0065] In step S106, based on the third similarity between the representation of each candidate item and the decoupled representation of the user intent, the preliminary recommendation results output by the sequence recommendation model are obtained.

[0066] In step S107, the preliminary recommendation results and rearrangement instructions are input into the large language model to obtain the recommendation results after rearranging the preliminary recommendation results.

[0067] like Figure 1 As shown, for sequence decoupling intent encoding, firstly, in step S101, the sequence encoder in the sequence recommendation model encodes the behavior sequence of the items clicked by the user to obtain the representation of the behavior sequence, which includes multiple user intents.

[0068] In this embodiment of the application, when a user clicks on an item, a behavior sequence corresponding to the user's behavior is generated. For example, the sequence corresponding to the item number of the item clicked by the user, in the behavior sequence middle, Let represent the (m-i+1)th user action of the nth user, where 1≤i≤m. After generating the action sequence, the sequence encoder in the sequence recommendation model receives the action sequence corresponding to the user action and encodes it to obtain the representation of the action sequence corresponding to the user action. A behavioral sequence representation can represent all the information of the behavioral sequence corresponding to a user's behavior. The behavioral sequence representation includes multiple user intentions. Let represent the user intent corresponding to the user's actions from the mth to the (m-i+1th)th times before the nth user, where 1≤i≤m.

[0069] The sequence encoder uses the SASRec encoder, which sequences user behaviors into a sequence. The input is fed into the SASRec encoder to obtain a representation of the behavior sequence corresponding to the user's behavior. This represents the output of a single-head SASRec encoder at the i-th position.

[0070] Furthermore, in step S102, the representation of the behavior sequence is clustered into multiple learnable prototype intentions to obtain multiple first similarities between the user intention and the prototype intention.

[0071] In this embodiment, a decoupling layer is added after the SASRec encoder. This decoupling layer allows for the decoupling of multiple interleaving factors inherent in the behavior sequence corresponding to user behavior. Specifically, this decoupling layer is used to obtain the representation of the behavior sequence corresponding to user behavior. Then, the decoupling layer represents the behavior sequence corresponding to the user's behavior. Clustering into multiple learnable prototype intentions {c1, c2, ..., c KThere are K learnable prototype intentions, which represent the user's possible intentions in K aspects.

[0072] The formula for clustering the representations of behavioral sequences corresponding to user behaviors into multiple learnable prototype intents through the decoupling layer is as follows:

[0073]

[0074] Here, LayerNorm represents a normalized layer. Different subscripts are used to distinguish different normalized layers in this paper (e.g., LayerNorm1, LayerNorm2, LayerNorm3, LayerNorm4, LayerNorm5). This indicates the user's intent at position i. The first similarity to the k-th prototype intention, 1≤k≤K, c s Let represent any prototype intention selected from 1 to K, where s represents the index of the summation, ranging from 1 to K, and has no practical meaning; it is used in the formula of the clustering process. In the expression, the denominator represents the user's intent at the i-th position. The numerator of the summation of the K prototype intentions represents the user's intention at the i-th position. The result calculated with the k-th prototype intent, 1≤s≤K, where D represents the dimension of the intent vector.

[0075] By using a decoupling layer, the representations of behavior sequences corresponding to user behaviors are clustered into multiple learnable prototype intents, resulting in multiple first similarity levels. For example, when the representations of behavior sequences corresponding to user behaviors are 3 (i.e., ... When there are 2 learnable prototype intentions (c1, c2), the first similarity level obtained is 6 (i.e., ... ).

[0076] Furthermore, in step S103, the future user intent is obtained based on the user intent at the last position in the representation of the behavior sequence.

[0077] In this embodiment of the application, after obtaining multiple first similarity levels, since the user's last action is usually highly correlated with the user's future actions, the user's intent can be determined based on the last position in the representation of the action sequence. User intent for the last position Perform calculations Received It can approximate the user's future intention, that is, the user's future intention is

[0078] Further, in step S104, a second similarity between the user intent and the future user intent is calculated.

[0079] In this embodiment of the application, after obtaining the future user intent is Next, calculate user intent. and future user intent Second similarity q i .

[0080]

[0081] in, α s α m , α, b, These are all learnable parameters.

[0082] Furthermore, in step S105, a decoupled representation of the user intent is obtained based on the first similarity, the second similarity, and the representation of the behavior sequence.

[0083] In this embodiment of the application, through the first similarity Second similarity q i Representation of behavioral sequences The following calculations are performed to obtain a decoupled representation of the user intent.

[0084]

[0085] Where k = 1, 2, ..., K, θ is the parameter of the sequence recommendation model, and β k This represents the bias when calculating the representation under the k-th prototype intention.

[0086] Furthermore, in step S106, based on the third similarity between the representation of each candidate item and the decoupled representation of the user's intent, the preliminary recommendation results output by the sequence recommendation model are obtained.

[0087] In this embodiment of the application, the decoupled representation of the user intent is obtained. Next, the decoupled representation of each candidate item and the user intent is calculated. The third similarity between them is used to obtain the preliminary recommendation results output by the sequence recommendation model.

[0088] Finally, in step S107, the preliminary recommendation results and rearrangement instructions are input into the large language model to obtain the recommendation results after rearranging the preliminary recommendation results.

[0089] like Figure 1 As shown, for sequence recommendation guided by a large model, in this embodiment of the application, since the sequence recommendation model can only make recommendations based on the user's user behavior and lacks comprehensive information on each candidate item to be recommended to the user, only the first N candidate items in the initial recommendation results output by the sequence recommendation model have confidence levels that meet the pre-set confidence conditions, while the confidence levels of the candidate items after the N candidate items do not meet the pre-set confidence conditions. Therefore, it is necessary to introduce the extensive prior knowledge of the large language model to make up for this deficiency. By rearranging the initial recommendation results, a reordered recommendation result is obtained, which can achieve the recommendation effect of meeting the user's intent.

[0090] Through the above embodiments, the sequence encoder in the sequence recommendation model can encode the behavioral sequence of items clicked by the user, obtaining a representation of multiple user intent behavioral sequences. These behavioral sequence representations are then clustered into multiple learnable prototype intents, resulting in multiple first similarities between the multiple user intents and the multiple prototype intents. Based on the user intent at the last position in the behavioral sequence representation, the future user intent is obtained. A second similarity between the current user intent and the future user intent is calculated. Based on the first similarity, the second similarity, and the behavioral sequence representation, a decoupled representation of the user intent is obtained. A third similarity between the representation of each candidate item and the decoupled representation of the user intent is then used to obtain the preliminary recommendation result output by the sequence recommendation model. The preliminary recommendation result and reordering instructions are input into a large language model to obtain a reordered recommendation result. This allows the sequence recommendation model to decouple the potential factors driving user behavior, perform preliminary recommendations based on user intent, and adjust the preliminary recommendation result output by the large model, thereby improving the recommendation effect.

[0091] Optionally, the architecture of the self-attention layer in the sequence encoder of the sequence recommendation model is: the optimal architecture obtained by searching a predetermined search space, wherein the predetermined search space satisfies the following conditions:

[0092] Each self-attention layer has at least one input source connected to the layer above it.

[0093] The Key input source and Value input source are the same for each self-attention layer. The Key input source refers to the semantic features input to the Key projection layer, and the Value input source refers to the semantic features input to the Value projection layer.

[0094] like Figure 1 As shown in the embodiments of this application, the sequence recommendation model is a model that can automatically search for the optimal network architecture during the sequence decoupling intent encoding process in model training and model application, especially searching for a self-attention layer for processing sequence information.

[0095] Specifically, such as Figure 1 As shown, for automatic attention representation search, in this embodiment of the application, since the self-attention layer needs to be designed manually, and the manually designed network architecture is often not optimal, this application can automatically find the architecture of the self-attention layer in the sequence encoder of the sequence recommendation model in the preset search space by using automatic machine learning during the training process of the sequence recommendation model.

[0096] The architecture of the self-attention layer in the sequence encoder of the sequence recommendation model is the optimal architecture searched from a predetermined search space. The self-attention mechanism is formalized as follows:

[0097] S Q =XW Q ,S K =XW K ,S V =XW V ,

[0098] Q = O Q (S Q ), K=O K (S K V=O V (S V )

[0099] Among them, S Q S k and S V The input source representing the self-attention mechanism (i.e., the three parts of the input sequence of the self-attention layer), O Q O K and O V This represents the type of operation performed on the input source: Q for Query, K for Key, V for Value, and S for Input. Q S represents the semantic features of the input Query projection layer. K S represents the semantic features of the input Key projection layer. V W represents the semantic features of the input Value projection layer. Q W K and W S These represent the projection matrices corresponding to the three projection layers mentioned above.

[0100] The self-attention layer is defined as follows:

[0101] Out = Attend Q→K V = Sim(Q,K)V.

[0102] The original search space requires searching for the type of each self-attention layer, the operations used, and the input source. The complexity of the original search space is O(n log n). During the execution of the search algorithm, more time and computing resources are required for exploration and evaluation. Furthermore, many architectures in the original search space may be isomorphic, which leads to redundancy in the search space and makes it more difficult to find accurate search results during the search process.

[0103] Based on this, this application imposes certain restrictions on the original search space, removes redundant or isomorphic structures, and obtains a predetermined search space.

[0104] Specifically, by restricting the structure of the entire search space to a chain structure, ensuring that each self-attention layer has at least one input source connected to the layer above it, and by restricting the Key input source and Value input source of each self-attention layer to be the same (the Key input source refers to the semantic features input to the Key projection layer, and the Value input source refers to the semantic features input to the Value projection layer), the complexity of the original search space is reduced to [value missing].

[0105] The above embodiments can greatly reduce the search pressure of the sequence recommendation model, while retaining the strong expressive power of the sequence recommendation model, and can take into account multiple intentions that users may have or may have when searching for the optimal architecture.

[0106] Optionally, the optimal architecture obtained from the predetermined search space includes:

[0107] The hypernetwork is trained using the training set, in which each input source corresponds to a set of parameters;

[0108] The trained supernetwork was sampled using a genetic algorithm to obtain multiple candidate architectures, each of which inherited the parameters of the trained supernetwork.

[0109] Select the best-performing candidate architecture from multiple candidate architectures as the optimized architecture.

[0110] Specifically, in the embodiments of this application, the optimal architecture obtained from the predetermined search space can be formally expressed as a two-stage optimization problem:

[0111] stw * (a) = argmin w∈W(a) L train (a,w)

[0112]

[0113] in, Representing the entire original search space, 'a' is one of the candidate architectures. * Let W(a) be the optimal architecture obtained through the search, and let W(a) be the parameter space given architecture a. * (a) is the optimal parameter in this parameter space, L val (a,w * (a) is the loss function computed on the validation set, L train (a,w) is the loss function computed on the training set. Let W represent the distribution of candidate architectures, and let W be the parameters of the hypernetwork that includes all candidate architectures in the original search space.

[0114] First, through the training set L train (a,w) trains the supernetwork by amplifying the parameters of each layer in the supernetwork so that each input source in the supernetwork has a corresponding set of parameters.

[0115] After training the supernetwork, a genetic algorithm is used to perform Monte Carlo sampling on the trained supernetwork to obtain multiple different candidate architectures. Each candidate architecture directly inherits the parameters of the trained supernetwork. Therefore, the performance of the candidate architectures can be calculated without training, and the architecture that performs best on the validation set L is selected from among the multiple candidate architectures. val (a,w * (a) The best performing architecture is the final optimal architecture. * .

[0116] Optionally, the loss function of the sequence recommendation model is:

[0117]

[0118] in, This represents the loss function value on the validation set. argmin represents the loss function value on the training set, where a and a′ are any two distinct candidate architectures in the predetermined search space. θ Indicates in Next, random sampling is used to obtain a′, and a′ is used as the model architecture to minimize the loss function, thus obtaining the parameters θ of the optimal sequence recommendation model. This represents the distribution of the candidate architectures.

[0119] Specifically, in this embodiment, after the optimal architecture is obtained through automated search, the training objective of the sequence recommendation model becomes the following loss function:

[0120]

[0121] in, This represents the loss function value on the validation set. Let a and a′ represent the loss function values ​​on the training set, and let a and a′ be any two candidate architectures in the predetermined search space. argmin represents the distribution of the candidate architectures. θ Indicates in Under the distribution, a′ is obtained by random sampling, and a′ is used as the model architecture to minimize the loss function, thereby obtaining the optimal parameters θ.

[0122] Optionally, the loss function value on the validation set include:

[0123] The loss function values ​​for sequence-to-item pairs and sequence-to-sequence pairs on the validation set;

[0124] loss function value on the training set include:

[0125] The loss function values ​​for sequence-to-item pairs and sequence-to-sequence pairs on the training set;

[0126] The loss function value for the sequence-to-sequence is determined according to the following steps:

[0127] Calculate the similarity between the decoupled representation of user intent based on the user's historical behavior sequence and the decoupled representation of user intent based on the user's future behavior sequence;

[0128] When the similarity is higher than a preset similarity, the loss function value of the sequence-to-sequence pair is calculated. Specifically, during the training of the sequence recommendation model, the loss function value on the validation set is... It consists of two parts: the loss function for sequence-pair items on the validation set. and the loss function of sequence to sequence Loss function value on the training set It consists of two parts: the loss function for sequence-pair items on the validation set. and the loss function of sequence to sequence θ represents the parameters of the sequence recommendation model. This represents a batch of samples used for a single training run.

[0129] Loss function of sequence to item for:

[0130]

[0131] in, Represents items The representation. If only the loss function of sequence pairs of items is available. This would then degenerate into a traditional recommendation problem, rather than a sequence recommendation problem. Therefore, this application introduces a sequence-to-sequence loss function.

[0132] Loss function of sequence to sequence for:

[0133]

[0134] in, Represents the 1 to i items in the historical behavior sequence. A decoupled representation of the user intent corresponding to items 1 to i in a historical behavior sequence. Represents the i+1 to m items in the future action sequence. This represents a decoupled representation of the user intent corresponding to the i+1 to m items in the future behavior sequence. This represents a summation over a batch of training samples, where i′ is the index corresponding to the future action sequence in sample (n′, m′), distinguished from i. k′ is distinguished from k. Since the loss function of this sequence is only added and calculated when the similarity is higher than the preset similarity, in ∑ k′ Here, k′ traverses a subset of {1,2,…,K}.

[0135] This application represents user intent through the decoupling of the user's historical behavior sequence. Decoupled representation of user intent from the user's future behavior sequence The loss function is constructed based on the similarity between sequences. Only when the similarity is higher than a preset similarity will the corresponding prototype intent be included in the sequence-to-sequence loss function. When the similarity is lower than the preset similarity, it means that the user's historical behavior sequence is decoupled from the user's intent. Decoupled representation of user intent from the user's future behavior sequence The corresponding prototype intent is not shared, therefore, the corresponding prototype intent is not added to the loss function of sequence-to-sequence.

[0136] The above embodiments can avoid the problem of the sequence recommendation model interfering with the judgment of user intent due to the introduction of prototype intents corresponding to lower than the preset similarity threshold. By sharing prototype intents with higher than the preset similarity, the recommendation effect can be improved.

[0137] Optionally, step S107 includes:

[0138] Obtain the confidence level of each candidate item in the preliminary recommendation results;

[0139] The confidence levels are arranged in descending order to obtain the ranking results;

[0140] Based on the sorting result, the rearrangement instruction is generated, which is used to rearrange the remaining candidate items except for the top N candidate items.

[0141] The preliminary recommendation results and the generated rearrangement instructions are input into the large language model to obtain the rearranged recommendation results.

[0142] Specifically, in this embodiment, after obtaining the preliminary recommendation results output by the sequence recommendation model, the confidence level of each candidate item in the preliminary recommendation results is calculated, and the candidate items are arranged in descending order of confidence level to obtain the ranking result.

[0143] Since the initial recommendation results from the sequence recommendation model are already highly accurate, the top N candidate items (e.g., five candidate items) have very high confidence. However, the confidence of candidate items after the top N is lower. Therefore, a pre-trained large language model is needed to re-rank the candidate items after the top N in the initial recommendation results. Thus, after obtaining the ranking of the candidate items, a list of remaining candidate items (excluding the top N) is generated based on this ranking. The reordering instruction, preliminary recommendation results, and generated reordering instruction are input into the large language model to obtain the reordered recommendation results. The specific meanings of items that interact with the user, the preliminary recommendation results, and the generated reordering instruction are input into the large language model to obtain the reordered recommendation results. In the reordered recommendation results, the sequence of the first N candidate items remains unchanged. Except for the top N candidate items, the remaining candidate items will have their sequence changed according to the adjustment of the large language model. Thus, the final recommendation result is obtained for the user through the recommendation of the sequence recommendation model and the fine-tuning of the large language model.

[0144] Figure 3 This is a schematic diagram illustrating the reordering process using a large language model in an automatic decoupled sequence recommendation method based on a large language model, as provided in an embodiment of this application. Figure 3 As shown, this application illustrates three examples.

[0145] In this embodiment, the items clicked by the user do not only represent actual items, but can include content such as videos, games, and goods that can be recommended.

[0146] Example 1 (videos and comments): When the initial recommendation results output by the sequence recommendation model (i.e., Figure 3The item description sequence in the image is: [5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], where each number corresponds to a video and 14 corresponds to a real item. The preliminary recommendation results, the specific meanings of the items that interact with the user, and the rearrangement instructions (based on the title and style of the movies watched by the user in history, rearrange the recommendation list given by the model, and if necessary, no changes can be made (the 14th item is a real item)) are input into the large language model. The large language model outputs the rearranged recommendation results as: [14,5,7,8,9,10,6,11,12,13,15,16,17,18,19,20].

[0147] Example 2 (Games and Reviews): When the initial recommendation results output by the sequence recommendation model (i.e. Figure 3 The item description sequence is: [5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], where each number corresponds to a video and 11 corresponds to a real item. The initial recommendation results, the specific meanings of items that interact with the user, and the rearrangement instructions (rearranging the recommended list based on the names and types of games purchased in the user's history; no changes may be necessary if needed (the 11th item is a real item)) are combined. The large language model outputs the rearranged recommendation results as follows:

[0148] [9,5,6,11,7,8,10,12,13,14,15,16,17,18,19,20].

[0149] Example 3 (Products and Reviews): When the initial recommendation results output by the sequence recommendation model (i.e., Figure 3 The item description sequence is: [5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], where each number corresponds to a video and 11 corresponds to a real item. The initial recommendation results, the specific meanings of items that interact with the user, and the rearrangement instructions (based on the descriptions and categories of items purchased historically by the user, rearranging the recommendation list given by the model; no changes may be necessary (the 13th item is a real item)) are then combined. The large language model outputs the rearranged recommendation results as follows:

[0150] [13,5,6,7,8,11,9,10,12,14,15,16,17,18,19,20].

[0151] Through the above embodiments, by leveraging the extensive prior knowledge and powerful semantic understanding capabilities of the large language model, the output results of the sequence recommendation model are further reordered, thereby improving the recommendation effect.

[0152] Figure 4This is a schematic diagram of the framework of an automatic decoupling sequence recommendation device based on a large language model, as provided in an embodiment of this application. Figure 4 As shown, one embodiment of this application provides an automatic decoupling sequence recommendation device based on a large language model, the device comprising:

[0153] The encoding module 11 is used to encode the behavior sequence of the items clicked by the user through the sequence encoder in the sequence recommendation model to obtain a representation of the behavior sequence, wherein the representation of the behavior sequence includes multiple user intentions.

[0154] Clustering module 12 is used to cluster the representation of the behavior sequence into multiple learnable prototype intentions to obtain multiple first similarities between the multiple user intentions and the multiple prototype intentions;

[0155] The acquisition module 13 is used to obtain the future user intent based on the user intent at the last position in the representation of the behavior sequence;

[0156] Calculation module 14 is used to calculate a second similarity between the user intent and the future user intent;

[0157] The user intent decoupling representation acquisition module 15 is used to obtain a decoupling representation of the user intent based on the first similarity, the second similarity, and the representation of the behavior sequence.

[0158] The preliminary recommendation result acquisition module 16 is used to obtain the preliminary recommendation results output by the sequence recommendation model based on the third similarity between the representation of each candidate item and the decoupled representation of the user's intent.

[0159] The rearrangement recommendation result acquisition module 17 is used to input the preliminary recommendation result and the rearrangement instruction into the large language model to obtain the recommendation result after rearranging the preliminary recommendation result.

[0160] Optionally, the architecture of the self-attention layer in the sequence encoder of the sequence recommendation model is: the optimal architecture obtained by searching a predetermined search space, wherein the predetermined search space satisfies the following conditions:

[0161] Each self-attention layer has at least one input source connected to the layer above it.

[0162] The Key input source and Value input source are the same for each self-attention layer. The Key input source refers to the semantic features input to the Key projection layer, and the Value input source refers to the semantic features input to the Value projection layer.

[0163] Optionally, the optimal architecture obtained from the predetermined search space includes:

[0164] The training module is used to train the supernetwork using the training set. In the supernetwork, each input source corresponds to a set of parameters.

[0165] The sampling module is used to perform Monte Carlo sampling on the trained supernetwork using a genetic algorithm to obtain multiple candidate architectures, each of which inherits the parameters of the trained supernetwork.

[0166] The candidate architecture selection module is used to select the best-performing candidate architecture on the validation set from multiple candidate architectures as the optimized architecture.

[0167] Optionally, the loss function of the sequence recommendation model is:

[0168]

[0169] in, This represents the loss function value on the validation set. Let a and a′ represent the loss function values ​​on the training set, and let a and a′ be any two candidate architectures in the predetermined search space. arg min represents the distribution of the candidate architectures. θ Indicates in Under the distribution, a′ is obtained by random sampling, and a′ is used as the model architecture to minimize the loss function, thereby obtaining the optimal parameters θ.

[0170] Optionally, the loss function value on the validation set include:

[0171] The loss function values ​​for sequence-to-item pairs and sequence-to-sequence pairs on the validation set;

[0172] loss function value on the training set include:

[0173] The loss function values ​​for sequence-to-item pairs and sequence-to-sequence pairs on the training set;

[0174] The loss function value for the sequence-to-sequence is determined according to the following steps:

[0175] The first computing unit is used to calculate the similarity between the decoupled representation of user intent based on the user's historical behavior sequence and the decoupled representation of user intent based on the user's future behavior sequence.

[0176] The second calculation unit is used to calculate the loss function value of the sequence-to-sequence pair when the similarity is higher than a preset similarity.

[0177] Optionally, the rearrangement recommendation result acquisition module 17 includes:

[0178] The acquisition unit is used to obtain the confidence level of each candidate item in the preliminary recommendation results;

[0179] A confidence ranking unit is used to arrange the confidence levels in descending order to obtain a ranking result;

[0180] The reordering unit is used to generate the reordering instruction based on the sorting result. The reordering instruction is used to reorder the remaining candidate items except for the top N candidate items.

[0181] The rearrangement recommendation result acquisition unit is used to input the preliminary recommendation result and the generated rearrangement instruction into the large language model to obtain the rearranged recommendation result.

[0182] Based on the same inventive concept, another embodiment of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the automatic decoupling sequence recommendation method based on a large language model as described in any of the above embodiments.

[0183] Based on the same inventive concept, another embodiment of this application also provides a computer program product, including a computer program that is executed by a processor as described in any of the above embodiments, the automatic decoupling sequence recommendation method based on a large language model.

[0184] Based on the same inventive concept, another embodiment of this application provides a computer-readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the automatic decoupling sequence recommendation method based on a large language model as described in any of the above embodiments.

[0185] As the apparatus is basically similar to the method embodiment, it is described in a relatively simple way. For relevant details, please refer to the description of the method embodiment.

[0186] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0187] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0188] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0189] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0190] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0191] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.

[0192] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes the element.

[0193] The above provides a detailed description of an automatic decoupling sequence recommendation method based on a large language model provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and its core ideas. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. An automatic decoupled sequence recommendation method based on a large language model, characterized in that, The method includes: The sequence encoder in the sequence recommendation model encodes the behavioral sequence of the items clicked by the user to obtain a representation of the behavioral sequence, which includes multiple user intentions. The representations of the behavioral sequences are clustered into multiple learnable prototype intentions to obtain multiple first similarities between the multiple user intentions and the multiple prototype intentions; Based on the user intent at the last position in the representation of the behavior sequence, the future user intent is obtained; Calculate a second similarity between the stated user intent and the future user intent; Based on the first similarity, the second similarity, and the representation of the behavior sequence, a decoupled representation of the user intent is obtained; Based on the third similarity between the representation of each candidate item and the decoupled representation of the user's intent, the preliminary recommendation results output by the sequence recommendation model are obtained. The preliminary recommendation results and the rearrangement instructions are input into the large language model to obtain the recommendation results after rearranging the preliminary recommendation results; The architecture of the self-attention layer in the sequence encoder of the sequence recommendation model is: the optimal architecture obtained by searching a predetermined search space, wherein the predetermined search space satisfies the following conditions: Each self-attention layer has at least one input source connected to the layer above it. The Key input source and Value input source are the same for each self-attention layer. The Key input source refers to the semantic features input to the Key projection layer, and the Value input source refers to the semantic features input to the Value projection layer. The optimal architecture obtained from the predetermined search space includes: The hypernetwork is trained using the training set, in which each input source corresponds to a set of parameters; The trained supernetwork was sampled using a genetic algorithm to obtain multiple candidate architectures, each of which inherited the parameters of the trained supernetwork. Select the best-performing candidate architecture from multiple candidate architectures as the optimized architecture.

2. The automatic decoupled sequence recommendation method based on a large language model according to claim 1, characterized in that, The loss function of the sequence recommendation model is: in, This represents the loss function value on the validation set. This represents the loss function value on the training set. and For any two distinct candidate architectures in the predetermined search space. Indicates in Below, random sampling was obtained and use The parameters of the optimal sequence recommendation model are obtained by minimizing the loss function as the model architecture. , This represents the distribution of the candidate architectures.

3. The automatic decoupling sequence recommendation method based on a large language model according to claim 2, characterized in that, The loss function value on the validation set include: The loss function values ​​for sequence-to-item pairs and sequence-to-sequence pairs on the validation set; loss function value on the training set include: The loss function values ​​for sequence-to-item pairs and sequence-to-sequence pairs on the training set; The loss function value for the sequence-to-sequence is determined according to the following steps: Calculate the similarity between the decoupled representation of user intent based on the user's historical behavior sequence and the decoupled representation of user intent based on the user's future behavior sequence; When the similarity is higher than the preset similarity, the loss function value of the sequence-to-sequence is calculated.

4. The automatic decoupled sequence recommendation method based on a large language model according to claim 1, characterized in that, The step of inputting the preliminary recommendation result and the rearrangement instruction into the large language model to obtain the recommendation result after rearranging the preliminary recommendation result includes: Obtain the confidence level of each candidate item in the preliminary recommendation results; The confidence levels are arranged in descending order to obtain the ranking results; Based on the sorting result, the rearrangement instruction is generated, which is used to rearrange the remaining candidate items except for the top N candidate items. The preliminary recommendation results and the generated rearrangement instructions are input into the large language model to obtain the rearranged recommendation results.

5. An automatic decoupled sequence recommendation device based on a large language model, characterized in that, The device includes: The encoding module is used to encode the behavioral sequence of items clicked by the user through the sequence encoder in the sequence recommendation model to obtain a representation of the behavioral sequence, which includes multiple user intentions. A clustering module is used to cluster the representations of the behavior sequence into multiple learnable prototype intentions to obtain multiple first similarities between the multiple user intentions and the multiple prototype intentions; The acquisition module is used to obtain the future user intent based on the user intent at the last position in the representation of the behavior sequence; The calculation module is used to calculate a second similarity between the user intent and the future user intent; The user intent decoupling representation acquisition module is used to obtain the user intent decoupling representation based on the first similarity, the second similarity, and the representation of the behavior sequence. The preliminary recommendation result acquisition module is used to obtain the preliminary recommendation results output by the sequence recommendation model based on the third similarity between the representation of each candidate item and the decoupled representation of the user's intent. The rearrangement recommendation result acquisition module is used to input the preliminary recommendation result and the rearrangement instruction into the large language model to obtain the recommendation result after rearranging the preliminary recommendation result; The architecture of the self-attention layer in the sequence encoder of the sequence recommendation model is: the optimal architecture obtained by searching a predetermined search space, wherein the predetermined search space satisfies the following conditions: Each self-attention layer has at least one input source connected to the layer above it. The Key input source and Value input source are the same for each self-attention layer. The Key input source refers to the semantic features input to the Key projection layer, and the Value input source refers to the semantic features input to the Value projection layer. The optimal architecture obtained from the predetermined search space includes: The training module is used to train the supernetwork using the training set. In the supernetwork, each input source corresponds to a set of parameters. The sampling module is used to perform Monte Carlo sampling on the trained supernetwork using a genetic algorithm to obtain multiple candidate architectures, each of which inherits the parameters of the trained supernetwork. The candidate architecture selection module is used to select the best-performing candidate architecture on the validation set from multiple candidate architectures as the optimized architecture.

6. An electronic device, characterized in that, The method includes a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the automatic decoupled sequence recommendation method based on a large language model as described in any one of claims 1-4.

7. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the automatic decoupling sequence recommendation method based on a large language model as described in any one of claims 1-4.

8. A computer-readable medium, characterized in that, It stores a computer program, wherein the computer program, when executed by a processor, implements the automatic decoupling sequence recommendation method based on a large language model as described in any one of claims 1-4.