Social contact fused intelligent agent and recommendation simulation environment construction method
By building social network and influence models and combining the agent decision interface, the shortcomings of the existing recommendation system simulator in social relationship modeling are solved, more accurate user behavior simulation is achieved, and the application scope of generative agents in recommendation system evaluation is expanded.
Patent Information
- Application Number
- CN202510439852.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-09
- Publication Date
- 2025-07-08
AI Technical Summary
The existing recommendation system simulator has shortcomings in social relationship modeling and cannot effectively simulate the interaction effect between users, resulting in a large gap between the simulation results and the real scene. Especially when users choose to be recommended by friends or group trends, independent behavior modeling methods are difficult to reflect the actual situation.
By collecting and preprocessing the interaction records between users and items, generating user feature vectors and item summary, calculating user behavior similarity, building a social network and updating an adjacency matrix, conducting influence modeling based on social networks, building an agent decision-making interface and behavior set, realizing user behavior simulation, and interacting in the simulation environment to dynamically update the social network.
It significantly improves the accuracy of user interest evolution and social relationship recognition, realizes more accurate social influence assessment, enables generative agents to make more realistic behavioral decisions while taking into account social impact, and provides a recommendation algorithm evaluation environment closer to real scenarios.
Smart Images

Figure CN120277269A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of recommendation systems, and particularly relates to an intelligent agent integrating social interaction and a method for constructing a recommendation simulation environment. Background Art
[0002] In the research and development of recommendation systems, there is a significant gap between offline evaluation and online performance. To bridge this gap, researchers have proposed various recommendation system simulators. These simulators can be mainly classified into the following categories: rule-based simulators, such as Virtual Taobao, which uses predefined rules to simulate user behavior on e-commerce platforms. This type of simulator is based on manually set rules, with simple implementation but lacking flexibility. Deep learning-based simulators, such as RecSim, which uses deep learning models to learn and generate user behavior sequences. This type of method can capture relatively complex behavior patterns but often lacks interpretability. Large language model-based simulators, such as the latest research Agent4Rec, which proposes using LLM-driven agents to simulate user behavior. This method initializes agents on datasets such as MovieLens, and each agent contains user profiles, memories, and behavior modules and can interact with the recommendation system.
[0003] Rule-based recommendation system simulators (such as Virtual Taobao) adopt predefined fixed rules when simulating user behavior. This method oversimplifies the user decision-making process and cannot adapt to complex and changing real-world scenarios, especially when considering the influence of user interactions, its limitations are more obvious. In addition, the design and adjustment of rules require a large amount of manual experience and have poor scalability. Deep learning-based recommendation system simulators (such as RecSim) can learn user behavior patterns from historical data, but they overly rely on the quality and distribution of training data. In practical applications, due to the sparsity and noise of user behavior data, it is difficult for the model to accurately capture the real motivation behind user decisions and cannot simulate new behavior patterns that do not appear in the training data. The newly proposed large language model-based recommendation system simulator Agent4Rec only focuses on modeling individual user characteristics, such as activity, conformity, and diversity, but completely ignores the influence of social relationships between users on behavior choices. On datasets lacking explicit social relationships (such as MovieLens), this method cannot effectively simulate the interaction effects between users, resulting in a large gap between the simulation results and the real scenario. Especially when a user's choice is influenced by friend recommendations or group trends, this independent behavior modeling method is difficult to reflect the actual situation. These existing technologies have not fully considered the important role of social networks in the user decision-making process, resulting in the lack of authenticity and reliability of the simulation effects. Summary of the Invention
[0004] In view of the deficiencies of the prior art, the present invention provides an intelligent agent integrating social interaction and a method for constructing a recommendation simulation environment, which overcomes the deficiencies of the existing intelligent agent recommendation simulator based on large language models in social relationship modeling.
[0005] The technical solution of the present invention is as follows:
[0006] The present invention provides an intelligent agent integrating social interaction and a method for constructing a recommendation simulation environment, including the following steps:
[0007] Collect the interaction records of users and items, preprocess them, and then generate the feature vector of each user based on the preprocessed interaction records of users and items.
[0008] Collect the basic information of items, and call a large language model to generate item summaries according to the basic information of items.
[0009] Based on the preprocessed interaction records of users and items, calculate the behavior similarity scores between different users, and generate a user behavior similarity matrix.
[0010] Based on the user behavior similarity matrix and the feature vector of each user, construct a social network and update the adjacency matrix of the social network. The social network takes users as nodes, and the connections between nodes represent social relationships between users.
[0011] Based on the social network, model the social influence of users to generate a social influence propagation matrix; the social influence propagation matrix is used to quantify the influence of each user in the social network.
[0012] Construct a recommendation module for recommending items to users; the input of the recommendation module is the user ID, and the output is a list of recommended items, including the basic information of the items and the item summaries.
[0013] Construct intelligent agents, an intelligent agent decision interface, and an intelligent agent behavior set; the intelligent agents are used to simulate the behaviors of users, and each intelligent agent corresponds to a user; the intelligent agent decision interface is used to call a large language model to support the behavior simulation of the intelligent agents; the intelligent agent behavior set includes several behaviors that the intelligent agents can take.
[0014] Based on the recommendation module and the intelligent agents, construct a simulation environment.
[0015] Based on the intelligent agent decision interface and the intelligent agent behavior set, in the simulation environment, use the intelligent agents to interact with the recommendation module to achieve user behavior simulation.
[0016] After each simulation ends, update the adjacency matrix of the social network and the social influence propagation matrix, and delete the edges in the social network whose weights are lower than the threshold within a continuous time window.
[0017] Further, collect the interaction records between users and items, preprocess them, and then generate a feature vector for each user based on the preprocessed interaction records between users and items, specifically as follows:
[0018] A1: Collect the interaction records between users and items. Each interaction record between a user and an item includes: a user ID, an item ID, the rating value of the user for the item, and the timestamp when the interaction occurred;
[0019] A2: Filter the interaction records between users and items. Specifically, set an interaction threshold and only retain the interaction records between users and items corresponding to users whose interaction times exceed the interaction threshold;
[0020] A3: Randomly select a set number of users, and screen out the interaction records between users and items corresponding to the randomly selected users from the interaction records between users and items filtered in A2, that is, obtain the preprocessed interaction records between users and items;
[0021] A4: Map the user IDs and item IDs in the filtered interaction records between users and items to consecutive integer indices respectively, and construct a mapping dictionary;
[0022] A6: Based on the preprocessed interaction records between users and items, construct a feature vector for each user. This feature vector includes three dimensions: activity, conformity, and diversity, and each dimension represents different levels through label values.
[0023] Further, calculate the behavior similarity scores between different users based on the preprocessed interaction records between users and items, and generate a user behavior similarity matrix, specifically as follows:
[0024] B1: According to the preprocessed interaction records between users and items, construct a user-item interaction matrix. The rows of the user-item interaction matrix represent users, the columns represent items, and each element in the user-item interaction matrix represents the rating value of the user for the item. If a user does not rate an item, the corresponding element value is 0;
[0025] B2: For each interaction record between a user and an item, calculate the time decay weight according to the timestamp when the interaction occurred;
[0026] The calculation formula for the time decay weight is as follows:
[0027]
[0028] where, w ij is the time decay weight, i is the index of the user, j is the index of the item, t now is the current timestamp, t ijis the timestamp when the interaction occurred in the interaction record between the user and the item, and λ is the decay coefficient;
[0029] B3: Based on the user-item interaction matrix and the time decay weights, construct a time-series weighted scoring matrix. Each element of the time-series weighted scoring matrix is obtained by multiplying the rating value of the user for the item by the corresponding time decay weight;
[0030] B4: Based on the time-series weighted scoring matrix, calculate the behavioral similarity scores between every two users, and then obtain a user behavioral similarity matrix, where each element represents the behavioral similarity score between two users;
[0031] The calculation of the behavioral similarity score uses the cosine similarity formula, that is: the behavioral similarity score between user A and user B is the cosine similarity between the time-series weighted scoring vector of user A and the time-series weighted scoring vector of user B, where the time-series weighted scoring vector of the user is the row vector corresponding to the index of the user in the time-series weighted scoring matrix.
[0032] Furthermore, based on the user behavioral similarity matrix and the feature vector of each user, construct a social network and update the adjacency matrix of the social network, specifically:
[0033] C1: Based on the generated user behavioral similarity matrix, construct a social network;
[0034] Specifically: taking users as nodes, set a similarity threshold θ to determine whether there is a social relationship between two users. If the behavioral similarity score between user A and user B is greater than or equal to θ, it is considered that there is a social connection between the two, and an edge is established in the social network;
[0035] The adjacency matrix of the social network is used to represent the social relationship between users. The dimension of the adjacency matrix is N×N, where N is the number of users. Each element represents the social relationship between two users. If there is a social relationship between user A and user B, the corresponding element value in the adjacency matrix is 1, otherwise it is 0;
[0036] C2: Introduce a feature weighting mechanism on the basis of the social network to update the adjacency matrix of the social network;
[0037] The specific method is: for every two users, if the element value representing the social relationship between the two users in the adjacency matrix of the social network is non-zero, calculate the feature similarity between the two users, and add the feature similarity to the corresponding element value in the adjacency matrix of the social network to obtain the updated adjacency matrix of the social network. Each element in it is the social connection strength between two users, and the larger its value, the closer the social relationship between the two;
[0038] The calculation formula for the feature similarity between two users is as follows:
[0039] Feature similarity = exp(-σ × Euclidean distance between the feature vectors of the two users)
[0040] Where σ is the standard deviation coefficient.
[0041] Furthermore, based on the social network, model the social influence of users to generate a social influence propagation matrix, specifically as follows:
[0042] D1: Calculate three centrality metrics for each node in the social network, including degree centrality, eigenvector centrality, and betweenness centrality;
[0043] Degree centrality: The number of neighbor nodes directly connected to a node;
[0044] Eigenvector centrality: Calculated through the eigenvalue equation, the value of the eigenvector centrality of a node is the value corresponding to the node in the principal eigenvector, and the principal eigenvector is the eigenvector corresponding to the element with the largest value in the adjacency matrix of the social network;
[0045] Betweenness centrality: Represents the ability of a node to act as a mediator node in the social network. Specifically, the betweenness centrality is equal to the proportion of the number of all shortest paths passing through the node to the total number of shortest paths;
[0046] D2: Based on the three centrality metrics of each node, construct a node centrality vector for each user, including three elements, which are the values of the three centrality metrics respectively;
[0047] D3: Based on the node centrality vector and the adjacency matrix of the social network, construct a social influence propagation matrix;
[0048] D3.1: Based on the adjacency matrix of the social network, construct a transition probability matrix, and each element in the transition probability matrix represents the probability of transferring from one node to another node;
[0049] The specific calculation method is: The probability of user A transferring to user B is the social connection strength between user A and user B in the adjacency matrix of the social network divided by the sum of the social connection strengths between user A and all users;
[0050] D3.2: Normalize each node centrality vector to obtain the initial influence distribution vector of each user;
[0051] D3.3: Based on the transition probability matrix and the initial influence distribution vector, calculate the influence score vector of each user, and splice the influence vectors of each user as row vectors to obtain the social influence propagation matrix;
[0052] In one iteration, the calculation formula of the influence score vector is as follows:
[0053] The influence score vector after iteration = (1 - α) × initial influence distribution vector + α × transition probability matrix × influence score vector before iteration;
[0054] Through iterative calculation until the influence score vector converges, where α is the damping coefficient.
[0055] Furthermore, the recommendation module receives the user ID as input, uses the recommendation algorithm to obtain a list of predicted scores for items, sorts the items according to the predicted scores of each item in the list of predicted scores for items, and then obtains a list of recommended items and displays them in pages, including item ID, predicted score, display sequence number in this page, basic information of the item, and item summary.
[0056] Furthermore, the construction of the agent, the agent decision interface, and the set of agent behaviors is specifically as follows:
[0057] The agent includes the following attributes: the feature vector of the user corresponding to the agent, the set of interaction records of the agent itself, and the fatigue level;
[0058] The set of interaction records of the agent itself includes several interaction records, including the collected interaction records between the user and the item and the runtime interaction records obtained by the agent in the process of simulating the user's behavior; the runtime interaction records include a user ID, an item ID, the rating value given by the user to the item, the timestamp when the interaction occurred, and the post-view feeling; the post-view feeling is a subjective evaluation of the item by the agent expressed in natural language form;
[0059] The fatigue level determines the behavior that the agent will take next;
[0060] When the agent decision interface calls the large language model to support the behavior simulation of the agent, the input of the large language model is the prompt word, and the output is natural language text, including: whether to view, rating value, and post-view feeling;
[0061] Whether to view: indicates whether the agent chooses to view the current item in the list of recommended items;
[0062] Rating value: If the agent chooses to view, a rating value is assigned to it;
[0063] The set of agent behavior decisions includes three behaviors: select and watch an item, obtain the next page of recommended content, and end the operation;
[0064] The process of simulating user behavior using an agent and an agent decision interface is as follows: Input the recommended item list into the agent. For each item in the recommended item list, search for the interaction record set of the neighbor nodes of the user corresponding to the current agent in the adjacency matrix of the social network, and obtain the influence of the neighbor nodes according to the social influence propagation matrix. Organize the interaction record set of the neighbor nodes, the influence of the neighbor nodes, the basic information of the item, the item summary, the interaction record set of the agent itself, and the feature vector of the user corresponding to the agent into a prompt, and call the agent decision interface. The large language model outputs natural language text according to the prompt;
[0065] If the fatigue level of the agent reaches threshold 1, choose to end the operation; if all items on the current page of the recommendation list have been traversed, then choose to obtain the next page of recommended content.
[0066] Further, the simulation environment includes: an agent pool, an item pool, social network information, runtime interaction records, and a recommendation module; the agent pool is the set of all agents; the item pool is the set of all items; the social network information includes the adjacency matrix of the social network and the social influence propagation matrix.
[0067] Further, based on the agent decision interface and the agent behavior set, in the simulation environment, the agent interacts with the recommendation module to implement user behavior simulation, specifically as follows:
[0068] E1: Initialize all agents and store them in the agent pool of the simulation environment;
[0069] E2: For each agent, call the recommendation module to obtain the recommended item list;
[0070] E3: Input the recommended item list into the agent;
[0071] E4: For the current item in the recommended item list, the agent generates a prompt and calls the agent decision interface, and the large language model outputs natural language text according to the prompt;
[0072] E5: According to the natural language text, determine the behavior of the agent. If the agent chooses to view an item, save the runtime interaction record of this time to the interaction record set of the agent itself, otherwise return to E4 to continue traversing the recommended item list;
[0073] E6: Update the fatigue level of the agent through a random number. If the behavior of the agent is to choose and view an item, randomly increase the fatigue level by any value;
[0074] E7: Judge whether the fatigue level reaches the threshold. If so, end the operation and this simulation ends, otherwise execute E8;
[0075] E8: Determine whether all items on the current page of the recommendation list have been traversed. If so, select to obtain the next page of recommendation content and return to E4 to continue traversing the recommended item list. Otherwise, directly return to E4.
[0076] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0077] By setting an interaction threshold and a multi-dimensional feature partitioning mechanism, the quality of user behavior data in the simulation environment is effectively improved; by adopting a time-series weighted scoring matrix and a social network construction strategy with double weights, the accuracy of user interest evolution and social relationship recognition is significantly improved; by fusing methods of multi-dimensional centrality metrics, a more accurate social influence assessment is achieved, which can better reflect the actual status of users in the social network. On this basis, by constructing a time-series weighted user behavior similarity calculation and a feature-weighted social network dynamic update mechanism, the generative agent can make more realistic behavior decisions considering social influence; by a social influence modeling method that fuses node centrality metrics and influence propagation matrices, each agent can accurately perceive and respond to the influence from its social network; through a standardized large language model interface and a complete agent interaction mechanism, an accurate simulation of user behavior in a social network environment is achieved, providing a more realistic experimental environment for the offline evaluation of recommendation algorithms. In summary, the present invention not only expands the application scope of generative agents in the evaluation of recommendation systems, but also provides an effective tool for studying the impact of social networks on user decision-making behavior, having significant technical effects and application values. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] Figure 1 It is a flowchart of a method for constructing a social-fused agent and a recommendation simulation environment in an embodiment of the present invention;
[0079] Figure 2 It is a flowchart of the operation of the simulation environment in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0080] The present invention will be described in detail below with reference to the drawings and embodiments.
[0081] The key technical points of the present invention lie in innovatively integrating social relationship modeling into the generative agent recommendation simulation system. First, in terms of data preprocessing, by constructing feature vectors in three dimensions of activity, conformity, and diversity, combined with a strict interaction threshold filtering mechanism, the data quality of the simulation environment is ensured. Second, in terms of calculating the similarity of user behavior, a time-series weighting mechanism is innovatively designed, and historical interactions are weighted by time-decaying weights to achieve dynamic evolution modeling of user interests. Third, in terms of constructing a social network, a dynamic update mechanism with double weights is proposed. By combining a similarity threshold and feature similarity, the social connection strength between users is accurately characterized and adaptively updated through a fixed time window. Fourth, in terms of social influence modeling, multi-dimensional indicators such as degree centrality, eigenvector centrality, and betweenness centrality are integrated, and accurate influence calculation is achieved through an influence propagation matrix and a damping coefficient. Fifth, in terms of constructing an agent environment, a standardized large language model interface is designed. Through strict input templates and output specifications, the consistency and controllability of agent decisions are ensured. In addition, the present invention also realizes the construction of a complete recommendation environment and an interactive behavior simulation mechanism. Through detailed designs such as paged display, fatigue calculation, and group behavior statistics, the authenticity and reliability of the simulation results are guaranteed. The organic combination of these key technical points enables this system to accurately simulate user recommendation behavior in a social network environment and provides a reliable experimental platform for the evaluation of recommendation algorithms.
[0082] This embodiment provides a method for constructing an intelligent agent and a recommendation simulation system integrating social interaction, as Figure 1 shown, including the following specific steps:
[0083] Step 1: Collect the interaction records between users and items, and preprocess them to ensure the data quality of the subsequent simulation environment. Then, based on the preprocessed interaction records between users and items, generate the feature vector of each user;
[0084] Step 1.1: First, collect the interaction records between users and items. Each interaction record between a user and an item contains the following information: a user ID (the unique identifier of the user), an item ID (the unique identifier of the item), the rating value of the user for the item (the rating range is from 1 to 5), and the timestamp when the interaction occurred. These information are the basis for constructing the recommendation simulation environment;
[0085] Step 1.2: To ensure data quality, set an interaction threshold, and only retain the interaction records between users and items corresponding to users whose interaction times exceed the interaction threshold. This filtering mechanism can eliminate noise data and avoid model bias caused by sparse interactions;
[0086] In this embodiment, the interaction threshold is set to 20 (consistent with Agent4Rec);
[0087] Step 1.3: Randomly select a set number of users, and filter out the interaction records of the randomly selected users corresponding to the user-item interaction records filtered in Step 1.2, that is, the preprocessed user-item interaction records, which are used to construct the simulation environment in the subsequent steps. The main purpose of this operation is to reduce the consumption of computing resources;
[0088] In this embodiment, the set number of randomly selected users is 100;
[0089] Step 1.4: Map the user IDs and item IDs in the filtered user-item interaction records to consecutive integer indices respectively to construct a mapping dictionary;
[0090] For example, the user ID "U123" can be mapped to the index "1", and the item ID "I456" can be mapped to the index "2". The mapping dictionary will be used to quickly search and match user and item information in the subsequent steps;
[0091] Step 1.5: Based on the filtered user-item interaction records, construct a feature vector for each user to describe their behavior pattern. This feature vector includes three dimensions: activity, conformity, and diversity. Each dimension represents different levels through label values. In this embodiment, the range of label values is from 1 to 3;
[0092] The specific construction method is as follows:
[0093] Activity: Judge according to the number of interactions between users and items. Sort all users in ascending order of the number of interactions and divide them into three activity levels. The users with the fewest interactions are marked as activity level 1, and the users with the most interactions are marked as activity level 3;
[0094] Conformity: Judge by the mean square deviation of user ratings (i.e., the degree of rating fluctuation). Sort all users in ascending order of the mean square deviation of ratings and divide them into three conformity levels. Users with less rating fluctuation are considered more inclined to conform and are marked as conformity level 1; users with greater rating fluctuation are considered more personalized and are marked as conformity level 3;
[0095] Diversity: Judge according to the category distribution of the items interacted by users. Sort all users in ascending order of the richness of the categories of interacted items and divide them into three diversity levels. Users with fewer categories of interacted items are marked as diversity level 1, and users with more categories of interacted items are marked as diversity level 3;
[0096] Through the above method, each user is assigned a three-dimensional feature vector to describe their behavioral characteristics in terms of activity, conformity, and diversity;
[0097] Step 2: Collect the basic information of the items and call the large language model to generate item summaries based on the basic information of the items;
[0098] Step 2.1: Obtain the basic information of each item in the preprocessed interaction records between users and items. The basic information of each item includes the following: item ID (the unique identifier of the item), the title of the item (item name), and the category of the item;
[0099] Step 2.3: According to the basic information of each item, call the large language model to generate an item summary for each item; the generation of the item summary is based on the title, category, and other relevant information of the item, aiming to extract the core features and key content of the item. For example, for a movie, the content summary may include its plot summary, director information, and main actors, etc.;
[0100] Step 3: Based on the preprocessed interaction records between users and items, calculate the behavioral similarity scores between different users and generate a user behavioral similarity matrix, which will be used for the subsequent construction of the social network and the dynamic update of social relationships; the behavioral similarity represents the degree of similarity between different users;
[0101] Step 3.1: According to the preprocessed interaction records between users and items, construct a user-item interaction matrix. The rows of the user-item interaction matrix represent users, the columns represent items, and each element in the user-item interaction matrix represents the rating value of the user for the item. If a user does not rate an item, the corresponding element value is 0;
[0102] For example, assume there are 100 users and 500 items, then the dimension of the user-item interaction matrix is 100×500;
[0103] Step 3.2: For each interaction record between a user and an item, calculate the time decay weight according to the timestamp when the interaction occurred; the calculation formula of the time decay weight is as follows:
[0104]
[0105] where, w ij is the time decay weight, i is the index of the user, j is the index of the item, t now is the current timestamp, t ij is the timestamp when the interaction occurred in the interaction record between the user and the item, and λ is the decay coefficient, which is used to control the speed of time decay and can be defined according to the actual situation. In this way, higher weights can be given to recent interactions, while earlier interactions are given lower weights;
[0106] Step 3.3: Based on the user-item interaction matrix and the time decay weight, construct a time-series weighted scoring matrix. Each element of the time-series weighted scoring matrix is obtained by multiplying the rating value of the user for the item by the corresponding time decay weight;
[0107] For example, if a user's rating for an item is 4 and the corresponding time decay weight is 0.8, then the value of the corresponding element in the time-series weighted scoring matrix is 3.2;
[0108] Step 3.4: Based on the time-series weighted scoring matrix, calculate the behavioral similarity scores between every two users; The calculation of the behavioral similarity scores uses the cosine similarity formula, that is: the behavioral similarity score between user A and user B is the cosine similarity of the time-series weighted scoring vector of user A and the time-series weighted scoring vector of user B, where the time-series weighted scoring vector of a user is the row vector corresponding to the index of this user in the time-series weighted scoring matrix. Through the above method, a user behavioral similarity matrix can be obtained, where each element represents the behavioral similarity score between two users;
[0109] Step 4: Based on the user behavioral similarity matrix and the feature vector of each user, construct a social network. The social network uses users as nodes, and the connections between nodes represent the social relationships between users;
[0110] Step 4.1: Based on the user behavioral similarity matrix generated in Step 3, construct a social network;
[0111] The specific operation is as follows: Using users as nodes, set a similarity threshold θ to determine whether there is a social relationship between two users. If the behavioral similarity score between user A and user B is greater than or equal to θ, it is considered that there is a social connection between the two, and an edge is established in the social network;
[0112] The adjacency matrix of the social network is used to represent the social relationships between users. The dimension of the adjacency matrix is N×N, where N is the number of users. Each element represents the social relationship between two users. If there is a social relationship between user A and user B, the value of the corresponding element in the adjacency matrix is 1, otherwise it is 0;
[0113] Step 4.2: Introduce a feature weighting mechanism on the basis of the social network to update the adjacency matrix of the social network;
[0114] The specific method is as follows: For every two users, if the value of the element representing the social relationship between these two users in the adjacency matrix of the social network is non-zero, calculate the feature similarity between the two users, and add the feature similarity to the value of the corresponding element in the adjacency matrix of the social network to obtain the updated adjacency matrix of the social network. Each element in it is the social connection strength between two users, and the larger its value, the closer the social relationship between the two;
[0115] The calculation formula for feature similarity is as follows:
[0116] Feature similarity = exp(-σ × Euclidean distance between the feature vectors of two users)
[0117] Where σ is the standard deviation coefficient, which is used to control the distribution range of feature similarity;
[0118] Step 5: Based on the social network, model the social influence of users to generate a social influence propagation matrix; the social influence propagation matrix is used to quantify the influence of each user in the social network, so as to provide a basis for the behavior decision-making of the agent;
[0119] Step 5.1: In order to evaluate the importance of each node in the social network, calculate the following three centrality indicators of each node in the social network:
[0120] Degree centrality: The number of neighbor nodes directly connected to a node;
[0121] Eigenvector centrality: Calculated through the eigenvalue equation, reflecting the global influence of a node in the social network. The value of the eigenvector centrality of a node is the value corresponding to this node in the principal eigenvector, and the principal eigenvector is the eigenvector corresponding to the element with the largest value in the adjacency matrix of the social network;
[0122] Betweenness centrality: Represents the ability of a node to act as a mediator node in the social network. Specifically, the betweenness centrality is equal to the proportion of the number of all shortest paths passing through this node in the total number of shortest paths; for example, if 30% of all shortest paths in the network pass through user A, then the betweenness centrality of user A is 0.3;
[0123] Step 5.2: According to the three centrality indicators of each node, construct a node centrality vector for each user to comprehensively describe its status in the social network. This vector includes three elements, which are the values of the above three centrality indicators respectively;
[0124] Step 5.3: Based on the node centrality vector and the adjacency matrix of the social network, construct a social influence propagation matrix;
[0125] The specific operation is as follows:
[0126] Step 5.3.1: Based on the adjacency matrix of the social network, construct a transition probability matrix. Each element in the transition probability matrix represents the probability of transferring from one node to another node;
[0127] The specific calculation method is as follows: The probability that user A transfers to user B is the social connection strength between user A and user B in the adjacency matrix of the social network divided by the sum of the social connection strengths between user A and all users;
[0128] For example, if the social connection strength between user A and user B is 0.6, and the sum of the social connection strengths between user A and all users is 2.0, then the probability of transferring from user A to user B is 0.6÷2.0 = 0.3;
[0129] Step 5.3.2: Normalize each node centrality vector to obtain the initial influence distribution vector for each user;
[0130] The initial influence distribution vector is obtained by normalizing the node centrality vector, ensuring that the sum of the initial influences of all users is 1;
[0131] Step 5.3.3: Based on the transition probability matrix and the initial influence distribution vector, calculate the influence score vector for each user, and splice the influence vectors of each user as row vectors to obtain the social influence propagation matrix;
[0132] In one iteration, the calculation formula for the influence score vector is as follows:
[0133] The influence score vector after iteration = (1 - α)×initial influence distribution vector + α×transition probability matrix×influence score vector before iteration;
[0134] Through iterative calculation until the influence score vector converges, where α is the damping coefficient, initially set to 0.85, which is used to balance the probabilities of random jump and neighbor propagation;
[0135] Step 6: Construct a recommendation module for recommending items to users;
[0136] The said recommendation module receives the user ID as input, uses the recommendation algorithm to obtain the list of item prediction scores, sorts the items according to the prediction scores of each item in the list of item prediction scores, and then obtains the recommended item list and displays it in pages. Each page contains 5 items, and each item includes the item ID (the unique identifier of the item), the prediction score, the display serial number in this page, the basic information of the item, and the item summary;
[0137] In this embodiment, common recommendation algorithms such as LightGCN and Multi-VAE are trained and deployed. The network structures and training methods of these algorithms are configured according to the descriptions in their original literatures, and it is necessary to ensure that the deployed recommendation algorithm receives the user id as input and returns the list of item prediction scores as output;
[0138] Step 7: Construct agents, agent decision interfaces, and agent behavior sets;
[0139] The agent is used to simulate user behavior, and each agent corresponds to a user; the agent decision interface is used to call the large language model to support the behavior simulation of the agent; the agent behavior set includes several behaviors that the agent can take;
[0140] The agent includes the following attributes: the feature vector of the user corresponding to the agent, the interaction record set of the agent itself, and the fatigue level;
[0141] The interaction record set of the agent itself includes several interaction records, including the interaction records of the user and the item collected in Step 1 and the runtime interaction records obtained by the agent during the process of simulating the user's behavior; the runtime interaction record includes a user ID, an item ID, the rating value of the user for the item, the timestamp when the interaction occurred, and the post-view feeling; the post-view feeling is a subjective evaluation of the item by the agent expressed in natural language form;
[0142] The fatigue level determines the next behavior of the agent. The initial value of the fatigue level is set to 0 and will be updated during the operation of the simulation environment;
[0143] The input of the large language model is a prompt, and the output is a natural language text, including: whether to view, the rating value, and the post-view feeling;
[0144] Whether to view: indicates whether the agent selects to view the current item in the recommended item list;
[0145] Rating value: If the agent selects to view, a rating value is assigned to it, ranging from 1 to 5;
[0146] The parameter settings of the agent decision interface include a temperature parameter (temperature = 0.2), a maximum generation length (max_tokens = 2048), and a timeout limit (timeout = 10 seconds), and these parameters conform to the common large language model call specifications;
[0147] The agent behavior decision set includes three behaviors, namely, select and watch an item, obtain the next page of recommended content, and end the operation, and corresponding functions are written in the class;
[0148] The process of simulating user behavior using an agent and an agent decision interface is as follows: Input the recommended item list into the agent. For each item in the recommended item list, search for the interaction record set of the neighbor nodes of the user corresponding to the current agent in the adjacency matrix of the social network, and obtain the influence of the neighbor nodes according to the social influence propagation matrix. Organize the interaction record set of the neighbor nodes, the influence of the neighbor nodes, the basic information of the item, the item summary, the interaction record set of the agent itself, and the feature vector of the user corresponding to the agent into a prompt. Call the agent decision interface. The large language model outputs natural language text according to the prompt.
[0149] If the fatigue degree of the agent reaches threshold 1, choose to end the operation; if all items on the current page of the recommendation list have been traversed, choose to obtain the next page of recommended content.
[0150] The method of organizing the interaction record set of the neighbor nodes, the influence of the neighbor nodes, the basic information of the item, the item summary, the interaction record set of the agent itself, and the feature vector of the user corresponding to the agent into a prompt is as follows:
[0151] Adopt the prompt template: Suppose you are a user browsing a movie recommendation system. Your activity characteristics are: "Natural language description of activity characteristics". Your relevant memories are: "Natural language description of interaction records". Your social situation is: "Natural language description of social records". Please evaluate the following movies recommended to you: "Recommended item". First, judge which movies match your taste and explain the reasons. Second, assume that this is the first time you have watched the selected movie, give a score and add your feelings.
[0152] Among them, the natural language description of activity characteristics refers to describing the activity, conformity, and diversity in the user feature vector through natural language. For example, an activity of 3 is mapped to: "A movie lover who is willing to watch almost all recommended movies." A conformity of 1 is mapped to: "An independent reviewer who completely ignores public reviews." A diversity of 3 is mapped to: "A pioneer explorer who pursues unique and avant-garde movie choices."
[0153] The natural language description of interaction records refers to describing the user's previous interaction records through natural language. For example, yesterday you watched "The Shawshank Redemption" and gave it a 5-star positive review.
[0154] The natural language description of the social record is obtained in two steps: obtain the 3 neighbor nodes with the highest influence, traverse them, search for the item being recommended in the interaction records of each neighbor node, and obtain the rating value and post-view feeling of the neighbor for the current item. Then describe these rating values and post-view feelings in natural language. For example: Your best friend A has watched it and given it 4 points. His comment is that it is good-looking but the plot develops too fast; Your acquaintance B has also watched it and given it 3 points. His comment is that the plot is average;
[0155] The recommended item in the template refers to the basic information (name) and item summary of the current recommended item, such as: Roman Holiday, a classic romantic movie.
[0156] Step 8: Based on the recommendation module and the agent, construct a simulation environment; the simulation environment includes: an agent pool, an item pool, social network information, runtime interaction records, and a recommendation module;
[0157] The agent pool is the set of all agents; the item pool is the set of all items; the social network information includes the adjacency matrix and the social influence propagation matrix of the social network;
[0158] In this embodiment, a programming language supporting object orientation can be used to implement the simulation environment. The simulation environment is defined as a class, and the agent pool, item pool, social network information, and runtime interaction records are the attributes of this class. The simulation environment is started by instantiating this class.
[0159] Step 9: As Figure 2 shown, based on the agent decision interface and the set of agent behaviors, in the simulation environment, use the agent to interact with the recommendation module to implement user behavior simulation;
[0160] Step 9.1: Initialize all agents and store them in the agent pool of the simulation environment;
[0161] Step 9.2: For each agent, call the recommendation module to obtain a list of recommended items;
[0162] Step 9.3: Input the list of recommended items into the agent;
[0163] Step 9.4: For the current item in the list of recommended items, the agent generates a prompt word and calls the agent decision interface, and the large language model outputs natural language text according to the prompt word;
[0164] Step 9.5: According to the natural language text, determine the behavior of the agent. If the agent chooses to view an item, save the runtime interaction record of this time to the interaction record set of the agent itself, otherwise return to Step 9.4 to continue traversing the list of recommended items;
[0165] Step 9.6: Update the agent's fatigue level through random numbers. If the agent's behavior is to select and view an item, randomly increase the fatigue level by 0.1 - 0.3.
[0166] Step 9.7: Determine whether the fatigue level has reached the threshold. If so, end the operation and this simulation ends; otherwise, execute Step 9.8.
[0167] Step 9.8: Determine whether all items on the current page of the recommendation list have been traversed. If so, select to obtain the next page of recommendation content and return to Step 9.4 to continue traversing the recommended item list; otherwise, directly return to Step 9.4.
[0168] Step 10: After each simulation ends, recalculate the user behavior similarity based on the newly added runtime interaction records. At the same time, update the adjacency matrix and social influence propagation matrix of the social network, and delete the edges in the social network whose weights are lower than the threshold ε within consecutive time windows.
[0169] The threshold ε is defaulted to 0.1 and can be adjusted according to the actual situation of the data.
[0170] Evaluation and Verification:
[0171] Recommendation Effect Evaluation: Based on the simulation data, construct two types of evaluation metrics: an offline metric set and an online metric set; the offline metrics include Precision@K and Recall@K, and the calculation formulas are as follows:
[0172]
[0173] where, I u is the actual viewing set of user u, and R u is the recommendation set.
[0174] Adopt a positive sample recognition verification method to verify the authenticity of the agent's behavior:
[0175] Positive Sample Recognition Task Setting: Randomly select 20 items for each user, including n items that the user has actually interacted with (positive samples) and m non-interacted items (negative samples), and the ratio is set to 1:3; calculate the accuracy accuracy, precision precision, recall recall, and F1 score of the agent's recognition of positive samples.
[0176] The agent constructed by the present invention has achieved remarkable results in the alignment task: the accuracy rate reaches 64.75%, the precision rate reaches 68.71%, the recall rate reaches 54.50%, and the F1 value reaches 58.62%. Compared with the Agent4Rec method without social relationships under the same experimental environment settings, the accuracy rate is increased by 11.64%, the precision rate is increased by 10.67%, the recall rate is increased by 26.75%, and the F1 value is increased by 21.46%. The present invention improves the authenticity of user session behavior through a standardized large language model interface and a strict parameter control system. At the same time, based on an interactive simulation strategy of paginated display and fatigue calculation, a complete evaluation and verification system ensures the reliability of the simulation results and provides a more reliable experimental environment for the offline evaluation of recommendation algorithms.
Claims
1. An intelligent agent integrating social interaction and a method for constructing a recommendation simulation environment, characterized in that, It includes the following steps: Collect the interaction records between users and items, preprocess them, and then generate a feature vector for each user based on the preprocessed interaction records between users and items; Collect the basic information of the items, and call the large language model to generate an item summary based on the basic information of the items; Based on the preprocessed interaction records between users and items, calculate the behavior similarity scores between different users, and generate a user behavior similarity matrix; Based on the user behavior similarity matrix and the feature vector of each user, construct a social network and update the adjacency matrix of the social network. The social network uses users as nodes, and the connections between nodes represent the social relationships between users; Based on the social network, model the social influence of users to generate a social influence propagation matrix; The social influence propagation matrix is used to quantify the influence of each user in the social network; Construct a recommendation module for recommending items to users; the input of the recommendation module is the user ID, and the output is a list of recommended items, including the basic information of the items and the item summary; Construct agents, an agent decision interface, and an agent behavior set; the agents are used to simulate the behaviors of users, and each agent corresponds to a user; the agent decision interface is used to call the large language model to support the behavior simulation of the agents; the agent behavior set includes several behaviors that the agents can take; Based on the recommendation module and the agents, construct a simulation environment; Based on the agent decision interface and the agent behavior set, in the simulation environment, use the agents to interact with the recommendation module to achieve user behavior simulation; After each simulation ends, update the adjacency matrix of the social network and the social influence propagation matrix, and delete the edges with weights lower than the threshold in the social network within consecutive time windows.
2. The intelligent agent integrating social networking and the method for constructing a recommendation simulation environment according to claim 1, wherein The specific process of collecting the interaction records between users and items, preprocessing them, and then generating a feature vector for each user based on the preprocessed interaction records between users and items is as follows: A1: Collect the interaction records between users and items. Each interaction record between a user and an item includes: a user ID, an item ID, the rating value of the user for the item, and the timestamp when the interaction occurred; A2: Filter the interaction records between users and items. Specifically, set an interaction threshold, and only retain the interaction records between users and items corresponding to the users whose interaction times exceed the interaction threshold; A3: Randomly select a set number of users, and screen out the interaction records between users and items corresponding to the randomly selected users from the interaction records between users and items filtered in A2, that is, obtain the preprocessed interaction records between users and items; A4: Map the user IDs and item IDs in the filtered interaction records between users and items to consecutive integer indexes respectively, and construct a mapping dictionary; A6: Based on the preprocessed interaction records between users and items, construct a feature vector for each user. The feature vector includes three dimensions: activity, conformity, and diversity, and each dimension represents different levels through label values.
3. The intelligent agent integrating social interaction and the method for constructing a recommendation simulation environment according to claim 1, wherein The specific process of calculating the behavior similarity scores between different users based on the preprocessed interaction records between users and items and generating a user behavior similarity matrix is as follows: B1: Construct a user-item interaction matrix based on the preprocessed interaction records between users and items. The rows of the user-item interaction matrix represent users, the columns represent items, and each element in the user-item interaction matrix represents the rating value of a user for an item. If a user has not rated an item, the corresponding element value is 0; B2: For each interaction record between a user and an item, calculate the time decay weight according to the timestamp when the interaction occurred; The calculation formula for the time decay weight is as follows: where, w ij is the time decay weight, i is the index of the user, j is the index of the item, t now is the current timestamp, t ij is the timestamp when the interaction occurred in the interaction record between the user and the item, and λ is the decay coefficient; B3: Based on the user-item interaction matrix and the time decay weight, construct a time-series weighted rating matrix. Each element of the time-series weighted rating matrix is obtained by multiplying the rating value of a user for an item by the corresponding time decay weight; B4: Based on the time-series weighted rating matrix, calculate the behavior similarity score between every two users, and then obtain a user behavior similarity matrix, where each element represents the behavior similarity score between two users; The calculation of the behavior similarity score uses the cosine similarity formula, that is: the behavior similarity score between user A and user B is the cosine similarity between the time-series weighted rating vector of user A and the time-series weighted rating vector of user B, where the time-series weighted rating vector of a user is the row vector corresponding to the index of this user in the time-series weighted rating matrix.
4. The intelligent agent integrating social interaction and the method for constructing a recommendation simulation environment according to claim 1, characterized in that Based on the user behavior similarity matrix and the feature vector of each user, construct a social network, specifically: C1: Based on the generated user behavior similarity matrix, construct a social network; Specifically: Use users as nodes and set a similarity threshold θ to determine whether there is a social relationship between two users. If the behavior similarity score between user A and user B is greater than or equal to θ, it is considered that there is a social connection between the two, and an edge is established in the social network; The adjacency matrix of the social network is used to represent the social relationship between users. The dimension of the adjacency matrix is N×N, where N is the number of users. Each element represents the social relationship between two users. If there is a social relationship between user A and user B, the corresponding element value in the adjacency matrix is 1, otherwise it is 0; C2: Introduce a feature weighting mechanism on the basis of the social network to update the adjacency matrix of the social network; The specific method is: For every two users, if the element value representing the social relationship between these two users in the adjacency matrix of the social network is non-zero, calculate the feature similarity between the two users, and add the feature similarity to the corresponding element value in the adjacency matrix of the social network to obtain the updated adjacency matrix of the social network. Each element in it is the social connection strength between two users, and the larger its value, the closer the social relationship between the two; The calculation formula for the feature similarity between two users is: Feature similarity = exp(-σ × Euclidean distance between the feature vectors of two users) where σ is the standard deviation coefficient.
5. A social integration intelligent agent and a method for constructing a recommendation simulation environment according to claim 1, characterized in that, Based on the social network, model the social influence of users to generate a social influence propagation matrix, specifically: D1: Calculate three centrality indicators of each node in the social network, including degree centrality, eigenvector centrality, and betweenness centrality; Degree centrality: It is the number of neighbor nodes directly connected to a node; Eigenvector centrality: Calculated through the eigenvalue equation, the value of the eigenvector centrality of a node is the value corresponding to the node in the principal eigenvector, and the principal eigenvector is the eigenvector corresponding to the element with the largest value in the adjacency matrix of the social network; Betweenness centrality: It represents the ability of a node to act as a mediating node in the social network. Specifically, the betweenness centrality is equal to the proportion of the number of all shortest paths passing through the node to the total number of shortest paths; D2: According to the three centrality indexes of each node, construct a node centrality vector for each user, including three elements, which are the values of the three centrality indexes respectively; D3: Based on the node centrality vector and the adjacency matrix of the social network, construct a social influence propagation matrix; D3.1: Based on the adjacency matrix of the social network, construct a transition probability matrix, and each element in the transition probability matrix represents the probability of transferring from one node to another node; The specific calculation method is: the probability of user A transferring to user B is the social connection strength between user A and user B in the adjacency matrix of the social network divided by the sum of the social connection strengths between user A and all users; D3.2: Normalize each node centrality vector to obtain the initial influence distribution vector of each user; D3.3: Based on the transition probability matrix and the initial influence distribution vector, calculate the influence score vector of each user, and splice the influence vectors of each user as row vectors to obtain the social influence propagation matrix; In one iteration, the calculation formula of the influence score vector is as follows: The influence score vector after iteration = (1 - α) × initial influence distribution vector + α × transition probability matrix × influence score vector before iteration; Through iterative calculation until the influence score vector converges, where α is the damping coefficient.
6. The intelligent agent integrating social interaction and the method for constructing a recommendation simulation environment according to claim 1, characterized in that The recommendation module receives the user ID as input, uses the recommendation algorithm to obtain a list of predicted scores of items, sorts the items according to the predicted scores of each item in the list of predicted scores of items, and then obtains a list of recommended items and displays them in pages, including item ID, predicted score, display sequence number in this page, basic information of the item, and item summary.
7. A social integration intelligent agent and a method for constructing a recommendation simulation environment according to claim 1, characterized in that The construction of the agent, the agent decision interface, and the set of agent behaviors is specifically as follows: The agent includes the following attributes: the feature vector of the user corresponding to the agent, the set of its own interaction records, and the fatigue degree; The set of the agent's own interaction records includes several interaction records, including the collected interaction records between users and items and the runtime interaction records obtained by the agent in the process of simulating user behavior; the runtime interaction records include a user ID, an item ID, the rating value given by the user to the item, the timestamp when the interaction occurred, and the post-view feeling; the post-view feeling is a subjective evaluation of the item by the agent expressed in natural language form; The fatigue degree determines the behavior that the agent will take next; When the agent decision interface calls the large language model to support the behavior simulation of the agent, the input of the large language model is the prompt, and the output is the natural language text, including: whether to view, the score value, and the post-view feeling; Whether to view: indicates whether the agent selects to view the current item in the recommended item list; Score value: If the agent selects to view, a score value is assigned to it; The agent behavior decision set includes three behaviors: select and view an item, obtain the next page of recommended content, and end the operation; The process of simulating user behavior using the agent and the agent decision interface is specifically as follows: input the recommended item list into the agent. For each item in the recommended item list, find the interaction record set of the neighbor nodes of the user corresponding to the current agent in the adjacency matrix of the social network, and obtain the influence of the neighbor nodes according to the social influence propagation matrix. Organize the interaction record set of the neighbor nodes, the influence of the neighbor nodes, the basic information of the item, the item summary, the interaction record set of the agent itself, and the feature vector of the user corresponding to the agent as the prompt, call the agent decision interface, and the large language model outputs the natural language text according to the prompt; If the fatigue degree of the agent reaches threshold 1, select to end the operation; if all the items on the current page of the recommended list have been traversed, select to obtain the next page of recommended content.
8. A social integration intelligent agent and a method for constructing a recommendation simulation environment according to claim 1, characterized in that The simulation environment includes: an agent pool, an item pool, social network information, runtime interaction records, and a recommendation module; the agent pool is the set of all agents; the item pool is the set of all items; the social network information includes the adjacency matrix of the social network and the social influence propagation matrix.
9. The intelligent agent integrating social interaction and the method for constructing a recommendation simulation environment according to claim 1, wherein Based on the agent decision interface and the agent behavior set, in the simulation environment, the agent interacts with the recommendation module to implement user behavior simulation, specifically as follows: E1: Initialize all agents and store them in the agent pool of the simulation environment; E2: For each agent, call the recommendation module to obtain the recommended item list; E3: Input the recommended item list into the agent; E4: For the current item in the recommended item list, the agent generates a prompt and calls the agent decision interface, and the large language model outputs the natural language text according to the prompt; E5: According to the natural language text, determine the behavior of the agent. If the agent selects to view an item, save the runtime interaction record of this time to the interaction record set of the agent itself, otherwise return to E4 to continue traversing the recommended item list; E6: Update the fatigue degree of the agent through a random number. If the behavior of the agent is to select and view an item, randomly increase the fatigue degree by any value; E7: Judge whether the fatigue degree reaches the threshold. If so, end the operation and this simulation ends, otherwise execute E8; E8: Judge whether all the items on the current page of the recommended list have been traversed. If so, select to obtain the next page of recommended content and return to E4 to continue traversing the recommended item list, otherwise directly return to E4.
Citation Information
Cited By
Large-scale social network simulation method and system based on dynamic topological structure
CN120542469A
A method and system for simulating large-scale social networks based on dynamic topology
CN120542469B