A multi-scene conversational recommendation method based on a large language model agent framework

By constructing a multi-scenario conversational recommendation method based on a large language model agent framework, and combining various recommendation algorithms and user feedback mechanisms, the shortcomings of existing technologies in user experience and interpretability of recommendation results are solved, and a highly interactive and scalable personalized recommendation system is realized.

CN119988743BActive Publication Date: 2026-04-07NORTHEASTERN UNIV CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-14
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing conversational recommendation systems have shortcomings in terms of user experience and interpretability of recommendation results, especially the combination of large language models and recommendation algorithms has not fully realized its potential.

Method used

A multi-scenario conversational recommendation method based on a large language model agent framework is constructed. By combining dialogue manager, judge agent, item agent, learning agent and execution agent, along with fine-tuned collaborative filtering and sequence recommendation algorithms and content similarity retrieval algorithm, personalized recommendation results are generated and corrected based on user feedback.

Benefits of technology

It implements a highly interactive and usable conversational recommendation model, which improves the transparency and scalability of the recommendation system, adapts to different user scenarios, and provides satisfactory recommendation results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119988743B_ABST
    Figure CN119988743B_ABST
Patent Text Reader

Abstract

The application provides a multi-scene conversational recommendation method based on a large language model agent framework, and relates to the technical field of recommendation systems. The method specifically comprises: constructing a recommendation model based on a large language model agent framework composed of a dialogue manager, a judge agent, an item agent, a learning agent and an execution agent; for any user, using the recommendation model based on the large language model agent framework to recommend items for the user according to the dialogue input by the user, if the user is not a new user, using a fine-tuned ID-based collaborative filtering recommendation algorithm or a fine-tuned sequence recommendation algorithm based on interaction history to generate a recommendation result for the user; if the user is a new user, using a recommendation algorithm based on content similarity retrieval to generate a recommendation result for the user; after the user receives the recommendation result, the user submits user feedback to correct the recommendation result until the user is satisfied.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of recommendation systems, in particular to a multi-scene conversational recommendation method based on a large language model agent framework. BACKGROUND

[0002] Conversational recommendation systems aim to gradually mine user interest preferences through multi-round natural language-based dialogues, and thus recommend items that may be of interest to the user. Existing conversational recommendation systems all conform to a general framework. The user interaction module is responsible for understanding user natural language input, while also bearing the responsibility of making system replies. The dialogue strategy management module is responsible for making decisions on how to reply based on the current state, such as whether to continue asking or directly make recommendations. The recommendation engine recommends appropriate items based on user input or extracted user portraits.

[0003] At present, conversational recommendation can be divided into two research directions. One direction is attribute-based conversational recommendation, which focuses on modeling the dialogue strategy management module. The research center is how to achieve the most accurate recommendation in the fewest dialogue rounds. The common practice is to use reinforcement learning methods to train the dialogue strategy management module, use a simple dialogue module, put the recommendation results into a fixed template with a result slot, and form the system's reply. The other direction is generative recommendation, which pays more attention to providing a smooth dialogue experience for users, while flexibly integrating the relevant information of recommended items into the reply text to improve the explainability of the recommendation results. This type of model usually uses a sequence model to construct the dialogue module, and the recent rise of large language models has further enhanced the language capabilities of generative dialogue recommendation systems.

[0004] In previous work, attribute-based conversational recommendation relies on templates for dialogue, which results in a poor user dialogue experience and a lack of explainability for the recommendation results. Although generative recommendation focuses on the user's dialogue experience, the use of small dialogue model parameters in the current large model era affects the quality of text generation, and does not consider how to combine large language models and recommendation algorithms to build a large model-based conversational recommendation system. SUMMARY

[0005] To overcome the deficiencies of the prior art, the present application constructs a general interactive system framework based on a large language model, proposes a multi-scene conversational recommendation method based on a large language model agent framework, and aims to realize the transparency and expandability of multi-scene recommendation.

[0006] The multi-scene conversational recommendation method based on the large language model agent framework proposed by the present application includes the following processes:

[0007] Construct a recommendation model based on a large language model agent framework;

[0008] Obtain a plurality of sets of user rating data and item metadata, and save all obtained user rating data and item metadata to the recommendation model based on the large language model agent framework;

[0009] For any user, according to the user input dialogue, the recommendation model based on the large language model agent framework is used to recommend items to the user, if the user is not a new user, the fine-tuned ID-based collaborative filtering recommendation algorithm or the fine-tuned interaction history-based sequence recommendation algorithm is used to generate the recommendation result for the user; if the user is a new user, a content similarity retrieval-based recommendation algorithm is used to generate the recommendation result for the user;

[0010] The fine-tuning methods of the ID-based collaborative filtering recommendation algorithm and the interaction history-based sequence recommendation algorithm are the same, that is, for the pre-defined algorithm model in the ID-based collaborative filtering recommendation algorithm or the interaction history-based sequence recommendation algorithm, the user interaction history data set path is specified and the pre-defined algorithm model name is modified to realize fine-tuning, and the fine-tuned algorithm model weight is saved;

[0011] After the user receives the recommendation result of the user, the user feedback is submitted to the recommendation model based on the large language model agent framework, the recommendation model based on the large language model agent framework corrects the recommendation result of the user according to the user feedback, and re-recommends items to the user according to the correction result until the user is satisfied;

[0012] Preferably, the recommendation model based on the large language model agent framework comprises a dialogue manager, a judge agent, an item agent, a learning agent and an execution agent; wherein the dialogue manager, the judge agent, the item agent, the learning agent and the execution agent are all agents;

[0013] The dialogue manager is used for dialogue interaction with the user in a chat scene, determines whether to switch to a recommendation scene according to the user input content, if necessary, takes the user input content as a recommendation requirement and switches to the recommendation scene, if not, takes the user input content as user feedback and transmits it to the judge agent; generate a recommendation scene description by judging whether the user ID exists, the number of dialogue rounds of the user and the recommendation requirement and transmit it to the execution agent; receive the user portrait from the learning agent and the item description from the item agent respectively, and generate the recommendation result of the user according to the user portrait and the item description and send it to the user and the judge agent respectively;

[0014] The judge agent is used for evaluating the difference between the user feedback and the recommendation result of the user, and correcting the recommendation result of the user according to the difference;

