Bidirectional Transform-based adversarial training and contrast learning sequence recommendation method

By using the adversarial training and contrastive learning methods of bidirectional Transformer in the recommendation system, combined with reinforcement learning and Monte Carlo sampling, the problem of the inability of traditional models to capture bidirectional dependencies and the introduction of noise is solved, achieving better recommendation effects and robustness. sex.

CN118798265APending Publication Date: 2024-10-18NANJING TECH UNIV +1

Patent Information

Application Number
CN202410825189.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

The traditional Transformer model has the limitation of one-way processing sequence when applied in recommendation systems, cannot capture bidirectional dependencies, and random mask training may introduce noise and cause over-fitting problems.

Method used

Adopt adversarial training and contrastive learning methods based on two-way Transformer, conduct adversarial training through reinforcement learning and policy gradient, combine Monte Carlo sampling and contrastive learning, and construct a joint loss function to optimize the model.

Benefits of technology

It overcomes the problems of noise introduction and over-fitting, improves the robustness and adaptability of the model, and improves the recommendation effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118798265A_ABST
    Figure CN118798265A_ABST
Patent Text Reader

Abstract

The invention provides an adversarial training and comparative learning sequence recommendation method based on bidirectional Transform, which comprises the following steps: acquiring a data set, and preprocessing the data set; pre-training the generated model by using the preprocessed data set; generating a model generation sample, and pre-training a discrimination model by using the generation sample and a sample combination collected from the training set; carrying out adversarial training on the generator and the discriminator through reinforcement learning and strategy gradient; a comparative learning method is adopted to assist confrontation training, and joint optimization iterative updating is carried out until the generated model is converged to the optimal state; and putting the test set into the trained generative model to generate a sequence recommendation list. According to the method, the bidirectional Transform model is used, and the relationship between the user preference and the sequence context can be more accurately captured through the strategy gradient adversarial training and comparative learning methods, so that the recommendation effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of information recommendation, and in particular to a method for adversarial training and contrastive learning sequence recommendation based on a bidirectional Transformer. Background Art

[0002] In the current era of information explosion, personalized recommendation systems play an important role in e-commerce, social media, and online content platforms. These systems provide personalized recommendations by analyzing users' historical behaviors, preferences, and interests, thereby improving user satisfaction and platform stickiness. In recent years, deep learning-based recommendation systems have made significant progress in improving recommendation results. Among them, the Transformer model has attracted much attention by capturing global dependencies in the input sequence through the self-attention mechanism, avoiding the long-range dependency problem in traditional recurrent neural networks, and enabling parallel computing, which greatly speeds up training.

[0003] However, there are still some limitations in the application of traditional Transformer models in recommendation systems. They are unidirectional and can only process sequences from front to back, but cannot capture bidirectional dependencies in the sequence. In comparison, the bidirectional Transformer uses a more comprehensive attention mechanism that can simultaneously consider items from both sides of the sequence and integrate bidirectional contextual information, making it better than the unidirectional transformer in performance.

[0004] At the same time, traditional sequence recommendation models are usually trained by predicting the next item at each position in the input sequence from left to right. In the bidirectional Transformers model, in order to avoid the information leakage problem caused by jointly adjusting the left and right contexts, the current solution is to introduce random masks in the input sequence and introduce cloze tasks to train the model. Nevertheless, this method may select some positions that are less important to the context information, introduce noise, and may cause the model to over-rely on the masked positions while ignoring other context information, which may cause overfitting problems. Summary of the invention

[0005] In order to solve the above problems, the present invention proposes a sequence recommendation method based on adversarial training and contrastive learning of bidirectional Transformer.

[0006] The content includes the following steps:

[0007] S1: Load the dataset, preprocess the dataset, and use the training set to pre-train the generated model.

[0008] S2: The generative model generates samples, and the generated samples and training set samples are used to pre-train the discriminative model.

[0009] S3: Adversarial training using reinforcement learning and policy gradient.

