A sequence recommendation method based on siamese generative adversarial network and uncertainty adversarial memory

By introducing Siamese networks and uncertainty adversarial memory mechanisms into generative adversarial networks, the problems of "hard boundary" classification and uncertainty sensitivity are solved, achieving more accurate sequence recommendation and enhancing the ability to model long sequence dependencies.

CN120632202BActive Publication Date: 2026-04-17CHINA UNIV OF PETROLEUM (EAST CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA UNIV OF PETROLEUM (EAST CHINA)
Filing Date
2025-05-29
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing generative adversarial networks suffer from feature space constraints due to "hard boundary" classification in sequence recommendation systems, and Transformer-based sequence modeling methods are sensitive to uncertainty and noise and lack the ability to model long sequence dependencies.

Method used

An augmented adversarial network framework integrating Siamese networks and an uncertainty adversarial memory mechanism is proposed. The learning process of the generator and discriminator is optimized through similarity loss, and a penalty correction term and Gaussian noise are introduced into the attention mechanism. Long-range dependency modeling is performed by combining an external memory mechanism.

Benefits of technology

It improves the learning synergy between the generator and discriminator, suppresses high uncertainty and noise interference, enhances the ability to model long sequence dependencies, and improves the accuracy and robustness of recommendation results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 1
    Figure 1
Patent Text Reader

Abstract

This invention discloses a sequence recommendation method based on Siamese generative adversarial networks and uncertainty adversarial memory. First, a Siamese network is introduced into the generative adversarial network. By mapping real and generated sequences to the same feature space, the feature similarity between real and generated sequences is measured, refining the feature differences between sequences. The similarity loss is integrated into the adversarial learning process, achieving adversarial learning optimization of similar features and effectively overcoming the limitations of traditional generative adversarial networks. Furthermore, this invention designs an uncertainty adversarial memory mechanism. By incorporating query and key penalty correction terms and adversarial Gaussian noise into the attention mechanism, it can dynamically suppress the interference of high uncertainty and noisy features. An external memory mechanism with memory slots is used to model long-range dependencies of user behavior. Extensive experiments on the Sports, Yelp, and ML-1M datasets demonstrate the effectiveness of our proposed model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the technical field of deep learning recommendation systems, and relates to the technical fields of adversarial learning optimization frameworks and deep sequence modeling. Background Technology

[0002] Recommender systems, as a core technology for information filtering and personalized services, have been widely applied in e-commerce, social media, and streaming media. Traditional methods, based on static user preference modeling, struggle to capture dynamic behavioral characteristics, especially in scenarios where user interests shift in real time (e.g., sudden needs in specific scenarios) or where behavior implies a strong temporal logic (e.g., a strong correlation in the consumption chain of "phone → screen protector → headphones"). This can easily lead to a mismatch between recommended results and the user's true intent. Therefore, sequence recommendation systems, as an important branch of the recommendation field, have received increasing attention. Unlike traditional recommendation methods, sequence recommendation captures the temporal order of user interactions, mining potential needs from continuous user actions, and can more accurately predict future user behavior. This method models based on the user's historical behavior sequence, focusing not only on single actions or static preferences but also on identifying dynamic changes in user interests, providing users with more context-sensitive recommendations.

[0003] Early research relied on Markov chains and matrix factorization to characterize short-range dependencies and global associations. Subsequently, deep learning models based on CNNs and RNNs significantly improved feature extraction capabilities through local pattern capture and long-range dependency modeling. The Transformer further optimized behavioral association modeling by dynamically weighting key behavioral nodes through self-attention mechanisms (such as identifying short-term peak demand for "buying flowers on Valentine's Day"). However, existing scaled dot-product attention mechanisms are sensitive to uncertainty and noisy data, resulting in insufficient robustness of representations. Secondly, engineered window truncation strategies limit the ability to model long-sequence dependencies. Specifically, the high uncertainty of user behavior sequences causes traditional dot-product attention mechanisms to confuse accidental noise with true preferences due to deterministic vector compression (such as misjudging holiday consumption as daily needs). Furthermore, the excessive sensitivity of attention to noisy interactions can amplify low-quality feature associations (such as a bread lover accidentally clicking on the refrigerator, leading to irrelevant product recommendations). While window truncation strategies improve computational efficiency, they sacrifice the periodic recurrence and gradual evolution of user behavior, resulting in insufficient modeling of distant behavioral patterns.

[0004] In recent years, Generative Adversarial Networks (GANs) have been used to generate high-quality interactive sequences through adversarial training. Previous research has reconstructed sequence recommendation as a discriminator adversarial training framework. However, the discriminator in traditional GANs typically employs a "hard-boundary" classification strategy, assigning label 1 to real samples and label 0 to generated samples. This binary classification strategy forces the discriminator to construct rigid classification boundaries in the feature space, leading to misclassification of samples near the boundaries due to insufficient separability. The generator relies on feedback from the discriminator for parameter updates, but "hard-boundary" classification only measures the matching degree between generated and real samples, failing to provide fine-grained supervision of local patterns such as item associations and temporal dependencies within the sequence.

[0005] To address the aforementioned problems and challenges, this invention proposes a method for enhancing sequence recommendation by integrating a Siamese network-based adversarial network framework and an uncertainty-based adversarial memory mechanism. Summary of the Invention

[0006] The purpose of this invention is to address the feature space constraints caused by the "hard boundary" classification in existing generative adversarial networks in sequence recommendation systems, as well as the shortcomings of Transformer-based sequence modeling methods, such as sensitivity to uncertainty and noise and the inability to model long sequence dependencies.

[0007] To achieve the above objectives, this application provides the following solution:

[0008] S1. Obtain the historical interaction dataset between users and items, and analyze the problems of applying generative adversarial networks to sequence recommendation;

[0009] S2. Construct an enhanced adversarial network framework that integrates the Siamese network. The generator receives the masked user interaction sequence to generate candidate sequences, and the discriminator achieves accurate classification.

[0010] S3. Input real samples and generated samples into the Siamese network and map them to the same feature space;

[0011] S4. Calculate the similarity loss between real samples and generated samples, and optimize the learning process of generator and discriminator through the similarity loss;

[0012] S5. After the real sequence is encoded by the encoder, it is combined with dynamic random augmentation and contrastive learning techniques to model the sequence features from multiple perspectives.

[0013] S6. An uncertainty-adversarial memory mechanism is proposed, which incorporates penalty correction terms for queries and keys and adversarial Gaussian noise into the attention mechanism to dynamically suppress the interference of high uncertainty and noise features, and uses memory slots of the external memory mechanism to model the long-range dependencies of user behavior.

[0014] S7. Employ a multi-task training strategy to jointly optimize the comparative learning task, generation task, discrimination task, and next item prediction task.

[0015] S8. Based on the user-item interaction probabilities output by the model, generate a list of recommended items for each user.

[0016] S9. This invention selected three datasets from different real-world scenarios to test and evaluate the recommendation performance of the model. This invention uses the recall rate (Recall@20) and normalized depreciation cumulative gain (NDCG@20) of the top 20 items in the results as quantitative indicators of recommendation performance.

[0017] In summary, compared with existing technologies, the present invention has the following advantages:

[0018] (1) This invention refines the mapping relationship between real sequences and generated sequences in the feature space by incorporating a Siamese network into a generative adversarial network, and optimizes the learning process of the generator and discriminator through similarity loss. This is an improved approach to gradually transition from "hard classification" to "soft classification".

[0019] (2) Compared with existing methods, the uncertainty adversarial memory mechanism designed in this invention makes two improvements on the basis of Transformer: the uncertainty perception adversarial attention mechanism incorporates the penalty correction term of query and key and Gaussian noise to optimize the attention weight distribution; the external memory mechanism realizes continuous modeling of users' long-term behavior patterns through a learnable memory slot matrix. Attached Figure Description

[0020] Figure 1 This is a diagram of the recommended model structure of the present invention;

[0021] Figure 2 A schematic diagram illustrating the "hard boundary" classification of the discriminator;

[0022] Figure 3 For Siamese network architecture;

[0023] Figure 4 As an uncertainty-resistant memory mechanism, it integrates uncertainty perception-resistant attention mechanism and external memory mechanism;

[0024] Figure 5 The statistical results of three real-world scenario datasets obtained in this invention;

[0025] Figure 6 The graph shows a comparison of the overall performance of the present invention with different baselines in three real-world scenarios. Detailed Implementation

[0026] The present invention will be further described below with reference to the accompanying drawings and embodiments. The drawings are for illustrative purposes only and should not be construed as limiting the scope of this patent.

[0027] This invention discloses a method for enhanced adversarial sequence recommendation that integrates Siamese networks, the model structure of which is shown in the figure below. Figure 1 As shown.

[0028] S1. Obtain the historical interaction dataset between users and items, and analyze the problems of applying generative adversarial networks to sequence recommendation;

[0029] In practice, S1 includes the following steps:

[0030] S101. This invention collects three datasets from different real-world scenarios: the ML-1M movie recommendation dataset, the Yelp commercial venue recommendation dataset, and the Sports sports recommendation dataset.

[0031] S102. As Figure 2 As shown, this invention visualizes a schematic diagram of the discriminator's "hard boundary" classification strategy, thereby demonstrating the significant rigid classification boundary of generative adversarial networks in sequence recommendation data, which leads to samples near the boundary being misclassified due to insufficient separability.

[0032] S2. Construct an enhanced adversarial network framework that integrates the Siamese network. The generator receives the masked user interaction sequence to generate candidate sequences, and the discriminator achieves accurate classification.

[0033] In practice, S2 includes the following steps:

[0034] S201. This invention uses the BERT4Rec model based on bidirectional Transformer as the generator G. Given a user interaction sequence S u We first hide some items in these sequences using a masking operation. Specifically, we randomly mask several items according to a predefined masking ratio γ, resulting in a partially masked interactive sequence S'. u The generator G is based on S' u To recover the original sequence, we obtain the generated sequence S'. u '=G(S' u The generator's loss function is in the form of:

[0035]

[0036] in, It is the set of masking items for user u. It's a real item label that conceals its location. This indicates that the generator is given a mask sequence S' u At that time, predict the masking location vm For real items The probability of.

[0037] S202. This invention employs the SASRec model based on a self-attention mechanism as the discriminator D. The discriminator accepts the real sequence and the generated sequence processed by the aggregation function as input and distinguishes them. Its loss function is:

[0038]

[0039] Where T is the maximum time step of the sequence. For the terms that generate the sequence, 1(·) is the indicator function, σ is the sigmoid function; w is the learnable parameter matrix; f D This represents the discriminator network; This represents the historical information of user u at time t.

[0040] S3. Input real samples and generated samples into the Siamese network and map them to the same feature space;

[0041] This invention innovatively embeds a Siamese network into a GAN framework, achieving joint optimization of generation and discrimination by measuring the feature similarity between generated and real sequences in the projection space. The Siamese network involved in this invention employs a two-layer fully connected structure to achieve dimensionality reduction mapping of the feature space, as illustrated in the schematic diagram below. Figure 3 As shown. Specifically, the generated sequence G(S) u ) and the true sequence S u The corresponding feature representations are obtained by inputting them into a dual-branch network with shared weights:

[0042] f gen =Sn(G(S) u ))

