Intelligent dialogue method, device, computer equipment, storage medium and product
By fine-tuning training of pre-trained large language models, the emotional intent recognition model and target reply model are constructed, which solves the problem that dialogue intent recognition model training relies on a large amount of labeled data in the existing technology, and realizes efficient recognition and reply under the limited sample size.
Patent Information
- Application Number
- CN202411660262.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-04-01
AI Technical Summary
When training the dialogue intention recognition model, existing dialogue systems need to have a large amount of labeling data, resulting in the data labeling consumes a lot of resources, and the accuracy of model recognition depends on the scale of labeling data. When the scale of labeling data is small, the recognition effect is poor.
The pre-trained large language model is fine-tuned and trained, and the emotional intent recognition model and the target reply model are constructed, and the corresponding emotional intent categories and reply content are generated using the target sample set and historical dialogue data.
The training effect of the emotional intention recognition model in scenarios with limited sample size is improved, the accuracy of emotional intention recognition and the degree of matching reply content with interactive data is improved, thus improving the dialogue effect.
Smart Images

Figure CN119739817A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of artificial intelligence technology, and in particular to an intelligent dialogue method, apparatus, computer equipment, storage medium and product. Background Art
[0002] With the popularization of the Internet and online social media, people are communicating more and more through online platforms. If the same user receives many communication requests and is unable to reply one by one, the automatic reply function provided by the dialogue system can be used to achieve automatic reply. Therefore, the dialogue system needs to be able to understand the user's dialogue intention and make adaptive replies based on the understood dialogue intention.
[0003] The dialogue system can identify the user's intention based on the dialogue intention recognition model of machine learning; however, in the related technology, when training the dialogue intention recognition model, it is usually necessary to use massive labeled data to train the model. The data labeling operation often requires a lot of manpower and resources, and the accuracy of the model in identifying the user's intention depends on the scale of the labeled data. When the scale of the labeled data is small, the model's recognition effect on the dialogue intention is poor, which in turn makes the dialogue effect poor. Summary of the invention
[0004] The embodiments of the present application provide an intelligent dialogue method, apparatus, computer equipment, storage medium and product, which can improve the recognition effect of dialogue intention and thus improve the dialogue effect. The technical solution is as follows.
[0005] In one aspect, an intelligent dialogue method is provided, the method comprising: Obtain the interaction data received by the target user; Identify the emotional intent category of the interaction data through an emotional intent recognition model; the emotional intent recognition model is obtained by fine-tuning a pre-trained large language model through a target sample set, wherein the target sample set is constructed based on dialogue samples of various emotional intent categories, and each dialogue sample has a corresponding emotional intent category label; A target reply model corresponding to the emotional intention category of the interactive data is called to generate reply content corresponding to the interactive data.
[0006] In another aspect, an intelligent dialogue device is provided, the device comprising: A first acquisition module, used to acquire the interaction data received by the target user; An intention recognition module, used to identify the emotional intent category of the interaction data through an emotional intent recognition model; the emotional intent recognition model is obtained after fine-tuning a pre-trained large language model through a target sample set, the target sample set is constructed based on dialogue samples of various emotional intent categories, each dialogue sample has a corresponding emotional intent category label; The reply generation module is used to call a target reply model corresponding to the emotional intention category of the interactive data to generate reply content corresponding to the interactive data.
[0007] In one possible implementation, the emotional intent includes a first intent category indicating daily chatting and a second intent category indicating professional advice.
[0008] In a possible implementation, the reply generation module is used to: In the case where the emotional intention category of the interaction data is the first intention category, a daily chat model is called to generate reply content corresponding to the interaction data; the daily chat model is obtained after fine-tuning the pre-trained large language model through the first sample set; the first sample set is constructed based on conversation samples with daily chat labels; in the case where the emotional intention category of the interaction data is the second intention category, a professional advice model is called to generate reply content corresponding to the interaction data; the professional advice model is obtained after fine-tuning the pre-trained large language model through the second sample set; the second sample set is constructed based on conversation samples with professional advice labels and professional knowledge data.
[0009] In a possible implementation manner, the device further includes: A second acquisition module is used to acquire original data, where the original data is a conversation sample with an emotional intent category label or professional knowledge data with an emotional intent category label; The data processing module is used to format the original data to obtain formatted sample data in a sample set, each sample data having a task description, input content and output content; the sample set includes a first sample set, a second sample set or the target sample set.
[0010] In a possible implementation, the reply generation module is used to: Based on the emotional intention type of the interactive data, calling the target reply model of the target user corresponding to the emotional intention type to generate reply content corresponding to the interactive data; The conversation samples used to train the target response model of the target user include the historical conversation data of the target user.
[0011] In a possible implementation, among the conversation samples used to train the target response model of the target user, the proportion of conversation samples derived from the historical conversation data of the target user is higher than a target proportion threshold.
[0012] On the other hand, a computer device is provided, which includes a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the above-mentioned intelligent dialogue method.
[0013] On the other hand, a computer-readable storage medium is provided, in which at least one computer program is stored. The computer program is loaded and executed by a processor to implement the above-mentioned intelligent dialogue method.
[0014] On the other hand, a computer program product is provided, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions, which, when executed by a computer, cause the computer to execute to implement the intelligent dialogue method provided in the above-mentioned various optional implementations.
[0015] The technical solution provided by this application may have the following beneficial effects: The intelligent dialogue method provided in the embodiment of the present application obtains the interaction data received by the target user, identifies the interaction data based on the emotion intent recognition model obtained after fine-tuning the large language model pre-trained with the target sample set, obtains the emotion intent category of the interaction data, and then calls the target reply model corresponding to the emotion intent to generate reply content corresponding to the interaction data, wherein the target sample set is constructed based on dialogue samples of various emotion intent categories; through the above method, the training effect of the emotion intent recognition model in scenarios with limited sample size can be improved, and the accuracy of emotion intent recognition can be improved; in addition, calling the corresponding reply model based on the recognized emotion intent to generate reply content can improve the matching degree between the reply content and the interaction data, thereby improving the dialogue effect.
[0016] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0018] Figure 1 A flowchart of an intelligent dialogue method provided by an exemplary embodiment of the present application is shown; Figure 2A flowchart of another intelligent dialogue method provided by an exemplary embodiment of the present application is shown; Figure 3 A schematic diagram of an intelligent dialogue method provided by an exemplary embodiment of the present application is shown; Figure 4 A block diagram of an intelligent dialogue device provided by an exemplary embodiment of the present application is shown; Figure 5 A structural block diagram of a computer device shown in an exemplary embodiment of the present application is shown; Figure 6 A structural block diagram of a computer device shown in an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0019] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0020] In order to improve the accuracy of intention recognition in the emotional field vertical category when the scale of labeled data is small, thereby improving the effect of intelligent dialogue in the emotional field, the embodiment of the present application provides an intelligent dialogue method, Figure 1 A flowchart of an intelligent dialogue method provided by an exemplary embodiment of the present application is shown. The method can be executed by a computer device, and the computer device can be implemented as a server or a terminal, such as Figure 1 As shown, the method may include the following steps.
[0021] Step 110: Acquire the interaction data received by the target user.
[0022] In an embodiment of the present application, the target user may be a content producing user; the target user may receive interactive data sent by other interactive users through an interactive platform, and the interactive platform may be a platform with user interactive communication functions. Schematically, the interactive platform may be a social platform, an audio and video platform, a shopping platform, etc. The present application does not limit the type of interactive platform.
[0023] The interactive data received by the target user may be sent by the interactive user based on the target user's output content; the interactive data may be text messages, voice input, emoticons, image information, etc. This application does not limit the type of interactive data.
[0024] Step 120, identifying the emotional intent category of the interactive data through an emotional intent recognition model; the emotional intent recognition model is obtained after fine-tuning a pre-trained large language model through a target sample set, and the target sample set is constructed based on dialogue samples of various emotional intent categories, and each dialogue sample has a corresponding emotional intent category label.
[0025] In an embodiment of the present application, a computer device can use a pre-trained large language model as a basic model, and fine-tune the pre-trained large language model based on dialogue samples with emotion intent category labels, so that the trained emotion intent recognition model is suitable for emotion intent category recognition in the emotion field; by performing fine-tuning training on the basis of the existing large language model, in terms of training samples, the sample size required for model training can be reduced, the sample annotation amount can be reduced, and the resource consumption required for sample annotation can be reduced. In terms of training effect, an emotion intent recognition model suitable for the emotion field can be obtained, and the accuracy of emotion intent recognition can be improved while improving the model training efficiency.
[0026] The emotional intent category label may be the current emotion of the user corresponding to the conversation sample, such as joy, anger, sadness, etc.; or the emotional intent category label may be the purpose of the user corresponding to the conversation sample sending the interactive data. In the embodiment of the present application, the emotional intent category label is taken as an example to illustrate the purpose of the user corresponding to the conversation sample sending the interactive data.
[0027] Step 130: Calling a target reply model corresponding to the emotional intent category of the interactive data to generate reply content corresponding to the interactive data.
[0028] In an embodiment of the present application, corresponding reply models can be set corresponding to different emotion intention categories. After obtaining the emotion intention category of the interaction data, the interaction data is input into the target reply model corresponding to the emotion intention category, and the target reply model outputs the reply content corresponding to the interaction data. This can make the generated reply content more in line with the interaction requirements of the interaction data, thereby further improving the interaction effect.
[0029] Furthermore, the computer device may feed back the reply content of the generated interactive data to the user who sent the interactive data (ie, the interactive user).
[0030] To summarize, the intelligent dialogue method provided in the embodiment of the present application obtains the interaction data received by the target user, identifies the interaction data based on the emotion intent recognition model obtained after fine-tuning the large language model pre-trained with the target sample set, obtains the emotion intent category of the interaction data, and then calls the target reply model corresponding to the emotion intent to generate reply content corresponding to the interaction data, wherein the target sample set is constructed based on dialogue samples of various emotion intent categories; through the above method, the training effect of the emotion intent recognition model in scenarios with limited sample size can be improved, and the accuracy of emotion intent recognition can be improved; in addition, calling the corresponding reply model based on the recognized emotion intent to generate reply content can improve the matching degree between the reply content and the interaction data, thereby improving the dialogue effect.
[0031] In a possible implementation, the emotional intent category includes a first intent category indicating daily chat and a second intent category indicating professional advice, and a corresponding reply model is pre-trained for each emotional intent category; based on this, Figure 2 A flowchart of another intelligent dialogue method provided by an exemplary embodiment of the present application is shown. The method can be executed by a computer device, and the computer device can be implemented as a server or a terminal, such as Figure 2 As shown, the method may include the following steps.
[0032] Step 210: Acquire the interaction data received by the target user.
[0033] In a possible implementation, the interaction data may include at least one of the following: comment data, message data, or private message data.
[0034] Step 220, identifying the emotional intent category of the interactive data through an emotional intent recognition model; the emotional intent recognition model is obtained after fine-tuning a pre-trained large language model through a target sample set, and the target sample set is constructed based on dialogue samples of various emotional intent categories, and each dialogue sample has a corresponding emotional intent category label.
[0035] In one possible implementation, conversation samples for training an emotion intent recognition model are generated based on historical conversation data, which may include historical interaction data sent by interactive users and reply data of content publishing users based on the historical interaction data. On an interactive platform, the content published by content producing users presents diversity and complexity, and content producing users are classified based on the types of content published by them, and each content producing user is assigned a corresponding user label. In order to train an emotion intent recognition model adapted to the emotion domain, when acquiring conversation samples, a computer device may acquire historical conversation data corresponding to content producing users whose user labels indicate that they belong to the emotion domain, so as to generate conversation samples based on this.
[0036] Furthermore, the computer device can also screen content-producing users belonging to the emotional field, for example, screening content-producing users based on the number of followers, or screening content-producing users based on the proportion of emotional content in the published content, so as to ensure that the content-producing users have a high correlation with the emotional field, thereby ensuring the correlation between the collected historical conversation data and the emotional field; when acquiring historical conversation data, the computer device can acquire a certain amount of historical conversation data in the recent period of time, wherein the acquisition time period and acquisition quantity of the historical conversation data can be set based on actual needs, and the present application does not impose any restrictions on this.
[0037] After obtaining the historical conversation data, the emotional intent category labels are annotated by manual or automatic annotation to obtain conversation samples with emotional intent category labels; among them, the conversation samples with daily chat labels are interactive chats based on the daily problems of interactive users or content that conforms to the emotions of interactive users; the conversation samples with professional advice labels are questions and answers in professional fields, such as questions and answers on emotional issues, constellation issues, etc.; labeling can facilitate the training of subsequent models; schematically, the conversation samples with daily chat labels can be: "Comment: [bitter][bitter] I don’t even know who he is; Reply: It should be that the love is not deep enough." "Comment: Yes, it feels like it’s only been a short time since the last Chinese New Year; Reply: I feel like I haven’t done anything well this year." And so on. The conversation samples with professional advice labels can be: "Comment: What about the Sun, Fire, Leo, Moon, Ox, Ascendant, Libra, Metal, Crab, and Water; Reply: This configuration is very good, the star energy is quite strong." And so on.
[0038] In a possible implementation, the computer device may obtain formatted sample data of instruction (task description), input (input content), and output (output data) by formatting the collected raw data; this process may be used to construct a sample set for training each model in this application, and the process may be implemented as follows: Obtaining raw data, where the raw data includes conversation samples or professional knowledge data with emotional intent category labels; The original data is formatted to obtain formatted sample data in a sample set, each sample data having a task description, input content and output content; the sample set includes a first sample set, a second sample set or a target sample set.
[0039] Wherein, when constructing a target sample set to train an emotion intent recognition model, the original data includes conversation samples with daily chat labels and conversation samples with professional advice labels, and the computer device can clean the sample data in the format of task description, input content, and output content, wherein the task description is used to instruct the large language model to judge the emotion intent category based on the input content; schematically, if the conversation sample labeled as daily chat is "I am not in a good mood today", the task description obtained based on the conversation sample can be "determine the corresponding emotion intent category based on the input content", the input content corresponds to the conversation sample content, that is, "I am not in a good mood today", and the output content corresponds to the emotion intent category label, that is, "daily chat"; the sample data in the target sample set obtained by formatting is fine-tuned on the existing large language model, and the difference between the predicted emotion intent category output by the model and the corresponding emotion intent category label (that is, the output content) is used to adjust the model parameters of the pre-trained large language model, so that the predicted emotion intent category output by the adjusted large language model is as close as possible to the corresponding emotion intent category label; when the training completion conditions are met, the large language model after fine-tuning training is determined as the emotion intent recognition model.
[0040] In a possible implementation, the large language model can be GPT-4, BERT, etc., and DeepSpeed technology can be used during fine-tuning training. During the training process, a single GPU card can be used to perform deep learning training for a certain period of time, and the application stage of the emotion intent recognition model can also use the single GPU card resources to realize emotion intent category recognition.
[0041] In the application stage of the emotion intention recognition model, the interaction data is input into the emotion intention recognition model to obtain the emotion intention category of the interaction data output by the emotion model.
[0042] Step 230, when the emotional intent category of the interaction data is the first intent category, calling the daily chat model to generate reply content corresponding to the interaction data; the daily chat model is obtained after fine-tuning the pre-trained large language model through the first sample set; the first sample set is constructed based on dialogue samples with daily chat labels.
[0043] When the emotional intention category of the interactive data is the first intention category, it means that the purpose of the interactive user sending the interactive data is to engage in daily chatting. In this case, the computer device generates reply content corresponding to the interactive data by calling the daily chat model, so that the generated reply content is more in line with the daily chat scenario, and the generated reply content is more matched with the interactive data.
[0044] The daily chat model can be obtained after fine-tuning the pre-trained large language model based on the first sample set; when constructing the first sample set, the original data is a conversation sample with a daily chat label; the computer device can extract historical conversation data with a daily chat label (i.e., the first historical conversation data) from the historical conversation data corresponding to the content production user, so as to construct the first sample set based on the first historical conversation data; in one possible implementation, the computer device can directly obtain the acquired first historical conversation data as a conversation sample (i.e., the original data) for constructing the first sample set; in another possible implementation, the computer device can further filter the first historical conversation data through a custom condition, and obtain the filtered first historical conversation data as a conversation sample for constructing the first sample set; illustratively, in the case where the historical conversation data is comment data, the custom condition can refer to an interaction amount greater than a quantity threshold, such as a like amount exceeding a like amount threshold, a collection amount exceeding a collection amount threshold, etc., which is not limited in this application.
[0045] After obtaining the dialogue samples used to construct the first sample set, the computer device can format the dialogue samples, clean and format them into sample data of task description, input content, and output content, so as to serve as sample data in the first sample set; wherein the task description is used to instruct the large language model to generate reply content based on the input content. Schematically, if the interactive data in the dialogue sample is: "Interesting Soul", and the reply content is: "One in a Million", the task description obtained based on the dialogue sample can be "Based on the input content, provide reply content that conforms to the context", the input content corresponds to the interactive data in the dialogue sample, i.e. "Interesting Soul", and the output content corresponds to the reply content in the dialogue sample, i.e. "One in a Million"; fine-tune the existing large language model with the sample data in the first sample set obtained by formatting, and adjust the model parameters of the pre-trained large language model based on the difference between the predicted reply content output by the model and the corresponding output content, so that the predicted reply content output by the adjusted large language model is as close to the output content as possible; when the training completion conditions are met, the large language model after fine-tuning training is determined as a daily chat model, which can more accurately understand the user's daily expression needs, thereby generating more targeted reply content.
[0046] In one possible implementation, the large language model can be GPT-4, BERT, etc., and DeepSpeed technology can be used during fine-tuning training. During the training process, a single GPU card can be used to perform deep learning training for a certain period of time, and the application stage of the daily chat model can also use the single GPU card resources to generate reply content.
[0047] Step 240, when the emotional intent category of the interaction data is the second intent category, calling the professional advice model to generate reply content corresponding to the interaction data; the professional advice model is obtained after fine-tuning the pre-trained large language model through the second sample set; the second sample set is constructed based on dialogue samples with professional advice labels and professional knowledge data.
[0048] When the emotional intention category of the interactive data is the second intention category, it means that the purpose of the interactive user sending the interactive data is to consult on professional issues. In this case, the computer device generates reply content corresponding to the interactive data by calling the professional advice model, so that the generated reply content is more in line with the scenario of professional question consultation, and the generated reply content is more matched with the interactive data.
[0049] The professional suggestion model can be obtained after fine-tuning the pre-trained large language model based on the second sample set; when constructing the second sample set, the computer device can construct the sample set based on the dialogue samples with professional suggestion labels and professional knowledge data.
[0050] Among them, when constructing the second sample set, the original data is conversation samples with professional establishment labels and professional knowledge data; the computer device can extract historical conversation data with professional suggestion labels (i.e., second historical conversation data) from the historical conversation data corresponding to the content production user, so as to construct the second sample set based on the second historical conversation data; in one possible implementation method, the computer device can directly obtain the acquired second historical conversation data as a conversation sample for constructing the second sample set; in another possible implementation method, the computer device can further filter the second historical conversation data through custom conditions, and obtain the filtered second historical conversation data as a conversation sample for constructing the second sample set; illustratively, in the case where the historical conversation data is comment data, the custom condition may refer to the interaction amount being greater than a quantity threshold, such as the number of likes exceeding the likes threshold, the number of collections exceeding the collection threshold, etc., and this application does not limit this.
[0051] When acquiring professional knowledge data, the computer device can construct a professional knowledge base, which includes professional knowledge in the emotional field; in one possible implementation method, in order to improve the response efficiency in the emotional field, when constructing the professional knowledge base, the emotional knowledge can be divided into knowledge fields such as personality emotional knowledge, comprehensive intelligence knowledge, psychological healing knowledge, and emotional gender knowledge, and the knowledge in each knowledge field can be captured from a public database to construct the professional knowledge base.
[0052] After obtaining the conversation samples with professional advice labels and the professional knowledge data in the professional knowledge base, the computer device can format the raw data, clean and format it into sample data of task description, input content, and output content, as the sample data in the second sample set; wherein the task description is used to instruct the large language model to generate response content based on the input content. Schematically, the raw data is professional knowledge data: depression is a common mental health problem, and its symptoms can be manifested in mood changes, loss of interest, energy changes, cognitive changes, sleep changes, appetite changes, physical symptoms, self-evaluation, etc. The task description obtained based on the professional knowledge data can be "provide response content that fits the context based on the content in the professional knowledge base combined with the input content", and the input content It can be "How to judge depression", and the output content can be "Depression can be judged from the aspects of mood changes, loss of interest, energy changes, cognitive changes, sleep changes, appetite changes, physical symptoms, self-evaluation, etc."; the sample data in the second sample set is obtained by formatting to perform fine-tuning training on the existing large language model, and the model parameters of the pre-trained large language model are adjusted according to the difference between the predicted reply content output by the model and the corresponding output content, so that the predicted reply content output by the adjusted large language model is as close to the output content as possible; when the training completion conditions are met, the large language model after fine-tuning training is determined as a professional advice model, which can more accurately understand the user's professional consulting needs, thereby generating more targeted and professional reply content.
[0053] In a possible implementation, the large language model can be GPT-4, BERT, etc., and DeepSpeed technology can be used during fine-tuning training. During the training process, a single GPU card can be used for deep learning training for a certain period of time, and the application stage of the professional suggestion model can also use the single GPU card resources to generate reply content.
[0054] In one possible implementation, since each content producing user has his or her own answer style and personality, in order to generate reply content that conforms to the style of the corresponding content producing user, the computer device can train corresponding reply models corresponding to each content producing user; in this case, the computer device can call the target reply model corresponding to the target user based on the emotional intent category of the interactive data to generate reply content corresponding to the interactive data.
[0055] Among them, the conversation samples used to train the target response model of the target user include the historical conversation data of the target user; when the target response model is a daily chat model, the first sample set corresponding to the daily chat model of the target user can be constructed based on conversation samples with daily chat labels in the historical conversation data of the target user; the second sample set corresponding to the professional advice model of the target user can be constructed based on conversation samples with professional advice labels in the historical conversation data of the target user and professional knowledge data.
[0056] Alternatively, in another possible implementation, in the conversation samples used to train the target response model of the target user, the proportion of conversation samples derived from the target user's historical conversation data is higher than the target proportion threshold. Schematically, the target proportion threshold is 50% or 60%, etc., to ensure that in the conversation samples for training the target response model, most of the conversation samples are derived from the target user's historical conversation data. This application does not impose any restrictions on the value of the target proportion threshold.
[0057] By specifying to add the target user's historical conversation data to the conversation samples for training the target response model, the target response model can learn the response style and personality of the target user; by calling the response model corresponding to the target user to generate the corresponding response content, the generated content can be more in line with the response style and personality of the target user.
[0058] To summarize, the intelligent dialogue method provided in the embodiment of the present application obtains the interaction data received by the target user, identifies the interaction data through an emotion intent recognition model obtained after fine-tuning the large language model pre-trained based on the dialogue samples, obtains the emotion intent category of the interaction data, and then calls the target reply model corresponding to the emotion intent category to generate reply content corresponding to the interaction data; through the above method, the training effect of the emotion intent recognition model in scenarios with limited sample size can be improved, and the accuracy of emotion intent category recognition can be improved; in addition, calling the corresponding reply model based on the identified emotion intent category to generate reply content can improve the matching degree between the reply content and the interaction data, thereby improving the dialogue effect.
[0059] In addition, by constructing conversation samples based on the target user's historical conversation data and performing corresponding reply models, the generated reply text can be more in line with the target user's reply style and personality, further improving the conversation effect.
[0060] The intelligent dialogue method provided in the embodiment of the present application includes two stages, namely, a model training stage and a model application stage; Figure 3 A schematic diagram of an intelligent dialogue method provided by an exemplary embodiment of the present application is shown. Figure 3As shown, in the model training stage, the computer device can construct the required sample sets, and fine-tune the pre-trained large language model through each sample set to obtain an emotion intention recognition model, a daily chat model and a professional advice model; wherein, the sample set 1 corresponding to the emotion intention recognition model is constructed based on conversation samples with emotion intention category labels; the sample set 2 corresponding to the daily chat model is constructed based on conversation samples with daily chat labels; the sample set 3 corresponding to the professional advice model is constructed based on conversation samples with professional advice labels and professional knowledge data.
[0061] During the model application stage, for the interactive data received by the target user, the computer device first identifies the emotional intent category of the interactive data through the emotional intent recognition model. When it is determined that the emotional intent category of the interactive data is daily chat, the daily chat model is called to generate reply content corresponding to the interactive data. When it is determined that the emotional intent category of the interactive data is professional advice, the professional advice model is called to generate reply content corresponding to the interactive data.
[0062] During the model training stage, fine-tuning training based on the existing large language model can reduce the number of samples required for training, improve model training efficiency, and ensure the model training effect. During the model application stage, the corresponding reply model is called based on the emotional intent category of the identified interactive data to generate the corresponding reply content, so that the reply content is more in line with the emotional intention category of the interactive user, thereby improving the dialogue effect.
[0063] Figure 4 A block diagram of an intelligent dialogue device provided by an exemplary embodiment of the present application is shown. The device can be used to perform the following steps: Figure 1 or Figure 2 All or part of the steps of the embodiment shown, such as Figure 4 As shown, the device comprises: A first acquisition module 410 is used to acquire the interaction data received by the target user; An intention recognition module 420 is used to identify the emotional intent category of the interaction data through an emotional intent recognition model; the emotional intent recognition model is obtained by fine-tuning a pre-trained large language model through a target sample set, and the target sample set is constructed based on dialogue samples of various emotional intent categories, each dialogue sample having a corresponding emotional intent category label; The reply generation module 430 is used to call a target reply model corresponding to the emotional intention category of the interactive data to generate reply content corresponding to the interactive data.
[0064] In one possible implementation, the emotional intent categories include a first intent category indicating daily chatting and a second intent category indicating professional advice.
[0065] In a possible implementation, the reply generation module 430 is used to: In the case where the emotional intent category of the interaction data is the first intent category, calling a daily chat model to generate reply content corresponding to the interaction data; the daily chat model is obtained by fine-tuning a pre-trained large language model through a first sample set; the first sample set is constructed based on conversation samples with daily chat labels; When the emotional intent category of the interaction data is the second intent category, a professional advice model is called to generate reply content corresponding to the interaction data; the professional advice model is obtained after fine-tuning the pre-trained large language model through the second sample set; the second sample set is constructed based on conversation samples with professional advice labels and professional knowledge data.
[0066] In a possible implementation manner, the device further includes: A second acquisition module is used to acquire original data, where the original data includes dialogue samples or professional knowledge data with emotional intent category labels; The data processing module is used to format the original data to obtain formatted sample data in a sample set, each sample data having a task description, input content and output content; the sample set includes a first sample set, a second sample set or the target sample set.
[0067] In a possible implementation, the reply generation module 430 is used to: Based on the emotional intention type of the interactive data, calling the target reply model of the target user corresponding to the emotional intention type to generate reply content corresponding to the interactive data; The conversation samples used to train the target response model of the target user include the historical conversation data of the target user.
[0068] In a possible implementation, among the conversation samples used to train the target response model of the target user, the proportion of conversation samples derived from the historical conversation data of the target user is higher than a target proportion threshold.
[0069] To summarize, the intelligent dialogue device provided in the embodiment of the present application obtains the interaction data received by the target user, identifies the interaction data through an emotion intent recognition model obtained after fine-tuning and training a large language model pre-trained based on dialogue samples, obtains the emotion intent category of the interaction data, and then calls the target reply model corresponding to the emotion intent category to generate reply content corresponding to the interaction data; through the above method, the training effect of the emotion intent recognition model in scenarios with limited sample size can be improved, and the accuracy of emotion intent category recognition can be improved; in addition, calling the corresponding reply model based on the identified emotion intent category to generate reply content can improve the matching degree between the reply content and the interaction data, thereby improving the dialogue effect.
[0070] Figure 5 The structural block diagram of a computer device 500 shown in an exemplary embodiment of the present application is shown. The computer device can be implemented as the server in the above-mentioned solution of the present application. The computer device 500 includes a central processing unit (CPU) 501, a system memory 504 including a random access memory (RAM) 502 and a read-only memory (ROM) 503, and a system bus 505 connecting the system memory 504 and the central processing unit 501. The computer device 500 also includes a large-capacity storage device 506 for storing an operating system 509, an application program 510 and other program modules 511.
[0071] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electronically-Erasable Programmable Read-Only Memory (EEPROM) flash memory or other solid-state storage technology, CD-ROM, Digital Versatile Disc (DVD) or other optical storage, tape cassettes, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer storage medium is not limited to the above. The above-mentioned system memory 504 and mass storage device 506 can be collectively referred to as memory.
[0072] According to various embodiments of the present disclosure, the computer device 500 can also be connected to a remote computer on the network through a network such as the Internet. That is, the computer device 500 can be connected to the network 508 through the network interface unit 507 connected to the system bus 505, or the network interface unit 507 can be used to connect to other types of networks or remote computer systems (not shown).
[0073] The memory also includes at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is stored in the memory. The central processing unit 501 implements all or part of the steps in the intelligent dialogue method shown in the above-mentioned embodiments by executing the at least one instruction, at least one program, code set or instruction set.
[0074] Figure 6 The following is a block diagram of a computer device 600 according to an exemplary embodiment of the present application. The computer device 600 may be implemented as the above-mentioned terminal, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, etc. The computer device 600 may also be called a user device, a portable terminal, a laptop terminal, a desktop terminal, etc.
[0075] Typically, the computer device 600 includes a processor 601 and a memory 602 .
[0076] In some embodiments, the computer device 600 may further optionally include: a peripheral device interface 603 and at least one peripheral device. The processor 601, the memory 602 and the peripheral device interface 603 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 603 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 604, a display screen 605, a camera assembly 606, an audio circuit 607 and a power supply 608.
[0077] In some embodiments, the computer device 600 further includes one or more sensors 609 , including but not limited to: an acceleration sensor 610 , a gyroscope sensor 611 , a pressure sensor 612 , an optical sensor 613 , and a proximity sensor 614 .
[0078] Those skilled in the art will understand that Figure 6 The structure shown in the figure does not constitute a limitation on the computer device 600, and the computer device 600 may include more or less components than those shown in the figure, or combine some components, or adopt a different arrangement of components.
[0079] In an exemplary embodiment, a computer-readable storage medium is also provided, in which at least one computer program is stored, and the computer program is loaded and executed by a processor to implement all or part of the steps in the above-mentioned intelligent dialogue method. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0080] In an exemplary embodiment, a computer program product is also provided, which includes a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, when the program instructions are executed by a computer, the computer is executed to implement the above Figure 1 or Figure 2 All or part of the steps of the intelligent dialogue method shown.
[0081] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the claims.
[0082] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. An intelligent dialogue method, characterized in that: The method comprises: Obtain the interaction data received by the target user; Identify the emotional intent category of the interaction data through an emotional intent recognition model; the emotional intent recognition model is obtained by fine-tuning a pre-trained large language model through a target sample set, wherein the target sample set is constructed based on dialogue samples of various emotional intent categories, and each dialogue sample has a corresponding emotional intent category label; A target reply model corresponding to the emotional intention category of the interactive data is called to generate reply content corresponding to the interactive data.
2. The method according to claim 1, characterized in that The emotional intent categories include a first intent category indicating daily chatting and a second intent category indicating professional advice.
3. The method according to claim 2, characterized in that The calling of a target reply model corresponding to the emotional intention category of the interactive data to generate reply content corresponding to the interactive data includes: In the case where the emotional intent category of the interaction data is the first intent category, calling a daily chat model to generate reply content corresponding to the interaction data; the daily chat model is obtained by fine-tuning a pre-trained large language model through a first sample set; the first sample set is constructed based on conversation samples with daily chat labels; When the emotional intent category of the interaction data is the second intent category, a professional advice model is called to generate reply content corresponding to the interaction data; the professional advice model is obtained after fine-tuning the pre-trained large language model through the second sample set; the second sample set is constructed based on conversation samples with professional advice labels and professional knowledge data.
4. The method according to claim 3, characterized in that The method further comprises: Acquire raw data, where the raw data includes conversation samples or professional knowledge data with emotional intent category labels; The original data is formatted to obtain formatted sample data in a sample set, each sample data having a task description, input content and output content; the sample set includes a first sample set, a second sample set or the target sample set.
5. The method according to any one of claims 1 to 4, characterized in that: The calling of a target reply model corresponding to the emotional intention type of the interaction data to generate reply content corresponding to the interaction data includes: Based on the emotional intention type of the interactive data, calling the target reply model of the target user corresponding to the emotional intention type to generate reply content corresponding to the interactive data; The conversation samples used to train the target response model of the target user include the historical conversation data of the target user.
6. The method according to claim 5, characterized in that In the conversation samples used to train the target response model of the target user, the proportion of the number of conversation samples derived from the historical conversation data of the target user is higher than the target proportion threshold.
7. An intelligent dialogue device, characterized in that: The device comprises: A first acquisition module, used to acquire the interaction data received by the target user; An intention recognition module, used to identify the emotional intent category of the interaction data through an emotional intent recognition model; the emotional intent recognition model is obtained after fine-tuning a pre-trained large language model through a target sample set, the target sample set is constructed based on dialogue samples of various emotional intent categories, each dialogue sample has a corresponding emotional intent category label; The reply generation module is used to call a target reply model corresponding to the emotional intention category of the interactive data to generate reply content corresponding to the interactive data.
8. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the intelligent dialogue method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer program, and the computer program is loaded and executed by the processor to implement the intelligent dialogue method as described in any one of claims 1 to 6.
10. A computer program product, characterized in that The computer program product includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer is caused to execute to implement the intelligent dialogue method as described in any one of claims 1 to 6.
Citation Information
Cited By
Model training method and device, electronic equipment and storage medium
CN120068983A
Training sample generation method of intelligent shopping guide dialogue robot and related device
CN120562550A