[0015] The item agent is configured to acquire item metadata and extract text information and image information respectively, encode the extracted text information and image information respectively, fuse the encoded text feature representation and image feature representation, generate an item portrait of the item, and transmit the item portrait to the learning agent; and the natural language generation technology is configured to convert the item ID in the recommendation result candidate set into an item description and transmit the item description to the dialogue manager;

[0016] The learning agent is configured to acquire dialogue interaction history and user rating data of a user, integrate all items that have interacted with the user from the dialogue interaction history and the user rating data of the user, generate a user portrait based on the item portrait of the item, and transmit the user portrait to the dialogue manager; and the learning agent is configured to calculate the similarity between items based on the item portrait and transmit the similarity to the execution agent;

[0017] The execution agent is configured to select a recommendation algorithm to be called according to a recommendation scenario description, and generate a recommendation result candidate set based on the similarity between items by using the recommendation algorithm and transmit the recommendation result candidate set to the item agent;

[0018] Preferably, the user rating data includes a user ID, a user name, an item ID rated by the user, an effective rating rate, a rating text, a rating timestamp, and a rating time.

[0019] The item metadata includes an item ID, item description information, an item price, a picture path, an item category, an item name, and a browsing history or a purchase history of an item purchaser.

[0020] Preferably, the process of recommending items for the user by using the recommendation model based on the large language model agent framework includes the following steps:

[0021] The dialogue content input by the user is acquired and text analysis is performed, and when the dialogue content is a recommendation demand, the recommendation model based on the large language model agent framework is switched to a recommendation scenario.

[0022] The user ID of the user is acquired, and it is determined whether the user ID exists in the stored user rating data, if the user ID exists in the stored user rating data, the user is a historical user, and the user rating data of the user is acquired; if the user ID does not exist in the stored user rating data, the user is a new user, and the registration information of the user is acquired and used as the user rating data of the user.

[0023] A recommendation scenario description is generated according to the user rating data of the user, the number of dialogue turns, and the recommendation demand.

[0024] Text information and image information of each item are extracted from the item metadata saved in the recommendation model based on the large language model agent framework, the extracted text information and image information are encoded respectively, the encoded text feature representation and image feature representation are fused, and an item portrait of each item is generated.

[0025] According to the user's dialogue interaction history and user rating data, all the items that have interacted with the user are integrated, and the user portrait is generated based on the item portrait of all the items that have interacted with the user;

[0026] For historical users, according to the user's user rating data, recommendation scene description and item portrait, the fine-tuned ID-based collaborative filtering recommendation algorithm or the fine-tuned interaction history-based sequence recommendation algorithm is used to generate a recommendation result candidate set for the user; for new users, according to the user's user rating data, recommendation scene description and item portrait, the recommendation algorithm based on content similarity retrieval is used to generate a recommendation result candidate set for the user;

[0027] The natural language generation technology is used to convert the item ID in the recommendation result candidate set into an item description, and the recommendation result of the user is generated according to the user portrait and the item description and sent to the user;

[0028] The user feeds back to the generated recommendation result, and the user's recommendation result is corrected according to the user feedback, and the item recommendation for the user is re-performed according to the correction result until the user is satisfied;

[0029] Preferably, the method for generating a recommendation result candidate set for the user using the fine-tuned ID-based collaborative filtering recommendation algorithm is:

[0030] According to the user's user rating data and item metadata, the user's user interaction history data set is constructed;

[0031] The construction method of the user interaction history data set is: according to the user's user rating data, the interaction history of each item in the item metadata with the user is obtained, for any item, taking the user ID as the primary key and the interaction history of the user with the item as the value to construct a user-item evaluation key-value pair, and then using all the user-item evaluation key-value pairs of all items with the user to construct the user's user interaction history data set; wherein the interaction history is the effective evaluation rate or evaluation text of the user to the item;

[0032] Based on the user's user interaction history data set, an initial random embedding representation is assigned to the user and all items respectively;

[0033] The user's user embedding representation and all items' item embedding representation are updated by iterating and weighted summing the initial random embedding representation of the user and all items:

[0034] According to the updated user embedding representation and all items' item embedding representation, the user's rating matrix is constructed, represented as:

[0035]

[0036] wherein represents a rating matrix of the user for all items; represents a user embedding representation; represents an item embedding representation of all items;

[0037] removing the items that the user has rated from the obtained rating matrix, and ranking the items in descending order of the predicted ratings of the remaining items in the rating matrix to generate a candidate set of recommendation results;

[0038] Preferably, the method for updating the user embedding representation is:

[0039]

[0040] wherein represents an updated user embedding representation; represents an iteration round; represents the user interacted item set; represents the number of items that the user interacted; represents the item embedding representation of the item in the current round; represents the user set that interacted with the item ; represents the number of users that interacted with the item ;

[0041] The method for updating the item embedding representation is:

[0042]

[0043] wherein represents the updated item embedding representation of the item ; represents the user embedding representation of the user in the current round;

[0044] Preferably, the method for generating a candidate set of recommendation results for the user by using the fine-tuned interaction history-based sequence recommendation algorithm is:

[0045] The user's user score data is used to time sort all the items that the user has evaluated, and the interaction sequence of the user and each item is generated respectively; wherein the element in the interaction sequence is the interaction behavior of the user to the item;

[0046] The behavior sequence of the user is defined, denoted as:

[0047]

[0048] Wherein denotes the behavior sequence of the user; denotes the interaction sequence of the user and the first item; denotes the user; denotes the interaction sequence of the user and the second item; denotes the interaction sequence of the user and the last item; denotes the length of the behavior sequence of the user;

[0049] Wherein the length of the behavior sequence of the user is limited to n;

[0050] The sequence encoding and position encoding are performed on the encoding of each item in the behavior sequence of the user, the sequence Embedding representation and the position Embedding representation of the item are generated, and the sequence Embedding representation and the position Embedding representation of the item are added to obtain the sequence interaction information of the item;

[0051] The self-attention mechanism is used to learn the sequence interaction information, and the attention score of each item is calculated;

[0052] For each item in the behavior sequence of the user, the item Embedding representation is generated and the relevance score of each item is calculated;

[0053] The behavior sequence of the user is converted into the user behavior sequence of the user;

