Content recommendation method and device, electronic equipment and storage medium
By generating user portraits and using large language models to perform explainable recommendation tasks, the problem that neural network models cannot provide reasons for personalized recommendations is solved, accurate recommendations and personalized explanations are achieved, and the user experience is improved.
Patent Information
- Application Number
- CN202510744592.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-05
- Publication Date
- 2025-09-26
AI Technical Summary
Existing neural network models cannot provide users with personalized recommendation reasons on online video platforms, and cannot accurately capture user intentions, resulting in reduced accuracy of recommendation results and reduced user trust.
By obtaining the user's historical behavior information and current query information, a user profile is generated, and a large language model is used to perform explainable recommendation tasks, determine the recommended content, and generate personalized recommendation reasons.
While accurately recommending content to users, it also provides users with personalized reasons for recommendations, enhancing users' trust and stickiness in the recommended content.
Smart Images

Figure CN120705352A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a content recommendation method, device, electronic device, and storage medium. Background Art
[0002] With the development of computer technology, conversational recommendation is becoming increasingly popular on online video platforms. For example, when a user enters a query into an online video platform, the platform generates a response based on the query and displays it to the user, thereby recommending videos.
[0003] With the rapid development of AI (Artificial Intelligence) in various fields, related technologies, such as the conversational recommendation system of online video platforms, use pre-trained neural network models to recommend videos based on user query information. Specifically, the user's query information is input into the neural network model, and the recommended video is directly output. In this case, the pre-trained neural network model is like a black box model.
[0004] However, because neural network models are pre-trained based on sample user queries and corresponding video tags, they lack the ability to reason and interpret. When using neural network models to recommend videos to users, they simply present recommendations without providing personalized reasons. Furthermore, neural network models cannot directly understand user input, making it difficult to accurately capture user intent, limiting the accuracy of recommendation results. Summary of the Invention
[0005] The purpose of the embodiments of the present invention is to provide a content recommendation method, apparatus, electronic device, and storage medium to accurately recommend content to users while providing personalized reasons for the recommendation. The specific technical solution is as follows:
[0006] In a first aspect of the present invention, a content recommendation method is provided, comprising:
[0007] Acquire the user's current query information, where the current query information includes the user's user ID;
[0008] Acquire content information of the content to be recommended; the content information of the content to be recommended is information used to describe the content to be recommended;
[0009] Based on the user identifier and the log data, determining whether the user has corresponding historical behavior information;
[0010] If the user has historical behavior information, the historical behavior information of the user is obtained, and based on the historical behavior information, the current query information, and the content information of the content to be recommended, the user preference of the user is predicted, so as to generate a user profile of the user by using the historical behavior information, the current query information, and the predicted user preference;
[0011] Based on the content information of the content to be recommended and the user portrait, a preset explainable recommendation task is called to determine the recommended content and generate a recommendation reason.
[0012] In a possible implementation, obtaining content information of the content to be recommended includes:
[0013] Obtaining the content to be recommended and the content description information corresponding to the content to be recommended from a preset database;
[0014] For each content to be recommended, the content description information and the first prompt word corresponding to the content to be recommended are input into the first language model to obtain the content information of the content to be recommended as output.
[0015] In a possible implementation, determining whether the user has corresponding historical behavior information based on the user identifier and log data includes:
[0016] Querying a preset log database, and determining whether the user has corresponding historical behavior information based on whether the user identifier has corresponding log information; the log database contains a correspondence between the user identifier and the log information;
[0017] When the user has historical behavior information, obtaining the historical behavior information of the user includes:
[0018] In the case where the user has historical behavior information, obtaining the target log corresponding to the user from the preset log database based on the user identifier;
[0019] The target log is classified using a pre-trained classification model, and logs belonging to a target category are extracted from the target log as historical behavior information based on the classification result.
[0020] In one possible implementation, the content information of the content to be recommended includes: the name of the content to be recommended, the historical behavior information includes viewing records, and the viewing records include the names of the viewed content. The predicting of the user's user preferences based on the historical behavior information, the current query information, and the content information of the content to be recommended, and generating a user profile of the user using the historical behavior information, the current query information, and the predicted user preferences, includes:
[0021] determining target content information corresponding to the viewed content included in the historical behavior information based on the name of the viewed content and the name of the content to be recommended;
[0022] Inputting the historical behavior information, the current query information, the target content information, and the second prompt word into a second language model to obtain an output first user preference;
[0023] A user profile of the user is generated based on the historical behavior information, the current query information, and the first user preference.
[0024] In one possible implementation, the content information of the content to be recommended includes: the name of the content to be recommended; the historical behavior information includes viewing records and search records, the viewing records include the name of the viewed content, and each viewing record and search record has a corresponding timestamp; the predicting of the user's user preferences based on the historical behavior information, the current query information, and the content information of the content to be recommended, and generating a user profile of the user using the historical behavior information, the current query information, and the predicted user preferences, includes:
[0025] Based on the timestamps corresponding to each viewing record and search record, respectively, determining long-term historical behavior information and short-term historical behavior information; the long-term historical behavior information and the short-term historical behavior information include the current query information;
[0026] Determining, based on the name of the viewed content and the name of the to-be-recommended content, first content information corresponding to the viewed content included in the long-term historical behavior information and second content information corresponding to the viewed content included in the short-term historical behavior information;
[0027] Inputting the long-term historical behavior information, the first content information, and the second prompt word into a second language model to obtain output long-term user preferences;
[0028] Inputting the short-term historical behavior information, the second content information, and the second prompt word into a second language model to obtain an output short-term user preference;
[0029] A user profile of the user is generated based on the long-term historical behavior information, the long-term user preferences, the short-term historical behavior information, and the short-term user preferences.
[0030] In a possible implementation, the calling of a preset explainable recommendation task based on the content information of the content to be recommended and the user profile, determining the recommended content and generating a recommendation reason includes:
[0031] The content information of the content to be recommended, the user portrait and the third prompt word are input into the third language model to perform a preset explainable recommendation task, and the output recommended content and recommendation reason are obtained.
[0032] In one possible implementation, the method further includes:
[0033] In the case that the user has no corresponding historical behavior information, a user portrait of the user is generated based on the current query information, or a user portrait of the user is generated based on the current query information and the content information of the content to be recommended.
[0034] In a possible implementation, generating a user profile of the user based on the current query information, or generating a user profile of the user based on the current query information and content information of the content to be recommended, includes:
[0035] Performing content identification on the current query information to determine whether the current query information contains the name of the query content;
[0036] When the current query information does not include the name of the query content, inputting the current query information and the second prompt word into the second language model to obtain an output second user preference;
[0037] generating a user profile of the user based on the current query information and the second user preference;
[0038] or,
[0039] When the current query information includes the name of the query content, determining third content information corresponding to the query content based on the name of the query content and the name of the content to be recommended;
[0040] Inputting the current query information, the third content information, and the second prompt word into a second language model to obtain an output third user preference;
[0041] A user profile of the user is generated based on the current query information and the third user preference.
[0042] In a second aspect of the present invention, a content recommendation device is provided, comprising:
[0043] A first acquisition module is used to acquire the current query information of the user, wherein the current query information includes the user ID of the user;
[0044] The second acquisition module is used to acquire content information of the content to be recommended; the content information of the content to be recommended is information used to describe the content to be recommended;
[0045] An information determination module, configured to determine whether the user has corresponding historical behavior information based on the user identifier and log data;
[0046] A first profile generation module is configured to obtain the historical behavior information of the user, if the user has historical behavior information, and predict the user preferences of the user based on the historical behavior information, the current query information, and the content information of the content to be recommended, so as to generate a user profile of the user by using the historical behavior information, the current query information, and the predicted user preferences;
[0047] The content recommendation module is used to call a preset explainable recommendation task based on the content information of the content to be recommended and the user portrait, determine the recommended content and generate a recommendation reason.
[0048] In another aspect of the present invention, an electronic device is provided, comprising a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0049] Memory for storing computer programs;
[0050] The processor is configured to implement any of the above-mentioned content recommendation methods when executing the program stored in the memory.
[0051] In another aspect of the present invention, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium. When the computer program is executed by a processor, any of the above-mentioned content recommendation methods is implemented.
[0052] In yet another aspect of the present invention, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any of the above-mentioned content recommendation methods.
[0053] The embodiments of the present invention provide a content recommendation method, device, electronic device, and storage medium. When a user has historical behavior information, the method obtains the user's historical behavior information and predicts the user's preferences based on the user's historical behavior information, the user's current query information, and the content information of the content to be recommended. The method generates a user profile of the user using the historical behavior information, current query information, and predicted user preferences. The generated user profile can accurately describe the user's behavior and preferences, so as to accurately recommend content to the user based on this. Furthermore, based on the obtained content information of the content to be recommended and the generated user profile, a preset explainable recommendation task can be called to determine the recommended content and generate a recommendation reason, thereby achieving the goal of accurately recommending content to the user while providing the user with personalized recommendation reasons. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for describing the embodiments or the prior art.
[0055] Figure 1 A schematic diagram of a flow chart of a content recommendation method according to an embodiment of the present invention;
[0056] Figure 2 Another flowchart of the content recommendation method according to an embodiment of the present invention is shown;
[0057] Figure 3 A schematic diagram of a method for generating a user portrait in an embodiment of the present invention;
[0058] Figure 4 Another schematic diagram of a method for generating a user portrait in an embodiment of the present invention;
[0059] Figure 5 A schematic diagram of user portrait generation according to an embodiment of the present invention;
[0060] Figure 6 This is a schematic diagram of content recommendation according to an embodiment of the present invention;
[0061] Figure 7 A schematic structural diagram of a content recommendation device according to an embodiment of the present invention;
[0062] Figure 8 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0063] The technical solutions in the embodiments of the present invention will be described below with reference to the accompanying drawings in the embodiments of the present invention.
[0064] Related technologies use black-box models, such as neural networks, to recommend videos based on user-entered query information. On one hand, because neural network models are pre-trained based on sample user queries and corresponding video tags, they lack the ability to reason and interpret. When using neural network models to recommend videos to users, they directly present recommendations without providing personalized reasons. This makes it difficult for users to understand how the recommended videos align with their needs, reducing their trust in the recommendations. On the other hand, neural network models cannot directly understand user input, resulting in an inability to accurately capture user intent during interaction with the user, limiting the accuracy of the recommendation results.
[0065] To accurately recommend content to users while providing personalized reasons for the recommendations, embodiments of the present invention provide a content recommendation method, apparatus, electronic device, and storage medium. The content recommendation method provided by embodiments of the present invention can be applied to content recommendation scenarios such as online and conversational recommendations, and can be applied to electronic devices, such as client devices and server devices, and content such as multimedia content.
[0066] The content recommendation method provided by the embodiment of the present invention is described in detail below:
[0067] like Figure 1 As shown, Figure 1 1 is a flow chart of a content recommendation method according to an embodiment of the present invention, which includes the following steps:
[0068] S101, obtaining the user's current query information;
[0069] The current query information includes the user ID of the user;
[0070] S102, obtaining content information of the content to be recommended;
[0071] The content information of the content to be recommended is information used to describe the content to be recommended;
[0072] S103, based on the user identifier and the log data, determining whether the user has corresponding historical behavior information;
[0073] S104, if the user has historical behavior information, obtain the user's historical behavior information, and predict the user's user preferences based on the historical behavior information, current query information, and content information of the content to be recommended, so as to generate a user profile of the user using the historical behavior information, current query information, and predicted user preferences;
[0074] S105: Based on the content information of the content to be recommended and the user portrait, a preset explainable recommendation task is called to determine the recommended content and generate a recommendation reason.
[0075] In an embodiment of the present invention, when a user has historical behavior information, the user's historical behavior information is obtained, and based on the user's historical behavior information, the user's current query information, and the obtained content information of the content to be recommended, the user's user preferences are predicted, so as to generate a user profile of the user using the historical behavior information, current query information, and predicted user preferences. The generated user profile can accurately describe the user's behavior and preferences, so as to accurately recommend content to the user based on this. Furthermore, based on the obtained content information of the content to be recommended and the generated user profile of the user, a preset explainable recommendation task can be called to determine the recommended content and generate a recommendation reason, thereby achieving the goal of accurately recommending content to the user while providing the user with personalized recommendation reasons.
[0076] The content recommendation method provided in the embodiments of the present invention is executed by an electronic device, which may be a client device or a server device. In the embodiments of the present invention, the content to be recommended is multimedia content or video content, and the application scenario is online recommendation. Of course, the content to be recommended may also be other content, such as literary works, and the application scenario may also be offline recommendation, and the present invention does not impose specific limitations on this.
[0077] Exemplarily, the content recommendation method provided in an embodiment of the present invention is applied to an online video platform, which is integrated in an electronic device and presented to users through an application program to interact with the users to recommend and watch online videos.
[0078] In step S101, a user enters a query into the electronic device's online recommendation platform. The electronic device (online recommendation platform) then retrieves the user's current query, which is the query currently being entered by the user and may include the user's user ID, query content, and query time. In one example, the electronic device's online recommendation platform integrates a recommendation system that implements content recommendations. The user ID may be information identifying the user, such as a name or code.
[0079] Taking multimedia content as an example, in the above step S102, the electronic device obtains content information of a preset number of multimedia contents from a preset content database. The content information of the multimedia contents may include the name, introduction, type, and characters related to the multimedia contents, etc., which are used to describe the multimedia contents. In an example, the introduction of the multimedia content may be an abstract of the multimedia content, or a summary of the text content of the multimedia content. The type of the multimedia content may be a TV series, a movie, or a short video, etc. When the multimedia content is film and television content, the type of the multimedia content may also be an emotional type, a suspense type, a comedy type, etc. The characters related to the multimedia content may be a director, a screenwriter, a leading actor, etc. The preset number can be set according to actual conditions. For example, the preset number of multimedia contents may be all the multimedia contents in the content database, or part of the multimedia contents, etc.
[0080] In the embodiment of the present invention, the order of step S101 and step S102 is not limited.
[0081] In step S103, if the user's current query information is obtained in step S101, the log data is queried based on the user ID included in the current query information to determine whether the user has any historical behavior information. The historical behavior information refers to the user's behavior information within a historical time period, such as the user's historical viewing history, historical search history, or query history.
[0082] If the user has historical behavior information, step S104 can obtain the user's historical behavior information from the log data. Then, based on the user's historical behavior information, current query information, and content information of the recommended content, the user's preferences are predicted to obtain the user's corresponding user preferences. The user's historical behavior information, current query information, and user preferences are then combined to generate a user profile that describes the user's behavior and preferences.
[0083] Furthermore, step S105 calls a preset explainable recommendation task based on the content information of the content to be recommended and the user profile of the user. The preset explainable recommendation task is performed, for example, by a pre-trained LLM (Large Language Model). Specifically, the pre-trained LLM performs the explainable recommendation task to recommend content and generate recommendation reasons, thereby determining the recommended content and generating personalized recommendation reasons corresponding to the user. Exemplarily, the pre-trained LLM can be pre-trained based on the content information of the sample content, the sample user profile, and the annotated recommendation results and annotated recommendation reasons.
[0084] LLM refers to a deep learning model trained using large amounts of text data. This model can generate natural language text or understand the meaning of language text. LLM performs well in a variety of application scenarios, such as text summarization, machine translation, sentiment analysis, dialogue generation, and content recommendation.
[0085] like Figure 2 As shown, Figure 2 FIG. 5 is another flow chart of a content recommendation method according to an embodiment of the present invention. The method includes the following steps:
[0086] S201, obtaining the user's current query information.
[0087] The current query information includes the user ID of the user.
[0088] S202: Obtain content to be recommended and content description information corresponding to the content to be recommended from a preset database.
[0089] In one example, the preset database may be a content database, which stores the content to be recommended, the identifier of the content to be recommended, and content description information corresponding to the content to be recommended. The content description information corresponding to the content to be recommended is information describing the content to be recommended, and may include, for example, the title of the content to be recommended, the release date / release date, the author / director, the actors / actresses, and the text content. For example, when the content to be recommended is a video, the text content is the plot text; when the content to be recommended is a literary work, the text content is a brief introduction to the work or the content of the work.
[0090] In an embodiment of the present invention, the electronic device can access a preset content database, and then obtain the content to be recommended and the content description information corresponding to the content to be recommended stored in the preset content database, and can also obtain the identifier of the content to be recommended and the content description information corresponding to the content to be recommended, etc.
[0091] S203 : For each content to be recommended, input the content description information and the first prompt word corresponding to the content to be recommended into the first language model to obtain output content information of the content to be recommended.
[0092] Among them, the first large language model is a first preset large language model, or a large language model trained based on the content description information of the sample content, the first sample prompt word, and the annotated content information corresponding to the content description information of the sample content. The first large language model is used to extract information from the content description information of the sample content under the guidance of the first sample prompt word.
[0093] In one example, the first preset large language model can be an open source model such as the Tongyi Qianwen large model or the Wenxin large model. The first large language model can also be a large language model obtained by fine-tuning the Tongyi Qianwen large model or the Wenxin large model.
[0094] The first prompt word and the first sample prompt word are the same, and are used to prompt the first language model to extract information from the content description information of the recommended content / sample content. For example, the first prompt word can be expressed as follows: based on the content description information of the recommended content, extract the name, type, and related characters of the recommended content, and summarize the text content of the recommended content to obtain a brief introduction. Similarly, the first sample prompt word can be expressed as follows: based on the content description information of the sample content, extract the name, type, and related characters of the sample content, and summarize the text content of the sample content to obtain a brief introduction.
[0095] The content information of the content to be recommended obtained includes: the name of the content to be recommended, the introduction of the content to be recommended, the characters related to the content to be recommended, and the type of the content to be recommended.
[0096] The first language model can better understand user input, and then extract content description information of the recommended content under the guidance of the first prompt word through the first language model, so as to quickly and accurately obtain the content information of the recommended content. Moreover, when the first language model is the first preset language model, there is no need to train the model again, which saves the time and cost of model training.
[0097] S204: query a preset log database and determine whether the user identifier has corresponding log information to determine whether the user has corresponding historical behavior information.
[0098] The log database contains the correspondence between the user ID and the log information. By querying the log database, it can be determined whether the user ID corresponds to the log information. If the user ID corresponds to the log information, it is determined that the user has the corresponding historical behavior information and the step S205 is executed. If the user ID does not correspond to the log information, it is determined that the user does not have the corresponding historical behavior information and the step S208 is executed.
[0099] S205 : In the case that the user has historical behavior information, a target log corresponding to the user is obtained from a preset log database based on the user identifier.
[0100] When the user has historical behavior information, it means that the user's current query is not the first query. At this time, based on the user ID, the correspondence between the user ID and the log information contained in the query log database is determined, the target log corresponding to the user ID is determined, and the target log is obtained from the log database, that is, the target log corresponding to the user is obtained.
[0101] S206 , classifying the target log using the pre-trained classification model, and extracting logs belonging to the target category from the target log as historical behavior information based on the classification result.
[0102] A log entry corresponds to a single user action. For example, logs can be categorized into viewing logs and search logs based on the type of user action. A viewing log can include the identifier of the content being viewed, the time it was viewed, and the duration of the viewing. A search log can include the searched content and the search time. The identifier of the content being viewed can be, for example, the title of the content being viewed.
[0103] In one example, the target log is input into a pre-trained classification model for classification to obtain a classification result. Further, based on the classification result, the target log belonging to the target category is determined as historical behavior information to obtain the user's historical behavior information. The pre-trained classification model is trained based on the sample logs and the annotation types corresponding to the sample logs. Exemplarily, the target category may be a viewing category and a search category, etc. The target logs corresponding to the target category are viewing logs and search logs, and the obtained user's historical behavior information may include viewing records and search records. A viewing record corresponds to a viewing log, and a search record corresponds to a search log. The viewing record includes the name of the content viewed, the viewing time, and the viewing duration, etc., and the search record includes the searched content and the search time, etc.
[0104] Through the correspondence between the user identification and log information contained in the log database, determine whether the user has corresponding historical behavior information. If the user has corresponding historical behavior information, obtain the log belonging to the target category from the log database as historical behavior information based on the user identification, so as to accurately generate a user portrait based on this.
[0105] S207, predicting the user's user preferences based on the historical behavior information, the current query information, and the content information of the content to be recommended, so as to generate a user profile of the user by using the historical behavior information, the current query information, and the predicted user preferences.
[0106] In one example, when the historical behavior information is a viewing history, the viewing history includes the name of the content viewed, and the obtained content information of the recommended content includes the name of the content to be recommended. Furthermore, based on the name of the content viewed in the viewing history, the content information of the target content to be recommended containing that name is determined. Then, based on the user's historical behavior information (viewing history), current query information, and content information of the target content to be recommended, the user's preferences are predicted to obtain the user's corresponding preferences. The user's historical behavior information, current query information, and user preferences are then combined to generate a user profile that describes the user's behavior and preferences.
[0107] S208 : When the user does not have corresponding historical behavior information, a user portrait of the user is generated based on the current query information, or a user portrait of the user is generated based on the current query information and content information of the content to be recommended.
[0108] In the case where the user has no corresponding historical behavior information, it means that the user's current query is the first query. At this time, content recognition can be used to further determine whether the current query information contains the name of the query content. In an example, an object recognition algorithm can be used to identify the objects contained in the current query information, and the similarity between the identified objects and the name of the content to be recommended is calculated. When the calculated similarity value is greater than a set threshold, it is determined that the identified object matches the name of the content to be recommended, that is, the current query information contains the name of the query content. Otherwise, it is determined that the current query information does not contain the name of the query content. The threshold can be set according to actual conditions, such as 0.9, 0.95 or 0.98.
[0109] If the current query information does not contain the name of the query content, the user's preferences are predicted directly based on the current query information to obtain the user's corresponding user preferences. The current query information and user preferences are then combined to generate a user profile that describes the user's behavior and preferences. If the current query information contains the name of the query content, the content information of the target content to be recommended that contains the query content name is determined based on the query content name contained in the current query information. Then, based on the current query information and the content information of the target content to be recommended, the user's preferences are predicted to obtain the user's corresponding user preferences. The current query information and user preferences are then combined to generate a user profile that describes the user's behavior and preferences.
[0110] In the case that the user has no corresponding historical behavior information, a user profile of the user is directly generated based on the current query information, or a user profile of the user is generated based on the current query information and the content information of the content to be recommended, so as to facilitate the subsequent use of the user profile to generate personalized recommendation reasons.
[0111] S209: Input the content information of the content to be recommended, the user portrait, and the third prompt word into the third language model to perform a preset explainable recommendation task, and obtain the output recommended content and recommendation reasons.
[0112] Among them, the third largest language model is a third preset large language model, or a large language model trained based on the content information of the sample content, the sample user portrait, the third sample prompt word, and the annotated recommendation results and annotated recommendation reasons. The third largest language model is used to determine the recommended content and generate the recommendation reasons under the guidance of the third sample prompt word. The third largest language model is used to perform the preset explainable recommendation task, which is to determine the recommended content and generate the recommendation reasons through the third largest language model under the guidance of the third prompt word. In other words, the third largest language model is trained based on the preset explainable recommendation task.
[0113] In one example, the third preset large language model can be an open source model such as the GET (General Expression Transformer) large model. The third large language model can also be a large language model obtained by fine-tuning the GET large model.
[0114] The third prompt is the same as the third sample prompt, and is used to prompt the third language model to determine recommended content and generate a recommendation reason. For example, the third prompt might be expressed as follows: determine recommended content for the user, output a recommendation reason based on the user profile, and sort the recommended content in descending order of similarity to the user profile. Similarly, the third sample prompt might be expressed as follows: determine recommended content for the user, output a recommendation reason based on the sample user profile, and sort the recommended content in descending order of similarity to the sample user profile.
[0115] The third language model can better understand the user's intention and the content to be recommended based on the user portrait and the content information of the content to be recommended, and then determine the recommended content and generate the recommendation reasons under the guidance of the third prompt word through the third language model. It can accurately recommend content to users and provide users with personalized recommendation reasons. Moreover, when the third language model is the third preset language model, there is no need to train the model again, saving the time and cost of model training.
[0116] In an embodiment of the present invention, if the user has historical behavior information, the user's historical behavior information is obtained, and based on the user's historical behavior information, the user's current query information, and the obtained content information of the content to be recommended, the user's user preferences are predicted, so as to generate a user profile of the user using the historical behavior information, current query information, and predicted user preferences. In addition, if the user does not have corresponding historical behavior information, the user's user profile is generated based on the current query information, or based on the current query information and the content information of the content to be recommended. The generated user profile can accurately describe the user's behavior and preferences, so as to accurately recommend content to the user based on this. Furthermore, based on the obtained content information of the content to be recommended and the generated user profile, a third language model can be used to perform a preset explainable recommendation task to determine the recommended content and generate a recommendation reason. This achieves the goal of accurately recommending content to the user while providing the user with personalized recommendation reasons, thereby enhancing the user's trust in the recommended content, and further guiding the user to watch the recommended content, thereby improving user stickiness.
[0117] In a possible implementation, the content information of the content to be recommended obtained above includes: the name of the content to be recommended, and the historical behavior information of the user obtained includes viewing records, and the viewing records include the name of the viewed content, such as Figure 3 As shown, the above step S207 predicts the user's user preferences based on the historical behavior information, the current query information, and the content information of the content to be recommended, so as to generate the user profile of the user by using the historical behavior information, the current query information, and the predicted user preferences. The implementation process may include:
[0118] S301 : Determine target content information corresponding to the viewed content included in the historical behavior information based on the name of the viewed content and the name of the content to be recommended.
[0119] The obtained content information of the recommended content includes the name of the recommended content, and the viewing history includes the name of the viewed content. Then, by calculating the similarity between the name of the viewed content and the name of each recommended content, the recommended content with a similarity value greater than a preset threshold is determined as the target recommended content. The content information of the target recommended content is then determined as the target content information corresponding to the viewed content included in the historical behavior information. The preset threshold can be set based on actual circumstances, for example, 0.9, 0.95, or 0.98.
[0120] For example, the name of the watched content is A, and the content information of the content to be recommended also includes the content to be recommended with the name A. The content information of the content to be recommended corresponding to the name A is determined as the target content information of the watched content A included in the user's historical behavior information.
[0121] S302: Input the historical behavior information, the current query information, the target content information, and the second prompt word into the second language model to obtain an output first user preference.
[0122] Exemplarily, the user's historical behavior information (viewing history), current query information, and target content information are spliced together as one input information, and the second prompt word is used as another input information and input into the second largest language model to obtain the first user preference output by the second largest language model under the guidance of the second prompt word.
[0123] Among them, the second largest language model is a second preset large language model, or a large language model trained based on the sample historical behavior information, the sample content information corresponding to the sample viewing content contained in the sample historical behavior information, the second sample prompt word, and the user's annotation preference corresponding to the sample historical behavior information. The second largest language model is used to predict the preference of the user corresponding to the sample historical behavior information under the guidance of the second sample prompt word.
[0124] In one example, the second preset large language model can be an open-source model such as the Tongyi Qianwen large model or the Wenxin large model. The second large language model can also be a large language model obtained by fine-tuning the Tongyi Qianwen large model or the Wenxin large model. The second preset large language model can be the same as or different from the first preset large language model.
[0125] The second prompt is the same as the second sample prompt and is used to prompt the second language model to predict the preferences of the user corresponding to the sample historical behavior information. For example, the second prompt can be expressed as: "Based on the user's historical behavior information, predict the user's preferences." Similarly, the second sample prompt can be expressed as: "Based on the sample historical behavior information, predict the preferences of the user corresponding to the sample historical behavior information." The second prompt can also be expressed as: "Based on the user's historical behavior information, predict the user's preferences and explain the reasons for the predicted preferences."
[0126] S303: Generate a user profile of the user based on historical behavior information, current query information, and the first user preference.
[0127] In one example, when the first user preference is obtained, the user's historical behavior information, current query information, and the first user preference are combined to generate a user profile of the user.
[0128] The generated user portrait can be expressed as structured text, for example: user's historical behavior information: viewing record 1 (name of viewing content: XXX, viewing time: a year a month a day a hour a minute a second, viewing duration: b minutes c seconds), viewing record 2...; current query information (query content: X, query time: d year d month d day d hour d minute d second); first user preference: XXXX.
[0129] In one possible implementation, the generated user portrait may also include a static portrait of the user, such as the user's identity information (age, gender, location, etc.), to facilitate a more detailed description of the user, and subsequently more accurately recommend content to the user and generate personalized recommendation reasons.
[0130] In an embodiment of the present invention, the user's historical behavior information, the target content information corresponding to the viewed content in the historical behavior information, the current query information, etc. are used as input so that the second language model can better understand the user and accurately predict the user's preferences, thereby facilitating more accurate content recommendations for the user and generating personalized recommendation reasons.
[0131] In a possible implementation, the content information of the content to be recommended obtained above includes: the name of the content to be recommended, the historical behavior information of the user obtained includes viewing records and search records, the viewing records include the name of the viewed content, and each viewing record and search record has a corresponding time stamp; Figure 4 As shown, the above step S207 predicts the user's user preferences based on the historical behavior information, the current query information, and the content information of the content to be recommended, so as to generate the user profile of the user by using the historical behavior information, the current query information, and the predicted user preferences. The implementation process may include:
[0132] S401 : Determine long-term historical behavior information and short-term historical behavior information based on the timestamp corresponding to each viewing record and search record.
[0133] In an embodiment of the present invention, a user's historical behavior information is divided into long-term historical behavior information and short-term historical behavior information based on time characteristics. For example, viewing and search records with timestamps belonging to a longer historical time period are determined as long-term historical behavior information, while viewing and search records with timestamps belonging to a shorter historical time period are determined as short-term historical behavior information. The longer historical time period may be, for example, one month, six months, or one year before the current time, and the shorter historical time period may be, for example, one day, three days, or one week before the current time.
[0134] Of course, a user's historical behavior information can also be divided into long-term historical behavior information and short-term historical behavior information based on data characteristics. For example, the 100, 200, or 300 historical behavior information items before the current moment can be considered long-term historical behavior information, while the 10, 20, or 30 historical behavior information items before the current moment can be considered short-term historical behavior information. In one example, the long-term historical behavior information can also be the user's entire historical behavior information.
[0135] The long-term historical behavior information and the short-term historical behavior information both contain the current query information.
[0136] S402 : Determine first content information corresponding to the viewed content included in the long-term historical behavior information and second content information corresponding to the viewed content included in the short-term historical behavior information based on the name of the viewed content and the name of the content to be recommended.
[0137] The implementation process of this step can refer to the implementation process of the above-mentioned step S301, and will not be described in detail in this embodiment of the present invention.
[0138] S403: Input the long-term historical behavior information, the first content information, and the second prompt word into the second language model to obtain output long-term user preferences.
[0139] S404: Input the short-term historical behavior information, the second content information, and the second prompt word into the second language model to obtain output short-term user preferences.
[0140] For example, the long-term historical behavior information (including long-term viewing history, long-term search history, and current query information) and the first content information are concatenated as one input, and the second prompt word is used as another input. These are fed into the second largest language model, and the long-term user preference output by the second largest language model under the guidance of the second prompt word is obtained. The long-term user preference reflects the user's long-term preferences.
[0141] Short-term historical behavior information (including short-term viewing history, short-term search history, and current query information) and the second content information are concatenated as one input, and the second prompt word is used as another input. These are fed into the second language model, and the second language model outputs short-term user preferences guided by the second prompt word. Short-term user preferences reflect the user's real-time preferences.
[0142] As above, the second largest language model is a second preset large language model, or a large language model trained based on the sample historical behavior information, the sample content information corresponding to the sample viewing content contained in the sample historical behavior information, the second sample prompt word, and the annotated preference of the user corresponding to the sample historical behavior information. The second largest language model is used to predict the preference of the user corresponding to the sample historical behavior information under the guidance of the second sample prompt word.
[0143] S405 , generating a user profile of the user based on the long-term historical behavior information, the long-term user preferences, the short-term historical behavior information, and the short-term user preferences.
[0144] In one example, long-term historical behavior information, long-term user preferences, short-term historical behavior information, and short-term user preferences are directly combined to generate a user profile.
[0145] The generated user portrait can be expressed as structured text, for example:
[0146] 1. User's long-term historical behavior information: viewing record 11 (title of viewed content: XXXXX, viewing time: aa year aa month aa day aa hour aa minute aa second, viewing duration: bb minute cc second), viewing record 12...; search record 11 (search content: XX, search time: dd year dd month dd day dd hour dd minute dd second); long-term user preference: XXXXXX;
[0147] 2. User's short-term historical behavior information: viewing record 21 (name of viewed content: Y, viewing time: aaa year aaa month aaa day aaa hour aaa minute aaa second, viewing duration: bbb minute ccc second), viewing record 22...; search record 21 (searched content: YY, search time: ddd year ddd month ddd day ddd hour ddd minute ddd second); short-term user preference: YYY.
[0148] In one possible implementation, the generated user portrait may also include a static portrait of the user, such as the user's identity information (age, gender, location, etc.), to facilitate a more detailed description of the user, and subsequently more accurately recommend content to the user and generate personalized recommendation reasons.
[0149] In an embodiment of the present invention, the user's historical behavior information is divided into long-term historical behavior information and short-term historical behavior information. The long-term historical behavior information is used to predict the user's long-term preferences, and the short-term historical behavior information is used to predict the user's real-time preferences, so as to more accurately describe the user's preferences, facilitate more accurate content recommendations for the user and generate personalized recommendation reasons.
[0150] For example, Figure 5 As shown, Figure 5 This is a schematic diagram of user profile generation according to an embodiment of the present invention. Based on time or data characteristics, a user's historical behavior information is divided into long-term historical behavior information and short-term historical behavior information. By combining the names of the viewed content contained in the viewing records of the long-term historical behavior information and the names of the to-be-recommended content contained in the content information of the to-be-recommended content, first content information corresponding to the viewed content contained in the long-term historical behavior information is determined. By combining the names of the viewed content contained in the viewing records of the short-term historical behavior information and the names of the to-be-recommended content contained in the content information of the to-be-recommended content, second content information corresponding to the viewed content contained in the short-term historical behavior information is determined.
[0151] The long-term historical behavior information, the first content information, and the second prompt word are input into the second language model to obtain the long-term user preferences output by the second language model under the guidance of the second prompt word. Furthermore, the short-term historical behavior information, the second content information, and the second prompt word are input into the second language model to obtain the short-term user preferences (real-time preferences) output by the second language model under the guidance of the second prompt word. The long-term historical behavior information, long-term user preferences, short-term historical behavior information, and short-term user preferences are then combined to generate a user profile for the user.
[0152] In a possible implementation, step S208 generates a user profile of the user based on the current query information, or generates a user profile of the user based on the current query information and content information of the content to be recommended, including:
[0153] Perform content recognition on the current query information to determine whether the current query information contains the name of the query content;
[0154] When the current query information does not include the name of the query content, the current query information and the second prompt word are input into the second language model to obtain the output second user preference;
[0155] Generate a user profile of the user based on the current query information and the second user's preferences;
[0156] or,
[0157] When the current query information includes the name of the query content, determining third content information corresponding to the query content based on the name of the query content and the name of the content to be recommended;
[0158] Inputting the current query information, the third content information, and the second prompt word into the second language model to obtain the output third user preference;
[0159] Generate a user profile of the user based on the current query information and third-party user preferences.
[0160] In an embodiment of the present invention, when the user does not have corresponding historical behavior information, a user profile of the user is directly generated based on the current query information, or a user profile of the user is generated based on the current query information and the content information of the content to be recommended, so as to facilitate the subsequent use of the user profile to generate personalized recommendation reasons.
[0161] For example, Figure 6 As shown, Figure 6 This is a schematic diagram of content recommendation according to an embodiment of the present invention. During the data processing phase, on the one hand, the content to be recommended and the corresponding content description information are obtained from a preset content database. For each piece of content to be recommended, the corresponding content description information and the first prompt word are input into a first language model, and the content information of the content to be recommended output by the first language model under the guidance of the first prompt word is obtained. On the other hand, the user's current query information is obtained, and a preset log database is queried. Based on whether the user identifier contained in the current query information corresponds to log information, it is determined whether the user has corresponding historical behavior information. If the user has corresponding historical behavior information, the user's historical behavior information is obtained.
[0162] Based on the user's historical behavior information (including current query information) and the content information of the content to be recommended, a user profile is generated to generate the user's user profile information. Then, based on the content information of the content to be recommended and the user profile information, the third language model ( Figure 6 The personalized explainable recommendation model (PMI) determines the recommended content and generates the reasoning for the recommendation, resulting in a recommendation result. The recommendation result includes the recommended content, the corresponding reasoning for the recommended content, and the recommendation match (the similarity between the recommended content and the user profile). This achieves accurate content recommendations for users while providing personalized recommendation reasons.
[0163] For example, the user's current query information is: "What movies and TV shows are worth watching recently?" The recommended content determined by the content recommendation method provided by the embodiment of the present invention is: recommended content 1-N, each of which corresponds to a recommendation reason and a recommendation match. Among them, the recommendation reason corresponding to recommended content 1 can be that the user has recently watched movies and TV shows of the same type, and the recommendation match is that the similarity between recommended content 1 and the user profile is 90%; the recommendation reason corresponding to recommended content 2 can be that the user has recently watched movies and TV shows directed by the same director, and the recommendation match is that the similarity between recommended content 2 and the user profile is 80%, and so on. This allows users to intuitively know whether the recommended content meets their needs based on the recommendation reasons, thereby improving users' trust in the recommendation results.
[0164] Corresponding to the above method embodiments, the embodiments of the present invention also provide corresponding device embodiments.
[0165] like Figure 7 As shown, an embodiment of the present invention provides a content recommendation device, which includes:
[0166] The first acquisition module 701 is used to obtain the user's current query information, which includes the user's user ID;
[0167] The second acquisition module 702 is used to acquire content information of the content to be recommended; the content information of the content to be recommended is information used to describe the content to be recommended;
[0168] An information determination module 703 is used to determine whether the user has corresponding historical behavior information based on the user identifier and log data;
[0169] A first profile generation module 704 is configured to obtain the user's historical behavior information if the user has historical behavior information, and predict the user's user preferences based on the historical behavior information, current query information, and content information of the content to be recommended, thereby generating a user profile for the user using the historical behavior information, current query information, and predicted user preferences;
[0170] The content recommendation module 705 is used to call a preset explainable recommendation task based on the content information of the content to be recommended and the user portrait, determine the recommended content and generate the recommendation reason.
[0171] In a possible implementation, the second obtaining module 702 is specifically configured to:
[0172] Obtaining the content to be recommended and the content description information corresponding to the content to be recommended from a preset database;
[0173] For each content to be recommended, the content description information and the first prompt word corresponding to the content to be recommended are input into the first language model to obtain the content information of the content to be recommended as output.
[0174] In a possible implementation, the information determination module 703 is specifically configured to query a preset log database and determine whether the user has corresponding historical behavior information based on whether the user identifier has corresponding log information; the log database contains a correspondence between the user identifier and the log information;
[0175] The first portrait generation module 704 is specifically configured to:
[0176] If the user has historical behavior information, the target log corresponding to the user is obtained from the preset log database based on the user ID;
[0177] The target logs are classified using a pre-trained classification model, and logs belonging to the target category are extracted from the target logs as historical behavior information based on the classification results.
[0178] In a possible implementation, the content information of the content to be recommended includes: the name of the content to be recommended; the historical behavior information includes viewing records, and the viewing records include the name of the viewed content; the first portrait generation module 704 is specifically configured to:
[0179] Determining target content information corresponding to the viewed content included in the historical behavior information based on the name of the viewed content and the name of the content to be recommended;
[0180] Inputting historical behavior information, current query information, target content information, and the second prompt word into the second language model to obtain the output of the first user preference;
[0181] Generate a user profile of the user based on historical behavior information, current query information and first user preferences.
[0182] In one possible implementation, the content information of the content to be recommended includes: the name of the content to be recommended; the historical behavior information includes viewing records and search records, the viewing records include the name of the viewed content, and each viewing record and search record has a corresponding timestamp; the first portrait generation module 704 is specifically configured to:
[0183] Based on the timestamps corresponding to each viewing record and search record, long-term historical behavior information and short-term historical behavior information are determined respectively; the long-term historical behavior information and short-term historical behavior information include current query information;
[0184] Determining, based on the name of the viewed content and the name of the content to be recommended, first content information corresponding to the viewed content included in the long-term historical behavior information and second content information corresponding to the viewed content included in the short-term historical behavior information;
[0185] Inputting the long-term historical behavior information, the first content information, and the second prompt word into the second language model to obtain the output long-term user preference;
[0186] Inputting the short-term historical behavior information, the second content information, and the second prompt word into the second language model to obtain the output short-term user preference;
[0187] Generate user profiles based on long-term historical behavior information, long-term user preferences, short-term historical behavior information, and short-term user preferences.
[0188] In a possible implementation, the content recommendation module 705 is specifically configured to:
[0189] The content information, user portrait and third prompt word of the content to be recommended are input into the third language model to perform the preset explainable recommendation task, and the output recommended content and recommendation reasons are obtained.
[0190] In a possible implementation, the above device further includes:
[0191] The second portrait generation module is used to generate a user portrait of the user based on the current query information when the user has no corresponding historical behavior information, or to generate a user portrait of the user based on the current query information and content information of the content to be recommended.
[0192] In a possible implementation, the second portrait generation module is specifically configured to:
[0193] Perform content recognition on the current query information to determine whether the current query information contains the name of the query content;
[0194] When the current query information does not include the name of the query content, the current query information and the second prompt word are input into the second language model to obtain the output second user preference;
[0195] Generate a user profile of the user based on the current query information and the second user's preferences;
[0196] or,
[0197] When the current query information includes the name of the query content, determining third content information corresponding to the query content based on the name of the query content and the name of the content to be recommended;
[0198] Inputting the current query information, the third content information, and the second prompt word into the second language model to obtain the output third user preference;
[0199] Generate a user profile of the user based on the current query information and third-party user preferences.
[0200] The embodiment of the present invention further provides an electronic device, such as Figure 8 As shown, it includes a processor 801, a communication interface 802, a memory 803 and a communication bus 804, wherein the processor 801, the communication interface 802, and the memory 803 communicate with each other through the communication bus 804.
[0201] Memory 803, used to store computer programs
[0202] The processor 801 is configured to implement the steps of any of the above method embodiments when executing the program stored in the memory 803 to achieve the same technical effect.
[0203] The communication bus mentioned in the terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.
[0204] The communication interface is used for communication between the above terminal and other devices.
[0205] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.
[0206] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
[0207] In another embodiment provided by the present invention, a computer-readable storage medium is also provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the method embodiments described in the above embodiments are implemented to achieve the same technical effect.
[0208] In another embodiment provided by the present invention, a computer program product containing instructions is also provided. When the computer program product is run on a computer, the computer executes the steps of any of the method embodiments described in the above embodiments to achieve the same technical effect.
[0209] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0210] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0211] Each embodiment in this specification is described in a related manner. Similar portions between the various embodiments can be referenced to each other. Each embodiment focuses on the differences from other embodiments. In particular, the device / electronic device embodiments are generally similar to the method embodiments, so their description is relatively simple. For related portions, reference can be made to the description of the method embodiments.
[0212] The above description is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention are included in the scope of protection of the present invention.
Claims
1. A content recommendation method, characterized in that: The method comprises: Acquire the user's current query information, where the current query information includes the user's user ID; Acquire content information of the content to be recommended; the content information of the content to be recommended is information used to describe the content to be recommended; Based on the user identifier and the log data, determining whether the user has corresponding historical behavior information; If the user has historical behavior information, the historical behavior information of the user is obtained, and based on the historical behavior information, the current query information, and the content information of the content to be recommended, the user preference of the user is predicted, so as to generate a user profile of the user by using the historical behavior information, the current query information, and the predicted user preference; Based on the content information of the content to be recommended and the user portrait, a preset explainable recommendation task is called to determine the recommended content and generate a recommendation reason.
2. The method according to claim 1, characterized in that The step of obtaining content information of the content to be recommended includes: Obtaining the content to be recommended and the content description information corresponding to the content to be recommended from a preset database; For each content to be recommended, the content description information and the first prompt word corresponding to the content to be recommended are input into the first language model to obtain the content information of the content to be recommended as output.
3. The method according to claim 1, characterized in that The determining, based on the user identifier and the log data, whether the user has corresponding historical behavior information includes: Querying a preset log database, and determining whether the user has corresponding historical behavior information based on whether the user identifier has corresponding log information; the log database contains a correspondence between the user identifier and the log information; When the user has historical behavior information, obtaining the historical behavior information of the user includes: In the case where the user has historical behavior information, obtaining the target log corresponding to the user from the preset log database based on the user identifier; The target log is classified using a pre-trained classification model, and logs belonging to a target category are extracted from the target log as historical behavior information based on the classification result.
4. The method according to claim 1, wherein The content information of the content to be recommended includes: the name of the content to be recommended; the historical behavior information includes a viewing record, and the viewing record includes the name of the viewed content; and predicting the user preference of the user based on the historical behavior information, the current query information, and the content information of the content to be recommended, so as to generate a user profile of the user by using the historical behavior information, the current query information, and the predicted user preference, including: determining target content information corresponding to the viewed content included in the historical behavior information based on the name of the viewed content and the name of the content to be recommended; Inputting the historical behavior information, the current query information, the target content information, and the second prompt word into a second language model to obtain an output first user preference; A user profile of the user is generated based on the historical behavior information, the current query information, and the first user preference.
5. The method according to claim 1, wherein The content information of the content to be recommended includes: the name of the content to be recommended, the historical behavior information includes viewing records and search records, the viewing records include the name of the viewed content, and each viewing record and search record has a corresponding timestamp; the user preferences of the user are predicted based on the historical behavior information, the current query information, and the content information of the content to be recommended, so as to generate a user profile of the user by using the historical behavior information, the current query information, and the predicted user preferences, including: Based on the timestamps corresponding to each viewing record and search record, respectively, determining long-term historical behavior information and short-term historical behavior information; the long-term historical behavior information and the short-term historical behavior information include the current query information; Determining, based on the name of the viewed content and the name of the to-be-recommended content, first content information corresponding to the viewed content included in the long-term historical behavior information and second content information corresponding to the viewed content included in the short-term historical behavior information; Inputting the long-term historical behavior information, the first content information, and the second prompt word into a second language model to obtain output long-term user preferences; Inputting the short-term historical behavior information, the second content information, and the second prompt word into a second language model to obtain an output short-term user preference; A user profile of the user is generated based on the long-term historical behavior information, the long-term user preferences, the short-term historical behavior information, and the short-term user preferences.
6. The method according to claim 1, characterized in that The step of calling a preset explainable recommendation task based on the content information of the content to be recommended and the user profile, determining the recommended content and generating a recommendation reason includes: The content information of the content to be recommended, the user portrait and the third prompt word are input into the third language model to perform a preset explainable recommendation task, and the output recommended content and recommendation reason are obtained.
7. The method according to any one of claims 1 to 6, characterized in that The method further comprises: In the case that the user has no corresponding historical behavior information, a user portrait of the user is generated based on the current query information, or a user portrait of the user is generated based on the current query information and the content information of the content to be recommended.
8. The method according to claim 7, characterized in that Generating the user portrait of the user based on the current query information, or generating the user portrait of the user based on the current query information and the content information of the content to be recommended, includes: Performing content identification on the current query information to determine whether the current query information contains the name of the query content; When the current query information does not include the name of the query content, inputting the current query information and the second prompt word into the second language model to obtain an output second user preference; generating a user profile of the user based on the current query information and the second user preference; or, When the current query information includes the name of the query content, determining third content information corresponding to the query content based on the name of the query content and the name of the content to be recommended; Inputting the current query information, the third content information, and the second prompt word into a second language model to obtain an output third user preference; A user profile of the user is generated based on the current query information and the third user preference.
9. A content recommendation device, characterized in that: The device comprises: A first acquisition module is used to acquire the current query information of the user, wherein the current query information includes the user ID of the user; The second acquisition module is used to acquire content information of the content to be recommended; the content information of the content to be recommended is information used to describe the content to be recommended; An information determination module, configured to determine whether the user has corresponding historical behavior information based on the user identifier and log data; A first profile generation module is configured to obtain the historical behavior information of the user, if the user has historical behavior information, and predict the user preferences of the user based on the historical behavior information, the current query information, and the content information of the content to be recommended, so as to generate a user profile of the user by using the historical behavior information, the current query information, and the predicted user preferences; The content recommendation module is used to call a preset explainable recommendation task based on the content information of the content to be recommended and the user portrait, determine the recommended content and generate a recommendation reason.
10. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory for storing computer programs; A processor, configured to implement the method according to any one of claims 1 to 8 when executing a program stored in a memory.
11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.