Emotion support dialogue method and device based on large language model
By generating multi-turn dialogues by having a large language model simultaneously act as both a user and an emotional supporter, and by using a set of strategies to control the length of responses, the problem of excessively long responses in existing technologies is solved, thereby improving the user interaction experience and reducing training costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-19
- Publication Date
- 2026-04-03
AI Technical Summary
Existing emotion-supported dialogue methods based on large language models do not fully understand the nature of multi-turn interactions, resulting in generated responses that are significantly longer than those of human emotion supporters, thus affecting the user interaction experience.
By having a large language model simultaneously act as both a user and an emotional supporter, multi-turn dialogues are generated, and responses are generated using strategies from a set of strategies, including asking questions, restating, emotional responses, self-disclosure, affirmation and comfort, and offering advice, while controlling the length of responses to closely resemble the natural expressions of human emotional supporters.
The generated responses were close to the natural expression of human emotional supporters, which improved the user interaction experience, reduced training costs, and increased training efficiency.
Smart Images

Figure CN121787432A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of large language model technology, and in particular to an emotion-supported dialogue method and apparatus based on a large language model. Background Technology
[0002] With the development of artificial intelligence technology, large language models have shown potential in the construction of Emotionally Supported Dialogue Systems (ESDSes). In EDSes, large language models, acting as supporters, can provide empathy, recognition, and action suggestions to users (seekers) experiencing emotional distress.
[0003] Most of the emotion-supported dialogue methods based on large models in related technologies follow the logic of "single-turn response generation," that is, the model acts as an emotion supporter based on the dialogue history and directly outputs a single response to answer the user's questions.
[0004] However, existing large-model-based affective dialogue methods fail to fully recognize the "multi-turn interactive nature" of affective dialogue. Instead, they tend to address all the help-seeker's questions in a single-turn response, resulting in responses generated by these methods being significantly longer than those from human affective supporters. For example, responses generated by GPT-4-based affective dialogue methods for the same dialogue history are typically more than 25 lexical units longer than those from human affective supporters. In the field of affective dialogue, excessively long responses generated by large language models can disrupt the dialogue flow (users lack the patience and motivation to read lengthy text responses), thus degrading the user experience. Summary of the Invention
[0005] This invention provides a method and apparatus for emotion-supported dialogue based on a large language model, enabling the length of responses generated by the large language model in emotion-supported dialogue to approach the length of natural expressions from human emotion supporters. The technical solution includes at least the following: In a first aspect, an emotion-supported dialogue method based on a large language model is provided, comprising: a first large language model acquiring the user's historical dialogue data; based on the historical dialogue data, the first large language model simultaneously acts as both the user and the emotion supporter, generating multi-turn dialogues; based on the multi-turn dialogues, acquiring the answer corresponding to the user's latest question, wherein the user's latest question is the latest unanswered question in the historical dialogue data.
[0006] Optionally, obtaining the answer to the user's latest question based on the multi-turn dialogue includes: taking the first answer from the emotional supporter in the multi-turn dialogue as the answer to the user's latest question.
[0007] Optionally, the step of generating multi-turn dialogues by having the first large language model simultaneously act as both a user and an emotional supporter based on the historical dialogue data includes: inputting a first prompt word and the historical dialogue data into the first large language model to obtain the multi-turn dialogues generated by the first large language model; wherein, the first prompt word is used to guide the first large language model to simultaneously act as both a user and an emotional supporter, and to generate the multi-turn dialogues according to the historical dialogue data; during the generation of the multi-turn dialogues, when the first large language model acts as an emotional supporter, it generates responses according to strategies in the strategy set.
[0008] Optionally, the strategy set includes: inquiry strategy, restatement or paraphrase strategy, emotional response strategy, self-disclosure strategy, affirmation and reassurance strategy, advice-providing strategy, information-providing strategy, and other strategies; the inquiry strategy is used to inquire about information related to the question; the restatement or paraphrase strategy is used to simply restate the user's statement in a more concise way; the emotional response strategy is used to clearly express and describe the user's current emotions; the self-disclosure strategy is used to proactively share similar experiences or express the same emotions as the user; the affirmation and reassurance strategy is used to acknowledge the user's strengths, motivations, and abilities, while conveying comfort and encouragement; the advice-providing strategy is used to provide the user with suggestions that can help change the current situation; the information-providing strategy is used to provide the user with helpful information; and the other strategies refer to using casual conversation to build rapport or using methods other than the defined strategies to provide support to the user.
[0009] Optionally, the method further includes: calculating multiple evaluation metrics of the first large language model on a test set to evaluate the performance of the first large language model, wherein the evaluation metrics include average length difference, average length, diversity metric, and text matching degree metric.
[0010] Secondly, an emotion-supported dialogue device based on a large language model is also provided, comprising: a first acquisition module for acquiring the user's historical dialogue data using a first large language model; a generation module for generating multi-turn dialogues based on the historical dialogue data, wherein the first large language model simultaneously acts as both the user and the emotion supporter; and a second acquisition module for acquiring the answer to the user's latest question based on the multi-turn dialogues, wherein the user's latest question is the latest unanswered question in the historical dialogue data.
[0011] Optionally, the second acquisition module is further configured to take the first answer from the emotional supporter in the multi-turn dialogue as the answer to the user's latest question.
[0012] Optionally, the generation module is further configured to input the first prompt word and the historical dialogue data into the first large language model to obtain the multi-turn dialogue generated by the first large language model; wherein, the first prompt word is used to guide the first large language model to simultaneously play the roles of user and emotional supporter, and generate the multi-turn dialogue based on the historical dialogue data, and during the generation of the multi-turn dialogue, when the first large language model plays the role of emotional supporter, it generates a response based on the strategies in the strategy set.
[0013] Optionally, the strategy set in the generation module includes: inquiry strategy, restatement or interpretation strategy, emotional response strategy, self-disclosure strategy, affirmation and comfort strategy, suggestion-providing strategy, information-providing strategy, and other strategies; the inquiry strategy is used to inquire about information related to the question; the restatement or interpretation strategy is used to simply restate the user's statement in a more concise way; the emotional response strategy is used to clearly express and describe the user's current emotions; the self-disclosure strategy is used to actively share similar experiences or express the same emotions as the user; the affirmation and comfort strategy is used to acknowledge the user's strengths, motivations, and abilities, while conveying comfort and encouragement; the suggestion-providing strategy is used to provide the user with suggestions that can help change the current situation; the information-providing strategy is used to provide the user with helpful information; and the other strategies refer to using casual conversation to build rapport or using methods other than the defined strategies to provide support to the user.
[0014] Optionally, the device further includes an evaluation module for calculating multiple evaluation metrics of the first large language model on a test set to evaluate the performance of the first large language model, the evaluation metrics including average length difference, average length, diversity metric, and text matching degree metric.
[0015] Thirdly, a computer device is also provided, comprising: a memory and a processor, wherein the memory stores at least one computer program, the at least one computer program being loaded and executed by the processor to perform the emotion-supported dialogue method based on a large language model as described in the above embodiments.
[0016] Fourthly, a computer-readable storage medium is also provided, wherein at least one computer program is stored in the computer-readable storage medium, the at least one computer program being loaded and executed by a processor to perform the emotion-supported dialogue method based on a large language model as described in the above embodiments.
[0017] Fifthly, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the method described in the first aspect.
[0018] The beneficial effects of the technical solution provided by this invention include at least the following: In this embodiment, the first large language model simultaneously acts as both the user and the emotional supporter, generating multi-turn dialogues. This allows the first large language model to understand that the current task is a multi-turn dialogue task. The answer to the user's latest question at this point is a response consistent with multi-turn dialogue habits, and the length of this answer is close to the natural expression length of a human emotional supporter. Furthermore, only one first large language model is needed to simultaneously act as both the user and the emotional supporter, eliminating the need for multiple agents (e.g., using two different large language models to act as the user and the emotional supporter respectively), reducing training costs and improving training efficiency. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in this embodiment, the accompanying drawings used in the description of the embodiment will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 A flowchart of an emotion-supported dialogue method based on a large language model, provided by an exemplary embodiment of the present invention, is shown. Figure 2 A flowchart of an emotion-supported dialogue method based on a large language model, provided by another exemplary embodiment of the present invention, is shown. Figure 3 A schematic diagram of the structure of an emotion-supported dialogue device based on a large language model provided in an exemplary embodiment of the present invention is shown. Figure 4 This is a schematic diagram of the structure of a computer device provided in an exemplary embodiment of the present invention. Detailed Implementation
[0021] Unless otherwise defined, the technical or scientific terms used herein shall have the ordinary meaning as understood by one of ordinary skill in the art to which this invention pertains. The terms “first,” “second,” “third,” and similar terms used in this patent application specification and claims do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Similarly, the terms “an” or “a” and similar terms do not indicate a quantity limitation, but rather indicate the presence of at least one. The terms “comprising” or “including” and similar terms mean that the elements or objects preceding “comprising” or “including” encompass the elements or objects listed following “comprising” or “including” and their equivalents, but do not exclude other elements or objects.
[0022] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
[0023] Figure 1 A flowchart illustrating an exemplary embodiment of the present invention provides an emotion-supported dialogue method based on a large language model, which can be executed by a computer device. See also Figure 1 The method includes: In step 101, the first language model acquires the user's historical dialogue data.
[0024] In this embodiment, the user is someone who needs real-time responses and seeks emotional support (the one seeking help). The historical dialogue data can be the dialogue records between the user and the first language model. The first language model acts as an emotional supporter, and the dialogue generated by the first language model is used to provide emotional support to the user.
[0025] Alternatively, the primary language model can be a large language model such as GPT-3.5, DeepSeek-V3, or Qwen-3-8B.
[0026] In step 102, based on historical dialogue data, the first language model simultaneously acts as both a user and an emotional supporter, generating multi-turn dialogues.
[0027] In this embodiment, the historical dialogue data includes multiple rounds of historical question-and-answer sessions between the user (the person seeking help) and the emotional supporter. The user inputs the question, and the emotional supporter outputs the answer. In one round of historical question-and-answer sessions, the user inputs a question text, and the emotional supporter outputs an answer text.
[0028] Optionally, step 102 includes: inputting the first prompt word and historical dialogue data into the first large language model to obtain a multi-turn dialogue generated by the first large language model.
[0029] The first prompt word guides the first language model to simultaneously act as both a user and an emotional supporter, generating multiple rounds of dialogue based on historical dialogue data. During the generation of these multiple rounds of dialogue, the first language model generates responses based on strategies in the strategy set when acting as an emotional supporter.
[0030] For example, the first prompt word is in the following form.
[0031] There exists a two-person dialogue: one party (the user) expresses their current problems and emotions, while the other party (the emotional supporter) must choose an appropriate dialogue strategy based on the content of the dialogue, establish an emotional connection with the user, and provide emotional support, comfort, encouragement, or advice. You now need to simultaneously play the roles of 'emotional supporter' and 'user,' completing the emotional support dialogue based on the input dialogue history until it naturally ends.
[0032] The first cue word can be considered as guiding the large language model to generate "dialogue completion-style responses" and simulate the dual roles of user and emotional supporter.
[0033] Optionally, the strategy set includes the following eight strategies: inquiry strategy, restatement or paraphrase strategy, emotional response strategy, self-disclosure strategy, affirmation and comfort strategy, advice-providing strategy, information-providing strategy, and other strategies.
[0034] Questioning strategies are used to ask for information related to a problem. The purpose of questioning strategies is to help users clearly express the problem they are facing. In questioning strategies, open-ended questions are preferred, but closed-ended questions can be used if specific information needs to be obtained.
[0035] The restatement or paraphrase strategy is used to simply restate a user's statement in a more concise way. This strategy helps users gain a clearer understanding of their current situation.
[0036] Emotional response strategies are used to clearly express and describe the emotions a user is currently experiencing. These strategies allow users to feel that their feelings are seen and understood.
[0037] Self-disclosure is a strategy used to proactively share similar experiences one has had or to express the same emotions as the user. It conveys empathy, allowing the user to feel, "I've had similar feelings to you, I understand you."
[0038] The affirmation and reassurance strategy is used to acknowledge a user's strengths, motivations, and abilities, while simultaneously offering comfort and encouragement. This strategy helps users build confidence.
[0039] Offering suggestions is a strategy to provide users with recommendations that can help change their current situation. However, it's important to be mindful of boundaries when offering suggestions; avoid excessive intervention and never use a "commanding" tone to force the other party to do things your way.
[0040] Information delivery strategies are used to provide users with information that is helpful to them; helpful information includes specific data, objective facts, reasonable viewpoints, and available resources. Alternatively, the content provided by an information delivery strategy can answer questions raised by users.
[0041] Other strategies refer to using casual small talk to build rapport, or providing support to users in ways other than the defined strategies. Here, defined strategies refer to those other than the other strategies mentioned above.
[0042] For example, after inputting the first prompt word and historical dialogue data into the first language model, the first language model generates the following multi-turn dialogue.
[0043] Q1: User: I'm very anxious about quitting my current job. The job is too stressful, but the salary is good.
[0044] S1: Supporter: [Questioning Strategy] What makes your job stressful? Q2: User: I have to deal with a lot of people who are in financial difficulty, which makes me feel very uncomfortable.
[0045] S2: Supporter: [Questioning Strategy] Would you help these clients improve their financial situation? Q3: User: Yes, but often they still don't achieve the state they want. Once the protection measures are canceled, many people may lose their homes.
[0046] S3: Supporter: [Affirmation and Reassurance Strategy] But you have indeed offered them a better future than they have now. This may not be what they want most, but it will help in the long run.
[0047] Q4: User: That's true, but sometimes I feel that I should put my own feelings and health first.
[0048] S4: Supporter: [Affirmation and Reassurance Strategy] I understand that feeling. [Questioning Strategy] Are there any other jobs that offer a similar salary? Q5: User: Probably not. I've been with this company for a long time and have consistently received bonuses every year.
[0049] S5: Supporter: [Other Strategies] Perhaps we could try looking at the clients' dire financial situation from a different perspective? Q6: User: I can give it a try.
[0050] The aforementioned multi-turn dialogue can be represented as C = {Q1, S1, Q2, S2, ..., Q5, S5, Q6}. Here, Q represents the question posed by the user, S represents the response from the emotional supporter, and the numbers following Q and S indicate the dialogue round; identical numbers indicate the same dialogue round.
[0051] Here, Q1 is the user's latest question in the history of the conversation, that is, the question the user raised and is waiting for the emotional supporter to reply to, while S1 is the emotional supporter's answer to Q1.
[0052] Furthermore, to enable the primary language model to understand the essence of multi-turn dialogues, this embodiment chooses to construct a prior knowledge base. This prior knowledge base contains a large number of complete and reasonable multi-turn dialogues, used to provide the primary language model with prior knowledge of multi-turn dialogues. In implementation, this prior knowledge base can be embedded in the first prompt word. For example, some multi-turn dialogues from the prior knowledge base can be added before the first prompt word as examples to provide the primary language model with prior knowledge of multi-turn dialogues.
[0053] In step 103, based on multi-turn dialogue, the answer to the user's latest question is obtained.
[0054] The user's latest question is the most recent unanswered question in the history of conversations.
[0055] In this embodiment, the first response from the emotional supporter in a multi-turn dialogue is taken as the answer to the user's latest question.
[0056] For example, in the case of a multi-turn dialogue generated by the first major language model, where C = {Q1, S1, Q2, S2, ..., Q5, S5, Q6}, the first response from the sentiment supporter is the answer to Q1, i.e., S1. In other words, S1 is taken as the answer to the user's latest question.
[0057] It should be noted that since the performance of current large-scale language models is already sufficiently mature and powerful, the first large language model can directly complete the content of steps 101 to 103 above without the need for additional training of the first large language model.
[0058] In related technologies, large language models are initially trained to solve user problems within a single turn. Therefore, the training objective of large language models is to resolve all current user questions at once, leading them to generate as many solutions as possible within a single response. However, emotion support tasks are essentially multi-turn dialogue tasks, requiring a step-by-step guidance of the user's psychological issues and a gradual resolution process. Therefore, the training method of large language models in related technologies contradicts the principles of emotion support tasks.
[0059] In this embodiment, the first large language model simultaneously acts as both the user and the emotional supporter, generating multi-turn dialogues. This allows the first large language model to understand that the current task is a multi-turn dialogue task. The answer to the user's latest question at this point is a response consistent with multi-turn dialogue habits, and the length of this answer is close to the natural expression length of a human emotional supporter. Furthermore, only one first large language model is needed to simultaneously act as both the user and the emotional supporter, eliminating the need for multiple agents (e.g., using two different large language models to act as the user and the emotional supporter respectively), reducing training costs and improving training efficiency.
[0060] Figure 2 A flowchart illustrating an emotion-supported dialogue method based on a large language model, provided by another exemplary embodiment of the present invention, is shown. This method can be executed by a computer device. See also Figure 2 The method includes: In step 201, multiple evaluation metrics of the first large language model on the test set are calculated.
[0061] Evaluation metrics include mean length difference (ALD), mean length (Len), diversity metrics (such as Dist-1 / Dist-2), and text matching metrics (such as BLEU-2 / BLEU-4, ROUGE-L).
[0062] To facilitate a comparative evaluation of the capabilities of the primary language model, this embodiment also introduces the following five emotion support models from related technologies as a reference. These emotion support models from related technologies also need to obtain evaluation indicators and scores from human experts.
[0063] Vanilla: Without emotional support framework optimization, it only prompts "play the role of an emotional supporter" to generate a single-round response, representing a large model system without optimization; : Based on Vanilla, add the "multi-round cognition" prompt to verify the impact of multi-round consciousness on length; LLM-ESC: Introduces an emotional support framework (clarifies character definition, 8 types of strategies and adds examples), but still generates single-round responses. It represents a large model system with optimized prompts in related technologies, and adds strategies and examples compared to Vanilla. MCC / MTL / CP: Supervised models trained on the ESConv dataset, representing optimization systems not driven by large models.
[0064] SinPsyBot (Qwen2-7B-Instruct): An emotion support system based on dialogue data generated by intelligent agent role-playing simulation and using the data to fine-tune a large model.
[0065] The first major language model in this embodiment is named RGDC.
[0066] In addition, a case was designed where the first major language model does not generate multi-turn dialogues during step 102, but only generates a single-turn dialogue (in this case, it is equivalent to directly generating the answer to the user's latest question). The major language model in this case is named... .
[0067] In this embodiment, the ESConv dataset is divided into a training set, a validation set, and a test set in a ratio of 8:1:1, and the performance of each model is verified on the test set.
[0068] Here, RGDC and This model does not require training and validation sets; these sets can exist as prior knowledge. Other control models, however, require training and validation sets before their performance can be evaluated on the test set.
[0069] The evaluation metrics for different models are shown in Table 1.
[0070] Table 1: Evaluation metrics for different models
[0071] In step 202, the human expert scores of the output of the first large language model on the test set are obtained.
[0072] The scoring results were obtained by 10 experts with psychology backgrounds who scored each model's output on randomly selected examples based on six dimensions: actual emotional support effect (effectiveness, advisability, and sense of identification), dialogue experience (fluency and contradiction), and safety risks (toxicity).
[0073] The scores given by human experts for different models are shown in Table 2.
[0074] Table 2: Human expert scores for different models
[0075] In step 203, the performance of the first language model is evaluated based on the evaluation metrics and the scores given by human experts.
[0076] The evaluation metrics in Table 1 compare the performance differences between non-large model-driven systems (MCC, MTL, CP), unoptimized large model systems (Vanilla series), large model systems with optimized strategies and examples (LLM-ESC series, SimPsyBot), and the RGDC series of this invention (RGDCsg, RGDC) from three core dimensions: response length control, response diversity, and text matching degree. The key conclusions are as follows: 1. The problem of lengthy replies has been significantly alleviated, and the length is closer to human expression. From the perspective of length-related metrics (Length, ALD), the RGDC series models perform best. Specifically, RGDC (Qwen3-8B) has an average length of only 25.56 units and an average length difference (ALD) as low as 14.31. This is significantly lower than the unoptimized Vanilla series (Qwen3-8B version has a length of 304.00 units and an ALD of 277.60), and also superior to the existing optimized LLM-ESC series (Qwen3-8B version has a length of 54.16 units and an ALD of 26.58) and SimPsyBot (Length of 34.57 units and an ALD of 16.37). Even... The version with only one round of dialogue completion also had an ALD of 14.89-16.55, which confirms that the "dual-role dialogue completion" mechanism can effectively guide large models to shorten redundant responses and make the response length close to the natural expression habits of human emotional supporters.
[0077] 2. The text matching accuracy is comparable to existing optimized systems, with no performance loss. In terms of matching metrics with the reference text (BLEU-2, BLEU-4, Rouge-L), the RGDC series models perform on par with existing optimization systems. For example, RGDC (GPT-3.5) has a BLEU-2 score of 6.56 and a Rouge-L score of 14.96, slightly higher than LLM-ESC (GPT-3.5) (BLEU-2 score of 6.47 and Rouge-L score of 16.03, a slight difference within an acceptable range), and significantly higher than the Vanilla series (GPT-3.5 version has a BLEU-2 score of 5.05 and a Rouge-L score of 13.87). This indicates that RGDC optimizes length and diversity without sacrificing the matching accuracy of the response with the reference text, thus solving the problem of "optimizing a single dimension leading to a decline in the performance of other dimensions."
[0078] In addition, although the MCC, MTL, and CP models, which are not driven by large models, have lower Length (18.31-27.07) and ALD (3.61-4.26), their Dist-1 (16.44-27.49) is abnormally high and their BLEU (1.35-10.39) fluctuates greatly. This indicates that although their response is short, their diversity is out of control and their matching degree is unstable. Their overall performance is far inferior to that of the RGDC series.
[0079] As can be seen from Table 2, the RGDC series models in this invention have the following two advantages.
[0080] 1. Provides superior practical emotional support, making it easier to alleviate user distress. In the positive effects dimensions (effectiveness, advisory value, and acceptance), the RGDC series models scored the highest. Specifically, RGDC (GPT-3.5) achieved scores of 78.35 for effectiveness, 75.00 for advisory value, and 81.95 for acceptance, surpassing not only the unoptimized Vanilla (Qwen3-8B) series (48.17 for effectiveness, 49.23 for advisory value, and 51.19 for acceptance) but also... The (Qwen3-8B) series (with an effectiveness score of 52.92, a suggestion score of 53.44, and a sense of identification score of 56.56) is slightly better than SimPsyBot (with an effectiveness score of 77.92, a suggestion score of 74.92, and a sense of identification score of 78.96) after fine-tuning with generated data and MCC (with an effectiveness score of 75.70, a suggestion score of 72.76, and a sense of identification score of 77.78) which is not driven by a large model. This indicates that the responses generated by RGDC are more in line with the needs of real emotional help-seeking scenarios, and can more effectively establish emotional connections, provide useful suggestions, and help users alleviate emotional distress.
[0081] 2. The fluency of the dialogue has been significantly improved, with no logical contradictions. In terms of smoothness, RGDC (GPT-3.5) scored 83.81, significantly higher than Vanilla (Qwen3-8B)'s 48.5. The score of 51.38 for (Qwen3-8B) is higher than that of SimPsyBot (81.92) and MCC (78.69), confirming that the "multi-turn dialogue completion" mechanism can optimize the dialogue rhythm and avoid the interruption of fluency caused by a single round being too long. At the same time, in the contradiction dimension (the lower the score, the better), the RGDC series models scored the lowest, with RGDC (Qwen3-8B) at 1.43 and RGDC (GPT-3.5) at 1.59, lower than MCC's 2.15 and SimPsyBot's 1.46. Vanilla (Qwen3-8B) had a contradiction score as high as 16.39, indicating that the response logic generated by RGDC is more coherent, without self-contradictory content, and the interactive experience is more natural.
[0082] Based on the above data, it can be seen that the RGDC in this invention can guide large models to recognize the multi-turn characteristics of emotion-supported dialogue, shorten redundant responses, and make the response length close to the natural expression of human emotion supporters; improve the adaptability of the response to real help needs, and ensure that the system can effectively alleviate users' emotional distress in real scenarios; simplify the technical implementation process, reduce the computational and time costs of system deployment, and facilitate large-scale application.
[0083] The following are device embodiments of this application. For details not described in detail in the device embodiments, please refer to the above method embodiments.
[0084] Figure 3 A schematic diagram of the structure of an emotion-supported dialogue device based on a large language model provided in an exemplary embodiment of the present invention is shown. See also Figure 3 The emotion-supported dialogue device 300 based on a large language model includes: a first acquisition module 301, a generation module 302, and a second acquisition module 303.
[0085] The first acquisition module 301 is used to acquire the user's historical dialogue data for the first large language model.
[0086] The generation module 302 is used to generate multi-turn dialogues based on historical dialogue data, with the primary language model acting as both a user and an emotional supporter.
[0087] The second acquisition module 303 is used to acquire the answer to the user's latest question based on multi-turn dialogue. The user's latest question is the latest unanswered question in the historical dialogue data.
[0088] Optionally, the second acquisition module is also used to take the first answer from the emotional supporter in the multi-turn dialogue as the answer to the user's latest question.
[0089] Optionally, the generation module 302 is further configured to input the first prompt word and historical dialogue data into the first large language model to obtain a multi-turn dialogue generated by the first large language model; wherein, the first prompt word is used to guide the first large language model to play the roles of both user and emotional supporter at the same time, and generate a multi-turn dialogue based on the historical dialogue data. During the generation of the multi-turn dialogue, when the first large language model plays the role of emotional supporter, it generates a response based on the strategies in the strategy set.
[0090] Optionally, the strategy set in generation module 302 includes: inquiry strategy, restatement or paraphrase strategy, emotional response strategy, self-disclosure strategy, affirmation and comfort strategy, advice-providing strategy, information-providing strategy, and other strategies; the inquiry strategy is used to ask for information related to the question; the restatement or paraphrase strategy is used to simply restate the user's statement in a more concise way; the emotional response strategy is used to clearly express and describe the user's current emotions; the self-disclosure strategy is used to proactively share similar experiences or express the same emotions as the user; the affirmation and comfort strategy is used to acknowledge the user's strengths, motivations, and abilities, while conveying comfort and encouragement; the advice-providing strategy is used to provide the user with suggestions that can help change the current situation; the information-providing strategy is used to provide the user with information that can help the user; and other strategies refer to using casual conversation to build rapport or using other methods besides the defined strategies to provide support to the user.
[0091] Optionally, the device further includes an evaluation module 304. The evaluation module 304 is used to calculate multiple evaluation metrics of the first language model on the test set to evaluate the performance of the first language model. The evaluation metrics include average length difference, average length, diversity metric, and text matching degree metric.
[0092] It should be noted that the above embodiments of the emotion-supported dialogue device based on a large language model are only illustrated by the division of the functional modules described above. In practical applications, the functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. Furthermore, the emotion-supported dialogue device based on a large language model and the emotion-supported dialogue method embodiments based on a large language model belong to the same concept, and their specific implementation process is detailed in the method embodiments, which will not be repeated here.
[0093] The module division in this embodiment of the invention is illustrative and represents only one logical functional division. In actual implementation, other division methods are possible. Furthermore, the functional modules in each embodiment of the invention can be integrated into a single processor, exist as separate physical entities, or consist of two or more modules integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0094] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a terminal device (which may be a personal computer, mobile phone, or communication device, etc.) or processor to execute all or part of the steps of the method of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0095] Figure 4 This is a schematic diagram of the structure of a computer device provided in an exemplary embodiment of the present invention. For example... Figure 4 As shown, the computer device 400 includes a processor 401 and a memory 402.
[0096] Processor 401 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 401 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 401 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 401 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 401 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0097] The memory 402 may include one or more computer-readable storage media, which may be non-transitory. The memory 402 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 402 are used to store at least one instruction, which is executed by the processor 401 to implement the emotion-supported dialogue method based on a large language model provided in this embodiment of the invention.
[0098] Those skilled in the art will understand that Figure 4 The structure shown does not constitute a limitation on computer device 400, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0099] This invention also provides a non-transitory computer-readable storage medium, which, when the instructions in the storage medium are executed by the processor of a computer device, enables the computer device to execute the emotion-supported dialogue method based on a large language model provided in this invention.
[0100] This invention also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the emotion-supported dialogue method based on a large language model provided in this invention.
[0101] The above description is merely an optional embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. An emotion-supported dialogue method based on a large language model, characterized in that, The method includes: The first major language model obtains users' historical dialogue data; Based on the historical dialogue data, the first language model simultaneously acts as both a user and an emotional supporter, generating multi-turn dialogues. Based on the multi-turn dialogue, the answer to the user's latest question is obtained. The user's latest question is the latest unanswered question in the historical dialogue data.
2. The method according to claim 1, characterized in that, The step of obtaining the latest answer to the user's question based on the multi-turn dialogue includes: The first response from the emotional supporter in the multi-round dialogue will be used as the answer to the user's latest question.
3. The method according to claim 1, characterized in that, Based on the historical dialogue data, the first large language model simultaneously acts as both a user and an emotional supporter, generating multi-turn dialogues, including: The first prompt word and the historical dialogue data are input into the first large language model to obtain the multi-turn dialogue generated by the first large language model; The first prompt word is used to guide the first large language model to simultaneously act as both a user and an emotional supporter, and to generate the multi-turn dialogue based on the historical dialogue data. During the generation of the multi-turn dialogue, when the first large language model acts as an emotional supporter, it generates a response based on the strategies in the strategy set.
4. The method according to claim 3, characterized in that, The strategy set includes: questioning strategies, restatement or paraphrasing strategies, emotional response strategies, self-disclosure strategies, affirmation and comfort strategies, advice-providing strategies, information-providing strategies, and other strategies; The inquiry strategy is used to ask for information related to the question; The restatement or paraphrase strategy is used to simply restate the user's expression in a more concise way; The emotional response strategy is used to clearly express and describe the emotions that the user is currently experiencing; The self-disclosure strategy is used to proactively share similar experiences one has had or to express the same emotions as the user. The affirmation and reassurance strategy is used to acknowledge the user's strengths, motivations, and abilities, while conveying reassurance and encouragement. The suggestion strategy is used to provide users with suggestions that can help change the current situation; The information delivery strategy is used to provide users with information that is helpful to them; The other strategies refer to using casual small talk to build rapport, or providing support to users in ways other than those defined.
5. The method according to any one of claims 1 to 4, characterized in that, The method further includes: Calculate multiple evaluation metrics for the first large language model on the test set to evaluate the performance of the first large language model. The evaluation metrics include average length difference, average length, diversity metric, and text matching degree metric.
6. An emotion-supported dialogue device based on a large language model, characterized in that, The device includes: The first acquisition module is used to acquire the user's historical dialogue data from the first major language model; The generation module is used to generate multi-turn dialogues based on the historical dialogue data, whereby the first large language model simultaneously acts as both a user and an emotional supporter. The second acquisition module is used to acquire the answer to the user's latest question based on the multi-turn dialogue, wherein the user's latest question is the latest unanswered question in the historical dialogue data.
7. The apparatus according to claim 6, characterized in that, The second acquisition module is further configured to: take the first answer from the emotional supporter in the multi-round dialogue as the answer to the user's latest question.
8. A computer device, characterized in that, The computer device includes a memory and a processor, wherein the memory stores at least one computer program, which is loaded and executed by the processor to implement the method according to any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one computer program, which is loaded and executed by a processor to implement the method of any one of claims 1 to 5.
10. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the method described in any one of claims 1 to 5.