[0054] The similarity between the user behavior sequence output of the user and the item Embedding representation of all items is calculated respectively to predict the score of each item by the user, all the items evaluated by the user are deleted, and the recommendation result candidate set is generated according to the relevance score and the score of the remaining items;

[0055] Preferably, the relevance score of each item is denoted as:

[0056]

[0057] Wherein denotes the relevance score of the i-th user to the j-th item; denotes the relevance score of the i-th user to the j-th item;​ represents the function of the th user in the th self-attention block, and is a function dependent on ; is the Embedding interaction representation of a single item; represents the item Embedding representation of the th item;

[0058] Preferably, the user behavior sequence output represents

[0059]

[0060] wherein represents the user behavior sequence output of the th user; represents padding; represents a padding value; the user representation of the th user; represents the predicted next user representation of the next user;

[0061] Preferably, the method for generating a recommendation result candidate set for the user using a content similarity-based retrieval recommendation algorithm is

[0062] An item ID candidate set is constructed using item metadata;

[0063] The construction method of the item ID candidate set is as follows: for any item, the item description information of the item is obtained from the item metadata, and the item description information of the item is encoded using a text encoder to obtain the item content representation of the item. The item representation key-value pair of the item is constructed with the item ID as the primary key and the item content representation of the item as the value. The item ID candidate set is constructed using the item representation key-value pairs of all items;

[0064] The user portrait of the user is encoded using a text encoder to generate the user portrait representation of the user;

[0065] The similarity between the user and all items in the item ID candidate set is calculated using the user portrait representation of the user and the content representation of each item in the item ID candidate set;

[0066] The calculation method of the similarity is

[0067]

[0068] wherein represents the similarity of the user and the item; Normalize represents normalization;

[0069] Sort all items in the item ID candidate set in descending order of the similarity of the user and all items in the item ID candidate set, and select the top P items in the sorting result to generate a recommended result candidate set.

[0070] The beneficial effects produced by the above technical solutions are as follows:

[0071] Compared with the existing recommendation system, the recommendation model based on the large language model agent framework constructed in the method improves the interactivity, realizes a highly available conversational recommendation model, and sets two recommendation scenarios, i.e., the user is a historical user and the user is a new user. When the user is a historical user, a fine-tuned ID-based collaborative filtering recommendation algorithm or a fine-tuned sequence recommendation algorithm based on interaction history is used to generate a recommendation result for the user. When the user is a new user, a content similarity retrieval-based recommendation algorithm is used to obtain a user-satisfactory recommendation result, thereby making up for the performance bottleneck of a single recommendation algorithm.

[0072] The method provides a new conversational recommendation system and method combining a large language model and a recommendation algorithm. The Prompt engineering technology is used to guide the large language model to learn the user input cases of the recommendation scenario, and then a multi-scene conversational recommendation system is constructed based on the large language model and the recommendation algorithm under different recommendation scenarios.

[0073] The method constructs a recommendation scenario input sample data set based on the self-instruction generation technology, and then uses the Prompt engineering to strengthen the recommendation scenario recognition ability of the open source large language model based on the generated recommendation scenario sample. The method constructs a general agent framework to adapt to different large language model bases and different recommendation tasks, and emphasizes the generality and practicality of the recommendation system.

[0074] The traditional recommendation algorithm has good recommendation performance, but does not have language interaction capability; and the large language model has good language understanding and interaction capability, but has the problem of insufficient recommendation precision in the recommendation field. Therefore, the method of the present application realizes a multi-scene interactive recommendation system through the idea of large model understanding and use of tools and use and development of multiple technical frameworks. Specifically, considering the universality, the method of the present application customizes a large language model base use paradigm, which reduces the hardware threshold for users to use the recommendation system. Various traditional recommendation algorithms and similarity-based retrieval are packaged into an API tool library, realizing the transparency and expandability of multi-scene recommendation. The method of the present application also proposes a mechanism for correcting the recommendation result based on user feedback, which improves the accuracy of the recommendation result based on content similarity.

[0075] Compared with the prior art, the present application constructs a general recommendation model based on a large language model agent framework based on a large language model. The client can use a multi-scene interactive recommendation model using very little hardware resource. Based on the custom Prompt engineering, more recommendation scenarios can be expanded, and the range of recommended items of the recommendation model is improved. Through performance testing, the recommendation model realized by the present application has good interaction and good performance, which meets the application requirements. BRIEF DESCRIPTION OF DRAWINGS

[0076] Figure 1 a flowchart of a multi-scene conversational recommendation method based on a large language model agent framework in the present embodiment;

[0077] Figure 2 a flowchart of interactive recommendation in the present embodiment;

[0078] Figure 3 a principle diagram of a recommendation model based on a large language model agent framework in the present embodiment. DETAILED DESCRIPTION

[0079] In order to facilitate the understanding of the present application, the specific embodiments of the present application are further described in detail below in combination with the drawings and embodiments. The following embodiments are used to illustrate the present application, but are not used to limit the scope of the present application. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive.

[0080] The embodiment takes Agent as the core framework, regards the recommendation algorithm as a tool that can be understood and used by the large language model, judges the current scene according to the input of the user, and gives a reply that satisfies the user. It mainly includes two aspects of recommendation algorithm preparation and conversational recommendation system construction. In order to fully consider the universality of the recommendation method, the embodiment has two recommendation scenes, that is, the user has an existing item interaction history and the user does not exist, that is, a new user. When there is a user item interaction history, the recommendation system needs a satisfactory recommendation result. In the recommendation scene of a new user, a recommendation algorithm based on content similarity retrieval is used to obtain a user-satisfactory recommendation result.

[0081] A multi-scene conversational recommendation method based on a large language model agent framework according to the embodiment, as shown in Figure 1 The method includes the following processes:

[0082] A recommendation model based on a large language model agent framework is constructed.

[0083] The recommendation model based on the large language model agent framework includes a dialogue manager, a judgment agent, an item agent, a learning agent, and an execution agent; and the recommendation process of the item recommendation model based on the large language model agent framework is divided into a chat scene and a recommendation scene.