[0043] f real =Sn(S u )

[0044] Where Sn(·) represents the Siamese network.

[0045] S4. Calculate the similarity loss between real samples and generated samples, and optimize the learning process of generator and discriminator through the similarity loss;

[0046] In practice, S4 includes the following steps:

[0047] S401. To quantify the feature similarity between the two types of sequences, cosine similarity is used as the metric:

[0048] Sim_p = cos(f real ,f gen )

[0049] S402. Finally, the generator's loss function consists of the standard cross-entropy loss and similarity loss:

[0050]

[0051] The discriminator's loss function consists of standard cross-entropy loss and similarity loss:

[0052]

[0053] S5. After the real sequence is encoded by the encoder, it is combined with dynamic random augmentation and contrastive learning techniques to model the sequence features from multiple perspectives.

[0054] In practice, S5 includes the following steps:

[0055] S501. To enhance the robustness of sequence representation, this invention proposes a joint optimization framework that integrates dynamic data augmentation and contrastive learning. Given a user behavior sequence... The encoder maps it to the latent space, resulting in the latent representation for each time step:

[0056]

[0057] Among them, f θ It is the encoder function, and θ is the model parameter.

[0058] S502. Obtaining the potential representation at each time step Then, by aggregating the latent representations of the entire sequence, the final latent representation h of the user behavior sequence can be obtained. u Here, the average of the last k time steps is used, as detailed below:

[0059]

[0060] Unlike traditional single data augmentation methods, we employ a dynamic random data augmentation strategy for the latent representation. Augmented samples are generated through this mechanism during each training iteration. and compared it with the original sample h u Both are used in contrastive learning. The goal of contrastive learning is to make the representations of enhanced samples as close as possible to the original samples by comparing their similarity, while keeping them away from other negative samples. To this end, we introduce a contrastive loss function:

[0061]

[0062] Where sim(·,·) represents the cosine similarity function, τ is the temperature coefficient that controls the smoothness of the similarity, and M(u) represents the set of users in a mini-batch containing user u.

[0063] S6. The attention mechanism incorporates penalty correction terms for queries and keys, as well as adversarial Gaussian noise, to dynamically suppress interference from high uncertainty and noise features. The memory slots of the external memory mechanism are used to model long-range dependencies of user behavior.

[0064] This step is an uncertainty-resistant memory mechanism, such as Figure 4 As shown. In specific implementation, S6 includes the following steps:

[0065] S601. Uncertainty-Aware Adversarial Memory Mechanism. Traditional attention mechanisms only calculate the similarity between the basic query and the key, while this invention introduces a penalty correction term in the attention score calculation to reduce the attention weight of high-uncertainty features. Specifically, given an input sequence tensor X∈R... B×L×d (B is the batch size, L is the sequence length, and d is the hidden layer dimension). The original attention score is calculated by subtracting the uncertainty penalty from the basic correlation score.

