Conversation generation method and device, computer equipment, storage medium and computer program product
By using large language model modules to replace natural language understanding and natural language generation modules in the dialogue robot framework, the problem of long-term model training in the existing technology is solved, and more efficient dialogue generation and rich user interaction experience is achieved.
Patent Information
- Application Number
- CN202411717095.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-02-25
AI Technical Summary
In the existing dialogue robot framework, the natural language understanding and natural language generation modules need to train multiple models separately, which makes the model training stage longer.
A dialogue generation method is provided, and a large language model module is used to replace natural language understanding and natural language generation modules. By obtaining user dialogue information, generating reply prompt words, extracting dialogue feature information and generating reply information, the target reply strategy determination and reply information output of the dialogue management module are realized.
It greatly saves time-consuming in the model training stage and improves the richness and user experience of the dialogue framework and user interaction.
Smart Images

Figure CN119513269A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of natural language processing, and in particular to a dialogue generation method, apparatus, computer device, storage medium and computer program product. Background Art
[0002] With the continuous development of conversational robots, a large number of companies have gradually introduced conversational robots to realize customer service, call answering and other functions, providing an intelligent and efficient processing method for customer service functions.
[0003] In the related technology, there are dialogue frameworks that allow users to customize conversational robots, such as the Rasa framework. In the Rasa framework, users can build natural language understanding (NLU) modules, dialogue management (DM) modules, and natural language generation (NLG) modules, and generate responses to users through the interaction of each module.
[0004] However, in related technologies, each module in the dialogue framework needs to be supported by training multiple models separately. For example, in the Rasa framework, the NLU module needs to train the word segmentation model, intent classification model, entity extraction model, etc., and the NLG module needs to train the natural language generation model, etc., which leads to the problem that the model training phase takes a long time. Summary of the invention
[0005] Based on this, it is necessary to provide a dialogue generation method, apparatus, computer device, storage medium and computer program product to address the above technical issues.
[0006] In a first aspect, the present application provides a method for generating a dialogue. The dialogue framework includes a natural language understanding module and a dialogue management module, and the natural language understanding module includes a large language model module. The method includes:
[0007] Acquire user conversation information, and determine the conversation domain to which the user conversation information belongs;
[0008] When the conversation domain meets a preset condition, obtaining each first sample reply information corresponding to the conversation domain from a reply information database, generating a reply prompt word based on the user conversation information and the first sample reply information, and inputting the reply prompt word into the large language model module to obtain the conversation feature information and at least one reply information output by the large language model module;
[0009] Inputting the dialogue feature information and the reply information into the dialogue management module, determining a target reply strategy based on the dialogue feature information by the dialogue management module, and generating first target reply information matching the target reply strategy according to the reply information;
[0010] The first target reply information is output as reply information for the user dialogue information, and the first target reply information is stored in the reply information database as sample reply information.
[0011] In one embodiment, the dialogue framework further includes a natural language generation module, the natural language understanding module further includes a dialogue feature information extraction module, and the method further includes:
[0012] In the case where the conversation domain does not satisfy the preset condition, inputting the user conversation information into the conversation feature information extraction module to obtain conversation feature information;
[0013] Inputting the dialogue feature information into the dialogue management module, determining the target reply strategy based on the dialogue feature information by the dialogue management module, and determining second sample reply information corresponding to the target reply strategy in the dialogue field from the reply information database;
[0014] Inputting the conversation feature information and the second sample reply information into the natural language generation module to obtain second target reply information output by the natural language generation module;
[0015] The second target reply information is output as reply information to the user dialogue information.
[0016] In one embodiment, the preset condition includes at least one of the following: the number of sample reply information corresponding to the dialogue field in the reply information database is less than a preset number, and the target reply duration corresponding to the dialogue field is greater than a preset threshold.
[0017] In one embodiment, the reply information database further stores sample conversation information and sample reply strategies corresponding to each sample reply information, and the generating of reply prompt words based on the user conversation information and the first sample reply information includes:
[0018] Determining third sample reply information from each of the first sample reply information according to the similarity between the sample conversation information corresponding to each of the first sample reply information and the user conversation information;
[0019] Respectively determine the target sample response strategies corresponding to each of the third sample response information;
[0020] For any of the target sample reply strategies, generating a reply prompt example corresponding to the target sample reply strategy according to each of the third sample reply information corresponding to the target sample reply strategy and the sample conversation information corresponding to each of the third sample reply information;
[0021] The reply prompt words are generated according to each of the reply prompt examples.
[0022] In one embodiment, the reply information database further stores a reply score corresponding to each of the sample reply information, and the generating of a reply prompt example corresponding to the target sample reply strategy according to each of the third sample reply information corresponding to the target sample reply strategy and the sample conversation information corresponding to each of the third sample reply information includes:
[0023] Sort the third sample reply information from high to low according to the reply score to obtain a third sample reply information sequence;
[0024] Determine positive third sample reply information and negative third sample reply information according to the sorting position of each third sample reply information in the third sample reply information sequence;
[0025] Generate a positive reply prompt example according to the positive third sample reply information and the sample dialogue information corresponding to the positive third sample reply information, and generate a negative reply prompt example according to the negative third sample reply information and the sample dialogue information corresponding to the negative third sample reply information;
[0026] According to the positive reply prompt example and the negative reply prompt example, a reply prompt example corresponding to the target sample reply strategy is generated.
[0027] In one embodiment, determining the positive third sample response information and the negative third sample response information according to the sorting position of each of the third sample response information in the third sample response information sequence includes:
[0028] From each of the third sample reply information, determine the candidate positive third sample reply information whose sorting position is in the front preset proportion in the third sample reply information sequence, and determine the candidate negative third sample reply information whose sorting position is in the back preset proportion in the third sample reply information sequence;
[0029] According to the similarity between the sample conversation information corresponding to each of the candidate positive third sample reply information and the user conversation information, the positive third sample reply information is determined from each of the candidate positive third sample reply information, and according to the similarity between the sample conversation information corresponding to each of the candidate negative third sample reply information and the user conversation information, the negative third sample reply information is determined from each of the candidate negative third sample reply information.
[0030] In a second aspect, the present application also provides a dialogue generation device. The dialogue framework includes a natural language understanding module and a dialogue management module, and the natural language understanding module includes a large language model module. The device includes:
[0031] An acquisition module, used to acquire user conversation information and determine the conversation domain to which the user conversation information belongs;
[0032] A first input module is used to obtain each first sample reply information corresponding to the dialogue field from a reply information database when the dialogue field meets a preset condition, generate a reply prompt word based on the user dialogue information and the first sample reply information, and input the reply prompt word into the large language model module to obtain dialogue feature information and at least one reply information output by the large language model module;
[0033] a second input module, configured to input the dialogue feature information and the reply information into the dialogue management module, determine a target reply strategy based on the dialogue feature information through the dialogue management module, and generate first target reply information matching the target reply strategy according to the reply information;
[0034] The first output module is used to output the first target reply information as reply information for the user dialogue information, and store the first target reply information as sample reply information in the reply information database.
[0035] In one embodiment, the dialogue framework further includes a natural language generation module, the natural language understanding module further includes a dialogue feature information extraction module, and the device further includes:
[0036] A third input module, configured to input the user conversation information into the conversation feature information extraction module to obtain conversation feature information when the conversation domain does not satisfy the preset condition;
[0037] a fourth input module, configured to input the dialogue feature information into the dialogue management module, determine the target reply strategy based on the dialogue feature information through the dialogue management module, and determine second sample reply information corresponding to the target reply strategy in the dialogue field from the reply information database;
[0038] a fifth input module, configured to input the conversation feature information and the second sample reply information into the natural language generation module, and obtain the second target reply information output by the natural language generation module;
[0039] The second output module is used to output the second target reply information as reply information to the user dialogue information.
[0040] In one embodiment, the preset condition includes at least one of the following: the number of sample reply information corresponding to the dialogue field in the reply information database is less than a preset number, and the target reply duration corresponding to the dialogue field is greater than a preset threshold.
[0041] In one embodiment, the reply information database further stores sample conversation information and sample reply strategies corresponding to each sample reply information, and the first input module is further used to:
[0042] Determining third sample reply information from each of the first sample reply information according to the similarity between the sample conversation information corresponding to each of the first sample reply information and the user conversation information;
[0043] Respectively determine the target sample response strategies corresponding to each of the third sample response information;
[0044] For any of the target sample reply strategies, generating a reply prompt example corresponding to the target sample reply strategy according to each of the third sample reply information corresponding to the target sample reply strategy and the sample conversation information corresponding to each of the third sample reply information;
[0045] The reply prompt words are generated according to each of the reply prompt examples.
[0046] In one embodiment, the reply information database further stores a reply score corresponding to each sample reply information, and the first input module is further used to:
[0047] Sort the third sample reply information from high to low according to the reply score to obtain a third sample reply information sequence;
[0048] Determine positive third sample reply information and negative third sample reply information according to the sorting position of each third sample reply information in the third sample reply information sequence;
[0049] Generate a positive reply prompt example according to the positive third sample reply information and the sample dialogue information corresponding to the positive third sample reply information, and generate a negative reply prompt example according to the negative third sample reply information and the sample dialogue information corresponding to the negative third sample reply information;
[0050] According to the positive reply prompt example and the negative reply prompt example, a reply prompt example corresponding to the target sample reply strategy is generated.
[0051] In one embodiment, the first input module is further used for:
[0052] From each of the third sample reply information, determine the candidate positive third sample reply information whose sorting position is located in the front preset proportion in the third sample reply information sequence, and determine the candidate negative third sample reply information whose sorting position is located in the back preset proportion in the third sample reply information sequence;
[0053] According to the similarity between the sample conversation information corresponding to each of the candidate positive third sample reply information and the user conversation information, the positive third sample reply information is determined from each of the candidate positive third sample reply information, and according to the similarity between the sample conversation information corresponding to each of the candidate negative third sample reply information and the user conversation information, the negative third sample reply information is determined from each of the candidate negative third sample reply information.
[0054] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, any one of the above methods is implemented.
[0055] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, any of the above methods is implemented.
[0056] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, any of the above methods is implemented.
[0057] The above-mentioned dialogue generation method, device, computer equipment, storage medium and computer program product, if the dialogue field is suitable for using a large language model to generate reply information, then the large language model is used to simultaneously extract dialogue feature information and generate reply information. After determining the target reply strategy, the dialogue management module can select the reply information that matches the target reply strategy from the reply information provided by the large language model for output. Through the above method, the large language model can replace the functions of the two modules of natural language understanding and natural language generation in the original dialogue framework. Only fine-tuning training of the large language model itself is required to complete the deployment of the two modules of natural language understanding and natural language generation, which greatly saves the time spent in the model training stage. At the same time, since the reply information generated by the large language model is relatively rich, it can also improve the richness of the interaction between the dialogue framework and the user, and improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 A flowchart of a method for generating a dialogue in one embodiment;
[0059] Figure 2 It is a flowchart of a method for generating a dialogue when a dialogue domain does not meet a preset condition in one embodiment;
[0060] Figure 3 is a flow chart of step 104 in one embodiment;
[0061] Figure 4 Schematic diagram of the principle of a LoRA fine-tuning method in one embodiment;
[0062] Figure 5 A schematic diagram of a dialogue framework after integrating a large language model in one embodiment;
[0063] Figure 6 A schematic diagram of an application of a dialogue framework in an embodiment;
[0064] Figure 7 is a structural block diagram of a dialogue generating device in one embodiment;
[0065] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0066] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0067] In one embodiment, Figure 1As shown, a method for generating a dialogue is provided. This embodiment uses the method applied to a server as an example. It is understandable that the method can also be applied to a terminal, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. A dialogue framework is provided in the server, and the dialogue framework can be implemented using any existing dialogue framework such as the Rasa framework. The dialogue framework includes a natural language understanding module and a dialogue management module, and the natural language understanding module includes a large language model module. In this embodiment, the method includes the following steps:
[0068] Step 102: Acquire user conversation information and determine the conversation domain to which the user conversation information belongs.
[0069] In the embodiment of the present application, the user dialogue information is the information input by the user into the dialogue frame, which can be text information or voice information. If the information is voice information, after obtaining the user dialogue information, the voice-to-text technology can be used to convert the user dialogue information into text information.
[0070] The server records multiple preset dialogue areas. The preset dialogue areas are determined according to the application scenarios of the dialogue framework. For example, when the dialogue framework is expected to be applied to dialogue robots in insurance reporting, insurance consultation, and insurance policy inquiry scenarios, the preset dialogue areas may be insurance reporting, insurance consultation, and insurance policy inquiry.
[0071] The conversation domain to which the user conversation information belongs can be obtained by classifying the user conversation information. Any classification model can be used to classify the user conversation information. The classification model will calculate the confidence that the user conversation information belongs to each preset conversation domain respectively, and take the conversation domain with the highest confidence as the conversation domain to which the user conversation information belongs.
[0072] Step 104, when the dialogue field meets the preset conditions, obtain each first sample reply information corresponding to the dialogue field from the reply information database, generate a reply prompt word based on the user dialogue information and the first sample reply information, and input the reply prompt word into the large language model module to obtain dialogue feature information and at least one reply information output by the large language model module.
[0073] In an embodiment of the present application, if the dialogue field meets the preset conditions, the large language model module is used to extract the dialogue feature information and reply information of the user dialogue information. The large language model module can be implemented using any existing large language model. In order to make the large language model perform better in special fields, the large language model can also be fine-tuned according to the possible application scenarios of the dialogue framework before connecting the large language model to the large language model module. The embodiment of the present application does not specifically limit the method of fine-tuning training, for example, LoRA (Low-Rank Adaptation, low-rank adaptation fine-tuning) can be used.
[0074] The preset condition is used to determine whether the dialogue domain is suitable for using a large language model to generate reply information. Considering the characteristics of a large language model, which takes a long time to generate reply information, but at the same time generates rich reply information, it is possible to determine which dialogue domains meet the preset condition based on the dialogue domain's requirements for the time required to generate reply information and the requirements for the richness of reply information. Those skilled in the art can refer to this principle and preset whether the dialogue domain meets the preset condition for each dialogue domain.
[0075] Taking the dialogue fields including insurance consultation and insurance reporting as an example, considering that users generally want to hear richer answers in the insurance consultation scenario, and users do not have high requirements for the timeliness of the responses, it can be determined that the insurance consultation field meets the preset conditions. In the insurance reporting scenario, users generally need to enter specific information, and do not have high requirements for whether the responses are rich, and users have high requirements for the timeliness of the responses, so it can be determined that the insurance reporting field does not meet the preset conditions.
[0076] If the dialogue domain meets the preset conditions, each first sample reply information corresponding to the dialogue domain is obtained from the reply information database to construct the reply prompt words that need to be input into the large language model. The reply information database stores multiple sample reply information, and the sample reply information can be pre-constructed by technicians in this field, or selected from the reply information previously generated by the large language model. In addition to storing each sample reply information, the reply information database also needs to store the dialogue domain corresponding to each sample reply information. The reply prompt words are used to instruct the large language model to extract the dialogue feature information corresponding to this dialogue domain (including but not limited to dialogue intentions, entities that can be extracted from dialogue information, etc.), and generate reply information for the user's dialogue information.
[0077] The embodiments of the present application do not specifically limit how to construct a reply prompt word based on each first sample reply information. For example, several sample reply information can be selected from each first sample reply information, and sample information can be constructed based on the multiple sample reply information, and then the pre-generated reply task description and each sample information can be combined to obtain a reply prompt word.
[0078] The reply task description is related to the dialogue domain. The reply task description may include background information of the dialogue domain, description of dialogue feature information that needs to be output by the large language model, and limitation of reply information output by the large language model. For example, for the insurance consulting domain, the reply task description may include information about each existing insurance product (background information of the insurance consulting domain), description of the user intent that the large language model needs to extract from the user dialogue information (dialogue feature information that needs to be output in the insurance consulting domain), and description of the insurance product recommendation that the large language model needs to generate to the user according to the user's needs, and only one insurance product can be recommended at a time, and new insurance product requirements cannot be fabricated outside of the given insurance products (limitation of reply information in the insurance consulting domain). For the insurance policy query field, the reply task description may include the query information that the user should at least provide when querying the insurance policy (background information in the insurance policy query field), the description of the information that the large language model needs to extract from the user conversation information that the user has provided in the query information (conversation feature information that needs to be output in the insurance query field), and the large language model needs to generate a reply for the information that the user has not yet provided in the query information, and mark the information that the user has not provided in bold in the reply, or if the user has provided all the query information, it is necessary to generate a requirement to inform the user that the corresponding insurance policy has been found based on the query information, or that the query information provided by the user is incorrect (limitation of reply information in the insurance policy query field).
[0079] For each possible response strategy in the dialogue management module, an example sample response information can be obtained (the response information database can record the response strategy corresponding to each sample response information), and then in the response prompt word, the large language model is required to generate a response information for each possible response strategy. This is because in the dialogue framework, the natural language understanding module must be deployed before the dialogue management module. Therefore, if the large language model is required to generate response information in the natural language understanding step, the large language model cannot refer to the target response strategy generated by the dialogue management module to generate the response information. At the same time, in simple dialogue scenarios where the dialogue framework needs to be applied, the number of response strategies is generally limited. Therefore, the large language model can generate response information for each possible response strategy, so that after the dialogue management module determines the target response strategy, it can determine the first target response information that matches the target response strategy from the response information.
[0080] It should be further explained here that the reason why the large language model is not used as a natural language understanding module to extract dialogue feature information first, and then used as a natural language generation module to generate reply information is because the large language model has high requirements for prompt words and context when generating replies. Therefore, the large language model is used to extract dialogue feature information and generate reply information at the same time, so that the generated reply information can fully refer to the dialogue feature information and obtain a reply that is more relevant to the dialogue feature information. Otherwise, in the stage of generating reply information, the prompt words need to be rebuilt based on the dialogue feature information, resulting in low efficiency in generating reply information.
[0081] For example, in the field of insurance policy inquiries, possible response strategies include: (1) if the information entered by the user is incomplete, the user is asked to continue to provide the missing information; (2) if the information entered by the user is complete and correct, the insurance policy information is returned to the user; (3) if the information entered by the user is complete but incorrect, the user is told that the corresponding insurance policy information was not found and needs to re-enter the information.
[0082] Accordingly, the sample response information obtained may include: (1) "Please continue to provide the following information: [missing information]"; (2) "The insurance policy has been found, and the following are the policy details: [policy information]. If you have any questions or need further service, please feel free to contact us"; (3) "Based on the information you provided, we were unable to find the corresponding policy record. It may be that the input is incorrect or the information has not been updated. Please recheck and enter the correct information so that we can provide you with accurate policy information. Thank you for your understanding and cooperation." Combining the above three sample information with the response task description, the response prompt words can be obtained.
[0083] After the reply prompt words are input into the large language model, the dialogue feature information and reply information output by the large language model according to the requirements of the reply prompt words can be obtained. This information is further input into the dialogue management module.
[0084] Step 106, input the dialogue feature information and the reply information into the dialogue management module, determine the target reply strategy based on the dialogue feature information through the dialogue management module, and generate first target reply information matching the target reply strategy according to the reply information.
[0085] In the embodiment of the present application, the dialogue management module is used to track the dialogue state (which may include user feature information, number of dialogue turns, dialogue feature information extracted from dialogue information, etc.), and is also used to select an appropriate response strategy according to the dialogue state. The dialogue management module can be implemented using an existing dialogue management module, and the embodiment of the present application does not limit how the dialogue management module tracks the dialogue state and how to determine the target response strategy. For example, the function of selecting a response strategy in the dialogue management module can be implemented using a classification model, and multiple preset response strategies can be pre-set. The confidence that the dialogue state belongs to each preset response strategy is calculated through the classification model, and the preset response strategy with the highest confidence is selected as the target response strategy.
[0086] After the dialogue management module determines the target response strategy, it determines the first target response information that matches the target response strategy from each response information according to the target response strategy. If the large language model is required to generate response information for each possible response strategy in the response prompt, the response information generated by the large language model for the target response strategy can be selected here, and the first target response information can be obtained after the required parts of the response information are filled in.
[0087] For example, taking the aforementioned insurance policy query field as an example, the dialogue management module can record the query information that has been extracted during multiple rounds of dialogue with the user in the dialogue state. When all query information has been extracted, the dialogue management module can access the insurance policy database and query the corresponding insurance policy according to the information provided by the user. If the insurance policy exists, the target response strategy generated by the dialogue management module is to inform the user that the information is complete and correct, and return the insurance policy information to the user. The dialogue management module can then fill in the [Insurance Policy Information] part in the reply information generated by the large language model based on the queried insurance policy information to obtain the first target reply information.
[0088] If the large language model has not been required to generate reply information that matches the reply strategy before (for example, the large language model is only required to generate "possible reply information in various situations" in the reply prompt words), the dialogue management module can use the pre-trained text classification model to generate text vectors corresponding to each reply information, and then classify each text vector into each preset reply strategy, and then select the reply information classified into the target reply strategy, complete the part that needs to be filled in the reply information, and obtain the first target reply information.
[0089] Step 108: output the first target reply information as reply information for the user dialogue information, and store the first target reply information as sample reply information in a reply information database.
[0090] In an embodiment of the present application, after obtaining the first target reply information, the dialogue management module may output the first target reply information, or when the user accesses the dialogue framework through a telephone or other means, the dialogue management module may input the first target reply information into the speech generation model, so that after the speech generation model generates the speech information, the speech information is output to the user.
[0091] Furthermore, the dialogue management module may also store the first target reply information as sample reply information in a reply information database for use when generating a reply prompt word next time.
[0092] The dialogue generation method provided in the embodiment of the present application, if the dialogue field is suitable for using a large language model to generate reply information, then the large language model is used to simultaneously extract dialogue feature information and generate reply information. After determining the target reply strategy, the dialogue management module can select the reply information that matches the target reply strategy from the reply information provided by the large language model for output. Through the above method, the large language model can replace the functions of the two modules of natural language understanding and natural language generation in the original dialogue framework. Only fine-tuning training of the large language model itself is required to complete the deployment of the two modules of natural language understanding and natural language generation, which greatly saves the time spent in the model training stage. At the same time, since the reply information generated by the large language model is relatively rich, the richness of the interaction between the dialogue framework and the user can also be improved, thereby improving the user experience.
[0093] In one embodiment, Figure 2 As shown, the dialogue framework further includes a natural language generation module, the natural language understanding module further includes a dialogue feature information extraction module, and the method further includes:
[0094] Step 202, when the dialogue field does not meet the preset conditions, the user dialogue information is input into the dialogue feature information extraction module to obtain dialogue feature information;
[0095] Step 204, inputting the dialogue feature information into the dialogue management module, determining the target reply strategy based on the dialogue feature information through the dialogue management module, and determining the second sample reply information corresponding to the target reply strategy in the dialogue domain from the reply information database;
[0096] Step 206, inputting the dialogue feature information and the second sample reply information into a natural language generation module to obtain second target reply information output by the natural language generation module;
[0097] Step 208: output the second target reply information as reply information to the user dialogue information.
[0098] In the embodiment of the present application, if the dialogue field is not suitable for using a large language model to generate reply information, the traditional dialogue framework architecture can be used to generate reply information. Specifically, the user dialogue information can be input into the dialogue feature information extraction module in the natural language understanding module. The dialogue feature information extraction module can be formed by combining multiple models, such as a word segmentation model, an intent recognition model, an entity extraction model, etc.
[0099] After the dialogue feature information extraction module extracts the dialogue feature information, it inputs the dialogue feature information into the dialogue management module, and the dialogue management module determines the target reply strategy based on the dialogue feature information. The way in which the dialogue management module determines the target reply strategy can be found in the prior art, and the embodiment of the present application will not be repeated.
[0100] The dialogue management module can also determine the second sample reply information corresponding to the target reply strategy in the dialogue field from the reply information database, and provide the second sample reply information to the natural language generation module for reference, so that even if the large language model is not used to generate the reply information, the final generated reply information can be relatively rich.
[0101] The natural language generation module can be implemented using any model that can generate natural language. When training these models, a training sample consisting of sample feature information and sample reply information can be constructed, and the input of the model includes the sample feature information and the pre-constructed reference reply information, so that the output of the model is the reply information, and the optimization goal of the model is set to minimize the gap between the reply information and the sample reply information, and minimize the gap between the reply information and the reference reply information. After training, a natural language generation module that can generate reply information with reference to the second sample reply information can be obtained.
[0102] After the natural language generation module outputs the second sample reply information, the server displays the second sample reply information to the user, or after generating voice information according to the second sample reply information, displays the voice information to the user.
[0103] The dialogue generation method provided in the embodiment of the present application adopts a traditional dialogue framework architecture to generate reply information for dialogue fields that are not suitable for generating reply information with a large language model, and enables the natural language generation module to refer to the second sample reply information previously generated by the large language model and stored in the database when generating reply information, so that even if the traditional dialogue framework is used to generate reply information, the obtained reply information can be relatively rich, thereby improving the user experience.
[0104] In one embodiment, the preset condition includes at least one of the following: the number of sample reply information corresponding to the dialogue field in the reply information database is less than a preset number, and the target reply duration corresponding to the dialogue field is greater than a preset threshold.
[0105] In the embodiment of the present application, for the dialogue field where the number of sample reply information stored in the reply information database is small, a large language model can be used to generate reply information to enrich the reply information database as quickly as possible. In this way, when the traditional dialogue framework is used to generate reply information in the future, enough second sample reply information can be obtained for reference by the natural language generation module, thereby improving the richness of the reply information generated by the traditional dialogue framework.
[0106] A target reply time can also be set for each dialogue domain. The target reply time is used to characterize the time that the user expects the dialogue framework to return the reply information after entering the user dialogue information. This time can be set by technicians in this field based on experience, and should usually be set between hundreds of milliseconds and several seconds. The preset threshold can be set according to the fastest time that the large language model can generate reply information (which can be obtained through experiments). If the target reply time corresponding to the dialogue domain is less than or equal to the preset threshold, it means that the large language model cannot return the reply information to the user in time within the time expected by the user. At this time, it is necessary to use a traditional dialogue framework with fewer parameters and thus faster generation of reply information. If the target reply time corresponding to the dialogue domain is greater than the preset threshold, the large language model can be used to generate reply information to improve the richness of the reply information.
[0107] In one embodiment, Figure 3 As shown, the reply information database also stores sample conversation information and sample reply strategies corresponding to each sample reply information. In step 104, a reply prompt word is generated based on the user conversation information and the first sample reply information, including:
[0108] Step 302, determining third sample reply information from each first sample reply information according to the similarity between the sample conversation information corresponding to each first sample reply information and the user conversation information;
[0109] Step 304, respectively determining the target sample reply strategies corresponding to each third sample reply information;
[0110] Step 306, for any target sample reply strategy, based on each third sample reply information corresponding to the target sample reply strategy and the sample dialogue information corresponding to each third sample reply information, generate a reply prompt example corresponding to the target sample reply strategy;
[0111] Step 308: Generate reply prompt words according to each reply prompt example.
[0112] In an embodiment of the present application, the reply information database also stores sample conversation information corresponding to the sample reply information and a sample reply strategy corresponding to the sample reply information. In the case where the sample reply information is pre-set by a technician and stored in the reply information database, the sample conversation information and the sample reply strategy can also be set by the technician. In the case where the sample reply information is the first target reply information, the sample conversation information is the user conversation information corresponding to the first target reply information, and the sample reply strategy is the target reply strategy corresponding to the first target reply information.
[0113] When generating reply prompt words, first, third sample reply information with similar corresponding sample dialogue information and user dialogue information can be screened out from each first sample reply information, and then, for each target sample reply strategy covered by each third sample reply information, one or more third sample reply information can be selected from the third sample reply information corresponding to the target sample reply strategy, and these third sample reply information and their sample dialogue information can be combined into reply prompt examples. Then, each reply prompt example can be spliced with the reply task description to obtain a reply prompt word.
[0114] The embodiment of the present application does not limit the specific form of the reply prompt example, as long as the large language model can parse the sample dialogue information and the third sample reply information from the reply prompt example, and can parse the corresponding relationship between the two information and the question-answer relationship. For example, when the sample dialogue information is "I want to query an insurance policy, the policy number is xxxxxx", and the third sample reply information is "Please continue to enter the insured's ID number and the insured's name", the reply prompt example can be: "Question: I want to query an insurance policy, the policy number is xxxxxx; Answer: Please continue to enter the insured's ID number and the insured's name".
[0115] The embodiment of the present application also does not specifically limit how to select one or more third sample reply information to generate a reply prompt example. It can be selected randomly or according to a certain rule.
[0116] In one example, the third sample reply information may be selected to generate a reply prompt example according to the similarity between the sample conversation information and the user conversation information. Specifically, for any target sample reply strategy, the target third sample reply information corresponding to the target sample reply strategy is determined, and the target third sample reply information whose corresponding sample conversation information has the highest similarity with the user conversation information is determined; based on the target third sample reply information and the sample conversation information corresponding to the target third sample reply information, a reply prompt example corresponding to the target sample reply strategy is generated.
[0117] In another example, the reply information database also records the reply scores corresponding to each sample reply information. The reply scores can be set by technicians in this field after regularly checking the reply information database, or after displaying the reply information to the user, the user can be prompted to score the reply information to obtain the reply score set by the user. Then, according to the reply scores corresponding to each third sample reply information, the third sample reply information can be selected to generate a reply prompt example.
[0118] Specifically, each third sample reply information is sorted from high to low according to the reply score to obtain a third sample reply information sequence; the positive third sample reply information and the negative third sample reply information are determined according to the sorting position of each third sample reply information in the third sample reply information sequence; a positive reply prompt example is generated according to the positive third sample reply information and the sample dialogue information corresponding to the positive third sample reply information, and a negative reply prompt example is generated according to the negative third sample reply information and the sample dialogue information corresponding to the negative third sample reply information; a reply prompt example corresponding to the target sample reply strategy is generated according to the positive reply prompt example and the negative reply prompt example.
[0119] Among them, the method of determining the positive third sample reply information and the negative third sample reply information according to the ranking position of each third sample reply information in the third sample reply information sequence can be to use all the third sample reply information with a preset proportion (for example, 5%) of the ranking position in the front in the third sample reply information sequence as the positive third sample reply information, and use all the third sample reply information with a preset proportion (for example, 10%) of the ranking position in the back as the negative third sample reply information.
[0120] Alternatively, it is also possible to determine, from each third sample reply information, candidate positive third sample reply information whose ranking position is in the front preset proportion in the third sample reply information sequence, and determine candidate negative third sample reply information whose ranking position is in the back preset proportion in the third sample reply information sequence; determine the positive third sample reply information from each candidate positive third sample reply information according to the similarity between the sample dialogue information corresponding to each candidate positive third sample reply information and the user dialogue information, and determine the negative third sample reply information from each candidate negative third sample reply information according to the similarity between the sample dialogue information corresponding to each candidate negative third sample reply information and the user dialogue information. For example, the information with the highest similarity among each candidate positive third sample reply information can be selected as the positive third sample reply information, and the information with the highest similarity among each candidate negative third sample reply information can be selected as the negative third sample reply information.
[0121] The method of generating positive reply prompt examples and negative reply prompt examples can refer to the method of generating reply prompt examples in the aforementioned embodiment, and the embodiments of the present application will not be repeated here.
[0122] After obtaining the positive reply prompt example and the negative reply prompt example, the reply prompt example corresponding to the target sample reply strategy can be generated. In the reply prompt example, it should be indicated which example is the positive reply prompt example and which is the negative reply prompt example, and how the large language model is required to refer to the positive reply prompt example and the negative reply prompt example to generate reply information. For example, when A represents the positive reply prompt example and B represents the negative reply prompt example, a part of the reply prompt example can be: "Requirement: Make the reply information close to the reply information in example A, and at the same time make the reply information far away from the reply information in example B".
[0123] In one embodiment, Figure 4 As shown, a dialogue generation method is provided, comprising:
[0124] S1, model fine-tuning training data generation.
[0125] Among them, the model fine-tuning training data is used to fine-tune the large language model in the large language model module. Taking the life insurance claim reporting dialogue as an example, dozens of real dialogue data and response data can be collected from the real life insurance claim reporting dialogue interaction between users and customer service, and the dialogue data can be annotated with intent and entity. Then, the large language model is used to build a similar sentence generation task, and tens of thousands of model fine-tuning training data are obtained.
[0126] S2, large language model fine-tuning.
[0127] Among them, ChatGLM3-6B (6.2 billion parameters) based on the General Language Model (GLM) architecture is used as a large language model. First, the parameters of the pre-trained model ChatGLM3-6B are initialized (zero initialization can be used), and then the conversation data is used as input, and the intent, entity, and reply data are used as output to train the model.
[0128] During the training process, a LoRA layer is added on top of ChatGLM3-6B to fine-tune the output of the model by optimizing the parameters of this layer. The technical principle of LoRA is to set two low-rank matrices A and B, reduce the dimension of the input data through the A matrix, and then increase the dimension of the input data through the B matrix. During training, the pre-trained parameters W of the large language model are fixed, and only the parameters of the two low-rank matrices A and B need to be updated. When the model is actually inferring, the output h will be equal to Wx+BAx=(W+BA)x, that is, the value of BA is merged into the pre-trained parameter W, which is equivalent to adjusting the pre-trained parameter W of the large language model.
[0129] In the embodiment of the present application, the rank parameter of LoRA is set to 8 (the larger the rank, the more parameters, so the slower the training. Here, in order to improve the model training speed, the rank can be set to 8), the training batch (epoch) is set to 30, the batch size (batch size) is 32, the maximum number of steps (max_steps) executed in the training process is set to 5000, and the model is saved after training.
[0130] S3, dialogue framework integration.
[0131] The open source Rasa is used as the dialogue framework, and the fine-tuned large language model is integrated into the Rasa framework as a custom NLU module pipeline. When customizing the NLU module, it is necessary to (1) install the python library transformers to load the large language model. (2) Construct the initialization method of the custom NLU module (used to initialize the instance after creating the custom NLU module instance), the large model loading method (used to call the large language model through the custom NLU module), the model training method (used to implement fine-tuning training of the large language model through the custom NLU module), and the model prediction method (used to transfer the data input to the custom NLU module to the large language model and receive the output of the large language model).
[0132] In the Rasa framework, you can also integrate speech recognition components, speech synthesis components, and other components suitable for voice dialogue robots. Figure 5 As shown in FIG. 1 , the specific form of the Rasa framework after the large language model is integrated into the Rasa framework.
[0133] S4, claims reporting robot application.
[0134] Connect the dialogue framework to the intelligent voice navigation of the customer service hotline. When a user calls the customer service hotline, the information of the user who calls can be obtained and input into the dialogue framework. At the same time, the voice recognition module will convert the user's voice into text. After the text is also input into the dialogue framework, the dialogue framework extracts the user's intention, extracts the entity information of the five elements of the report, and generates a reply text to output to the speech synthesis module. After synthesizing the speech, the speech synthesis module transmits the speech to the user to complete an interaction. The collection of report information can be completed through multiple interactions. If the report information cannot be collected after multiple rounds of dialogue, or the user explicitly requests to be transferred to manual customer service, the call can be transferred to manual customer service for acceptance. After the report is successfully reported, a joint handling form is automatically generated, and the report is accepted after review by the technical staff. Figure 6 shown.
[0135] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0136] Based on the same inventive concept, the embodiment of the present application also provides a conversation generation device for implementing the above-mentioned conversation generation method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in one or more conversation generation device embodiments provided below can refer to the above-mentioned limitations on the conversation generation method, and will not be repeated here.
[0137] In one embodiment, Figure 7 As shown, a dialog generation device 700 is provided, wherein the dialog framework includes a natural language understanding module and a dialog management module, wherein the natural language understanding module includes a large language model module. The device includes: an acquisition module 702, a first input module 704, a second input module 706, and a first output module 708, wherein:
[0138] An acquisition module 702 is used to acquire user conversation information and determine the conversation domain to which the user conversation information belongs;
[0139] A first input module 704 is used to obtain each first sample reply information corresponding to the dialogue field from a reply information database when the dialogue field meets a preset condition, generate a reply prompt word based on the user dialogue information and the first sample reply information, and input the reply prompt word into the large language model module to obtain dialogue feature information and at least one reply information output by the large language model module;
[0140] A second input module 706, configured to input the dialogue feature information and the reply information into the dialogue management module, determine a target reply strategy based on the dialogue feature information by the dialogue management module, and generate first target reply information matching the target reply strategy according to the reply information;
[0141] The first output module 708 is used to output the first target reply information as reply information for the user dialogue information, and store the first target reply information as sample reply information in the reply information database.
[0142] The dialogue generation device provided in the embodiment of the present application, if the dialogue field is suitable for using a large language model to generate reply information, then the large language model is used to simultaneously extract dialogue feature information and generate reply information. After determining the target reply strategy, the dialogue management module can select the reply information that matches the target reply strategy from the reply information provided by the large language model for output. Through the above method, the large language model can replace the functions of the two modules of natural language understanding and natural language generation in the original dialogue framework. Only fine-tuning training of the large language model itself is required to complete the deployment of the two modules of natural language understanding and natural language generation, which greatly saves the time spent in the model training stage. At the same time, since the reply information generated by the large language model is relatively rich, the richness of the interaction between the dialogue framework and the user can also be improved, thereby improving the user experience.
[0143] In one embodiment, the dialogue framework further includes a natural language generation module, the natural language understanding module further includes a dialogue feature information extraction module, and the device further includes:
[0144] A third input module, used for inputting the user conversation information into the conversation feature information extraction module to obtain conversation feature information when the conversation field does not meet the preset condition;
[0145] a fourth input module, configured to input the dialogue feature information into the dialogue management module, determine the target reply strategy based on the dialogue feature information through the dialogue management module, and determine second sample reply information corresponding to the target reply strategy in the dialogue field from the reply information database;
[0146] a fifth input module, configured to input the conversation feature information and the second sample reply information into the natural language generation module, and obtain the second target reply information output by the natural language generation module;
[0147] The second output module is used to output the second target reply information as reply information to the user dialogue information.
[0148] In one embodiment, the preset condition includes at least one of the following: the number of sample reply information corresponding to the dialogue field in the reply information database is less than a preset number, and the target reply duration corresponding to the dialogue field is greater than a preset threshold.
[0149] In one embodiment, the reply information database further stores sample conversation information and sample reply strategies corresponding to each sample reply information. The first input module 704 is further used to:
[0150] Determining third sample reply information from each of the first sample reply information according to the similarity between the sample conversation information corresponding to each of the first sample reply information and the user conversation information;
[0151] Respectively determine the target sample response strategies corresponding to each of the third sample response information;
[0152] For any of the target sample reply strategies, generating a reply prompt example corresponding to the target sample reply strategy according to each of the third sample reply information corresponding to the target sample reply strategy and the sample conversation information corresponding to each of the third sample reply information;
[0153] The reply prompt words are generated according to each of the reply prompt examples.
[0154] In one embodiment, the reply information database further stores reply scores corresponding to the sample reply information, and the first input module 704 is further used to:
[0155] Sort the third sample reply information from high to low according to the reply score to obtain a third sample reply information sequence;
[0156] Determine positive third sample reply information and negative third sample reply information according to the sorting position of each third sample reply information in the third sample reply information sequence;
[0157] Generate a positive reply prompt example according to the positive third sample reply information and the sample dialogue information corresponding to the positive third sample reply information, and generate a negative reply prompt example according to the negative third sample reply information and the sample dialogue information corresponding to the negative third sample reply information;
[0158] According to the positive reply prompt example and the negative reply prompt example, a reply prompt example corresponding to the target sample reply strategy is generated.
[0159] In one embodiment, the first input module 704 is further used to:
[0160] From each of the third sample reply information, determine the candidate positive third sample reply information whose sorting position is in the front preset proportion in the third sample reply information sequence, and determine the candidate negative third sample reply information whose sorting position is in the back preset proportion in the third sample reply information sequence;
[0161] According to the similarity between the sample conversation information corresponding to each of the candidate positive third sample reply information and the user conversation information, the positive third sample reply information is determined from each of the candidate positive third sample reply information, and according to the similarity between the sample conversation information corresponding to each of the candidate negative third sample reply information and the user conversation information, the negative third sample reply information is determined from each of the candidate negative third sample reply information.
[0162] Each module in the above device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.
[0163] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 8 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a dialogue generation method is implemented.
[0164] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0165] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0166] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0167] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0168] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0169] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0170] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0171] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for generating a dialogue, characterized in that: The dialogue framework includes a natural language understanding module and a dialogue management module, the natural language understanding module includes a large language model module, and the method includes: Acquire user conversation information, and determine the conversation domain to which the user conversation information belongs; When the conversation domain meets a preset condition, obtaining each first sample reply information corresponding to the conversation domain from a reply information database, generating a reply prompt word based on the user conversation information and the first sample reply information, and inputting the reply prompt word into the large language model module to obtain the conversation feature information and at least one reply information output by the large language model module; Inputting the dialogue feature information and the reply information into the dialogue management module, determining a target reply strategy based on the dialogue feature information by the dialogue management module, and generating first target reply information matching the target reply strategy according to the reply information; The first target reply information is output as reply information for the user dialogue information, and the first target reply information is stored in the reply information database as sample reply information.
2. The method according to claim 1, characterized in that The dialogue framework further includes a natural language generation module, the natural language understanding module further includes a dialogue feature information extraction module, and the method further includes: In the case where the conversation domain does not satisfy the preset condition, inputting the user conversation information into the conversation feature information extraction module to obtain conversation feature information; Inputting the dialogue feature information into the dialogue management module, determining the target reply strategy based on the dialogue feature information by the dialogue management module, and determining second sample reply information corresponding to the target reply strategy in the dialogue field from the reply information database; Inputting the conversation feature information and the second sample reply information into the natural language generation module to obtain second target reply information output by the natural language generation module; The second target reply information is output as reply information to the user dialogue information.
3. The method according to claim 1 or 2, characterized in that: The preset condition includes at least one of the following: the number of sample reply information corresponding to the dialogue field in the reply information database is less than a preset number, and the target reply duration corresponding to the dialogue field is greater than a preset threshold.
4. The method according to claim 1, characterized in that: The reply information database also stores sample conversation information and sample reply strategies corresponding to each sample reply information. The generating of reply prompt words based on the user conversation information and the first sample reply information includes: Determining third sample reply information from each of the first sample reply information according to the similarity between the sample conversation information corresponding to each of the first sample reply information and the user conversation information; Respectively determine the target sample response strategies corresponding to each of the third sample response information; For any of the target sample reply strategies, generating a reply prompt example corresponding to the target sample reply strategy according to each of the third sample reply information corresponding to the target sample reply strategy and the sample conversation information corresponding to each of the third sample reply information; The reply prompt words are generated according to each of the reply prompt examples.
5. The method according to claim 4, characterized in that The reply information database also stores reply scores corresponding to each of the sample reply information. The third sample reply information corresponding to the target sample reply strategy and the sample conversation information corresponding to each of the third sample reply information generate a reply prompt example corresponding to the target sample reply strategy, including: Sort the third sample reply information from high to low according to the reply score to obtain a third sample reply information sequence; Determine positive third sample reply information and negative third sample reply information according to the sorting position of each third sample reply information in the third sample reply information sequence; Generate a positive reply prompt example according to the positive third sample reply information and the sample dialogue information corresponding to the positive third sample reply information, and generate a negative reply prompt example according to the negative third sample reply information and the sample dialogue information corresponding to the negative third sample reply information; According to the positive reply prompt example and the negative reply prompt example, a reply prompt example corresponding to the target sample reply strategy is generated.
6. The method according to claim 5, characterized in that The determining, according to the sorting position of each of the third sample reply information in the third sample reply information sequence, the positive third sample reply information and the negative third sample reply information comprises: From each of the third sample reply information, determine the candidate positive third sample reply information whose sorting position is in the front preset proportion in the third sample reply information sequence, and determine the candidate negative third sample reply information whose sorting position is in the back preset proportion in the third sample reply information sequence; According to the similarity between the sample conversation information corresponding to each of the candidate positive third sample reply information and the user conversation information, the positive third sample reply information is determined from each of the candidate positive third sample reply information, and according to the similarity between the sample conversation information corresponding to each of the candidate negative third sample reply information and the user conversation information, the negative third sample reply information is determined from each of the candidate negative third sample reply information.
7. A dialogue generation device, characterized in that: The dialogue framework includes a natural language understanding module and a dialogue management module, the natural language understanding module includes a large language model module, and the device includes: An acquisition module, used to acquire user conversation information and determine the conversation domain to which the user conversation information belongs; A first input module is used to obtain each first sample reply information corresponding to the dialogue field from a reply information database when the dialogue field meets a preset condition, generate a reply prompt word based on the user dialogue information and the first sample reply information, and input the reply prompt word into the large language model module to obtain dialogue feature information and at least one reply information output by the large language model module; a second input module, configured to input the dialogue feature information and the reply information into the dialogue management module, determine a target reply strategy based on the dialogue feature information through the dialogue management module, and generate first target reply information matching the target reply strategy according to the reply information; The first output module is used to output the first target reply information as reply information for the user dialogue information, and store the first target reply information as sample reply information in the reply information database.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.