[0084] In the embodiment, as shown in Figure 2 The item recommendation model based on the large language model agent framework mainly adopts the operation principle of the recommendation Agent framework, divides the chat scene and the recommendation scene based on the group chat nesting idea, and clearly defines the functions and input and output of each Agent. In the process of interaction between the user and the dialogue manager, if the user expresses the intention to recommend goods, the dialogue manager will switch the dialogue scene to the recommendation scene. After entering the recommendation scene, the corresponding learning agent of the user will obtain the user portrait combined with the existing item interaction sequence, and will also obtain the user portrait based on the interaction history of the user. After inputting the user portrait into the dialogue manager, obtaining the item candidate set through the recommendation algorithm, and selecting the item that the user is most interested in according to the similarity, the output is obtained. If the user is not satisfied, the learning agent will adjust the user portrait combined with the feedback of the user, and then generate a recommended item until the user exits the recommendation scene

[0085] The chat manager is configured to interact with the user in a chat scene, determine whether to switch to a recommendation scene according to content input by the user, if necessary, take the content input by the user as a recommendation requirement and switch to the recommendation scene, and if not, take the content input by the user as user feedback and transmit the content to the critic agent; generate a recommendation scene description by judging whether a user ID exists, a dialogue round number of the user and a recommendation requirement, and transmit the recommendation scene description to the execution agent; receive a user portrait from the learning agent and an item description from the item agent, respectively, and generate a recommendation result of the user according to the user portrait and the item description and send the recommendation result to the user and the critic agent, respectively.

[0086] In the embodiment, the chat manager is a manager of the entire conversation, responsible for interaction with the user and processing of different output and input information, and uses ChatGPT as a base.

[0087] The critic agent is configured to evaluate a difference between the user feedback and the recommendation result of the user, and correct the recommendation result of the user according to the difference.

[0088] In the embodiment, the critic agent is configured to evaluate a difference between the user feedback and the recommendation result of the user, and correct the recommendation result of the user according to the difference.

[0089] The item agent is configured to obtain item metadata, extract text information and image information, respectively, encode the extracted text information and image information, respectively, fuse the encoded text feature representation and image feature representation, generate an item portrait and transmit the item portrait to the learning agent, and convert item IDs in a recommendation result candidate set into item descriptions by using a natural language generation technology and transmit the item descriptions to the chat manager.

[0090] In the embodiment, the item agent is responsible for extraction and fusion of bimodal item information and generation of an item portrait, uses InternLM-xcomposer as a base, and supports bimodal information processing. The natural language generation (NLG) technology is used to convert structured information of item metadata into fluent natural language text.

[0091] The learning agent is configured to obtain a dialogue interaction history of the user and user rating data, integrate all items that have interacted with the user from the dialogue interaction history of the user and the user rating data, generate a user portrait based on item portraits of the items, and transmit the user portrait to the chat manager; and calculate similarities between the items by using the item portraits and transmit the similarities to the execution agent.

[0092] In this embodiment, the learning agent (Learn Agent) is responsible for generating user portraits, using ChatGPT as the base.

[0093] The execution agent is configured to select a recommendation algorithm to be invoked according to the recommendation scenario description, and generate a candidate set of recommendation results based on the similarity between items using the recommendation algorithm and transmit the candidate set to the item agent.

[0094] In this embodiment, the execution agent (Action Agent) is the role of calling the recommendation algorithm and is also the core role of the framework. The main function is to obtain a candidate set of recommended items, using ChatGLM3 as the base.

[0095] In this embodiment, as shown in Figure 3 The running process of the item recommendation model based on the large language model agent framework in the recommendation scenario is as follows: the item agent processes the graphic and text information in the item metadata through the powerful ability of the multi-modal large language model, and converts the multi-modal information into a simple text description. The learning agent integrates the user's conversation history and existing interaction history information through Prompt engineering and thinking chain reasoning technology to obtain the user's preference portrait. The dialogue manager gives a recommendation scenario description by judging whether the user ID exists and the number of conversation rounds of the user in the recommendation system. The execution agent matches the recommendation algorithm API according to the recommendation scenario description, and runs the appropriate recommendation algorithm to obtain a preliminary candidate set of recommended item IDs. The item agent converts the item ID into an item description. The dialogue manager makes accurate recommendations based on the powerful ability of the large language model. The evaluation agent gives modification suggestions according to the user's feedback, and puts the modification suggestions into the memory module for more accurate personalized recommendation in the next recommendation.

[0096] The dialogue manager, evaluation agent, item agent, learning agent, and execution agent are all agents, and the composition of the agent includes role definition Prompt, large language model base, memory module Memory, and tools.

[0097] In this embodiment, the recommendation model based on the large language model agent framework is implemented in the manner of multiple large language models and multiple agents. One agent is actually a higher-level application of a large language model, including role definition Prompt, large language model base, memory module Memory, and tools. The tools are non-essential components.

[0098] The role definition Prompt is used to define the role of each Agent and specify the functions and behaviors of each Agent in the large language model-based recommendation model.

[0099] The large language model base provides the language understanding and generation capabilities of the Agent, supports the execution of the role definition Prompt and the update of the memory module Memory.

[0100] In this embodiment, the large language model base is the core of the Agent, providing natural language understanding and generation capabilities. Different Agents use different large language models as the base to adapt to their specific task requirements.

[0101] The memory module Memory is used to store and manage the conversation history and user information of the Agent, providing data support for the role definition Prompt.

[0102] In this embodiment, the memory module allows the Agent to store and retrieve past interaction information for use in subsequent conversations, which is crucial for maintaining contextual coherence and personalized recommendations.

[0103] The tool is used to execute tasks under the support of the large language model base according to the instructions of the Prompt, and update the memory module Memory.

[0104] In this embodiment, tools are optional components, but they can extend the capabilities of the Agent. For example, the Agent may use external APIs to obtain real-time data or use specific algorithms to process recommendation tasks.

[0105] In practical applications, each Agent may selectively implement the above components according to its role and task requirements. For example, an Agent focused on generating user profiles may focus more on the memory module and the large language model base, while an Agent responsible for calling recommendation algorithms may need to integrate specific tools to perform its tasks.

[0106] The interactive recommendation model implemented in this embodiment focuses more on the generality and practicality of the recommendation model, and has good interactivity and accuracy after deployment, use and performance testing.

[0107] Obtain several sets of user rating data and item metadata, and save all obtained user rating data and item metadata to the large language model-based recommendation model.