[0066]

[0067] To further improve the robustness of the model, we add Gaussian noise ∈ ~N(0,σ) to the query and key. 2 ), generating the attention score after perturbation:

[0068]

[0069] in, and These are the query and the key after applying random perturbations, respectively.

[0070] S602. External Memory Mechanism. The model extracts long-term interest representations related to the current behavior through attentional interaction between the query vector and the memory matrix. Specifically, given the current query vector... Calculate its relationship with the memory matrix (N is the number of memory slots, d) m The association weights (for the memory vector dimension) are then used to assign weights to all memory slots M in the memory matrix. i Perform a weighted summation:

[0071] α = softmax(query·W) r )

[0072]

[0073] To address new features in dynamically stored sequences, a gating-based update strategy is designed. For the current output of the Transformer... By combining it with old memories, candidate memories are generated:

[0074]

[0075] By updating the gate weight g u ∈[0,1] controls the mixing ratio of new and old memories:

[0076]

[0077] Ultimately, gating and weighting are used to achieve smooth updates and avoid memory conflicts.

[0078]

[0079] S7. Employ a multi-task training strategy to jointly optimize the comparative learning task, generation task, discrimination task, and next item prediction task.

[0080] To optimize the sequence recommendation model, this invention employs a multi-task training strategy, jointly optimizing the contrastive learning task, the generation task, the discrimination task, and the next item prediction task. We define the following total loss function:

[0081] L = L rec +λ3L cl +λ4L gen +λ5L disc

[0082] By appropriately adjusting the weight coefficients λ3, λ4, and λ5, the contribution of each task to the total loss can be flexibly controlled. Ultimately, this multi-task learning strategy will effectively promote the coordinated optimization of the model across multiple objectives.

[0083] S8. Based on the user-item interaction probabilities output by the model, generate a list of recommended items for each user.

[0084] In practical implementation, the goal of the top-k recommendation task studied in this invention is to find the k most likely uninterrupted items that the user is interested in and generate a sorted recommendation list.