[0010] S4: Use contrastive learning to assist training by Monte Carlo sampling of positive and negative samples.

[0011] S5: Construct loss function through joint optimization to optimize the model.

[0012] S6: Put the test set into the trained generative model to generate a sequence recommendation list.

[0013] Based on the above content, the specific steps of S1 are as follows:

[0014] Load the dataset, input the training set into the generative model in batches, and obtain the corresponding components of the normalized output vector; pre-train the generative model by minimizing the cross entropy loss.

[0015] By constructing a generative model G parameterized by θ θ , so that for any prefix subsequence X in a given sequence 1:T =[x1, x2, …, x t ] as input, and the output y=G(x) is obtained through the model.

[0016] where y = [y1, y2, ..., y m-1 ,y m ], the output y is a sorted list, which indicates the probability that the user will click on all items next after inputting the current sequence. The top k items with the highest scores in y are recommended to the user, and the generator model uses a bidirectional Transformer.

[0017] Based on the above content, the specific steps of S2 are as follows:

[0018] The number of samples generated by the generator is equal to the number of samples collected in the training set; the discriminative model is pre-trained by minimizing the cross entropy loss.

[0019] The discriminant model evaluates whether the input sequence data is a real sample from the training set or a sample generated by the generator. Parameterized Discriminant Model Provide guidance for improving the generative model Gθ to minimize the difference between real samples and generated samples.

[0020] Based on the above content, the specific steps of S3 are as follows:

[0021] Based on the idea of ​​reinforcement learning: At time step t, state s represents all items [x1, x2, …, x t-1 ], action a represents the next item x that the user wants to select t, the recommendation list is equivalent to the list of the next possible click actions.