[0108] The user rating data includes: user ID, user name, user evaluated item ID, effective evaluation rate, evaluation text, evaluation timestamp, and evaluation time.

[0109] The item metadata includes: item ID, item description information, item price, picture path, item classification, item name, and item purchaser's browsing history or purchase history.

[0110] In this embodiment, the two datasets of Amazon Beauty and Amazon Clothing are used when the user already exists as training data for the subsequent recommendation algorithm. The Amazon dataset contains two types of data. One is Meta item metadata, which includes item ID, item description information, item price, picture path, item classification, item name, and those goods that the user who purchased the item has also browsed or purchased. The other is the user rating data set, which includes user ID, user name, user evaluated item ID, effective evaluation rate, evaluation text, evaluation timestamp, and evaluation time. In the user rating data set, a user can rate multiple goods. Using a self-written data set processing script, the user's item interaction sequence can be obtained by sorting the multiple goods rated by the user according to time. Each element of the item interaction sequence is an item ID.

[0111] For any user, according to the dialog input by the user, a recommendation model based on a large language model agent framework is used to recommend items to the user. If the user is not a new user, a fine-tuned ID-based collaborative filtering recommendation algorithm or a fine-tuned interaction history-based sequence recommendation algorithm is used to generate a recommendation result for the user; if the user is a new user, a recommendation algorithm based on content similarity retrieval is used to generate a recommendation result for the user.

[0112] The fine-tuning methods of the ID-based collaborative filtering recommendation algorithm and the interaction history-based sequence recommendation algorithm are the same, both of which are: for the pre-defined algorithm model in the ID-based collaborative filtering recommendation algorithm or the interaction history-based sequence recommendation algorithm, the user interaction history dataset path is specified and the pre-defined algorithm model name is modified to realize fine-tuning, and the weight of the fine-tuned algorithm model is saved.

[0113] In this embodiment, the ID-based collaborative filtering recommendation algorithm uses the LightGCN recommendation algorithm provided by RecBole. RecBole is a research-oriented, easy-to-develop and reproducible recommendation algorithm code library. Based on the LightGCN recommendation algorithm code and training framework provided by RecBole, the algorithm is fine-tuned, that is, the dataset path parameter and model name are added after the run.py file to directly fine-tune the model and obtain the weight after fine-tuning.

[0114] In this embodiment, the sequence recommendation algorithm based on the interaction history adopts the SASRec recommendation algorithm provided by RecBole. On the basis of the SASRec recommendation algorithm code and training framework provided by RecBole, the algorithm is fine-tuned, which is consistent with the method of fine-tuning the ID-based collaborative filtering recommendation algorithm, and the same data set is used. The difference is that the model parameter of run.py is changed to --model=SASRec.

[0115] After the user receives the recommendation result of the user, the user feedback is submitted to the recommendation model based on the large language model agent framework, and the recommendation model based on the large language model agent framework corrects the recommendation result of the user according to the user feedback, and re-recommends items for the user according to the correction result until the user is satisfied.

[0116] The process of using the recommendation model based on the large language model agent framework to recommend items for the user is:

[0117] The dialog content input by the user is obtained and text analysis is performed. When the dialog content is a recommendation demand, the recommendation model based on the large language model agent framework is switched to a recommendation scene.

[0118] The user ID of the user is obtained, and it is judged whether the user ID exists in the stored user rating data. If it exists, the user is a historical user, and the user rating data of the user is obtained. If it does not exist, the user is a new user, and the registration information of the user is obtained as the user rating data of the user.

[0119] A recommendation scene description is generated according to the user rating data of the user, the number of dialog rounds, the dialog content and the recommendation demand.

[0120] In this embodiment, the recommendation scene description usually contains the user ID, the current query or behavior of the user, such as the number of dialog rounds and the dialog content, the interests, preferences, historical behaviors, etc. of the user, the historical interaction records between the user and the system, such as clicks, ratings, purchases, etc., other context information, such as time, place, device type, etc. Environmental factors that may affect user preferences.

[0121] Text information and image information of each item are extracted from item metadata saved in the recommendation model based on the large language model agent framework, and the extracted text information and image information are respectively encoded. The encoded text feature representation and image feature representation are fused to generate an item portrait of each item.

[0122] All items that have interacted with the user are integrated according to the dialog interaction history of the user and the user rating data, and a user portrait is generated based on the item portraits of all items that have interacted with the user.

[0123] For historical users, a fine-tuned ID-based collaborative filtering recommendation algorithm or a fine-tuned interaction history-based sequence recommendation algorithm is used to generate a candidate set of recommendation results for the user according to the user rating data, the recommended scene description and the item portrait of the user; for new users, a content similarity retrieval-based recommendation algorithm is used to generate a candidate set of recommendation results for the user according to the user rating data, the recommended scene description and the item portrait of the user.

[0124] In the embodiment, the user representation based on the user ID is The recommendation algorithm for collaborative filtering is based on the user representation of the item ID interaction sequence The recommendation algorithm for sequence recommendation based on interaction history selects items in item metadata as a candidate set of item IDs for the content similarity retrieval-based recommendation algorithm.

[0125] The method of generating a candidate set of recommendation results for the user by using the fine-tuned ID-based collaborative filtering recommendation algorithm is:

[0126] The user interaction history dataset of the user is constructed according to the user rating data and the item metadata of the user.

[0127] The construction method of the user interaction history dataset is: according to the user rating data of the user, the interaction history of each item in the item metadata with the user is obtained, for any item, a user-item evaluation key-value pair is constructed with the user ID as the primary key and the interaction history of the user with the item as the value, and the user interaction history dataset of the user is constructed by using all user-item evaluation key-value pairs of all items with the user; wherein the interaction history is the effective evaluation rate or evaluation text of the user on the item.

[0128] In the embodiment, each row in the user interaction history dataset represents a user, and the user ID is unique, which is used to distinguish different users. The value in each row represents the interaction history of the user with the item, including the rating, purchase times, click times and the like of the user on each item.

[0129] Based on the user interaction history dataset of the user, an initial random embedding representation is assigned to the user and all items respectively.

[0130] The user embedding representation and the item embedding representation of all items are updated by iterating and weighted summing the initial random embedding representation of the user and all items.