[0085] S9. This invention selects three datasets from different real-world scenarios to test and evaluate the recommendation performance of the model. Figure 5 The statistical data for the dataset is listed. This invention uses the recall rate (Recall@20) and normalized depreciation cumulative gain (NDCG@20) of the top 20 items in the results as quantitative indicators of recommendation performance.

[0086] This invention evaluates the overall performance of the recommendation model. For example... Figure 6As shown, the overall performance of this invention was compared with different baselines in three different real-world scenarios. The comparison results demonstrate that this invention consistently outperforms other baselines across different datasets and evaluation metrics. Specifically, compared to suboptimal models, this invention improves the Recall@10 metric by 11.3% and 5.8% on the Yelp and ML-1M datasets, respectively; and by 4.9% on the Sports dataset's Recall@20 metric. These performance improvements are attributed to the following core innovations: First, by introducing a Siamese network architecture and a similarity loss function into the generative adversarial network framework, this invention innovatively solves the "hard boundary" decision bias problem caused by traditional discriminator binary classification, achieving collaborative optimization between the generator and discriminator. Second, this invention applies an uncertainty adversarial memory mechanism to the encoder, generator, and discriminator, effectively suppressing high uncertainty and noise interference while capturing long-term dependency patterns.

[0087] This invention proposes an enhanced adversarial sequence recommendation method based on Siamese networks, aiming to address the limitations of "hard-boundary" classification strategies in traditional generative adversarial networks (GANs) and the shortcomings of Transformers in terms of robustness to uncertainty and noise and long sequence modeling. Specifically, by introducing Siamese networks into the GAN, the similarity mapping between real and generated sequences in the feature space is refined, and the learning process of the generator and discriminator is optimized using similarity loss, thereby generating sequence recommendation results that better match user preferences. Furthermore, the design of an uncertainty adversarial memory mechanism effectively suppresses high-uncertainty sequence data, reduces noise interference, and enables long-range dependency modeling. In summary, this invention not only overcomes the shortcomings of existing GANs but also provides new ideas for improving the sequence modeling capabilities of the Transformer architecture. In the future, we will focus on enhancing the interpretability of this invention, providing better transparency and insight into the recommendation generation process, which will further improve the credibility and acceptability of the system.

[0088] Finally, the details of the above embodiments of the present invention are merely examples for explaining the present invention. For those skilled in the art, any modifications, improvements, and substitutions to the above embodiments should be included within the protection scope of the claims of the present invention.

Claims

