A conversation recommendation method and device fusing contrastive learning denoising optimization
By constructing a graph of session data, performing local embedding denoising and joint contrastive learning optimization, the problem of noise influence in session recommendation is solved, the accuracy and robustness of recommendations are improved, and a more accurate list of user session recommendations is generated.
Patent Information
- Application Number
- CN202211419448.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-14
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2042-11-14
AI Technical Summary
Existing graph-based session recommendation methods suffer from poor robustness, low accuracy, and weak interpretability when dealing with random data and noisy click behavior in sessions.
By constructing a graph from user session data, obtaining local embeddings, performing denoising processing, optimizing using joint contrastive learning, generating a session recommendation list by combining adaptive weights, and employing noise filter and contrastive learning techniques to filter noise, the robustness and accuracy of the model are enhanced.
It improves the accuracy, robustness, and interpretability of conversation recommendations, effectively handles dynamic changes in user intent and noisy click behavior, and generates a more accurate list of user conversation recommendations.
Smart Images

Figure CN115795005B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of conversation recommendation technology, and in particular to a conversation recommendation method and apparatus that integrates contrastive learning for denoising optimization. Background Technology
[0002] In an era of explosive growth in internet information, recommender systems have successfully evolved into one of the fundamental tools for information services. They help users make rational choices and decisions, and improve the efficiency of data processing. However, due to privacy policies or restrictions on anonymous user access, traditional recommendation methods based on user profiles and long-term historical configuration files have become ineffective. In contrast, the emergence of session-based recommendation methods, which only need to predict the items that users are truly interested in based on the click behavior records in the current session, has demonstrated significant application value.
[0003] Graph Neural Networks (GNNs) have been widely applied in daily life, such as personalized recommendations, due to their superior performance, and are also finding applications in cutting-edge scientific fields such as COVID-19 drug development. Numerous methods have been developed to construct graph data structures from conversation sequences to extract conversation-level features, demonstrating impressive recommendation performance. However, despite significant progress in graph conversation modeling, graph-based conversation recommendation methods still have certain limitations. In particular, existing models do not effectively analyze and process random and noisy data within conversations, noisy user click behavior, and dynamically changing user intent. Consequently, the resulting conversation recommendations still suffer from poor robustness, low accuracy, and weak interpretability. Summary of the Invention
[0004] This invention provides a conversation recommendation method and apparatus that integrates contrastive learning for denoising optimization, in order to solve the problems of poor robustness, low accuracy and weak interpretability in existing conversation recommendation technologies.
[0005] In a first aspect, embodiments of the present invention provide a session recommendation method that integrates contrastive learning for denoising optimization, including: acquiring user session data;
[0006] The user session data is constructed into a graph, and the local embeddings corresponding to all nodes in the graph are obtained.
[0007] Calculate the first global session embedding based on the local embeddings corresponding to all the nodes;
[0008] Denoise the local embeddings corresponding to all the nodes to obtain the denoised second global session embedding;
[0009] Based on the first global session embedding and the second global session embedding, a third global session embedding is obtained through joint contrastive learning optimization.
[0010] Adaptive weights are assigned to the local embeddings and the third global session embeddings corresponding to all nodes to calculate the user session representation and generate a user session recommendation list.
[0011] As another embodiment of this application, the step of constructing the user session data into a graph and obtaining the local embeddings corresponding to all nodes in the graph includes:
[0012] Construct the out-degree adjacency matrix and in-degree adjacency matrix corresponding to the user session data;
[0013] The user session data is transformed into a graph using the out-degree adjacency matrix and the in-degree adjacency matrix.
[0014] By aggregating and connecting the information in the graph, an intermediate vector is obtained;
[0015] The local embeddings of all nodes in the graph are obtained using a graph neural network.
[0016] As another embodiment of this application, the step of calculating the first global session embedding based on the local embeddings corresponding to all nodes includes:
[0017] The local embeddings corresponding to all the nodes are input into the attention mechanism to obtain the first attention weight values corresponding to all the nodes in the graph;
[0018] The first global session embedding is calculated based on the first attention weight value corresponding to all nodes and the local embedding corresponding to all nodes.
[0019] As another embodiment of this application, the step of denoising the local embeddings corresponding to all nodes to obtain the denoised second global session embedding includes:
[0020] Calculate the average attention weight based on the first attention weight values corresponding to all the nodes;
[0021] Based on the average attention weight, the second attention weight value after denoising of all nodes in the graph is calculated by the noise filter;
[0022] The second global session embedding is calculated based on the second attention weight values of all nodes after denoising in the graph and the local embeddings corresponding to all nodes.
[0023] As another embodiment of this application, the step of calculating the second attention weight value after denoising of all nodes in the graph using a noise filter based on the average attention weight includes:
[0024] Set parameters to control the degree of noise reduction, and use the product of the average attention weight and the parameters as the weight threshold;
[0025] Detect whether the first attention weight value corresponding to the node in the graph is greater than the weight threshold;
[0026] If the first attention weight value corresponding to a node in the graph is greater than the weight threshold, then the weight exceeding the weight threshold is used as the second attention weight value of the node after denoising.
[0027] If the first attention weight value corresponding to a node in the graph is not greater than the weight threshold, then the second attention weight value of the node after denoising is set to zero.
[0028] As another embodiment of this application, the step of obtaining a third global session embedding based on the first global session embedding and the second global session embedding through joint contrastive learning optimization includes:
[0029] Based on the first global session embedding and the second global session embedding, a noisy contrast function with standard binary cross-entropy loss is used as the target of contrastive supervised learning to obtain the first optimization target;
[0030] The cross-entropy loss function is used as the objective function for learning and training to obtain the second optimization objective.
[0031] By combining the first optimization objective and the second optimization objective, a joint comparative optimization objective is obtained;
[0032] The third global conversation embedding is obtained by learning and training based on the joint contrast optimization objective.
[0033] As another embodiment of this application, the step of assigning adaptive weights to the local embeddings corresponding to all nodes and the third global session embedding, calculating the user session representation, and generating a user session recommendation list includes:
[0034] A gating mechanism is used to assign adaptive weights to the local embeddings and the third global session embeddings corresponding to all nodes, and then perform a weighted summation to obtain the user session representation;
[0035] The nodes in the user session representation are normalized to generate a user session recommendation list.
[0036] Secondly, embodiments of the present invention provide a conversation recommendation apparatus that integrates contrastive learning for denoising optimization, comprising:
[0037] The data acquisition module is used to acquire user session data;
[0038] The local embedding module is used to construct a graph from the user session data and obtain the local embeddings corresponding to all nodes in the graph.
[0039] A global embedding module is used to calculate the first global session embedding based on the local embeddings corresponding to all the nodes;
[0040] The noise filtering module is used to perform noise reduction processing on the local embeddings corresponding to all the nodes to obtain the noise-reduced second global session embedding.
[0041] The joint comparison optimization module is used to obtain a third global session embedding by jointly comparing and optimizing the first global session embedding and the second global session embedding through joint comparison learning.
[0042] The session recommendation module is used to assign adaptive weights to the local embeddings and the third global session embeddings corresponding to all nodes, calculate the user session representation, and generate a user session recommendation list.
[0043] This invention provides a conversation recommendation method and apparatus that integrates contrastive learning for denoising optimization. It proposes a mechanism with an embedded noise filter to filter out items irrelevant to the user's primary purpose. Furthermore, through joint contrastive learning, it assists the model in denoising, more effectively uncovering deep-seated correlations between user click behaviors. Further, it assigns adaptive weights to local and global embeddings, calculating and generating the final user recommendation list. The method provided by this invention effectively solves the technical problems of low recommendation accuracy, poor robustness, and weak interpretability in the generation of user conversation recommendation lists in existing technologies. Attached Figure Description
[0044] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0045] Figure 1 This is a flowchart illustrating the implementation of the conversation recommendation method provided in this embodiment of the invention.
[0046] Figure 2 These are the session graph and adjacency matrix graph of the session recommendation method provided in this embodiment of the invention;
[0047] Figure 3 This is a flowchart of the calculation of global session embedding after denoising provided in an embodiment of the present invention;
[0048] Figure 4 This is a flowchart of denoising processing for local embedding provided in an embodiment of the present invention;
[0049] Figure 5 This is a schematic diagram of joint comparison learning provided in an embodiment of the present invention;
[0050] Figure 6 This is a comparison chart of indicators provided in the embodiments of the present invention;
[0051] Figure 7 This is a schematic diagram of the conversation recommendation device provided in an embodiment of the present invention;
[0052] Figure 8 This is a schematic diagram of the terminal provided in an embodiment of the present invention. Detailed Implementation
[0053] Existing technologies have numerous methods for constructing session sequences as graph data structures to extract session-level features, demonstrating impressive recommendation performance. However, despite significant progress in graph session modeling, graph-based session recommendation methods still face certain limitations and challenges.
[0054] Due to the randomness and noise of conversation data, not all interactions in a conversation sequence are helpful for predicting the next item. Furthermore, the model cannot skip items that are not related to the user's main interests when forming interest representations. This hinders the model from effectively learning intent, and the learned conversation representations may have poor robustness and inaccuracy.
[0055] Traditional solutions for dealing with noisy clicks by users typically employ attention mechanisms to weaken the influence of items unrelated to the user's primary purpose. This involves assigning smaller weights to less important items, which is a form of implicit noise reduction. However, after multiple iterations, these low-weight, noisy clicks can still accumulate a lot of noise, easily leading to ineffective intent learning.
[0056] While existing session-based prediction methods utilize powerful representation learning techniques to encode the order-related relationships of items in a low-dimensional space, they also have certain limitations. User interests are essentially driven by user intent, which changes dynamically over time, and users' interests in items also change accordingly. This change can easily lead to problems where models cannot accurately analyze the complex interdependencies within implicit feedback data and cannot fully capture the dynamic changes in users' true preferences.
[0057] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of the invention. However, those skilled in the art will understand that the invention can be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of the invention with unnecessary detail.
[0058] To make the objectives, technical solutions, and advantages of the present invention clearer, specific embodiments will be described below in conjunction with the accompanying drawings.
[0059] Figure 1 The implementation flowchart of the session recommendation method provided in the embodiments of the present invention is described in detail below:
[0060] Step 101: Obtain user session data.
[0061] Optionally, in one possible implementation, the time sequence of user clicks on items and the interaction behavior are obtained to form user session sequence data.
[0062] Step 102: Construct a graph from the user session data and obtain the local embeddings corresponding to all nodes in the graph.
[0063] Optionally, in this embodiment, the local embeddings corresponding to all nodes in the graph can be obtained according to the following calculation method.
[0064] First, construct the out-degree adjacency matrix and the in-degree adjacency matrix corresponding to the user session data. The adjacency matrix is a matrix representing the adjacency relationship between nodes, while the out-degree adjacency matrix represents the set of edges starting from row nodes and ending at column nodes, and the in-degree adjacency matrix represents the set of edges starting from column nodes and ending at row nodes.
[0065] Furthermore, user session data is transformed into a graph using out-degree and in-degree adjacency matrices. For example, in Figure 2 In this process, based on the information in the user session data, the corresponding out-degree adjacency matrix and in-degree adjacency matrix are constructed to obtain the nodes in the graph and the adjacency relationships between the nodes, thereby transforming the adjacency matrix into a session graph.
[0066] Furthermore, by aggregating and connecting the information in the graph, an intermediate vector is obtained:
[0067]
[0068] Among them, a t The intermediate vector is represented by Concat, which is the join function. Let b represent the in-degree adjacency matrix and the out-degree adjacency matrix corresponding to the nodes in the graph, respectively. In ,b Out ∈R d Let [s1,...s] represent the in-degree deviation vector and the out-degree deviation vector, respectively. n ] represents the concatenated vector representing the node representation vectors in the graph. This represents the trainable parameter matrix.
[0069] Furthermore, the local embeddings of all nodes in the graph are obtained through a graph neural network:
[0070]
[0071]
[0072]
[0073]
[0074] in, This represents the output of a neural network layer. These represent the results of the update gate and the reset gate operations, respectively. v represents the candidate result of the current iteration. i and Let a represent the embedding vectors of the nodes at time t and t-1, respectively. i t ∈R 2d Indicates extraction of v i t The neighbor information, σ(·) represents the sigmoid activation function, ⊙ represents element-wise multiplication, W z W r W h ∈R 2d×d L z ,L r ,L h ∈R d×d All of these are trainable parameter matrices.
[0075] This method of extracting local node features can enhance the model's expressive power, thereby enabling it to learn more fully and accurately user conversation representations with rich semantics.
[0076] Step 103: Calculate the first global session embedding based on the local embeddings corresponding to all nodes.
[0077] Attention mechanisms essentially involve linearly weighting the relationships between things to obtain new representations, thus using limited computing resources to process more important information, which is an effective means of solving the problem of information overload.
[0078] Optionally, the local embeddings corresponding to all nodes are input into the attention mechanism to obtain the first attention weight values for all nodes in the graph:
[0079] α i =q Τ σ(W1h n +W2h i +c)
[0080] Where, αi q represents the first attention weight value corresponding to the node. Τ ∈R d W1, W2 ∈ R d×d This represents the parameter matrix of the local embedding corresponding to the control node, where c represents a constant.
[0081] Furthermore, based on the first attention weight values corresponding to all nodes and the local embeddings corresponding to all nodes, the first global session embedding is calculated:
[0082]
[0083] Among them, S global This indicates the first global session embedding.
[0084] Step 104: Denoise the local embeddings corresponding to all nodes to obtain the denoised second global session embedding.
[0085] Optionally, in step 104, the local embeddings corresponding to all nodes are denoised to obtain the denoised second global session embedding, which may include, for example: Figure 3 The steps are shown.
[0086] Step 301: Calculate the average attention weight based on the first attention weight values corresponding to all nodes.
[0087] Optional, this step can be based on Calculate the average attention weight;
[0088] Where, α avg α represents the average attention weight value. k This represents the first attention weight value of the k-th node.
[0089] Step 302: Based on the average attention weight, calculate the second attention weight value of all nodes in the graph after denoising using a noise filter.
[0090] Optional, such as Figure 4 As shown, the process of calculating the second attention weight value after denoising all nodes in the graph based on the average attention weight using a noise filter may include:
[0091] Step 401: Set parameters to control the degree of noise reduction, and use the product of the average attention weight and the parameter as the weight threshold.
[0092] Optionally, this step can be based on α0 = λα avg Obtain the weight threshold;
[0093] Where α0 represents the obtained weight threshold, and λ represents the parameter that controls the degree of denoising.
[0094] Step 402: Detect whether the first attention weight value corresponding to the node in the graph is greater than the weight threshold.
[0095] Optionally, if the first attention weight value corresponding to a node in the graph is greater than the weight threshold, then step 403 is executed; if the first attention weight value corresponding to a node in the graph is not greater than the weight threshold, then step 404 is executed.
[0096] Step 403: If the first attention weight value corresponding to a node in the graph is greater than the weight threshold, then the weight exceeding the weight threshold is used as the second attention weight value after denoising the node in the graph.
[0097] Optionally, when the first attention weight value corresponding to a node in the graph is greater than the weight threshold, the second attention weight value of the node after denoising is calculated as follows:
[0098] α′ i =α i -λα avg , (α i -λα avg >0)
[0099] Where, α′ i The second attention weight value is the node in the graph after denoising.
[0100] Step 404: If the first attention weight value corresponding to a node in the graph is not greater than the weight threshold, then the second attention weight value of the node after denoising is set to zero.
[0101] Optionally, when the first attention weight value corresponding to a node in the graph is not greater than the weight threshold, the second attention weight value of the node after denoising is calculated as follows:
[0102] α′ i =0, (α) i -λα avg ≤0)
[0103] Step 303: Based on the second attention weight values of all nodes in the graph after denoising and the local embeddings of all nodes, the second global session embedding is calculated.
[0104] Optional, this step can be based on The second global session embedding is calculated;
[0105] Among them, S′ global This represents the calculated second global session embedding.
[0106] Attention parameter data frames are generated by assigning different attention scores to the local embeddings corresponding to all nodes through an attention mechanism. The attention coefficients are then processed more finely using a noise filter to filter out local embeddings with weights below a certain threshold, thereby generating an effective global session vector representation and explicitly filtering out items that are not relevant to the user's main purpose.
[0107] Step 105: Based on the first global session embedding and the second global session embedding, the third global session embedding is obtained through joint contrastive learning optimization.
[0108] Contrastive learning helps models learn representations with high similarity across different views by comparing consistent and inconsistent views, thereby forming richly encoded graph or node representations. In short, its main idea is that contrastive learning can make the distance between a sample and a similar positive sample much larger than the distance between a sample and a dissimilar negative sample. With the successful applications of contrastive learning in computer vision and natural language processing (NLP), researchers have also introduced it into recommender systems to build auxiliary tasks for recommendation modeling.
[0109] Optional, such as Figure 5 As shown in this embodiment, to achieve better denoising performance, the obtained first global session embedding is used as a negative sample, and the denoised second global session embedding is used as a positive sample for comparative learning training. By reducing the distance between items in the positive samples and increasing the distance between the positive and negative samples, noise interference is better suppressed, resulting in high-quality session feature vector representations. This allows for more effective mining of deeper connections between user sessions, increasing the robustness and interpretability of the model.
[0110] Based on the set positive and negative samples, and according to the first and second global session embeddings, a noisy contrastive function with standard binary cross-entropy loss is used as the objective of contrastive supervised learning, resulting in the first optimization objective:
[0111] loss s =-lnσ(f D (S global ,S′ global )-lnσ(1-f D (S global ,S′ global )))
[0112] Where, loss s Let f represent the first optimization objective obtained. D This represents a noise contrast function with standard binary cross-entropy loss.
[0113] Furthermore, the cross-entropy loss function is used as the objective function for training to obtain the second optimization objective. Optionally, this step selects to train a conversational recommendation model method based on graph neural networks, and the second optimization objective can be calculated according to the following formula:
[0114]
[0115] Where, loss r Let y represent the obtained second optimization objective. i This represents the actual click probability of item i. This represents the probability predicted by the conversation recommendation model based on graph neural networks.
[0116] Furthermore, combining the first and second optimization objectives, a joint comparative optimization objective is obtained:
[0117] L = loss r +δloss s
[0118] Where L represents the joint contrastive objective, and δ is the weight of the contrastive supervised learning task corresponding to the first optimization objective.
[0119] Furthermore, a third global conversation embedding is obtained by learning and training based on the joint contrastive optimization objective. Optionally, a graph neural network-based conversation recommendation model is trained using the joint contrastive optimization objective as the learning objective to obtain a more accurate third global conversation embedding.
[0120] Step 106: Assign adaptive weights to the local embeddings and third global session embeddings corresponding to all nodes, calculate the user session representation, and generate a user session recommendation list.
[0121] A gating mechanism is used to assign adaptive weights to the local embeddings and the third global session embeddings corresponding to all nodes, and then a weighted sum is performed to obtain the user session representation:
[0122]
[0123]
[0124] Among them, S v This represents the obtained user session representation, where α represents the weight corresponding to the third global session embedding. S represents the third global session embedding. local This represents the global embedding representation formed by concatenating the local embeddings corresponding to all nodes, where [p; q] represents the concatenation operation, and W... g This represents the trainable parameter matrix.
[0125] Further, the nodes in the user session representation are normalized to generate a user session recommendation list. Optionally, the user session recommendation list is generated using the softmax function in this step.
[0126]
[0127]
[0128] in, S represents the user session. v The scores of all candidates. Indicates in user session representation S v Middle node h i The probability of being clicked next.
[0129] By employing a gating mechanism to adaptively fuse global and local preference representations, we can effectively model the complex transformation relationship between users and interaction sequences in a session. By combining global and local item features, we can reveal the pattern of user interest changes in the session sequence, obtain a more accurate session vector representation, and thus form personalized recommendations to predict the next item that the user will click.
[0130] Optional, such as Figure 6 As shown, this embodiment compares the data obtained through effective experiments with the experimental results on the Diginetica dataset. The comparison results show that this embodiment outperforms the SRGNN and S2-DHCN algorithms in terms of recall, average inverse rank, normalized depreciation cumulative gain, and accuracy.
[0131] This invention proposes a conversation recommendation method that integrates contrastive learning for denoising optimization. It utilizes an attention mechanism with a noise filter to remove unimportant local embeddings of nodes, resulting in a denoised and enhanced global conversation embedding. Simultaneously, contrastive learning is introduced to set an optimization strategy to guide the model in denoising learning. An adaptive weight is assigned to the local node embeddings and the global conversation embedding through a gating mechanism, yielding the final conversation recommendation list. This effectively alleviates the problem of existing conversation recommendation methods struggling to accurately extract user preferences from noisy, anonymous conversations, thereby improving the accuracy, robustness, and interpretability of conversation recommendations.
[0132] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0133] The following are device embodiments of the present invention. For details not described in detail, please refer to the corresponding method embodiments described above.
[0134] Figure 7 A schematic diagram of the conversation recommendation device provided in an embodiment of the present invention is shown. For ease of explanation, only the parts related to the embodiment of the present invention are shown, and are described in detail below:
[0135] like Figure 7 As shown, the conversation recommendation device 700 includes: a data acquisition module 701, a local embedding module 702, a global embedding module 703, a noise filtering module 704, a joint comparison and optimization module 705, and a conversation recommendation module 706.
[0136] The acquisition module 701 is used to acquire user session data;
[0137] The local embedding module 702 is used to construct a graph from user session data and obtain the local embeddings corresponding to all nodes in the graph.
[0138] The global embedding module 703 is used to calculate the first global session embedding based on the local embeddings corresponding to all nodes;
[0139] The noise filtering module 704 is used to perform noise reduction processing on the local embeddings corresponding to all nodes to obtain the noise-reduced second global session embedding.
[0140] The joint comparison optimization module 705 is used to obtain the third global session embedding by jointly comparing and optimizing the first and second global session embeddings.
[0141] The session recommendation module 706 is used to assign adaptive weights to the local embeddings and the third global session embeddings corresponding to all nodes, calculate the user session representation, and generate a user session recommendation list.
[0142] Optionally, the local embedding module 702 constructs a graph from the user session data. When obtaining the local embeddings corresponding to all nodes in the graph, it can be used for:
[0143] Construct the out-degree adjacency matrix and in-degree adjacency matrix corresponding to the user session data;
[0144] User session data is transformed into a graph using out-degree and in-degree adjacency matrices.
[0145] By aggregating information from the connection graph, an intermediate vector is obtained.
[0146] The local embeddings of all nodes in the graph are obtained through a graph neural network.
[0147] Optionally, when the global embedding module 703 calculates the first global session embedding based on the local embeddings corresponding to all nodes, it can be used for:
[0148] The local embeddings corresponding to all nodes are input into the attention mechanism to obtain the first attention weight values corresponding to all nodes in the graph;
[0149] The first global session embedding is calculated based on the first attention weight value corresponding to all nodes and the local embedding corresponding to all nodes.
[0150] Optionally, when the noise filtering module 704 performs denoising processing on the local embeddings corresponding to all nodes to obtain the denoised second global session embedding, it can be used for:
[0151] Calculate the average attention weight based on the first attention weight values corresponding to all nodes;
[0152] Based on the average attention weight, the second attention weight value of all nodes in the graph is calculated after noise removal using a noise filter.
[0153] The second global session embedding is calculated based on the second attention weight values of all nodes after denoising and the local embeddings of all nodes.
[0154] Optionally, when the noise filtering module 704 calculates the second attention weight value after denoising for all nodes in the graph based on the average attention weight using the noise filter, it can be used for:
[0155] Set parameters to control the degree of noise reduction, and use the product of the average attention weight and the parameter as the weight threshold;
[0156] Check whether the first attention weight value corresponding to a node in the graph is greater than the weight threshold;
[0157] If the first attention weight value corresponding to a node in the graph is greater than the weight threshold, then the weight exceeding the weight threshold will be used as the second attention weight value after the node in the graph has been denoised.
[0158] If the first attention weight value corresponding to a node in the graph is not greater than the weight threshold, then the second attention weight value of the node after denoising is set to zero.
[0159] Optionally, when the joint contrastive optimization module 705 obtains the third global session embedding based on the first and second global session embeddings through joint contrastive learning optimization, it can be used for:
[0160] Based on the first global session embedding and the second global session embedding, a noisy contrast function with standard binary cross-entropy loss is used as the target of contrastive supervised learning to obtain the first optimization target;
[0161] The cross-entropy loss function is used as the objective function for learning and training to obtain the second optimization objective.
[0162] Combining the first and second optimization objectives, a joint comparative optimization objective is obtained;
[0163] The third global conversation embedding is obtained by learning and training based on the joint contrastive optimization objective.
[0164] Optionally, when the session recommendation module 706 assigns adaptive weights to the local embeddings and third global session embeddings corresponding to all nodes, calculates the user session representation, and generates the user session recommendation list, it can be used for:
[0165] A gating mechanism is adopted to assign adaptive weights to the local embeddings and the third global session embeddings corresponding to all nodes, and then perform weighted summation to obtain the user session representation;
[0166] The nodes in the user session representation are normalized to generate a user session recommendation list.
[0167] The aforementioned conversation recommendation device improves the graph neural network-based conversation recommendation algorithm by employing a graph neural network conversation recommendation method that integrates contrastive learning for denoising optimization. By designing a noise filter to remove noise embeddings in the conversation and combining it with a contrastive learning strategy for joint optimization denoising, the device can improve the accuracy of conversation recommendations. It effectively solves the problems of dynamic changes in user intent and uncertainty in user behavior, and can learn more accurate conversation representations from conversation sequences.
[0168] Figure 8 This is a schematic diagram of a terminal provided in an embodiment of the present invention. Figure 8 As shown, the terminal 800 in this embodiment includes: a processor 801, a memory 802, and a computer program 803 stored in the memory 802 and executable on the processor 801. When the processor 801 executes the computer program 803, it implements the steps in the various session recommendation method embodiments described above, for example... Figure 1 Steps 101 to 106 are shown. Alternatively, when the processor 801 executes the computer program 803, it implements the functions of each module in the above-described device embodiments, for example... Figure 7 The functions of modules 701 to 706 are shown.
[0169] For example, the computer program 803 can be divided into one or more modules, which are stored in the memory 802 and executed by the processor 801 to complete the present invention. The one or more modules can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program 803 in the terminal 800. For example, the computer program 803 can be divided into... Figure 7 Modules 701 to 706 are shown.
[0170] The terminal 800 may include, but is not limited to, a processor 801 and a memory 802. Those skilled in the art will understand that... Figure 8 This is merely an example of terminal 800 and does not constitute a limitation on terminal 800. It may include more or fewer components than shown, or combine certain components, or different components. For example, the terminal may also include input / output devices, network access devices, buses, etc.
[0171] The processor 801 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0172] The memory 802 can be an internal storage unit of the terminal 800, such as a hard disk or memory of the terminal 800. The memory 802 can also be an external storage device of the terminal 800, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the terminal 800. Furthermore, the memory 802 can include both internal storage units and external storage devices of the terminal 800. The memory 802 is used to store the computer program and other programs and data required by the terminal. The memory 802 can also be used to temporarily store data that has been output or will be output.
[0173] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0174] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0175] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0176] In the embodiments provided by this invention, it should be understood that the disclosed devices, terminals, and methods can be implemented in other ways. For example, the device and terminal embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0177] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0178] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0179] If the integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various session recommendation method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0180] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A conversation recommendation method that integrates contrastive learning for denoising optimization, characterized in that, include: Obtain user session data; The user session data is constructed into a graph, and the local embeddings corresponding to all nodes in the graph are obtained. The first global session embedding is calculated based on the local embeddings corresponding to all the nodes; Denoise the local embeddings corresponding to all the nodes to obtain the denoised second global session embedding; Based on the first global session embedding and the second global session embedding, a third global session embedding is obtained through joint contrastive learning optimization. Adaptive weights are assigned to the local embeddings and the third global session embeddings corresponding to all nodes to calculate the user session representation and generate a user session recommendation list; The step of constructing a graph from the user session data and obtaining the local embeddings corresponding to all nodes in the graph includes: Construct the out-degree adjacency matrix and in-degree adjacency matrix corresponding to the user session data; The user session data is transformed into a graph using the out-degree adjacency matrix and the in-degree adjacency matrix. By aggregating and connecting the information in the graph, an intermediate vector is obtained; The local embeddings of all nodes in the graph are obtained through a graph neural network; The formula for the intermediate vector is as follows: in, As the intermediate vector, Represents the join function. Let these represent the in-degree adjacency matrix and the out-degree adjacency matrix corresponding to the nodes in the graph, respectively. These represent the in-degree deviation vector and the out-degree deviation vector, respectively. This represents the concatenated vector representing the node representation vectors in the graph. Represents the trainable parameter matrix; Obtain the local embeddings of all nodes in the graph using a graph neural network: in, This represents the output of a neural network layer. These represent the results of the update gate and the reset gate operations, respectively. Indicates the candidate results of the current iteration. and They represent Time and Embedding vector of time node, Indicate extraction Information about neighboring nodes, Indicates activation function , ⊙ represents element-wise multiplication. All of these are trainable parameter matrices.
2. The conversation recommendation method according to claim 1, characterized in that, The step of calculating the first global session embedding based on the local embeddings corresponding to all nodes includes: The local embeddings corresponding to all the nodes are input into the attention mechanism to obtain the first attention weight values corresponding to all the nodes in the graph; The first global session embedding is calculated based on the first attention weight value corresponding to all nodes and the local embedding corresponding to all nodes.
3. The conversation recommendation method according to claim 2, characterized in that, The step of denoising the local embeddings corresponding to all the nodes to obtain the denoised second global session embedding includes: Calculate the average attention weight based on the first attention weight values corresponding to all the nodes; Based on the average attention weight, the second attention weight value after denoising of all nodes in the graph is calculated by the noise filter; The second global session embedding is calculated based on the second attention weight values of all nodes after denoising in the graph and the local embeddings corresponding to all nodes.
4. The conversation recommendation method according to claim 3, characterized in that, The step of calculating the second attention weight value after denoising all nodes in the graph based on the average attention weight using a noise filter includes: Set parameters to control the degree of noise reduction, and use the product of the average attention weight and the parameters as the weight threshold; Detect whether the first attention weight value corresponding to the node in the graph is greater than the weight threshold; If the first attention weight value corresponding to a node in the graph is greater than the weight threshold, then the weight exceeding the weight threshold is used as the second attention weight value of the node after denoising. If the first attention weight value corresponding to a node in the graph is not greater than the weight threshold, then the second attention weight value of the node after denoising is set to zero.
5. The conversation recommendation method according to claim 3, characterized in that, The step of obtaining a third global session embedding based on the first and second global session embeddings through joint contrastive learning optimization includes: Based on the first global session embedding and the second global session embedding, a noisy contrast function with standard binary cross-entropy loss is used as the target of contrastive supervised learning to obtain the first optimization target; The cross-entropy loss function is used as the objective function for learning and training to obtain the second optimization objective. By combining the first optimization objective and the second optimization objective, a joint comparative optimization objective is obtained; The third global conversation embedding is obtained by learning and training based on the joint contrast optimization objective.
6. The conversation recommendation method according to claim 5, characterized in that, The process involves assigning adaptive weights to the local embeddings and the third global session embeddings corresponding to all nodes, calculating the user session representation, and generating a user session recommendation list, including: A gating mechanism is used to assign adaptive weights to the local embeddings and the third global session embeddings corresponding to all nodes, and then perform a weighted summation to obtain the user session representation; The nodes in the user session representation are normalized to generate a user session recommendation list.
7. A conversation recommendation apparatus for performing the conversation recommendation method based on fusion contrastive learning denoising optimization as described in any one of claims 1 to 6, characterized in that, include: The data acquisition module is used to obtain user session data; The local embedding module is used to construct a graph from the user session data and obtain the local embeddings corresponding to all nodes in the graph. A global embedding module is used to calculate the first global session embedding based on the local embeddings corresponding to all the nodes; The noise filtering module is used to perform noise reduction processing on the local embeddings corresponding to all the nodes to obtain the noise-reduced second global session embedding. The joint comparison optimization module is used to obtain a third global session embedding by jointly comparing and optimizing the first global session embedding and the second global session embedding through joint comparison learning. The session recommendation module is used to assign adaptive weights to the local embeddings and the third global session embeddings corresponding to all nodes, calculate the user session representation, and generate a user session recommendation list.
8. A terminal, comprising a memory and a processor, the memory for storing a computer program, the processor for calling and running the computer program stored in the memory, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 6 above.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 6 above.