[0131] The updating method of the user embedding representation is:

[0132]

[0133] wherein represents the updated user embedding representation; represents the iteration round; represents the user set of items interacted with; represents the number of items interacted with by the user ; represents the item embedding representation of the item under the current round; represents the set of users interacted with the item ; represents the number of users interacted with the item .

[0134] The updating method of the item embedding representation is:

[0135]

[0136] wherein represents the updated item embedding representation of the item ; represents the user embedding representation of the user under the current round.

[0137] According to the updated user embedding representation and the item embedding representation of all items, a rating matrix of the user is constructed.

[0138] The rating matrix is represented as:

[0139]

[0140] wherein represents the rating matrix of the user for all items; represents the user embedding representation; represents the item embedding representation of all items.

[0141] In the embodiment, the prediction part is to multiply the representations of the user and the item to obtain the rating matrix.

[0142] The items that have been evaluated by the user are removed from the obtained rating matrix, and the items are sorted in the order of the predicted ratings of the remaining items in the rating matrix from high to low to generate a candidate set of recommendation results.

[0143] The method for generating the candidate set of recommendation results for the user by using the fine-tuned interaction history-based sequence recommendation algorithm is:

[0144] The user's user score data is used to time-sort all the items that the user has evaluated, and the interaction sequence of the user and each item is generated respectively; wherein the elements in the interaction sequence are the user's interaction behaviors on the items.

[0145] In the present embodiment, the user's interaction sequence can include various forms of user interaction with items, such as clicking, purchasing, scoring, or browsing, etc. These interactions are used to capture the user's interests and preferences, so that the model can learn and predict other items that the user may be interested in.

[0146] The behavior sequence of the user is defined, denoted as:

[0147]

[0148] wherein represents the behavior sequence of the user; represents the interaction sequence of the user and the first item; represents the user; represents the interaction sequence of the user and the second item; represents the interaction sequence of the user and the last item; represents the length of the behavior sequence of the user.

[0149] wherein the length of the behavior sequence of the user is limited to n.

[0150] In the present embodiment, the behavior sequence is controlled to a suitable length n, which is 16 by default, indicating that a user has interacted with 16 items, and when there are more than 16 items, it is truncated, and when there are less than 16 items, it is padded.

[0151] Each item in the behavior sequence of the user is encoded for sequence encoding and position encoding, to generate a sequence Embedding representation and a position Embedding representation of the item, and the sequence Embedding representation and the position Embedding representation of the item are added to obtain sequence interaction information of the item.

[0152] The self-attention mechanism is used to learn the sequence interaction information, and the attention score of each item is calculated.

[0153] The function of the self-attention mechanism is represented as:

[0154]

[0155] wherein represents the attention score; is a query vector, used to represent the result obtained by multiplying the sequence interaction information and the query vector weight matrix; The key vector represents the result of multiplying the sequence interaction information with the key vector weight matrix. This is a value vector used to represent the result of multiplying the sequence interaction information with the value vector weight matrix; Indicates normalization; express and The similarity between them; Indicates the dimension size.

[0156] In this implementation, the query vector represents the current user's or item's query needs or interests; the key vector represents the features of each item in the sequence; and the value vector represents the actual information or embedding representation of each item in the sequence. The overall function representation of the self-attention mechanism means: for a given query vector... Calculate its relationship with all key vectors The correlation scores are then normalized using the softmax function, and finally the normalized scores are used to plot the value vector. The weighted summation yields a final output that is a weighted representation of each item in the sequence based on its relevance to the query vector.

[0157] For each item in the user's behavior sequence, generate an item embedding representation and calculate the relevance score for each item.

[0158] The relevance score for each item is expressed as follows:

[0159]

[0160] in Indicates the first The user on the first The relevance score of each item; Indicates the first The user in the first The function of a self-attention block, and It is dependent on The function; An interactive representation of the embedding for a single item; Indicates the first The item embedding is represented by an item.

[0161] Transform the user's behavior sequence into a user behavior sequence output, represented as:

[0162]

[0163] in Indicates the first Output the user behavior sequence of each user; Indicates filling; Indicates the fill value; No. User representation for each user; This represents the predicted user representation of the next user.

[0164] In this implementation, three cases are defined for the output of the user behavior sequence: when equal to fill value When, output This indicates that this part of the output is invalid. When, that is, within the effective length range of the sequence, the output is... , indicating the next user representation. When When the length equals the sequence length, output This represents the complete sequence of user actions.

[0165] The similarity between the user's user behavior sequence output and the item embedding representation of all items is calculated to predict the user's rating for each item. All items rated by the user are deleted, and a candidate set of recommendation results is generated based on the relevance scores and ratings of the remaining items.

[0166] The method for generating a candidate set of recommendation results for this user using a recommendation algorithm based on content similarity retrieval is as follows:

[0167] Construct a candidate set of item IDs using item metadata.

[0168] The method for constructing the candidate set of item IDs is as follows: For any item, obtain the item's product description information from the item's metadata, and encode the item's product description information using a text encoder to obtain the item's content representation. Using the item ID as the primary key, the item's contents are represented... Use the values ​​to construct the item representation key-value pairs for the item; construct a candidate set of item IDs using the item representation key-value pairs for all items.

[0169] In this embodiment, the recommendation algorithm based on content similarity retrieval relies on the user profile representation obtained from the contextual dialogue. Item representation in the candidate set of item IDs Recommendations are made based on the similarity between the pairs. The user portrait text description is obtained by a large language model according to the dialogue history through the method of the Prompt engineering, and then the user portrait is embedded by using a bge model. The format of the item ID candidate set is a key-value pair. The item description information is encoded by using a text encoder such as a bge model to obtain an item representation. The bge is an open-source embedding coding model proposed by the Beijing Institute of Artificial Intelligence.

[0170] The user portrait of the user is encoded by using a text encoder to generate a user portrait representation of the user .

[0171] The user portrait representation of the user and the content representation of each item in the item ID candidate set are used to calculate the similarity between the user and all items in the item ID candidate set.

[0172] The calculation method of the similarity is as follows:

[0173]

[0174] wherein represents the similarity between the user and the item; and Normalize represents normalization.

[0175] All items in the item ID candidate set are sorted in descending order of the similarity between the user and all items in the item ID candidate set, and the top P items in the sorting result are selected to generate a recommended result candidate set.