[0022] Generative model G θ Generate sequence X 1:T = [x1, x2, …, x t , …, x T . Calculate the expected cumulative reward as:

[0023]

[0024] where t represents the time step; X 1:t-1 represents the current sequence [x1, x2, …, x t-1 ; x t represents the t-th item in sequence X 1:T , that is, the next item to be clicked.

[0025] Since the discriminator can only provide rewards for complete sequences, that is, when t < T, it means the current sequence is incomplete, and it is necessary to sample the items that have not been generated in the current sequence to obtain a complete sequence. represents sampling the current sequence X 1:t-1 by following the simulation strategy G using the m-th Monte Carlo algorithm β for the sampled sequence, G θ and G β share parameters. represents performing M times of Monte Carlo search on the subsequence, and obtaining a set of M complete sequences from the simulation strategy G β after adopting the last T - t items that have not been generated. represents the discriminative model for the generated sequence output. represents the average reward of the M sequences.

[0026] When t = T, it means the current sequence is complete, and the discriminative model output value for the generated sequence X 1:t .

[0027] Calculate the objective function of the generative model G θ as:

[0028]

[0029] where t represents the time step; X 1:t-1 represents the current sequence [x1, x2, …, x t-1 ; x t represents the t-th item in sequence X 1:T , that is, the next item to be clicked; G θ (x t |X1:t-1 ) indicates that in the current sequence state X 1:t-1 Next, Project x t Probability of being clicked; Indicates that from the current sequence X 1:t-1 To begin, follow the generative model G θ Click on the item x t The expected cumulative reward.

[0030] Update the generative model G using stochastic gradient descent θ The parameters θ of the generated model G are updated θ , the specific formula is:

[0031]

[0032] Among them, α represents the learning rate, It represents the gradient of J(θ) with respect to the parameter θ of the generative model. The specific calculation formula is:

[0033]

[0034] in, Represented by the generator G θ Generate sequence X 1:t-1 expectations, represents the gradient of the sequence generated by the generator;

[0035] By sampling the output of the generator, a loss function is used to measure the difference between the samples generated by the generator and the real samples. The generator loss function of the policy gradient is:

[0036]

[0037] in, represents the generator loss function, Represented by the generator G θ Generate sequence X 1:t-1 Expectations, G θ (x t |X 1:t-1 ) indicates that in the current sequence state X 1:t-1 Next, Project x t Probability of being clicked; Indicates that from the current sequence X 1:t-1 To begin, follow the generative model G θ Click on the item x t Expected cumulative reward of

[0038] Updated generative model G θ Generate samples, sample samples from the training set, and train the discriminant model Discriminant model The training goal is to minimize the following formula:

[0039]

[0040] Among them, X~P d(X) Indicates that the sequence X comes from the real data distribution P of the training set d(X) , Represents the discriminant model Output value of sequence X; X′~G θ Indicates that the sequence X′ comes from the generative model G θ , Represents the discriminant model Output value for sequence X′;

[0041] Based on the above content, the specific steps of S4 are as follows:

[0042] In each Monte Carlo search, the generator generates N sample sequences, denoted as x1, x2, ..., x N After being scored by the discriminator, the sample sequence with the highest score is selected as the positive sample x + , and randomly select another sample x from the generated sample sequence - As negative samples;

[0043] The infoNCE loss function is calculated to measure the similarity and difference between positive sample pairs and negative sample pairs. The loss function is as follows:

[0044]

[0045] in, represents the contrast loss function, i, cos() is the cosine similarity function, f(x + ) represents the score of the positive sample, f(x - ) represents the score of negative samples, f(x j ) represents the scores of other samples, and τ is the temperature coefficient.

[0046] Based on the above content, the specific steps of S5 are as follows:

[0047] By combining adversarial training of policy gradients and auxiliary contrastive learning tasks to optimize the convergence of the generator, the total loss function of the generator can be expressed as follows:

[0048] Here we adopt the strategy of dynamically adjusting the contrastive learning loss weight λ; where L σ+1joint Represents the total loss function, L σ+1main and L σ+1cl They represent the adversarial training task loss and contrastive learning loss of the σ+1th iteration respectively. σ+1The update formula is:

[0049]

[0050] Among them, α is a parameter used to control the update speed of λ, which determines the value of λ in the previous iteration. σ and the current calculated value The weight distribution between The calculation of depends on the current loss value and is defined as:

[0051]

[0052] in, Indicates the iteration value of the current calculation, L σ+1main and L σ+1cl They represent the adversarial training task loss and contrastive learning loss of the σ+1th iteration, respectively, and θ is a hyperparameter;

[0053] Based on the above content, the specific steps of S6 are as follows:

[0054] When the generator model converges to the best, it is transformed into a probability distribution of candidate items through a simple linear layer:

[0055] p(x)=W P h t +b P

[0056] Among them, p(x) represents the probability of predicting item x, is the weight matrix, is the bias term of the prediction layer.

[0057] The present invention uses a bidirectional Transformer as a recommendation model, adopts adversarial training of policy gradient and auxiliary contrastive learning direction training model, and proposes a bidirectional Transformer-based adversarial training and contrastive learning sequence recommendation method. Compared with the prior art, the present invention has the following advantages:

[0058] 1. It cleverly combines adversarial training and contrastive learning to train bidirectional Transformer, which is a novel method for training bidirectional Transformer recommendation models.

[0059] 2. It overcomes the problems of introducing unnecessary noise and underfitting caused by training the bidirectional Transformer with random masks, making its representation more robust and adaptable, and able to obtain additional training signals, resulting in better recommendation effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] Figure 1It is a specific flow chart of the adversarial training and contrastive learning sequence recommendation method based on bidirectional Transformer described in the present invention. DETAILED DESCRIPTION

[0061] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and specific implementation methods.

[0062] 1. Preprocessing the dataset

[0063] The embodiment of the present invention takes the dataset MovieLens-1M as an example. MovieLens-1M is a movie rating dataset released by the GroupLens research project team of the University of Minnesota. It contains 1 million ratings from 6,000 users on approximately 4,000 movies. All numerical ratings or comments are converted. For each user, repeated interactive actions are discarded and then sorted in chronological order to construct a user sequence. At least 5 feedbacks are retained for each user to ensure the quality of the dataset. A leave-one-out evaluation strategy is adopted, with the last item in its behavior sequence as the test set, the second to last item as the validation set, and the remaining items used for training.

[0064] 2. Use the training set to pre-train the generative model:

[0065] Input the training set into the generative model in batches to obtain the corresponding components of the normalized output vector;

[0066] Pre-train the generative model by minimizing the cross entropy loss;

[0067] The goal is to build a θ-parameterized generative model G θ , so that for any prefix subsequence X in a given sequence 1:T =[x1, x2, …, x t ] as input, and the model obtains output y = G(x), where y = [y1, y2, ..., y m-1 ,y m ], the output y is a sorted list, which indicates the probability that the user will click on all items next after entering the current sequence, and the top k items with the highest scores in y are recommended to the user.

[0068] 3. Use the training set to pre-train the generative model:

[0069] The number of samples generated by the generator is equal to the number of samples collected in the training set; the discriminant model is pre-trained by minimizing the cross entropy loss;

[0070] Target training one Parameterized Discriminant Model Provide guidance for improving the generative model Gθ to minimize the difference between real samples and generated samples;

[0071] 4. Adopt reinforcement learning and policy gradients for adversarial training;

[0072] Convert to solving the sequential recommendation problem based on the idea of reinforcement learning: At time step t, the state s represents all the items [x1, x2, …, x t-1 generated by the current user's clicks, and the action a represents the next item x t to be selected by the user. The recommendation list is equivalent to the list of possible next actions to be clicked.

[0073] The generative model G θ Generates the sequence X 1:T = [x1, x2, …, x t , …, x T . Calculate the expected cumulative reward as:

[0074]

[0075] where t represents the time step; X 1:t-1 represents the current sequence [x1, x2, …, x t-1 ; x t represents the t-th item in the sequence X 1:T , that is, the next item to be clicked;

[0076] Since the discriminator can only provide rewards for complete sequences, that is, when t < T, it means the current sequence is incomplete, and the items not yet generated in the current sequence need to be sampled to obtain a complete sequence. represents sampling the current sequence X 1:t-1 through the m-th Monte Carlo algorithm following the simulated policy G β The sampled sequence, G θ and G β share parameters. represents performing M times of Monte Carlo search on the subsequence, and obtaining the set of M complete sequences after adopting the last T - t items not yet generated from the simulated policy G β ; represents the discriminative model 's output for the generated sequence ; represents the average reward of the M sequences;

[0077] When t = T, it means the current sequence is complete, and the output value of the discriminative model for the generated sequence X 1:t ;

[0078] Calculate the objective function of the generative model G θ as:

[0079]

[0080] Where t represents the time step; X 1:t-1 represents the current sequence [x1, x2, ..., x t-1 ]; x t Represents the sequence X 1:T The tth item in G is the next item to be clicked; θ (x t |X 1:t-1 ) indicates that in the current sequence state X 1:t-1 Next, Project x t Probability of being clicked; Indicates that from the current sequence X 1:t-1 To begin, follow the generative model G θ Click on the item x t Expected cumulative reward of

[0081] Update the generative model G using stochastic gradient descent θ The parameters θ of the generated model G are updated θ , the specific formula is:

[0082]

[0083] Among them, α represents the learning rate, It represents the gradient of J(θ) with respect to the parameter θ of the generative model. The specific calculation formula is:

[0084]

[0085] in, Represented by the generator G θ Generate sequence X 1:t-1 expectations, represents the gradient of the sequence generated by the generator;

[0086] By sampling the output of the generator, a loss function is used to measure the difference between the samples generated by the generator and the real samples. The generator loss function of the policy gradient is as follows:

[0087]

[0088] in, represents the generator loss function, Represented by the generator G θ Generate sequence X 1:t-1 Expectations, G θ (x t |X 1:t-1 ) indicates that in the current sequence state X 1:t-1 Next, Project xt Probability of being clicked; Indicates that from the current sequence X 1:t-1 To begin, follow the generative model G θ Click on the item x t Expected cumulative reward of

[0089] Updated generative model G θ Generate samples, sample samples from the training set, and train the discriminant model Discriminant model The training goal is to minimize the following formula:

[0090]

[0091] Among them, X~P d(X) Indicates that the sequence X comes from the real data distribution P of the training set d(X) , Represents the discriminant model Output value of sequence X; X′~G θ Indicates that the sequence X′ comes from the generative model G θ , Represents the discriminant model Output value for sequence X′;

[0092] 4. Use Monte Carlo sampling of positive and negative samples and contrastive learning to assist training;

[0093] In each Monte Carlo search, the generator generates N sample sequences, denoted as x1, x2, ..., x N After being scored by the discriminator, the sample sequence with the highest score is selected as the positive sample x + , and randomly select another sample x from the generated sample sequence - As negative samples;

[0094] The infoNCE loss function is calculated to measure the similarity and difference between positive sample pairs and negative sample pairs. The loss function is as follows:

[0095]

[0096] in, represents the contrast loss function, i, cos() is the cosine similarity function, f(x + ) represents the score of the positive sample, f(x - ) represents the score of negative samples, f(x j ) represents the scores of other samples, τ is the temperature coefficient;

[0097] 5. Construct loss function through joint optimization to optimize the model;

[0098] By combining adversarial training of policy gradients and auxiliary contrastive learning tasks to optimize the convergence of the generator, the total loss function of the generator is calculated:

[0099] L σ+1joint =L σ+1main +λ σ+1 L σ+1cl

[0100] The strategy of dynamically adjusting the contrastive learning loss weight λ is adopted; where L σ+1joint Represents the total loss function, L σ+1main and L σ+1cl They represent the adversarial training task loss and contrastive learning loss of the σ+1th iteration respectively. σ+1 The update formula is:

[0101]

[0102] Among them, α is a parameter used to control the update speed of λ, which determines the relationship between λ in the previous iteration value λσ and the current calculated value The weight distribution between The calculation of depends on the current loss value and is defined as:

[0103]

[0104] in, Indicates the iteration value of the current calculation, L σ+1main and L σ+1cl They represent the adversarial training task loss and contrastive learning loss of the σ+1th iteration, respectively, and θ is a hyperparameter;

[0105] 6. Put the test set into the trained generative model to generate a sequence recommendation list.

[0106] When the generator model converges to the best, it is transformed into a probability distribution of candidate items through a simple linear layer:

[0107] p(x)=W P h t +b P

[0108] Among them, p(x) represents the probability of predicting item x, is the weight matrix, is the bias term of the prediction layer.

[0109] The performance of the model is evaluated using the evaluation indicators top hit rate (HR@20) and normalized discounted cumulative return (NDGC@20);

[0110] The top hit rate (HR@20) is used to measure the accuracy of the model in the recommendation list. The higher the result, the higher the recommendation accuracy. The specific definition is as follows:

[0111]

[0112] Where N represents the number of all users in the test set, n hit Indicates the number of items that users actually clicked on in the top 20 ranking list;

[0113] Normalized discounted cumulative gain (NDGC@20) provides more comprehensive ranking quality information. The higher the result, the better the prediction effect. The specific definition is as follows:

[0114]

[0115] Among them, i represents the position of the item in the recommendation list, rel i is the relevance score of the i-th recommended item, and log2(i+1) is a penalty factor for position.

Claims

1. A sequence recommendation method based on adversarial training and contrastive learning of bidirectional Transformer, characterized in that: The following steps are involved: S1: Load the dataset, preprocess the dataset, and use the training set to pre-train the generated model; S2: The generative model generates samples, and the discriminative model is pre-trained with the generated samples and training set samples; S3: Adversarial training using reinforcement learning and policy gradient; S4: Monte Carlo sampling of positive and negative samples, using contrastive learning to assist training; S5: Construct loss function through joint optimization to optimize the model; S6: Put the test set into the trained generative model to generate a sequence recommendation list.

2. The method for sequence recommendation based on adversarial training and contrastive learning of bidirectional Transformer according to claim 1, characterized in that: The specific steps of S1 are as follows: Load the dataset, input the training set into the generative model in batches, and obtain the corresponding components of the normalized output vector; pre-train the generative model by minimizing the cross entropy loss; and construct a θ-parameterized generative model G. θ , so that for any prefix subsequence X in a given sequence 1:T =[x1, x2, …, x t ] as input, and the model obtains output y = G(x), where y = [y1, y2, ..., y m-1 ,y m ], the output y is a sorted list, which indicates the probability that the user will click on all items next after inputting the current sequence. The top k items with the highest scores in y are recommended to the user, and the generation model uses a bidirectional Transformer.

3. The method for sequence recommendation based on adversarial training and contrastive learning of bidirectional Transformer according to claim 1, characterized in that: The specific steps of S2 are as follows: The number of samples generated by the generative model is equal to the number of samples collected in the training set; the discriminative model is pre-trained by minimizing the cross entropy loss; the discriminative model evaluates whether the input sequence data is a real sample from the training set or a sample generated by the generative model, and Parameterized Discriminant Model To improve the generative model G θ Provide guidance to minimize the difference between real and generated samples.

4. The method for sequence recommendation based on adversarial training and contrastive learning of bidirectional Transformer according to claim 1, characterized in that: The specific steps of S3 are as follows: Solve the sequence recommendation problem based on the idea of ​​reinforcement learning: In time step t, state s represents all items [x1, x2, ..., x t-1 ], action a represents the next item x that the user wants to select t , the recommendation list is equivalent to a list of possible next actions to click.

5. The method for sequence recommendation based on adversarial training and contrastive learning of bidirectional Transformer according to claim 1, characterized in that: The specific steps of S3 are as follows: Generate Model G θ Generate sequence X 1:T =[x1, x2, …, x t , …, x T ], the expected cumulative reward is calculated as: where t represents the time step; X 1:t-1 represents the current sequence [x1, x2, …, x t-1 ; x t represents the t-th item in the sequence X 1:T , that is, the next item to be clicked; since the discriminator can only provide rewards for complete sequences, that is, when t < T, it means the current sequence is incomplete, and the items not yet generated in the current sequence need to be sampled to obtain a complete sequence, represents sampling the current sequence X 1:t-1 by following the simulation strategy G β using the m-th Monte Carlo algorithm, where G θ and G β share parameters, represents performing M times of Monte Carlo search on the subsequence, and obtaining a set of M complete sequences from the simulation strategy G β after adopting the last T - t items not yet generated, represents the discriminant model output for the generated sequence ; represents the average reward of the M sequences; when t = T, it means the current sequence is complete, and the discriminant model output value for the generated sequence X 1:t ; Generate Model G θ The goal is to generate a user click sequence from a given state s and the generator's parameters θ. By maximizing the expected cumulative return, the generator can learn a strategy to generate more realistic and high-quality sequences. The objective function is: Where t represents the time step; X 1:t-1 represents the current sequence [x1, x2, ..., x t-1 ]; x t Represents the sequence X 1:T The tth item in G is the next item to be clicked; θ (x t |X 1:t-1 ) indicates that in the current sequence state X 1:t-1 Next, Project x t Probability of being clicked; Indicates that from the current sequence X 1:t -1 starts, following the generative model G θ Click on the item x t The expected cumulative reward.

6. The method for sequence recommendation based on adversarial training and contrastive learning of bidirectional Transformer according to claim 1, characterized in that: The specific steps of S3 are as follows: Update the generative model G using stochastic gradient descent θ The parameters θ of the generated model G are updated θ , the specific formula is: Among them, α represents the learning rate, It represents the gradient of J(θ) with respect to the parameter θ of the generative model. The specific calculation formula is: in, Represented by the generator G θ Generate sequence X 1:t-1 expectations, represents the gradient of the sequence generated by the generator; By sampling the output of the generator, the loss function is used to measure the difference between the samples generated by the generator and the real samples. The generator loss function of the policy gradient is as follows: in, represents the generator loss function, Represents the sequence X generated by the generator Gθ 1:t-1 Expectations, G θ (x t |X 1:t-1 ) indicates that in the current sequence state X 1:t-1 Next, Project x t Probability of being clicked; Indicates that from the current sequence X 1:t-1 To begin, follow the generative model G θ Click on the item x t Expected cumulative reward of Updated generative model G θ Generate samples, sample samples from the training set, and train the discriminant model Discriminant model The training goal is to minimize the following formula: Among them, X~P d(X) Indicates that the sequence X comes from the real data distribution P of the training set d(X) , Represents the discriminant model Output value of sequence X; X′~Gθ means sequence X′ comes from generative model Gθ, Represents the discriminant model Output value for sequence X'.

7. The method for sequence recommendation based on adversarial training and contrastive learning of bidirectional Transformer according to claim 1, characterized in that: The specific steps of S4 are as follows: In each Monte Carlo search, the generator generates N sample sequences, denoted as x1, x2, ..., x N , after being scored by the discriminator, the sample sequence with the highest score is selected as the positive sample x + , and randomly select another sample x from the generated sample sequence - As negative samples; the infoNCE loss function is used to measure the similarity and difference between positive sample pairs and negative sample pairs. The loss function is as follows: in, represents the contrast loss function, cos() is the cosine similarity function, f(x + ) represents the score of the positive sample, f(x - ) represents the score of negative samples, f(x j ) represents the scores of other samples, and τ is the temperature coefficient.

8. The method for sequence recommendation based on adversarial training and contrastive learning of bidirectional Transformer according to claim 1, characterized in that: The specific steps of S5 are as follows: By combining adversarial training of policy gradients and auxiliary contrastive learning tasks to optimize the convergence of the generator, The total loss function of the generator can be expressed as follows: L σ+1 joint =L σ+1 main +λ σ+1 L σ+1 cl The strategy of dynamically adjusting the contrastive learning loss weight λ is adopted; where L σ+1 joint Represents the total loss function, L σ+1 main and L σ+1 cl denote the adversarial training task loss and contrastive learning loss of the σ+1th iteration, respectively, and λ σ+1 The update formula is: Among them, α is a parameter used to control the update speed of λ, which determines the value of λ in the previous iteration. σ and the current calculated value The weight distribution between The calculation of depends on the current loss value and is defined as: in, Indicates the iteration value of the current calculation, L σ+1 main and L σ+1 c l represents the adversarial training task loss and contrastive learning loss of the σ+1th iteration, and θ is a hyperparameter.

9. The method for sequence recommendation based on adversarial training and contrastive learning of bidirectional Transformer according to claim 1, characterized in that: The specific steps of S6 are as follows: When the generator model converges to the best, it is transformed into a probability distribution of candidate items through a simple linear layer: p(x)=W P h t +b P Among them, p(x) represents the probability of predicting item x, is the weight matrix, h t is the hidden state at the current time step t, is the bias term of the prediction layer.

Citation Information

Patent Citations

  • Session recommendation list generation method based on adversarial learning

    CN110399553A

  • BERT-based sequence recommendation method and system

    CN117035014A

  • Movie recommendation method and system based on deep reinforcement learning

    CN117725318A

  • Contrastive Pre-Training for Language Tasks

    US20210089724A1

Cited By

  • Personalized recommendation method in robot intelligent aided design system

    CN119598011A

  • A personalized recommendation method in a robot intelligent aided design system

    CN119598011B

  • Construction method of medical examination recommendation model based on progressive spatial-temporal feature fusion

    CN120256716A