1. A sequence recommendation method based on Siamese generative adversarial networks and uncertain adversarial memory, the method comprising the following steps: S1. Obtain the historical interaction dataset between users and items, and analyze the problems of applying generative adversarial networks to sequence recommendation; S2. Construct an enhanced adversarial network framework that integrates the Siamese network. The generator receives the masked user interaction sequence to generate candidate sequences, and the discriminator achieves accurate classification. S3. Input real samples and generated samples into the Siamese network and map them to the same feature space; S4. Calculate the similarity loss between real samples and generated samples, and optimize the learning process of generator and discriminator through the similarity loss; S5. After the real sequence is encoded by the encoder, dynamic random augmentation and contrastive learning techniques are combined to model the sequence features from multiple perspectives; S6. An uncertainty-adversarial memory mechanism is proposed, which incorporates penalty correction terms for queries and keys and adversarial Gaussian noise into the attention mechanism to dynamically suppress the interference of high uncertainty and noise features, and uses memory slots of the external memory mechanism to model long-range dependencies of user behavior. S7. Employ a multi-task training strategy to jointly optimize the contrastive learning task, the generation task, the discrimination task, and the next item prediction task. S8. Based on the user-item interaction probability output by the model, generate a recommended item list for each user; S9. Three datasets from different real-world scenarios were selected to test and evaluate the recommendation performance of the model. The recall rate and normalized depreciation cumulative gain of the top 20 items in the results were used as quantitative indicators of recommendation performance. The specific process of S2 is as follows: S201. Employ a BERT4Rec model based on a bidirectional Transformer as the generator ; Given a user interaction sequence We first hide some items in these sequences using masking operations; then, according to a predefined masking ratio... Randomly mask several items to obtain a partially masked interaction sequence. ; Generator according to To recover the original sequence and obtain the generated sequence The loss function of the generator is in the form of: in, User The set of masking items, It's a real item label that conceals its location. This indicates that the generator is given a mask sequence. At that time, predict the location of the masking. For real items The probability of; S202. The SASRec model based on the self-attention mechanism is used as the discriminator. The discriminator accepts the real sequence and the generated sequence processed by the aggregation function as input and distinguishes them; its loss function is: in, The maximum time step of the sequence. For the items that generate the sequence, For indicator functions, It is the Sigmoid function; Learnable parameter matrix; This represents the discriminator network; Indicates time user Historical information; The specific process of S6 is as follows: S601. Uncertainty-Aware Adversarial Memory Mechanism: A penalty correction term is introduced into the attention score calculation to reduce the attention weight of high-uncertainty features; given an input sequence tensor... , For batch size, Sequence length, For the hidden layer dimension, the original attention score is calculated by subtracting the uncertainty penalty term from the basic relevance score: To further improve the robustness of the model, Gaussian noise was added to the query and key. The attention score after perturbation is generated: in, and These are the query and key after applying a random perturbation; S602. External Memory Mechanism: The model extracts long-term interest representations related to the current behavior through attentional interaction between the query vector and the memory matrix, given the current query vector. Calculate its relationship with the memory matrix Association weights, The number of memory slots, The dimension of the memory vector is then used, and this weight is applied to all memory slots in the memory matrix. Perform a weighted summation: To address new features in dynamically stored sequences, a gating-based update strategy is designed; for the current output of the Transformer... By combining it with old memories, candidate memories are generated: By updating the gate weight Controlling the mixing ratio of new and old memories: Ultimately, gating and weighting are used to achieve smooth updates and avoid memory conflicts. 。 2. The sequence recommendation method based on Siamese generative adversarial networks and uncertain adversarial memory according to claim 1, wherein the specific process of S3 is as follows: By embedding the Siamese network into a GAN framework, joint optimization of generation and discrimination is achieved by measuring the feature similarity between generated and real sequences in the projection space. The Siamese network employs a two-layer fully connected structure to achieve dimensionality reduction mapping in the feature space. and the real sequence The corresponding feature representations are obtained by inputting them into a dual-branch network with shared weights: in, This represents the Siamese network.

3. The sequence recommendation method based on Siamese generative adversarial networks and uncertain adversarial memory according to claim 1, wherein the specific process of S5 is as follows: S501. To enhance the robustness of sequence representation, a joint optimization framework integrating dynamic data augmentation and contrastive learning is proposed; given a user behavior sequence... The encoder maps the data to the latent space, yielding the latent representation for each time step: in, It is an encoder function. These are model parameters; S502. Obtaining the potential representation at each time step Then, by aggregating the latent representations of the entire sequence, the final latent representation of the user behavior sequence is obtained. Here, the last one was used. The average value of each time step is as follows: Unlike traditional single data augmentation methods, we employ a dynamic random data augmentation strategy for the latent representation; Augmented samples are generated through this mechanism during each training session. and compared it with the original sample Both are used in contrastive learning; the goal of contrastive learning is to enhance the similarity between the original sample and the new sample, making their representations as close as possible while keeping them away from other negative samples; to achieve this, a contrastive loss function is introduced: in, Represents the cosine similarity function. It's a temperature coefficient that controls the smoothness of the similarity. Indicates that it includes users A small batch of user sets.

4. The sequence recommendation method based on Siamese generative adversarial networks and uncertain adversarial memory according to claim 1, wherein the specific process of S7 is as follows: To optimize the sequence recommendation model, a multi-task training strategy was adopted. By jointly optimizing the contrastive learning task, the generation task, the discrimination task, and the next item prediction task, we defined the following total loss function: By adjusting the weighting coefficients , and This allows for flexible control over the contribution of each task to the total loss; ultimately, this multi-task learning strategy will effectively promote the coordinated optimization of the model across multiple objectives.

Citation Information

Patent Citations

  • Recommendation algorithm based on adversarial learning and bidirectional long-short-term memory network

    CN112035745A

  • Fair and controllable image generation method based on structured network priori knowledge

    CN116109719A