[0176]

[0177] wherein represents the output recommended result candidate set; represents the top P items in the sorting result.

[0178] The item ID in the recommended result candidate set is converted into an item description by using natural language generation technology, and the recommended result of the user is generated according to the user portrait and the item description and sent to the user.

[0179] The user feeds back the generated recommended result, and the recommended result of the user is corrected according to the user feedback until the user is satisfied.

[0180] In order to realize the universality of the recommendation framework and the recommendation method, the open-source large language model base needs to be expanded. The large language model base used in the development stage of the embodiment is shown in Table 1.

[0181] Table 1 Large language model base table

[0182]

[0183] This implementation uses the LangChain framework, specifically designed for building large language model applications. Based on LangChain, this implementation uses a unified deployment scheme for different large language models. The core idea of ​​this scheme is a client / server architecture, deploying the open-source LLM on the server side and providing an access interface as a custom API. For closed-source models like ChatGPT, the API is provided by the service provider. The middle layer is the component layer, which uses LangChain to customize the open API into a request-based access base and inherits from the LLM class. Users can use the recommendation system even without high-performance computing resources. The client is responsible for processing and packaging input data, verifying user qualifications, and customizing Prompt templates. This implementation uses Python as the development language, and RecBole, an easy-to-develop and reproducible recommendation algorithm code library for researchers, is used for fine-tuning the recommendation algorithm. Faiss, a library for efficient similarity search and clustering of dense vectors, is used for vector retrieval acceleration based on content similarity. The tool usage scheme is based on the Tsinghua ChatGLM3 large language model, which encapsulates the finely tuned recommendation algorithm into an API tool library. The large language model matches the most suitable recommendation algorithm based on the API description and recommendation scenario to obtain the recommendation result. The system front-end testing uses Streamlit, a Python toolkit for quickly generating interactive front-ends.

[0184] To facilitate understanding of this application, specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and embodiments. The following embodiments are illustrative of the invention but are not intended to limit its scope. Rather, these embodiments are provided to provide a more thorough and complete understanding of the disclosure of this application.

Claims

1. A multi-scenario conversational recommendation method based on a large language model proxy framework, characterized in that, This method includes the following steps: Construct a recommendation model based on a large language model proxy framework; Acquire several sets of user rating data and item metadata, and save all acquired user rating data and item metadata to a recommendation model based on a large language model agent framework; For any user, based on the dialogue input by the user, a recommendation model based on a large language model proxy framework is used to recommend items to the user. If the user is not a new user, a fine-tuned ID-based collaborative filtering recommendation algorithm or a fine-tuned interaction history-based sequence recommendation algorithm is used to generate recommendation results for the user. If the user is a new user, a recommendation algorithm based on content similarity retrieval will be used to generate recommendations for the user. The fine-tuning methods for the ID-based collaborative filtering recommendation algorithm and the interaction history-based sequence recommendation algorithm are the same: for the predefined algorithm model in the ID-based collaborative filtering recommendation algorithm or the interaction history-based sequence recommendation algorithm, fine-tuning is achieved by specifying the path of the user interaction history dataset and modifying the name of the predefined algorithm model, and the weight of the fine-tuned algorithm model is saved. After receiving the recommendation results from other users, the user submits feedback to the recommendation model based on the large language model proxy framework. The recommendation model based on the large language model proxy framework corrects the user's recommendations based on the feedback and then re-recommends items to the user based on the corrected results until the user is satisfied.

2. The multi-scenario conversational recommendation method based on a large language model proxy framework according to claim 1, characterized in that, The recommendation model based on the large language model agent framework includes: a dialogue manager, a judgment agent, an item agent, a learning agent, and an execution agent; wherein the dialogue manager, judgment agent, item agent, learning agent, and execution agent are all Agents. The dialogue manager is used to interact with users in a chat scenario. It decides whether to switch recommendation scenarios based on the user's input. If necessary, it uses the user's input as a recommendation requirement and switches to the recommendation scenario. If not, it uses the user's input as user feedback and transmits it to the evaluation agent. It generates a recommendation scenario description by determining whether the user ID exists, the user's dialogue rounds, and the recommendation requirements, and transmits it to the execution agent. It receives user profiles from the learning agent and item descriptions from the item agent, and generates recommendation results for the user based on the user profiles and item descriptions, and sends them to the user and the evaluation agent respectively. The evaluation agent is used to assess the difference between user feedback and user recommendation results, and to correct the user recommendation results based on the difference; The item agent is used to obtain item metadata and extract text and image information respectively. Then, the extracted text and image information are encoded respectively, and the encoded text feature representation and image feature representation are fused to generate an item profile and transmit it to the learning agent. Natural language generation technology is used to convert the item IDs in the recommendation result candidate set into item descriptions and transmit them to the dialogue manager. The learning agent is used to acquire the user's dialogue interaction history and user rating data, integrate all items that the user has interacted with from the user's dialogue interaction history and user rating data, generate a user profile based on the item profile, and then transmit the user profile to the dialogue manager; use the item profile to calculate the similarity between items and transmit it to the execution agent. The execution agent is used to select the recommendation algorithm to be invoked according to the recommendation scenario description, and generate a candidate set of recommendation results based on the similarity between items and transmit it to the item agent.

3. The multi-scenario conversational recommendation method based on a large language model proxy framework according to claim 2, characterized in that, The user rating data includes: user ID, username, item IDs rated by the user, valid rating rate, rating text, rating timestamp, and rating time; The item metadata includes: item ID, item description information, item price, image path, item category, item name, and the browsing or purchase history of the item buyer.

