Method and device for determining response information, storage medium and electronic device
By combining the current input information and historical dialogue information, the response information of the intelligent dialogue is adjusted, which solves the problem of low accuracy of the intelligent dialogue response information and achieves a more humane and highly accurate dialogue effect.
Patent Information
- Application Number
- CN202411104345.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-08-13
AI Technical Summary
The accuracy of the response information of intelligent dialogue is low, and it fails to truly understand the user's scene and complex emotional changes, resulting in a less humane dialogue.
By obtaining the current input information and historical dialogue information of the target object, combined with the scene lookup table and the preset information library, the historical scenes and emotions are determined, and the response information is adjusted according to the current dialogue information, and the emotional feedback matrix and scene transition probability are used to calculate the optimal scene. value to ensure the accuracy of the response information.
It improves the accuracy of response information in intelligent dialogues, realizes a more humane dialogue method, enhances the emotional understanding and scene perception of dialogues, and improves the accuracy of dialogues and user experience.
Smart Images

Figure CN118626628B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic digital data processing, and in particular to a method and device for determining response information, a storage medium, and an electronic device. Background Art
[0002] With the rapid development of artificial intelligence, intelligent dialogue has gradually penetrated into various fields, and there are many ways of interaction. However, the most common form of interaction is still language communication. Therefore, intelligent dialogue has become an important form and foundation. Only by understanding the language can we make corresponding movements or actions. However, just understanding the semantics cannot truly understand the scene, mood and complex emotional changes of people. In the chat, how to focus on the user's topic, understand the scene and complex emotions of the interlocutor, and give a delicate, emotional and accurate dialogue is a major problem and challenge.
[0003] The current society is in a stage of rapid development of intelligence, and the language model has been rapidly developed and continuously iterated; at the same time, intelligent dialogue has gradually penetrated into all aspects of life, but in most cases it is based on specific business needs without considering people's emotional fluctuations. Although there are already expression-based dialogue solutions, they do not truly reflect the characteristics of intelligence and multi-emotion, nor do they fundamentally understand the scene in which the dialoguer is in. Therefore, the expression-based dialogue solution is relatively simple, which leads to low accuracy of the response information of the intelligent dialogue.
[0004] In view of the problem that the accuracy of the response information of the intelligent dialogue in the related technology is low, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present application provide a method and device for determining response information, a storage medium, and an electronic device, so as to at least solve the problem of low accuracy of response information of intelligent dialogue in the related art.
[0006] According to an embodiment of the embodiments of the present application, a method for determining response information is provided, comprising: obtaining current input information of a target object, and inputting the current input information into a large model, so that the large model outputs first response information according to the current input information; obtaining a historical context corresponding to historical dialogue information, wherein the historical dialogue information is dialogue information between the target object and the large model for a target number of rounds, and the historical context includes: historical scenes and historical emotions; determining a first scene corresponding to a historical scene in a scene lookup table, wherein the numerical value in the scene lookup table is used to indicate a reward value corresponding to the conversion of any scene in a scene set to all scenes in the scene set, and the reward value corresponding to the switching of the historical scene to the first scene satisfies a preset switching strategy; determining a first emotion corresponding to the switching of the historical scene to the first scene according to a preset information library, wherein the preset information library stores emotions when scenes are switched; determining a second context according to current dialogue information, wherein the current dialogue information includes: the current input information and the first response information; determining whether to adjust the first response information according to the first context and the second context, wherein the first context includes: the first scene and the first emotion.
[0007] In an exemplary embodiment, determining whether to adjust the first response information according to the first context and the second context includes: determining the similarity between the first context and the second context; and determining not to adjust the first response information if the similarity satisfies a preset similarity matching rule.
[0008] In an exemplary embodiment, determining the similarity between the first context and the second context includes: determining a first emotion vector of a first emotion and a second emotion vector of a second emotion, and determining a first scene vector of a first scene and a second scene vector of a second scene, wherein the first context includes: the first emotion and the first scene, and the second context includes: the second emotion and the second scene; determining a first vector similarity between the first emotion vector and the second emotion vector, and determining a second vector similarity between the first scene vector and the second scene vector; determining the similarity based on the first vector similarity and the second vector similarity.
[0009] In an exemplary embodiment, after determining the similarity between the first scenario and the second scenario, the method further includes: when the similarity does not satisfy a preset similarity matching rule, inputting the first scenario into the big model so that the big model generates a corresponding second response information based on the first scenario; and sending the second response information to a terminal device corresponding to the target object.
[0010] In an exemplary embodiment, after determining not to adjust the first response information, the method further includes: determining whether the second context is consistent with the historical context; if the second context is consistent with the historical context, constructing a training data pair based on the historical conversation information and the current conversation information, and determining that the data category of the training data pair is a first data category, wherein the first data category is a data type whose second context is consistent with the historical context; if the second context is inconsistent with the historical context, constructing a training data pair based on the historical conversation information and the current conversation information, and determining that the data category of the training data pair is a second data category, wherein the second data category is a data type whose second context is inconsistent with the historical context; training the large model based on the training information of the first data category and / or the training information of the second data category.
[0011] In an exemplary embodiment, constructing a training data pair based on the historical conversation information and the current conversation information includes: determining a historical annotation of the historical conversation information and a current annotation of the current conversation information, wherein the historical annotation is used to indicate whether the context of the historical conversation information has changed relative to the previous round of conversation information, and if so, the reason for the change, and the current annotation is used to indicate whether the context of the current conversation information has changed relative to the previous round of conversation information, and if so, the reason for the change; constructing first training data based on the historical annotation, the historical context and the historical conversation information, and constructing second training data based on the current annotation, the second context and the current conversation information; constructing the training data pair based on the first training data and the second training data.
[0012] In an exemplary embodiment, before determining the first scene corresponding to the historical scene in the scene lookup table, the method also includes: obtaining a sample context, wherein the sample context includes: a plurality of sample emotions and a plurality of sample scenes; determining an information pair according to the sample context, and establishing an emotion feedback matrix according to the information pair, wherein the information pair includes: the sample scene and the sample emotion corresponding to the sample scene, and the emotion feedback matrix is used to indicate the reward value obtained by taking the target emotion in the target scene; calculating the scene transition probability according to the sample context, wherein the scene transition probability is used to indicate the probability of the first sample scene transferring to the second sample scene under the first sample emotion; determining a discount factor, wherein the discount factor is used to indicate the attenuation of the future reward value relative to the immediate reward value; determining the numerical value of the optimal scene value corresponding to the first sample scene according to the emotion feedback matrix, the scene transition probability and the discount factor; and establishing the scene lookup table according to the numerical value of the optimal scene value corresponding to the first sample scene.
[0013] In an exemplary embodiment, determining the numerical value of the optimal scene value corresponding to the first sample scene according to the emotional feedback matrix, the scene transition probability and the discount factor includes: determining the numerical value of the scene value corresponding to the first sample scene according to the emotional feedback matrix, the scene transition probability and the discount factor; determining the numerical value of the optimal scene value corresponding to the first sample scene according to the numerical value of the scene value corresponding to the first sample scene.
[0014] In an exemplary embodiment, determining the value of the scene value corresponding to the first sample scene according to the emotion feedback matrix, the scene transition probability and the discount factor includes: determining the value of the scene value corresponding to the first sample scene by the following formula: :
[0015] = , where S is the emotion set, C is the scene set, is the probability distribution of the first sample emotion s when the first sample scene is c, is the emotional feedback matrix when the first sample emotion is s and the first sample scene is c, r is the discount factor, is the probability of the first sample scene c transferring to the second sample scene c' when the first sample emotion is s, is the value of the scene value corresponding to the second sample scene c', is the sentiment trend coefficient, .
[0016] In an exemplary embodiment, determining the value of the optimal scene value corresponding to the first sample scene according to the value of the scene value corresponding to the first sample scene includes: determining the value of the optimal scene value corresponding to the first sample scene according to the following formula: :
[0017] ,in, is the value of the scene value of the first sample scene c, is the emotional feedback matrix when the first sample emotion is s and the first sample scene is c, is the probability of the first sample scene c transferring to the second sample scene c' when the first sample emotion is s, r is the discount factor, is the value of the optimal scene value corresponding to the second sample scene c', is the sentiment trend coefficient.
[0018] In an exemplary embodiment, before confirming the numerical value of the optimal scene value corresponding to the first sample scene based on the emotion feedback matrix, the scene transition probability and the discount factor, the method also includes: determining positive emotions and negative emotions among the multiple sample emotions; determining the positive emotion weight of each positive emotion based on the timestamp of each positive emotion, and determining the negative emotion weight of each negative emotion based on the timestamp of each negative emotion; determining the emotion trend coefficient based on the positive emotion weight of each positive emotion and the negative emotion weight of each negative emotion.
[0019] In an exemplary embodiment, the scenario lookup table is established according to the numerical value of the optimal scenario value corresponding to the first sample scenario, including: determining the maximum reward value of each sample scene transferred to the multiple sample scenes according to the numerical value of the optimal scenario value corresponding to the first sample scenario; and establishing the scenario lookup table according to the maximum reward value of each sample scene transferred to other sample scenes.
[0020] In an exemplary embodiment, obtaining a historical context corresponding to historical conversation information includes: determining a first conversation vector of the historical conversation information, and determining a second conversation vector for each sample conversation information in a sample conversation set; determining a second vector similarity between the first conversation vector and the second conversation vector of each sample conversation information; determining a similarity that satisfies a threshold matching rule among multiple second vector similarities, and determining target sample conversation information corresponding to the vector similarity that satisfies the threshold matching rule; determining a context corresponding to the target sample conversation information, and determining the context corresponding to the target sample conversation information as the historical context.
[0021] In an embodiment of the present application, a device for determining response information is also provided, including: a first acquisition module, used to obtain current input information of a target object, and input the current input information into a large model, so that the large model outputs first response information according to the current input information; a second acquisition module, used to obtain a historical context corresponding to historical dialogue information, wherein the historical dialogue information is dialogue information between the target object and the large model for a target number of rounds, and the historical context includes: historical scenes and historical emotions; a first determination module, used to determine a first scene corresponding to a historical scene in a scene lookup table, wherein the value in the scene lookup table is used to indicate the transition of any scene in a scene set The reward values corresponding to all scenes in the scene set are switched to the reward values corresponding to the historical scene switching to the first scene, and the reward value corresponding to the historical scene switching to the first scene satisfies the preset switching strategy; a second determination module is used to determine the first emotion corresponding to the historical scene switching to the first scene according to a preset information library, wherein the preset information library stores the emotions when the scene switches; a third determination module is used to determine the second situation according to the current dialogue information, wherein the current dialogue information includes: the current input information and the first response information; a fourth determination module is used to determine whether to adjust the first response information according to the first situation and the second situation, wherein the first situation includes: the first scene and the first emotion.
[0022] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0023] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0024] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0025] Through the present application, the current first situation is predicted by the historical situation corresponding to the historical dialogue information, and the second situation is determined according to the current dialogue information, and whether the first response information is accurate is determined according to the first situation and the second situation. That is, the historical dialogue information and the current dialogue information are comprehensively considered to determine whether the current response information is accurate, which solves the problem of low accuracy of response information of intelligent dialogue in related technologies, that is, a more humane dialogue method is adopted to achieve highly accurate dialogue goals. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] 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.
[0027] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0028] Figure 1 It is a hardware environment diagram of a method for determining response information in an embodiment of the present application;
[0029] Figure 2 is a flowchart of a method for determining response information according to an embodiment of the present application;
[0030] Figure 3 is a schematic diagram of a method for determining response information according to an embodiment of the present application (I);
[0031] Figure 4 is a schematic diagram of a method for determining response information according to an embodiment of the present application (II);
[0032] Figure 5 It is a structural block diagram of a device for determining response information according to an embodiment of the present application. DETAILED DESCRIPTION
[0033] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.
[0034] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the information used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0035] According to one aspect of an embodiment of the present application, a method for determining response information is provided. The method for determining response information is widely used in smart home, smart home, smart home device ecology, smart residential (Intelligence House) ecology and other whole-house intelligent digital control application scenarios. Optionally, in this embodiment, the above-mentioned method for determining response information can be applied to Figure 1 In the hardware environment composed of the terminal device 102 and the server 104 shown in FIG. Figure 1 As shown, the server 104 is connected to the terminal device 102 via a network, and can be used to provide services (such as application services, etc.) for the terminal or a client installed on the terminal. An information library can be set on the server or independently of the server to provide information storage services for the server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide information computing services for the server 104.
[0036] The network may include but is not limited to at least one of the following: wired network, wireless network. The wired network may include but is not limited to at least one of the following: wide area network, metropolitan area network, local area network, and the wireless network may include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal device 102 may be but is not limited to a PC, a mobile phone, a tablet computer, a smart air conditioner, a smart range hood, a smart refrigerator, a smart oven, a smart stove, a smart washing machine, a smart water heater, a smart washing equipment, a smart dishwasher, a smart projection equipment, a smart TV, a smart clothes drying rack, a smart curtain, a smart audio and video, a smart socket, a smart speaker, a smart speaker, a smart fresh air equipment, a smart kitchen and bathroom equipment, a smart bathroom equipment, a smart sweeping robot, a smart window cleaning robot, a smart mopping robot, a smart air purification equipment, a smart steamer, a smart microwave oven, a smart kitchen treasure, a smart purifier, a smart water dispenser, a smart door lock, etc.
[0037] In this embodiment, a method for determining response information is provided, which is applied to the above terminal device. Figure 2 : is a flowchart of a method for determining response information according to an embodiment of the present application, the process comprising the following steps:
[0038] Step S202, obtaining current input information of the target object, and inputting the current input information into the large model, so that the large model outputs first response information according to the current input information;
[0039] Step S204, obtaining a historical context corresponding to the historical dialogue information, wherein the historical dialogue information is dialogue information between the target object and the large model for a target number of rounds, and the historical context includes: a historical scene and a historical emotion;
[0040] It should be noted that the above historical dialogue information can be understood as the previous round of dialogue information of the current dialogue.
[0041] Step S206, determining a first scene corresponding to a historical scene in a scene lookup table, wherein the value in the scene lookup table is used to indicate a reward value corresponding to switching any scene in a scene set to all scenes in the scene set, and the reward value corresponding to switching the historical scene to the first scene satisfies a preset switching strategy;
[0042] It should be noted that the reward value corresponding to the switching from the historical scene to the first scene satisfies the preset switching strategy, which can be understood as the reward value corresponding to the switching from the historical scene to the first scene is the largest.
[0043] The scene lookup table in the embodiment of the present application includes: a reward value corresponding to the conversion of any scene in a scene set to all scenes in the scene set, wherein the scene set is a pre-set scene set, or a set of scenes that is gradually determined during the use of the large model.
[0044] For example, the scene set includes: scene 1, scene 2, and scene 3, and the scene lookup table includes: reward value 11 for scene 1 to be converted to scene 1; reward value 12 for scene 1 to be converted to scene 2; reward value 13 for scene 1 to be converted to scene 3; reward value 21 for scene 2 to be converted to scene 1; reward value 22 for scene 2 to be converted to scene 2; reward value 23 for scene 2 to be converted to scene 3; reward value 31 for scene 3 to be converted to scene 1; reward value 32 for scene 3 to be converted to scene 2; reward value 33 for scene 3 to be converted to scene 3.
[0045] When the historical scene is scene 1, it is determined that reward value 12 is the largest among reward value 11, reward value 12, and reward value 13. Therefore, it is determined that the first scene is most likely scene 2, and the first emotion of the transition from the first scene to the second scene is determined according to the preset information library.
[0046] Step S208, determining a first emotion corresponding to the switching of the historical scene to the first scene according to a preset information library, wherein the preset information library stores emotions when the scene switches;
[0047] Step S210, determining a second context according to current dialogue information, wherein the current dialogue information includes: the current input information and the first response information;
[0048] It should be noted that the method for determining the second context based on the current dialogue information is: determining the cosine similarity between the current dialogue information and multiple sample dialogue information; determining the target sample dialogue information that is most similar to the current dialogue information based on multiple cosine similarities; and determining that the context information corresponding to the target sample dialogue information is the second context.
[0049] Step S212: determining whether to adjust the first response information according to a first situation and the second situation, wherein the first situation includes: the first scene and the first emotion.
[0050] Through the above steps, that is, in the embodiment of the present application, the current first situation is predicted by the historical situation corresponding to the historical dialogue information, and the second situation is determined according to the current dialogue information, and whether the first response information is accurate is determined according to the first situation and the second situation. That is, the historical dialogue information and the current dialogue information are comprehensively considered to determine whether the current response information is accurate, which solves the problem of low accuracy of response information of intelligent dialogue in related technologies, that is, a more humane dialogue method is adopted to achieve a highly accurate dialogue goal.
[0051] Optionally, the above step S212 can be implemented in the following ways: determine the similarity between the first scenario and the second scenario; when the similarity satisfies a preset similarity matching rule, determine not to adjust the first response information; when the similarity does not satisfy the preset similarity matching rule, input the first scenario into the big model so that the big model generates corresponding second response information according to the first scenario; and send the second response information to the terminal device corresponding to the target object.
[0052] It should be noted that the similarity satisfying the preset similarity matching rule can be understood as the similarity being greater than or equal to the preset similarity; the similarity not satisfying the preset similarity matching rule can be understood as the similarity being less than the preset similarity.
[0053] In an embodiment of the present application, when the similarity does not satisfy the preset similarity matching rules, it means that the context corresponding to the current dialogue information is greatly different from the predicted context, and therefore, there is a possibility that the response information is inaccurate, and therefore the first response information needs to be adjusted. Optionally, the first context is input into the large model so that the large model generates second response information based on the input information of the target object and the predicted context information, so that the response information sent to the terminal device can better meet the current context; when the similarity satisfies the preset similarity matching rules, it means that the context corresponding to the current dialogue information is not much different from the predicted context, and therefore, the first response information is considered accurate, and there is no need to adjust the first response information, and the first response information is sent to the terminal device corresponding to the target object.
[0054] Through the embodiments of the present application, the problem of low accuracy of response information of intelligent dialogue in the related art is solved, and the goal of highly accurate dialogue is achieved.
[0055] Optionally, the similarity between the first context and the second context is determined in the following manner: determining a first emotion vector of a first emotion and a second emotion vector of a second emotion, and determining a first scene vector of a first scene and a second scene vector of a second scene, wherein the first context includes: the first emotion and the first scene, and the second context includes: the second emotion and the second scene; determining a first vector similarity between the first emotion vector and the second emotion vector, and determining a second vector similarity between the first scene vector and the second scene vector; determining the similarity based on the first vector similarity and the second vector similarity.
[0056] In the embodiment of the present application, since the context includes two parts of information: emotion and scene, when determining the similarity between the first context and the second context, the vector similarity between the first emotion and the second emotion is first determined, as well as the vector similarity between the first scene and the second scene. Then, based on the vector similarity between the first emotion and the second emotion and the average value of the vector similarity between the first scene and the second scene, the similarity between the first context and the second context is determined.
[0057] In an exemplary embodiment, after determining not to adjust the first response information, the method further includes: determining whether the second context is consistent with the historical context; if the second context is consistent with the historical context, constructing a training data pair based on the historical conversation information and the current conversation information, and determining that the data category of the training data pair is a first data category, wherein the first data category is a data type whose second context is consistent with the historical context; if the second context is inconsistent with the historical context, constructing a training data pair based on the historical conversation information and the current conversation information, and determining that the data category of the training data pair is a second data category, wherein the second data category is a data type whose second context is inconsistent with the historical context; training the large model based on the training information of the first data category and / or the training information of the second data category.
[0058] In the embodiment of the present application, it is necessary to continuously train the large model. Therefore, after sending the first response information to the terminal device, when a new round of dialogue information is obtained, the data category corresponding to the new round of dialogue information is determined.
[0059] Since in the embodiment of the present application, the context of the current conversation is predicted by historical conversation information, it is necessary to determine the historical conversation information and the current conversation information as a training data pair, and determine the data category of the training data pair based on whether the second context is consistent with the historical context. Specifically, when the second context is consistent with the historical context, the data category of the training data pair is determined to be the first data category; when the second context is inconsistent with the historical context, the data category of the training data pair is determined to be the second data category.
[0060] Optionally, constructing a training data pair based on the historical conversation information and the current conversation information includes: determining a historical annotation of the historical conversation information and a current annotation of the current conversation information, wherein the historical annotation is used to indicate whether the context of the historical conversation information has changed relative to the previous round of conversation information, and if so, the reason for the change, and the current annotation is used to indicate whether the context of the current conversation information has changed relative to the previous round of conversation information, and if so, the reason for the change; constructing a first training data based on the historical annotation, the historical context and the historical conversation information, and constructing a second training data based on the current annotation, the second context and the current conversation information; and constructing the training data pair based on the first training data and the second training data.
[0061] That is, in the embodiment of the present application, the large model can be fine-tuned through one round of dialogue information, using the following data structure: (dialogue information, scene, emotion, annotation); the large model can also be fine-tuned through multiple rounds of dialogue information (i.e., training data pairs), using the following data structure: (multiple rounds of dialogue information, scene, emotion, annotation).
[0062] Optionally, before determining the first scene corresponding to the historical scene in the scene lookup table, it is necessary to establish the scene lookup table. The specific establishment method is as follows:
[0063] Step S2061: Acquire sample contexts, wherein the sample contexts include: multiple sample emotions and multiple sample scenes;
[0064] Step S2062: determining an information pair according to the sample scenario, and establishing an emotion feedback matrix according to the information pair, wherein the information pair includes: the sample scenario and the sample emotion corresponding to the sample scenario, and the emotion feedback matrix is used to indicate the reward value obtained by taking the target emotion in the target scenario;
[0065] For example, the emotion feedback matrix is used to indicate the reward value obtained by transferring to scene S' after executing emotion A in scene S.
[0066] Step S2063: Calculating a scene transition probability according to the sample context, wherein the scene transition probability is used to indicate a probability of a first sample scene transitioning to a second sample scene under a first sample emotion;
[0067] Step S2064: determining a discount factor, wherein the discount factor is used to indicate the decay of the future reward value relative to the immediate reward value;
[0068] Step S2065: determining a value of the optimal scene value corresponding to the first sample scene according to the emotion feedback matrix, the scene transition probability and the discount factor;
[0069] Step S2066: Establish the scene lookup table according to the numerical value of the optimal scene value corresponding to the first sample scene.
[0070] The immediate reward value is the reward value for executing the current scene, and the future reward value is the reward value for transferring scene S to scene S'.
[0071] Optionally, the above step S2065 can be implemented in the following manner: determine the numerical value of the scene value corresponding to the first sample scene based on the emotional feedback matrix, the scene transition probability and the discount factor; determine the numerical value of the optimal scene value corresponding to the first sample scene based on the numerical value of the scene value corresponding to the first sample scene.
[0072] Optionally, the value of the scene value corresponding to the first sample scene is determined by the following formula: :
[0073] = , where S is the emotion set, C is the scene set, is the probability distribution of the first sample emotion s when the first sample scene is c, is the emotional feedback matrix when the first sample emotion is s and the first sample scene is c, r is the discount factor, is the probability of the first sample scene c transferring to the second sample scene c' when the first sample emotion is s, is the value of the scene value corresponding to the second sample scene c', is the sentiment trend coefficient, .
[0074] Optionally, the value of the optimal scene value corresponding to the first sample scene is determined according to the following formula: :
[0075] ,in, is the value of the scene value of the first sample scene c, is the emotional feedback matrix when the first sample emotion is s and the first sample scene is c, is the probability of the first sample scene c transferring to the second sample scene c' when the first sample emotion is s, r is the discount factor, is the value of the optimal scene value corresponding to the second sample scene c', is the sentiment trend coefficient.
[0076] It should be noted that. .
[0077] In an exemplary embodiment, before confirming the numerical value of the optimal scene value corresponding to the first sample scene according to the emotion feedback matrix, the scene transition probability and the discount factor, it also includes: determining positive emotions and negative emotions among the multiple sample emotions; determining the positive emotion weight of each positive emotion according to the timestamp of each positive emotion, and determining the negative emotion weight of each negative emotion according to the timestamp of each negative emotion; determining the emotion trend coefficient according to the positive emotion weight of each positive emotion and the negative emotion weight of each negative emotion.
[0078] That is to say, in the embodiment of the present application, each dialogue message corresponds to an emotion, but considering that the emotion of the target object is also affected by the previous emotion, the emotion trend coefficient is determined based on the previous emotion. The specific method is as follows: Determine the positive emotion weight based on the following formula : ,in, is the positive sentiment weight of each positive sentiment, is the weight of the dialogue information corresponding to the positive sentiment, is a collection of conversation information with positive sentiment; the negative sentiment weight is determined based on the following formula ,in, is the negative sentiment weight for each negative sentiment, is the weight of the dialogue information corresponding to negative sentiment, is a collection of conversation information with negative sentiment; the sentiment trend coefficient is determined based on the following formula
[0079] It should be noted that the positive sentiment with an earlier timestamp has a smaller positive sentiment weight, and the positive sentiment with a later timestamp has a larger positive sentiment weight; the negative sentiment with an earlier timestamp has a smaller negative sentiment weight, and the negative sentiment with a later timestamp has a larger negative sentiment weight.
[0080] Optionally, the scene lookup table is established according to the numerical value of the optimal scene value corresponding to the first sample scene, including: determining the maximum reward value of each sample scene transferred to the multiple sample scenes according to the numerical value of the optimal scene value corresponding to the first sample scene; and establishing the scene lookup table according to the maximum reward value of each sample scene transferred to other sample scenes.
[0081] Determining the maximum reward value of each sample scene transferred to the multiple sample scenes according to the numerical value of the optimal scene value corresponding to the first sample scene, including: determining the maximum reward value of each sample scene transferred to the multiple sample scenes according to the method of determining the numerical value of the optimal scene value corresponding to the first sample scene, that is, loopingly executing the method of determining the numerical value of the optimal scene value corresponding to the first sample scene to determine the numerical value of the optimal scene value corresponding to the first sample scene.
[0082] Optionally, obtaining the historical context corresponding to the historical conversation information includes: determining a first conversation vector of the historical conversation information, and determining a second conversation vector of each sample conversation information in a sample conversation set; determining a second vector similarity between the first conversation vector and the second conversation vector of each sample conversation information; determining a similarity that satisfies a threshold matching rule among multiple second vector similarities, and determining a target sample conversation information corresponding to the vector similarity that satisfies the threshold matching rule; determining a context corresponding to the target sample conversation information, and determining the context corresponding to the target sample conversation information as the historical context.
[0083] That is to say, in the embodiment of the present application, the method of determining the historical context is: determining the vector similarity between the historical dialogue information and each sample dialogue information, determining the target sample dialogue information according to the similarity, and determining the information corresponding to the target sample dialogue information as the historical context.
[0084] In order to better understand the process of the method for determining the above-mentioned response information, the implementation method flow of determining the above-mentioned response information is described below in combination with an optional embodiment, but it is not used to limit the technical solution of the embodiment of the present application.
[0085] In this embodiment, a method for determining response information is provided. Figure 3 is a schematic diagram of a method for determining response information according to an embodiment of the present application (I), such as Figure 3 As shown, the specific steps are as follows:
[0086] Step S301: obtaining fine-tuning data;
[0087] The data structure of the fine-tuning data is as follows: (conversation content, scene, emotion, annotations); the conversation content in the fine-tuning data can be a single round or multiple rounds, and each interaction becomes a round. There is an explanation of which scene it is and which emotion it belongs to. The annotations give the large model an explanation of whether the scene and emotion have changed, the reasons for the changes, etc.
[0088] Step S302: fine-tune the large model based on the fine-tuning data;
[0089] Step S303: Obtain input information of the target object;
[0090] Step S304: the large model outputs response information based on the input information;
[0091] Step S305: determining the scene and emotion of the current dialogue information, wherein the current dialogue information includes: input information and response information;
[0092] The specific method is as follows:
[0093] Semantically determine the context and sentiment of the current conversation:
[0094] Sim = CosineSimilarity(vectorA, vectorB)+1;
[0095] Among them, vectorA is the vector of the current dialogue information, and vectorB is the vector corresponding to the training data. The scene and emotion of the current dialogue information are found through rapid retrieval. Among them, Sim is between (0, 2), and adding 1 at the end can prevent the generation of negative probability.
[0096] Step S306: determining whether the response information meets the standard according to the scene and emotion of the current dialogue information;
[0097] The specific method is as follows:
[0098] Step 1: Record the scene of the current conversation information as c and the emotion as s;
[0099] Step 2: It is necessary to judge whether a scene change has occurred in the most recent round based on past emotions and scenes;
[0100] The scene change mark is ec, when ec=1 it means a change has occurred, otherwise it is 0.
[0101] The emotional change is recorded as se, when se=1 it means a change has occurred, otherwise it is 0.
[0102] Step 3: The scenes to which the contents of past conversations belong are recorded as ct-1, ct-2, ...c0. They all belong to one of the scenes. They may be the same or different, and are just labeled in time. Similarly, the emotions to which the contents of past conversations belong are recorded as st-1, st-2, ...s0.
[0103] Taking into account the emotional aspect of people, the mentality tends to calm down gradually with the passage of time and the guidance of chatting. Therefore, an attenuation factor is needed in terms of emotions, which is reflected in the process from excitement to calmness or from stability to excitement. For this reason, the emotion can be multiplied by the coefficient as the number of chat rounds increases. Indicates changes in emotions, and there may also be negative emotional fluctuations, in which case penalties will be imposed , , where s is the sentiment of the current dialogue information in step 1, is the sentiment of the current dialogue information after fine-tuning.
[0104] According to the above content, the following calculation method can be obtained:
[0105] Scene value function: ;
[0106] in, ;
[0107] Where π is the probability distribution of emotion s given a scene c. Since the scene space C and the emotion space S are both finite sets, we can use the sum to calculate the expectation . is the past impact factor. R is the scenario emotion feedback matrix, which represents the reward value obtained by taking a certain emotion in a certain scenario. R is a known matrix. The ultimate goal is to maximize the reward for the emotional response taken in each scenario, of course, taking into account the past scenarios and emotions. For predicted emotions.
[0108] Based on the above scenario value function, the optimal state value function is obtained : .
[0109] in, :Recorded as It is a comprehensive consideration of the tendency after emotional fluctuations. If the emotional trend is stable, it is positive, otherwise it is negative. ,in, is the positive sentiment weight of each positive sentiment, is the weight of the dialogue information corresponding to the positive sentiment, is a collection of conversation information with positive sentiment; the negative sentiment weight is determined based on the following formula ,in, is the negative sentiment weight for each negative sentiment, is the weight of the dialogue information corresponding to negative sentiment, A collection of conversation information with negative sentiment.
[0110] Step 4: In order to more quickly find the response emotion in each scenario, a lookup table T is formed after multiple iterations. When the scenario of the current conversation content is determined, the table can be looked up to find the next optimal response scenario c' and s'.
[0111] Step 5: Determine the similarity between c, s obtained above and the responses c', s'; determine whether the similarity matches a given threshold α, and then determine whether the response information meets the standard.
[0112] Step S307: Return to the user if the standard is met;
[0113] Step S308: If the standard is not met, the dialogue content is annotated and new fine-tuning data is generated.
[0114] Specifically: According to ce and se, select the sample category in the fine-tuning data that this conversation information enters.
[0115] Optionally, a method for determining response information is also provided in this embodiment. Figure 4 is a schematic diagram (II) of a method for determining response information according to an embodiment of the present application, such as Figure 4 As shown, specifically including:
[0116] As shown in the figure, the large model after fine-tuning already has the ability to reason about scenes and emotions. When the user inputs content, it needs to be further processed by the scene and emotion algorithm service in order to further enhance the judgment ability of the large model. It has a certain reminder effect. After the conversation is processed, it enters the large model and produces conversation content based on the conversation history.
[0117] In summary, the large model, scenario, and emotional service architecture system, as well as the service process, are described. This makes user conversations more convenient, smooth, and humane, improving the user conversation experience. Overall, the technical architecture of a more comfortable conversation environment is achieved that is not only business-related but also emotionally relevant, making the intelligent conversation content more emotionally thoughtful, so as to meet the communication needs in different situations in real life.
[0118] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0119] Figure 5 is a structural block diagram of a device for determining response information according to an embodiment of the present application; Figure 5 As shown, including:
[0120] A first acquisition module 52 is used to acquire current input information of the target object and input the current input information into the large model so that the large model outputs first response information according to the current input information;
[0121] A second acquisition module 54 is used to acquire a historical context corresponding to the historical dialogue information, wherein the historical dialogue information is dialogue information between the target object and the large model for a target number of rounds, and the historical context includes: historical scenes and historical emotions;
[0122] A first determination module 56 is used to determine a first scene corresponding to a historical scene in a scene lookup table, wherein the value in the scene lookup table is used to indicate a reward value corresponding to switching any scene in the scene set to all scenes in the scene set, and the reward value corresponding to switching the historical scene to the first scene satisfies a preset switching strategy;
[0123] A second determining module 58 is used to determine a first emotion corresponding to the switching of the historical scene to the first scene according to a preset information library, wherein the preset information library stores emotions when the scene switches;
[0124] A third determination module 60, configured to determine a second context according to current dialogue information, wherein the current dialogue information includes: the current input information and the first response information;
[0125] The fourth determination module 62 is used to determine whether to adjust the first response information according to a first situation and the second situation, wherein the first situation includes: the first scene and the first emotion.
[0126] Through the above-mentioned device, the current first situation is predicted by the historical situation corresponding to the historical dialogue information, and the second situation is determined according to the current dialogue information, and whether the first response information is accurate is determined according to the first situation and the second situation. That is, the historical dialogue information and the current dialogue information are comprehensively considered to determine whether the current response information is accurate, which solves the problem of low accuracy of response information of intelligent dialogue in related technologies, that is, a more humane dialogue method is adopted to achieve highly accurate dialogue goals.
[0127] In an exemplary embodiment, the fourth determination module 62 is configured to determine the similarity between the first context and the second context; and determine not to adjust the first response information if the similarity satisfies a preset similarity matching rule.
[0128] In an exemplary embodiment, the fourth determination module 62 is used to determine a first emotion vector of a first emotion and a second emotion vector of a second emotion, and to determine a first scene vector of a first scene and a second scene vector of a second scene, wherein the first situation includes: the first emotion and the first scene, and the second situation includes: the second emotion and the second scene; determine a first vector similarity between the first emotion vector and the second emotion vector, and determine a second vector similarity between the first scene vector and the second scene vector; determine the similarity based on the first vector similarity and the second vector similarity.
[0129] In an exemplary embodiment, the first acquisition module 52 is used to input the first situation into the big model when the similarity does not satisfy the preset similarity matching rule, so that the big model generates a corresponding second response information according to the first situation; and send the second response information to the terminal device corresponding to the target object.
[0130] In an exemplary embodiment, the above-mentioned device also includes: a training module, which is used to determine whether the second situation is consistent with the historical situation; when the second situation is consistent with the historical situation, constructing a training data pair according to the historical dialogue information and the current dialogue information, and determining that the data category of the training data pair is a first data category, wherein the first data category is a data type in which the second situation is consistent with the historical situation; when the second situation is inconsistent with the historical situation, constructing a training data pair according to the historical dialogue information and the current dialogue information, and determining that the data category of the training data pair is a second data category, wherein the second data category is a data type in which the second situation is inconsistent with the historical situation; training the large model based on the training information of the first data category and / or the training information of the second data category.
[0131] In an exemplary embodiment, a training module is used to determine historical annotations of the historical conversation information and current annotations of the current conversation information, wherein the historical annotations are used to indicate whether the context of the historical conversation information has changed relative to the previous round of conversation information, and if so, the reason for the change; the current annotations are used to indicate whether the context of the current conversation information has changed relative to the previous round of conversation information, and if so, the reason for the change; construct first training data based on the historical annotations, the historical context and the historical conversation information, and construct second training data based on the current annotations, the second context and the current conversation information; and construct the training data pair based on the first training data and the second training data.
[0132] In an exemplary embodiment, the above-mentioned device also includes an establishment module for obtaining sample contexts, wherein the sample contexts include: multiple sample emotions and multiple sample scenes; determining information pairs based on the sample contexts, and establishing an emotion feedback matrix based on the information pairs, wherein the information pairs include: the sample scenes and the sample emotions corresponding to the sample scenes, and the emotion feedback matrix is used to indicate the reward value obtained by taking the target emotions in the target scenes; calculating the scene transition probability based on the sample contexts, wherein the scene transition probability is used to indicate the probability of the first sample scene transferring to the second sample scene under the first sample emotion; determining a discount factor, wherein the discount factor is used to indicate the attenuation of future reward values relative to immediate reward values; determining the numerical value of the optimal scene value corresponding to the first sample scene based on the emotion feedback matrix, the scene transition probability and the discount factor; and establishing the scene lookup table based on the numerical value of the optimal scene value corresponding to the first sample scene.
[0133] In an exemplary embodiment, a module is established for determining a numerical value of the scene value corresponding to the first sample scene based on the emotional feedback matrix, the scene transition probability and the discount factor; and determining a numerical value of the optimal scene value corresponding to the first sample scene based on the numerical value of the scene value corresponding to the first sample scene.
[0134] In an exemplary embodiment, a module is established to determine the value of the scene value corresponding to the first sample scene by the following formula: :
[0135] = , where S is the emotion set, C is the scene set, is the probability distribution of the first sample emotion s when the first sample scene is c, is the emotional feedback matrix when the first sample emotion is s and the first sample scene is c, r is the discount factor, is the probability of the first sample scene c transferring to the second sample scene c' when the first sample emotion is s, is the value of the scene value corresponding to the second sample scene c', is the sentiment trend coefficient, .
[0136] In an exemplary embodiment, a module is established to determine the numerical value of the optimal scene value corresponding to the first sample scene by the following formula: :
[0137] ,in, is the value of the scene value of the first sample scene c, is the emotional feedback matrix when the first sample emotion is s and the first sample scene is c, is the probability of the first sample scene c transferring to the second sample scene c' when the first sample emotion is s, r is the discount factor, is the value of the optimal scene value corresponding to the second sample scene c', is the sentiment trend coefficient.
[0138] In an exemplary embodiment, a module is established for determining positive emotions and negative emotions among the multiple sample emotions; determining the positive emotion weight of each positive emotion according to the timestamp of each positive emotion, and determining the negative emotion weight of each negative emotion according to the timestamp of each negative emotion; and determining the emotion trend coefficient according to the positive emotion weight of each positive emotion and the negative emotion weight of each negative emotion.
[0139] In an exemplary embodiment, a module is established to determine the maximum reward value of each sample scene transferred to the multiple sample scenes based on the numerical value of the optimal scene value corresponding to the first sample scene; and the scene lookup table is established based on the maximum reward value of each sample scene transferred to other sample scenes.
[0140] In an exemplary embodiment, the second acquisition module 54 is used to determine a first conversation vector of historical conversation information, and determine a second conversation vector of each sample conversation information in a sample conversation set; determine a second vector similarity between the first conversation vector and the second conversation vector of each sample conversation information; determine a similarity that satisfies a threshold matching rule among multiple second vector similarities, and determine the target sample conversation information corresponding to the vector similarity that satisfies the threshold matching rule; determine a context corresponding to the target sample conversation information, and determine the context corresponding to the target sample conversation information as the historical context.
[0141] An embodiment of the present application further provides a storage medium, which includes a stored program, wherein the program executes any of the above methods when it is run.
[0142] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:
[0143] S1, obtaining current input information of the target object, and inputting the current input information into the large model, so that the large model outputs first response information according to the current input information;
[0144] S2, obtaining a historical context corresponding to the historical dialogue information, wherein the historical dialogue information is dialogue information between the target object and the large model for a target number of rounds, and the historical context includes: a historical scene and a historical emotion;
[0145] S3, determining a first scene corresponding to a historical scene in a scene lookup table, wherein the value in the scene lookup table is used to indicate a reward value corresponding to the conversion of any scene in the scene set to all scenes in the scene set, and the reward value corresponding to the switching of the historical scene to the first scene satisfies a preset switching strategy;
[0146] S4, determining a first emotion corresponding to the switching of the historical scene to the first scene according to a preset information library, wherein the preset information library stores the emotion when the scene switches;
[0147] S5, determining a second context according to current dialogue information, wherein the current dialogue information includes: the current input information and the first response information;
[0148] S6. Determine whether to adjust the first response information according to a first situation and the second situation, wherein the first situation includes: the first scene and the first emotion.
[0149] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0150] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0151] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0152] S1, obtaining current input information of the target object, and inputting the current input information into the large model, so that the large model outputs first response information according to the current input information;
[0153] S2, obtaining a historical context corresponding to the historical dialogue information, wherein the historical dialogue information is dialogue information between the target object and the large model for a target number of rounds, and the historical context includes: a historical scene and a historical emotion;
[0154] S3, determining a first scene corresponding to a historical scene in a scene lookup table, wherein the value in the scene lookup table is used to indicate a reward value corresponding to the conversion of any scene in the scene set to all scenes in the scene set, and the reward value corresponding to the switching of the historical scene to the first scene satisfies a preset switching strategy;
[0155] S4, determining a first emotion corresponding to the switching of the historical scene to the first scene according to a preset information library, wherein the preset information library stores the emotion when the scene switches;
[0156] S5, determining a second context according to current dialogue information, wherein the current dialogue information includes: the current input information and the first response information;
[0157] S6. Determine whether to adjust the first response information according to a first situation and the second situation, wherein the first situation includes: the first scene and the first emotion.
[0158] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0159] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0160] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0161] The embodiments of the present application also provide a computer program, which includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the steps in any one of the above method embodiments.
[0162] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0163] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0164] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for determining response information, characterized in that: include: Acquire current input information of the target object, and input the current input information into the large model, so that the large model outputs first response information according to the current input information; Acquire a historical context corresponding to the historical dialogue information, wherein the historical dialogue information is dialogue information between the target object and the large model for a target number of rounds, and the historical context includes: a historical scene and a historical emotion; Determine a first scene corresponding to a historical scene in a scene lookup table, wherein the value in the scene lookup table is used to indicate a reward value corresponding to the conversion of any scene in a scene set to all scenes in the scene set, and the reward value corresponding to the switching of the historical scene to the first scene satisfies a preset switching strategy; Determine, according to a preset information library, a first emotion corresponding to the switching of the historical scene to the first scene, wherein the preset information library stores the emotion when the scene switches; Determining a second context according to current dialogue information, wherein the current dialogue information includes: the current input information and the first response information; Determine whether to adjust the first response information according to a first situation and the second situation, wherein the first situation includes: the first scene and the first emotion.
2. The method for determining response information according to claim 1, characterized in that: Determining whether to adjust the first response information according to the first scenario and the second scenario includes: determining a similarity between the first context and the second context; In a case where the similarity satisfies a preset similarity matching rule, it is determined not to adjust the first response information.
3. The method for determining response information according to claim 2, characterized in that: Determining the similarity between the first context and the second context includes: Determine a first emotion vector for a first emotion and a second emotion vector for a second emotion, and determine a first scene vector for a first scene and a second scene vector for a second scene, wherein the first scene includes: the first emotion and the first scene, and the second scene includes: the second emotion and the second scene; Determining a first vector similarity between the first emotion vector and the second emotion vector, and determining a second vector similarity between the first scene vector and the second scene vector; The similarity is determined according to the first vector similarity and the second vector similarity.
4. The method for determining response information according to claim 2, characterized in that: After determining the similarity between the first context and the second context, the method further includes: In the case where the similarity does not satisfy a preset similarity matching rule, inputting the first scenario into the large model so that the large model generates corresponding second response information according to the first scenario; The second response information is sent to the terminal device corresponding to the target object.
5. The method for determining response information according to claim 2, characterized in that: After determining not to adjust the first response information, the method further includes: determining whether the second scenario is consistent with the historical scenario; In the case where the second context is consistent with the historical context, constructing a training data pair according to the historical conversation information and the current conversation information, and determining that the data category of the training data pair is a first data category, wherein the first data category is a data type that is consistent with the second context and the historical context; In the case where the second context is inconsistent with the historical context, constructing a training data pair according to the historical conversation information and the current conversation information, and determining that the data category of the training data pair is a second data category, wherein the second data category is a data type in which the second context is inconsistent with the historical context; The large model is trained based on the training information of the first data category and / or the training information of the second data category.
6. The method for determining response information according to claim 5, characterized in that: Constructing a training data pair according to the historical conversation information and the current conversation information, including: Determining a historical annotation description of the historical dialogue information and a current annotation description of the current dialogue information, wherein the historical annotation description is used to indicate whether the context of the historical dialogue information has changed relative to the previous round of dialogue information, and if so, the reason for the change, and the current annotation description is used to indicate whether the context of the current dialogue information has changed relative to the previous round of dialogue information, and if so, the reason for the change; constructing first training data according to the historical annotation description, the historical context and the historical dialogue information, and constructing second training data according to the current annotation description, the second context and the current dialogue information; The training data pair is constructed according to the first training data and the second training data.
7. The method for determining response information according to claim 1, characterized in that: Before determining the first scene corresponding to the historical scene in the scene lookup table, the method further includes: Acquire a sample context, wherein the sample context includes: a plurality of sample emotions and a plurality of sample scenes; Determine an information pair according to the sample scenario, and establish an emotion feedback matrix according to the information pair, wherein the information pair includes: the sample scenario and the sample emotion corresponding to the sample scenario, and the emotion feedback matrix is used to indicate the reward value obtained by taking the target emotion in the target scenario; Calculating a scene transition probability according to the sample context, wherein the scene transition probability is used to indicate a probability of a first sample scene transitioning to a second sample scene under a first sample emotion; Determining a discount factor, wherein the discount factor is used to indicate the decay of the future return value relative to the immediate return value; Determining a numerical value of an optimal scene value corresponding to the first sample scene according to the emotion feedback matrix, the scene transition probability and the discount factor; The scene lookup table is established according to the numerical value of the optimal scene value corresponding to the first sample scene.
8. The method for determining response information according to claim 7, characterized in that: Determining a value of an optimal scene value corresponding to the first sample scene according to the emotion feedback matrix, the scene transition probability and the discount factor includes: Determine a numerical value of a scene value corresponding to the first sample scene according to the emotion feedback matrix, the scene transition probability and the discount factor; The value of the optimal scene value corresponding to the first sample scene is determined according to the value of the scene value corresponding to the first sample scene.
9. The method for determining response information according to claim 8, characterized in that: Determining a value of a scene value corresponding to the first sample scene according to the emotion feedback matrix, the scene transition probability and the discount factor includes: The numerical value of the scene value corresponding to the first sample scene is determined by the following formula: : = , where S is the emotion set, C is the scene set, is the probability distribution of the first sample emotion s when the first sample scene is c, is the emotional feedback matrix when the first sample emotion is s and the first sample scene is c, r is the discount factor, is the probability of the first sample scene c transferring to the second sample scene c' when the first sample emotion is s, is the value of the scene value corresponding to the second sample scene c', is the sentiment trend coefficient, .
10. The method for determining response information according to claim 8, characterized in that: Determining a value of an optimal scene value corresponding to the first sample scene according to a value of the scene value corresponding to the first sample scene includes: Determine the optimal scene value corresponding to the first sample scene according to the following formula: : ,in, is the value of the scene value of the first sample scene c, is the emotional feedback matrix when the first sample emotion is s and the first sample scene is c, is the probability of the first sample scene c transferring to the second sample scene c' when the first sample emotion is s, r is the discount factor, is the value of the optimal scene value corresponding to the second sample scene c', is the sentiment trend coefficient.
11. The method for determining response information according to claim 9, characterized in that: Before confirming the value of the optimal scene value corresponding to the first sample scene according to the emotion feedback matrix, the scene transition probability and the discount factor, the method further includes: determining positive sentiment and negative sentiment among the plurality of sample sentiments; Determine the positive emotion weight of each positive emotion according to the timestamp of each positive emotion, and determine the negative emotion weight of each negative emotion according to the timestamp of each negative emotion; The sentiment trend coefficient is determined according to the positive sentiment weight of each positive sentiment and the negative sentiment weight of each negative sentiment.
12. The method for determining response information according to claim 7, characterized in that: The scene lookup table is established according to the value of the optimal scene value corresponding to the first sample scene, including: Determine the maximum reward value of each sample scenario transferred to the multiple sample scenarios according to the value of the optimal scenario value corresponding to the first sample scenario; The scenario lookup table is established according to the maximum reward value of each sample scenario transferred to other sample scenarios.
13. The method for determining response information according to claim 1, characterized in that: Get the historical context corresponding to the historical conversation information, including: Determine a first dialogue vector for the historical dialogue information, and determine a second dialogue vector for each sample dialogue information in the sample dialogue set; Determining a second vector similarity between the first conversation vector and a second conversation vector of each sample conversation information; Determining a similarity satisfying a threshold matching rule among a plurality of second vector similarities, and determining target sample dialogue information corresponding to the vector similarity satisfying the threshold matching rule; The context corresponding to the target sample dialogue information is determined, and the context corresponding to the target sample dialogue information is determined as the historical context.
14. A device for determining response information, characterized in that: include: A first acquisition module is used to acquire current input information of the target object and input the current input information into the large model so that the large model outputs first response information according to the current input information; A second acquisition module is used to acquire a historical context corresponding to the historical dialogue information, wherein the historical dialogue information is dialogue information between the target object and the large model for a target number of rounds, and the historical context includes: historical scenes and historical emotions; A first determination module is used to determine a first scene corresponding to a historical scene in a scene lookup table, wherein the value in the scene lookup table is used to indicate a reward value corresponding to the conversion of any scene in a scene set to all scenes in the scene set, and the reward value corresponding to the switching of the historical scene to the first scene satisfies a preset switching strategy; A second determining module is used to determine a first emotion corresponding to the switching of the historical scene to the first scene according to a preset information library, wherein the preset information library stores the emotions when the scene switches; a third determining module, configured to determine a second context according to current dialogue information, wherein the current dialogue information includes: the current input information and the first response information; A fourth determination module is used to determine whether to adjust the first response information according to a first situation and the second situation, wherein the first situation includes: the first scene and the first emotion.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 13 when executed.
16. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 13 through the computer program.
Citation Information
Patent Citations
Deep-reinforcement-learning-based scene text detection method and system
CN108090443A
Voice matching method for intelligent dialogue system, electronic device and computer device
WO2021000403A1