4. The multi-scenario conversational recommendation method based on a large language model proxy framework according to claim 3, characterized in that, The process of recommending items to the user using a recommendation model based on a large language model proxy framework is as follows: The system acquires and analyzes the dialogue content input by the user. When the dialogue content is related to a recommendation request, the recommendation model based on the large language model proxy framework is switched to the recommendation scenario. Obtain the user's user ID and determine if the user ID exists in the stored user rating data. If it exists, the user is a historical user, and the user rating data for that user is obtained. If it does not exist, the user is a new user, and the user's registration information is obtained and used as the user rating data for that user. Generate a recommendation scenario description based on the user's user rating data, number of conversation turns, and recommendation requirements; Text and image information of each item are extracted from the item metadata stored in the recommendation model based on the large language model agent framework. The extracted text and image information are then encoded separately, and the encoded text feature representations and image feature representations are fused to generate item profiles for each item. Based on the user's dialogue interaction history and user rating data, all items that the user has interacted with are integrated, and a user profile is generated based on the item profiles of all items that the user has interacted with. For historical users, a candidate set of recommendation results is generated for them based on their user rating data, recommendation scenario description, and item profile, using a fine-tuned ID-based collaborative filtering recommendation algorithm or a fine-tuned interaction history-based sequence recommendation algorithm; for new users, a candidate set of recommendation results is generated for them based on their user rating data, recommendation scenario description, and item profile, using a content similarity-based retrieval recommendation algorithm. Natural language generation technology is used to convert the item IDs in the candidate set of recommendation results into item descriptions, and the recommendation results for the user are generated based on the user profile and item descriptions and sent to the user. The user provides feedback on the generated recommendations, and the recommendations are revised based on the user's feedback. Then, the recommended items are re-recommended for the user based on the revised results, until the user is satisfied.

5. The multi-scenario conversational recommendation method based on a large language model proxy framework according to claim 4, characterized in that, The method for generating a candidate set of recommendation results for this user using a fine-tuned ID-based collaborative filtering recommendation algorithm is as follows: Construct a user interaction history dataset for the user based on the user rating data and item metadata; The method for constructing the user interaction history dataset is as follows: Based on the user's user rating data, obtain the interaction history between each item and the user in the item metadata. For any item, construct a user-item rating key-value pair with the user ID as the primary key and the user's interaction history with the item as the value. Then, construct the user's user interaction history dataset using all items and the user's user-item rating key-value pairs. The interaction history refers to the user's effective rating rate or rating text for the item. Based on the user's user interaction history dataset, assign an initial random embedding representation to the user and all items respectively; The user's embedding representation and all items' item embedding representations are updated by iterating and weighting the initial random embedding representations of the user and all items: Based on the updated user embedding and the item embeddings of all items, construct the user's rating matrix, as follows: ; in This represents a user rating matrix for all items. This represents the user's embedding. The item embedding represents all items; Remove items that the user has already rated from the obtained rating matrix, and sort the remaining items in the rating matrix in descending order of their predicted ratings to generate a candidate set of recommendation results.

6. The multi-scenario conversational recommendation method based on a large language model proxy framework according to claim 5, characterized in that, The update method for the user embedding representation is as follows: ; in This represents the updated user embedding. Indicates the iteration round; Indicates user An interactive collection of items; Indicates user The number of items interacted with; Indicates the items in the current round The item embedding is used to represent; Indicates with items A collection of interacting users; Represents items The number of users interacting; The method for updating the item embedding is as follows: ; in Represents items The updated item embedding representation; Indicates the user in the current round The user embedding indicates.

7. The multi-scenario conversational recommendation method based on a large language model proxy framework according to claim 6, characterized in that, The method for generating a candidate set of recommendation results for the user using a fine-tuned sequence recommendation algorithm based on interaction history is as follows: The user rating data is used to sort all the items rated by the user in chronological order, and an interaction sequence between the user and each item is generated; the elements in the interaction sequence are the user's interaction behaviors with the items. Define the user's sequence of actions as follows: ; in Represents a sequence of user actions; This represents the sequence of interactions between the user and the first item; Indicates user; This represents the sequence of interactions between the user and the second item; This represents the sequence of interactions between the user and the last item. Indicates the length of the user's action sequence; The length of the user's behavior sequence is limited to n; Each item in the user's behavior sequence is encoded using sequence encoding and location encoding to generate a sequence embedding representation and a location embedding representation for the item. The sequence embedding representation and the location embedding representation are then added together to obtain the item's sequence interaction information. A self-attention mechanism is used to learn sequential interaction information and calculate the attention score for each item; For each item in the user's behavior sequence, generate an item embedding representation and calculate the relevance score for each item; Transform the user's behavior sequence into the user's behavior sequence; The similarity between the user's user behavior sequence output and the item embedding representation of all items is calculated to predict the user's rating for each item. All items rated by the user are deleted, and a candidate set of recommendation results is generated based on the relevance scores and ratings of the remaining items.

8. The multi-scenario conversational recommendation method based on a large language model proxy framework according to claim 7, characterized in that, The relevance score for each item is expressed as follows: ; in Indicates the first The user on the first The relevance score of each item; Indicates the first The user in the first The function of a self-attention block, and It is dependent on The function; An interactive representation of the embedding for a single item; Indicates the first The item embedding is represented by an item.

9. The multi-scenario conversational recommendation method based on a large language model proxy framework according to claim 8, characterized in that, The user behavior sequence output is represented as follows: ; in Indicates the first Output the user behavior sequence of each user; Indicates filling; Indicates the fill value; No. User representation for each user; This represents the predicted user representation of the next user.

10. The multi-scenario conversational recommendation method based on a large language model proxy framework according to claim 9, characterized in that, The method for generating a candidate set of recommendation results for this user using a recommendation algorithm based on content similarity retrieval is as follows: Construct a candidate set of item IDs using item metadata; The method for constructing the candidate set of item IDs is as follows: For any item, obtain the item's product description information from the item's metadata, and encode the item's product description information using a text encoder to obtain the item's content representation. Using the item ID as the primary key, the item's contents are represented... Use the values ​​to construct the item representation key-value pairs for the item; construct a candidate set of item IDs using the item representation key-value pairs of all items; The user profile is encoded using a text encoder to generate a user profile representation. ; Using the user's user profile to represent Content representation of each item in the item ID candidate set Calculate the similarity between the user and all items in the candidate set of item IDs; The similarity is calculated as follows: ; in This indicates the similarity between users and items; Normalize indicates normalization. Sort all items in the item ID candidate set according to the similarity between the user and all items in the item ID candidate set from high to low, and select the top P items in the sorting results to generate a candidate set of recommendation results.

Citation Information

Patent Citations

  • Proxy-aware cross-domain sequence recommendation method and device, medium and product

    CN116881548A

  • Large model under Mindore framework and recommendation method

    CN117436480A