Task type multi-round dialogue data generation method and device
By filtering and converting candidate multi-round dialogue data, a rich and diverse task-type multi-round dialogue data are generated, which solves the problems of poor data authenticity and identity cognition errors in the existing technology, and achieves high-quality and high-authentic dialogue data generation.
Patent Information
- Application Number
- CN202510268728.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2045-03-07
AI Technical Summary
When generating task-type multi-round dialogue data, the data is not rich and diverse enough, has poor authenticity, and is prone to identity cognition errors, resulting in confusion in dialogue semantics.
By obtaining candidate multi-round conversation data generated in the set task scenario, the conversation data with correct identity recognition is selected and converted into single-round data. Then, multiple single-round instruction data are generated based on single-round data using the second largest language model, and finally, a rich and diverse multi-round dialogue data are generated based on these instruction data.
The authenticity and quality of the generated multi-round dialogue data is improved, ensuring that the data is rich and diverse in the task scenario, overcoming the problem of identity cognition errors, and significantly improving the controllability and dynamicity of dialogue data.
Smart Images

Figure CN119783832A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method and device for generating task-based multi-round dialogue data. Background Art
[0002] Nowadays, applications such as intelligent customer service and virtual assistants are becoming more and more widespread. The core of these applications is to understand and respond to users' natural language input, use users' true intentions, execute users' actions, and continue to provide help in multiple rounds until a specific task is completed or the problem is solved. In order to train a more accurate and efficient dialogue system, a large amount of high-quality dialogue data is needed as support. However, manually creating and collecting such data is time-consuming and expensive, so automated task-based multi-round dialogue data generation methods have become crucial.
[0003] In the prior art, in terms of task-based multi-round dialogue data generation, one method is to use the self-instruct mechanism of a single pre-trained large language model (LLM) to generate dialogue content. First, the user intent, scenario, and task settings are defined, and then a small amount of seed data (such as the initial dialogue fragment) is provided for each intent or scenario. The large language model will automatically generate new multi-round dialogue rounds based on this information until the pre-set task completion conditions are met. However, the large language model is too dependent on the quality of the seed data. In a multi-round scenario, it is easy to repeat the logic in the seed dialogue data, and the data cannot be rich and diverse. The authenticity of the data is also poor. Moreover, it only relies on a large semantic model for continuous generation. The controllability of the dialogue will be poor, and the logic and process of the dialogue cannot be adjusted dynamically in real time. Another commonly used method for generating task-based multi-round dialogue data is to use a multi-agent architecture, such as the common AutoGen, MetaGPT and other frameworks, in which different agent models play the roles of users and assistants to simulate dialogues to imitate the interpersonal communication process in the real world. However, this method lacks training on identity recognition. When the two models are talking to each other, identity recognition confusion often occurs. For example, a large model simulating a user is prone to identity recognition errors and mistakenly thinks itself as an assistant to respond, resulting in confusion in the semantics of the generated dialogue. Summary of the invention
[0004] The present invention provides a method and device for generating task-based multi-round dialogue data, so as to overcome the defects of the task-based multi-round dialogues generated in the prior art that are not rich and diverse enough, have poor authenticity and are prone to identity recognition errors.
[0005] The present invention provides a method for generating task-based multi-round dialogue data, the method comprising the following steps: Acquire candidate multi-round dialogue data generated in a set task scenario, wherein two virtual objects in the dialogue in the candidate multi-round dialogue data have correct identity recognition; Calling the first language model to convert the candidate multi-round dialogue data into single-round data; The single-round data is used as seed data, and the second largest language model is called to generate the seed data to obtain a plurality of single-round instruction data in a set task scenario; Based on each of the single-round instruction data, final multi-round dialogue data in a set task scenario is generated.
[0006] In some embodiments, obtaining candidate multi-round dialogue data generated in a set task scenario includes: In the set task scenario, two candidate language models are called to simulate two virtual objects in conversation to generate conversations and obtain original multi-round conversation data; The original multi-round dialogue data is screened according to preset dialogue screening rules to obtain candidate multi-round dialogue data, wherein the preset dialogue screening rules are used to screen out dialogue data in which virtual objects in the original multi-round dialogue data have identity recognition errors.
[0007] In some embodiments, the preset conversation screening rules include: The two virtual objects in the conversation have correct identity recognition; The semantic similarity between each round of dialogue is not less than the similarity threshold; The number of pronouns in the conversation exceeds the quantity threshold; Updated the setting mission scenario.
[0008] In some embodiments, calling the first large language model to convert the candidate multi-turn dialogue data into single-turn data includes: Constructing a conversion prompt word, wherein the conversion prompt word is used to instruct the first language model to determine a core keyword from the last round of the candidate multi-round dialogue data; The conversion prompt word and the candidate multi-round dialogue data are input into the first large language model for generation to obtain single-round data, where the single-round data is generated by the first large language model according to the determined core keywords.
[0009] In some embodiments, the calling of the second largest language model to generate the seed data to obtain a plurality of single-round instruction data in a set task scenario includes: Constructing and generating prompt words according to the seed data, and obtaining a plurality of single-round instructions in a set task scenario; The generated prompt words and the single-round instructions are input into the second largest language model for dialogue generation to obtain multiple single-round instruction data in the set task scenario, wherein the dialogue generation process of the second largest language model is implemented according to a self-guidance mechanism.
[0010] In some embodiments, generating final multi-round dialogue data in a set task scenario based on each of the single-round instruction data includes: Constructing a matching pair according to the candidate multi-round dialogue data and the single-round data; The matching pairs are used as task prompt words generated from a single round to multiple rounds, and the task prompt words and each of the single-round instruction data are input into the second largest language model for generation, so as to obtain the final multiple-round dialogue data in the set task scenario.
[0011] The present invention also provides a task-based multi-round dialogue data generation device, which includes the following modules: An acquisition module, used to acquire candidate multi-round dialogue data generated in a set task scenario, wherein two virtual objects in the dialogue in the candidate multi-round dialogue data have correct identity recognition; A conversion module, used for calling the first language model to convert the candidate multi-round dialogue data into single-round data; A generation module, used to use the single-round data as seed data, call the second largest language model to generate the seed data, and obtain a plurality of single-round instruction data in a set task scenario; The generation module is also used to generate final multi-round dialogue data in a set task scenario based on each single-round instruction data.
[0012] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for generating task-based multi-round dialogue data as described above is implemented.
[0013] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for generating task-based multi-round dialogue data as described in any one of the above is implemented.
[0014] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned task-based multi-round dialogue data generation methods.
[0015] The task-based multi-round dialogue data generation method and device provided by the present invention obtains candidate multi-round dialogue data generated in a set task scenario, first screens out dialogue data with identity recognition, overcomes the defect of identity recognition in the task-based multi-round dialogue generated in the prior art, and at the same time, the setting of the task scenario also ensures the authenticity of the constructed candidate multi-round dialogue data, thereby improving the quality of the dialogue data. After the candidate multi-round dialogue data is converted into single-round data, multiple single-round instruction data in the set task scenario are generated, so that the final multi-round dialogue data in the set task scenario generated has rich diversity in the scenario of ensuring data authenticity. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced one by one below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 It is a flowchart of the method for generating task-based multi-round dialogue data provided by the present invention.
[0018] Figure 2 It is a structural schematic diagram of a task-based multi-round dialogue data generating device provided by the present invention.
[0019] Figure 3 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0021] The task-based multi-round dialogue data generation method provided by the present invention can be applied to scenarios with artificial intelligence dialogue interaction, for example, deployed in application software such as intelligent customer service and virtual assistants, to generate high-quality multi-round dialogue data, to help train the artificial intelligence algorithms or models in the applications, to improve the dialogue quality of the artificial intelligence algorithms or models, and to meet different user needs.
[0022] The task-based multi-round dialogue data generation method and device of the present invention are described below with reference to the accompanying drawings. Figure 1 is a flowchart of generating task-based multi-round dialogue data provided by the present invention, such as Figure 1 As shown, the method includes the following steps 101 to 104, which are described one by one below.
[0023] Step 101: Obtain candidate multi-round dialogue data generated in a set task scenario.
[0024] In an embodiment of the present invention, first, candidate multi-round dialogue data is generated according to the set task scenario. Among them, the multi-round dialogue data can be generated using a multi-agent architecture in the prior art, such as common frameworks such as AutoGen and MetaGPT. However, there may be identity recognition errors in the virtual objects in these multi-round dialogue data, and identity recognition errors are also role relationship errors, specifically, there is confusion in the identities between the two virtual objects in the dialogue data. Identity recognition errors can cause semantic confusion in the dialogue data. For example, two virtual objects simulate a user and an assistant respectively, but during the dialogue process, the "user" regards itself as an "assistant" for dialogue, or the "assistant" regards itself as a "user" for dialogue, which causes serious semantic confusion in the generated dialogue, making the dialogue data quality very poor and low in authenticity.
[0025] Therefore, it is necessary to screen the generated candidate multi-round dialogue data to ensure that the two virtual objects in the multi-round dialogue data have correct identity recognition. The screening process can use the dialogue data with correct identity recognition as a reference for comparison. For example, the semantic similarity of the dialogue text is calculated for the dialogue data and the reference. If the semantic similarity is greater than the threshold, it means that it is consistent with the reference and has correct identity recognition. Otherwise, it means that there is an identity recognition error. Finally, the candidate multi-round dialogue data is obtained through screening. The two virtual objects in this candidate multi-round dialogue data have correct identity recognition.
[0026] Step 102: Call the first language model to convert the candidate multi-round dialogue data into single-round data.
[0027] Through step 101, candidate multi-round dialogue data is obtained in the set task scenario, providing a data basis for subsequent dialogue data generation. Next, the first language model can be called to convert the candidate multi-round dialogue data into single-round data. The candidate multi-round dialogue data includes multi-round data generated by two virtual objects of the dialogue. For example, in a conversation, the "user" will ask questions or make requests to the "assistant", and the "assistant" needs to answer or give feedback, which involves multiple user requests asked by the "user" to the "assistant". The first language model is used to identify the core requests in these user requests, or to summarize these user requests and generate corresponding single-round data to express the semantic information in the candidate multi-round dialogue data, so as to realize the conversion generation from multi-round to single-round.
[0028] Step 103: Use the single-round data as seed data, call the second largest language model to generate the seed data, and obtain multiple single-round instruction data in the set task scenario.
[0029] Here, the single-round data generated by the first language model is used as seed data, for example, as an initial dialogue segment, and then the second language model is called to generate the seed data to obtain multiple single-round instruction data in the set task scenario. In this process, multiple preset single-round instructions can be obtained for generation, for example, multiple user instructions are set, and the second language model generates multiple dialogue data corresponding to the user instructions in the set task scenario. This can improve the richness and diversity of data and data quality.
[0030] Step 104: Generate final multi-round dialogue data in a set task scenario based on each single-round instruction data.
[0031] Here, each single-round instruction data generated in step 103 is used as the basis for the dialogue, and the final multi-round dialogue data in the set task scenario is further generated, so as to realize the conversion generation from single round to multi-round. The generation process can be completed by calling the second largest language model, by constructing the corresponding generation prompt words, and then inputting the generation prompt words and the single-round instruction data into the second largest language model for generation. Since the multiple single-round instruction data are already rich and diverse, the final multi-round dialogue data in the set task scenario generated in the end is also rich and diverse.
[0032] The embodiment of the present invention obtains candidate multi-round dialogue data generated in a set task scenario, first screens out dialogue data with identity recognition, overcomes the defect of identity recognition in task-based multi-round dialogues generated in the prior art, and at the same time, the setting of the task scenario also ensures the authenticity of the constructed candidate multi-round dialogue data, thereby improving the quality of the dialogue data. After the candidate multi-round dialogue data is converted into single-round data, multiple single-round instruction data in the set task scenario are generated, so that the final multi-round dialogue data in the set task scenario generated has rich diversity in the scenario of ensuring data authenticity.
[0033] Compared with the prior art, the final multi-round dialogue data generated by the embodiment of the present invention has higher quality, whether it is the richness of the data or the strong contextual associations and dependencies between the multi-round dialogues, there are obvious improvements, which can significantly help the training of artificial intelligence algorithms or models in application software such as intelligent customer service and virtual assistants, and improve the dialogue quality of artificial intelligence algorithms or models. It is very suitable for the cold start link before the artificial intelligence algorithm or model is launched, which can greatly reduce the cost of research and development of application software such as intelligent customer service and virtual assistants, and accelerate the research and development cycle. In addition, the embodiment of the present invention is automated in the process of generating dialogue data, without relying too much on manual participation, so data is easier to obtain and the cost is low.
[0034] In some embodiments, the candidate multi-round dialogue data is an important data basis for generating the final multi-round dialogue data. The following describes the process of obtaining the candidate multi-round dialogue data generated in the set task scenario. First, in the set task scenario, two candidate language models are called to simulate two virtual objects in dialogue to generate dialogues and obtain the original multi-round dialogue data.
[0035] Here, the task scenario can be determined by manual setting, such as travel schedule setting or train ticket booking, etc. Based on these set task scenarios, two candidate language models can be constructed, such as a large language model that can realize the artificial intelligence dialogue function, and then the two candidate language models are called to simulate two virtual objects of the dialogue to generate dialogue, such as simulating "user" and "assistant" respectively, and then the dialogue is carried out by realizing the artificial intelligence dialogue function, and the text data of the dialogue is collected as the original multi-round dialogue data. The amount of dialogue data depends on the situation, for example, 1,000 pieces can be enough.
[0036] Since the candidate language model for simulating dialogues may lack identity recognition training, the virtual objects of the two dialogues in the original multi-round dialogue data have identity recognition errors. Therefore, the embodiment of the present invention here filters the original multi-round dialogue data according to the preset dialogue screening rules to obtain candidate multi-round dialogue data. This preset dialogue screening rule is used to filter out dialogue data in which the virtual objects in the original multi-round dialogue data have identity recognition errors. In addition, there is a high probability that low-quality dialogue data with low context relevance exists in the original multi-round dialogue data, and these low-quality dialogue data also need to be filtered out. Therefore, the dialogue screening rules not only need to overcome the problem of identity recognition errors, but also need to ensure that the dialogue data has strong context relevance, so as to improve the quality of the dialogue data as a whole.
[0037] The embodiment of the present invention utilizes two candidate language models to simulate two virtual objects in a conversation to generate a conversation, obtains original multi-round conversation data, and utilizes conversation screening rules to eliminate identity recognition errors that may exist in the conversation data. This can overcome the identity recognition errors that exist in the multi-round conversation data generated in the prior art, improve the authenticity and data quality of the conversation data, and provide a good data foundation for subsequent conversation data generation.
[0038] In some embodiments, the preset dialogue screening rules specifically include: the virtual objects of the two dialogues have correct identity recognition; the semantic similarity between each round of dialogue is not less than the similarity threshold; the number of pronouns appearing in the dialogue exceeds the number threshold; and the set task scenario is updated. The following will explain them one by one.
[0039] The first is that the two virtual objects in the conversation have correct identity recognition, which is the main purpose of the conversation screening rule. The judgment standard can be compared with a reference. Specifically, it can be to obtain normal conversation data with correct identity recognition as a reference, and then calculate the semantic similarity between the original conversation data and the reference for each round of original conversation data in the original multi-round conversation data, because the standards, semantics, and tone of the conversation between the two virtual objects (such as users and assistants) are different. If the original conversation data has an identity recognition error, then the semantic similarity calculated with the normal reference must be very low, otherwise the semantic similarity is very high. The similarity is measured by setting a threshold. If the similarity is greater than the threshold, it means that the conversation role of the current round of original conversation data is the same as the reference and has correct identity recognition. Otherwise, it means that the conversation role is opposite to the reference and there is an identity recognition error. This round of original conversation data needs to be screened out. In this way, it can be determined whether there is an identity recognition error in each round of original conversation data, and then screened one by one.
[0040] The second is that the semantic similarity between each round of dialogue is not less than the similarity threshold. This rule ensures that there is a strong context dependency between multiple rounds of dialogue in the original multi-round dialogue data or that the context is coherent. By extracting the semantic features of each round of dialogue, and then calculating the semantic similarity between the semantic features, and then comparing them with the preset similarity threshold, if it is lower than the similarity threshold, it means that the dependency between multiple rounds of dialogue is weak and the context may be incoherent. Such original multi-round dialogue data needs to be filtered out.
[0041] The third is that the number of pronouns in the conversation exceeds the quantity threshold. This rule ensures that there is more semantic information in the original multi-round conversation data, such as "user" expressing more content and intention, to improve the authenticity of the conversation data. Pronouns can be "you, me, him, it", etc., or names that describe specific things. By identifying these pronouns that appear in the conversation and counting their number, and then judging by the quantity threshold, the original multi-round conversation data with the number of pronouns below the quantity threshold is filtered out.
[0042] The fourth is to update the set task scenario. This rule ensures that the original multi-round dialogue data can update the set task scenario when the task scenario changes, and ensures that there is a strong correlation between the dialogue and the task scenario. The update is a logical process such as adjustment and change of the task scenario during the dialogue. For example, some original multi-round dialogue data is: "User" asks the "assistant" about the travel schedule. At this time, the task scenario is the travel schedule setting. After the "assistant" gives the travel schedule, the "user" continues to ask the "assistant" what travel options are available. The "assistant" gives the train. At this time, the task scenario is adjusted and changed to train ticket booking. The "user" continues to instruct the "assistant" to help book train tickets. Changes and adjustments to the task scenario appeared in the above original multi-round dialogue data.
[0043] The embodiments of the present invention obtain preset dialogue screening rules and screen the original multi-round dialogue data, thereby ensuring that the dialogue data has correct identity recognition, and that there are strong context dependencies between multi-round dialogues, etc., thereby improving the authenticity and data quality of the dialogue data and providing a good data foundation for subsequent dialogue data generation.
[0044] In some embodiments, after obtaining the candidate multi-round dialogue data of the set task scenario, the first large language model is called to convert the candidate multi-round dialogue data into single-round data. The conversion process here can be a process of using a large language model to realize a multi-round dialogue to a single-round instruction. The main step of this process is to determine the core keywords from the multi-round dialogue, that is, the focus and main intention of the dialogue. For example, in the dialogue between the user and the assistant, the core needs of the user need to be determined first. The conversion process is described in detail below.
[0045] First, construct the conversion prompt, which includes: conversion steps, output format, and output requirements, and if possible, some examples. The conversion prompt is used to instruct the first large language model to determine the core keywords from the last round of the candidate multi-round dialogue data. Here, it is generally considered that the last round of dialogue data, that is, the latest round of dialogue, is most likely to be the focus and main intention of the dialogue, and the previous counterparty may be just a prelude. Therefore, the constructed conversion prompt is to prompt to determine the core keywords from the last round of the candidate multi-round dialogue data, so that the large language model can understand the focus and main intention of the dialogue.
[0046] Of course, in some embodiments, the core keywords may not necessarily be determined in the last round of dialogue, and some dialogues directly hit the topic without any preparation. Therefore, the conversion prompt words in the embodiments of the present invention can also be used to instruct the large language model to determine the core keywords from the entire candidate multi-round dialogue data, and there is no limitation in the specific implementation.
[0047] During the conversion process, the candidate multi-round dialogue data is used as input data, and then the conversion prompt word and the candidate multi-round dialogue data are input into the first language model together for generation to obtain single-round data. The first language model will determine the core keywords from the last round of dialogue data in the candidate multi-round dialogue data according to the prompt of the conversion prompt word. The core keyword can be a word or a dialogue fragment. The single-round data is generated by the first language model according to the determined core keywords. The first language model will generate the corresponding single-round data according to the determined core keywords and output them.
[0048] The following uses the conversation between the "user" and the "assistant" as an example to illustrate the conversion process of a single round of data in the above embodiment.
[0049] The conversion prompt word prompt can be: “Based on the multi-round dialogue between the user assistant, rewrite the latest round of user requests into a complete single-round request; Use the following steps to complete the task: Read the conversation context carefully to ensure you understand the content and intent of each turn of conversation; Identify the user’s core need or problem in the latest round of conversation; Integrate the need or question into a complete and clear single-round request, ensuring that no important information is omitted; Keep the tone and style of the original conversation; Output format: The generated single-round request should be a complete statement or question, which can stand alone and clearly express the user's needs; Output requirements: Do not omit any important information and do not output information irrelevant to the user's request;" The candidate multi-turn dialogue data as input data can be: “User: I want to order XX exclusive membership; Assistant: OK, it has been ordered for you; User: Can I watch XXX now? Assistant: Yes, you have subscribed to XX exclusive membership, so you can watch "XXX" directly; User: What about YYY? " After the final conversion is completed, the output single-round data can be: "I have subscribed to XX exclusive membership, can I watch "YYY" now?" The embodiment of the present invention realizes the generation process from multiple rounds to single rounds by using the screened candidate multi-round dialogue data as input data to generate single-round data. Subsequently, it can be used as a task guide to teach the second largest language model to complete the generation process from single round to multiple rounds, so as to facilitate the generation of final multi-round dialogue data.
[0050] In some embodiments, after generating single-round data through the first large language model, the single-round data is used as seed data, and the second large language model is called to generate the seed data to obtain multiple single-round instruction data in the set task scenario. The seed data generation process here is to improve the quality and richness of the single-round data.
[0051] First, a generation prompt word is constructed based on the seed data. The generation prompt word here can also include requirements for generating single-round instruction data. For example, the generated single-round instruction data must be in a set task scenario, and the seed data is used as an example in the generation prompt word.
[0052] Then, multiple single-round instructions in the set task scenario are obtained, wherein the single-round instructions are used to instruct the second largest language model to generate a specified number of instruction data according to the examples in the generated prompt words in the set task scenario, and this instruction data can form a single-round dialogue data together with the seed data. In other words, the single-round instructions are used to instruct the second largest language model to generate corresponding questions using the seed data as answers.
[0053] Taking "user" and "assistant" as an example, the seed data can be the answer of the "assistant", and the generated single-round instruction data is the question asked by the "user" to the "assistant". Of course, there can be multiple questions, so there will be multiple single-round instruction data.
[0054] During the generation process, the generation prompt words and single-round instructions are input into the second largest language model for dialogue generation, and multiple single-round instruction data in the set task scenario are obtained. The second largest language model generates dialogues based on a self-instruct mechanism, which will not be elaborated here.
[0055] For example, a self-guided generation prompt could be: “You are a single-round instruction set creation assistant. You can simulate more and richer user instructions based on single-round instruction input; Require: 1. Ensure that instruction generation and examples are not repeated; 2. It can be more complicated (including more conditions, more complicated logic, etc.); 3. Make sure the instructions and examples appear in the same large scenario (such as watching TV, checking the weather, listening to music, etc.). As an example, the seed data may be: "Play the highlights of the third quarter of the game between Country X and Country Y last Wednesday night."
[0056] Multiple single-round instructions in a set task scenario can be: "Please output 3 other user instructions." The three single-round instruction data in the final output of the set task scenario can be: “1. If today is the weekend and it is raining outside, please play an animated movie with a rating higher than 8.5 for me; 2. Check the weather forecast between 7 and 9 a.m. tomorrow. If the wind speed exceeds 30 kilometers per hour, I am advised to choose indoor activities instead of morning jogging. 3. During dinner time (between 6pm and 8pm), play some relaxing jazz music randomly selected from my music collection.” In the embodiment of the present invention, the single-round data is used as seed data, and the second largest language model is called to generate the seed data to obtain multiple single-round instruction data. Since the seed data is rich and diverse, the generated single-round instruction data is also rich and diverse. In addition, the set task scenarios are limited during the generation process, so that the single-round instruction data is more authentic and will not deviate from the real scenario.
[0057] In some embodiments, after generating multiple single-round instruction data through the second largest language model, the final multi-round dialogue data in the set task scenario is generated based on each of the single-round instruction data. The generation process here uses the idea of inverse generation, because the screened candidate multi-round dialogue data is used as input data to generate single-round data, realizing the generation process from multi-round to single-round, and here it is necessary to realize the inverse generation process from single-round to multi-round, which is described in detail below.
[0058] First, a matching pair is constructed based on the candidate multi-round dialogue data and single-round data. This matching pair can serve as a task guide and represents the generative thinking from multi-round to single-round.
[0059] During the generation process, the matching pairs can be used as task prompt words generated from a single round to multiple rounds, and the task prompt words and each single-round instruction data can be input into the second largest language model for generation to obtain the final multi-round dialogue data in the set task scenario.
[0060] Here, the task prompt words are used as task guidance, which can also include the requirements for dialogue generation, such as ensuring the coherence of the generated multi-round dialogues and the dependencies between the contexts. The task prompt words allow the second language model to learn the reverse generation process from single round to multi-round based on the generation process from multi-round to single round, so that each single-round instruction data can be generated into the final multi-round dialogue data in the set task scenario.
[0061] The following uses "user" and "assistant" as examples to explain that the task prompt words can be: “You are a multi-round dataset creation assistant. You can simulate multi-round conversation data between the user and the assistant based on the user’s single-round command input; Requirements: 1. Ensure the continuity of the conversation; 2. Maintain strong dependencies between contexts; 3. Replace, delete, and add more conditions between multiple rounds of user commands; The following are examples (i.e., matching pairs of candidate multi-turn dialogue data and single-turn data): YYYYY.
[0062] One of the single-round instruction data as input data can be: "Input: I have subscribed to XX exclusive membership, can I watch "YYY" now?" The final multi-round dialogue data generated can be: "Output: User: I want to watch a martial arts movie; Assistant: You haven't ordered any membership packages yet. Do you need to order one? User: I want to order XX exclusive membership; Assistant: OK, it has been ordered for you; User: Can I watch XXX now? Assistant: Yes, you have subscribed to XX exclusive membership, so you can watch "XXX" directly; User: What about YYY? " Another single-round instruction data as input data can be: "If it doesn't rain tomorrow, please buy me a XXXX pass, including a cruise, after 3 pm." The final multi-round dialogue data generated can also be: "Output: User: I want to know the price of XXXX pass; Assistant: The price of XXXX's pass varies according to the season and the specific items included. When do you plan to go? User: I plan to go tomorrow, if it doesn’t rain; Assistant: I see. According to the weather forecast, tomorrow will be sunny and suitable for traveling. The ticket for XXXX after 3 pm, including the cruise project, costs 150 yuan. Do you need me to book it for you? User: Please help me confirm whether all attractions are included; Assistant: OK, XXXX's pass includes all the main attractions in the scenic area and a boat tour. There are no additional charges. User: OK, buy me one. Assistant: OK, I have booked a XXXX pass for you after 3pm tomorrow, including the cruise service. Please check the ticket information and go on time. If you have any other questions, please feel free to contact me. " In the embodiment of the present invention, the generation process of candidate multi-round dialogue data and single-round data is used as a task guide, so that the second largest language model reversely generates the final multi-round dialogue data according to the single-round instruction data. Since the candidate multi-round dialogue data is multi-round dialogue data with strong context association and the single-round instruction data also has rich diversity, the generated multi-round dialogue data also has strong context association and rich diversity.
[0063] The task-based multi-round dialogue data generating device provided by the present invention is described below. The task-based multi-round dialogue data generating device described below and the task-based multi-round dialogue data generating method described above can be referenced to each other.
[0064] like Figure 2 As shown, the task-based multi-round dialogue data generation device provided by the present invention includes: an acquisition module 201, a conversion module 202, and a generation module 203. Specifically, the acquisition module 201 is used to acquire candidate multi-round dialogue data generated in a set task scenario, wherein the two virtual objects of the dialogue in the candidate multi-round dialogue data have correct identity recognition; the conversion module 202 is used to call the first large language model to convert the candidate multi-round dialogue data into single-round data; the generation module 203 is used to use the single-round data as seed data, call the second large language model to generate the seed data, and obtain multiple single-round instruction data in the set task scenario; the generation module 203 is also used to generate the final multi-round dialogue data in the set task scenario based on each of the single-round instruction data.
[0065] It should be noted that the beneficial effects of the task-based multi-round dialogue data generation device here and the task-based multi-round dialogue data generation method mentioned above can correspond to each other, so the beneficial effects of the task-based multi-round dialogue data generation device are not repeated here.
[0066] Figure 3 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 3 As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communication interface 320 and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the task-based multi-round dialogue data generation method, the method comprising: obtaining candidate multi-round dialogue data generated in a set task scenario, wherein the virtual objects of the two dialogues in the candidate multi-round dialogue data have correct identity recognition; calling the first large language model to convert the candidate multi-round dialogue data into single-round data; using the single-round data as seed data, calling the second large language model to generate the seed data, and obtaining multiple single-round instruction data in the set task scenario; generating the final multi-round dialogue data in the set task scenario based on each of the single-round instruction data.
[0067] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0068] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the task-based multi-round dialogue data generation method provided by the above-mentioned methods, the method including: obtaining candidate multi-round dialogue data generated in a set task scenario, wherein two virtual objects of the dialogue in the candidate multi-round dialogue data have correct identity recognition; calling a first large language model to convert the candidate multi-round dialogue data into single-round data; using the single-round data as seed data, calling a second large language model to generate the seed data, and obtaining multiple single-round instruction data in the set task scenario; based on each of the single-round instruction data, generating the final multi-round dialogue data in the set task scenario.
[0069] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the task-based multi-round dialogue data generation method provided by the above-mentioned methods, the method comprising: obtaining candidate multi-round dialogue data generated in a set task scenario, wherein two virtual objects of the dialogue in the candidate multi-round dialogue data have correct identity recognition; calling a first large language model to convert the candidate multi-round dialogue data into single-round data; using the single-round data as seed data, calling a second large language model to generate the seed data, and obtaining multiple single-round instruction data in the set task scenario; based on each of the single-round instruction data, generating the final multi-round dialogue data in the set task scenario.
[0070] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0071] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0072] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for generating task-based multi-round dialogue data, characterized in that: include: Acquire candidate multi-round dialogue data generated in a set task scenario, wherein two virtual objects in the dialogue in the candidate multi-round dialogue data have correct identity recognition; Calling the first language model to convert the candidate multi-round dialogue data into single-round data; The single-round data is used as seed data, and the second largest language model is called to generate the seed data to obtain a plurality of single-round instruction data in a set task scenario; Based on each of the single-round instruction data, final multi-round dialogue data in a set task scenario is generated.
2. The method for generating task-based multi-round dialogue data according to claim 1, characterized in that: The obtaining of candidate multi-round dialogue data generated in a set task scenario includes: In the set task scenario, two candidate language models are called to simulate two virtual objects in conversation to generate conversations and obtain original multi-round conversation data; The original multi-round dialogue data is screened according to preset dialogue screening rules to obtain candidate multi-round dialogue data, wherein the preset dialogue screening rules are used to screen out dialogue data in which virtual objects in the original multi-round dialogue data have identity recognition errors.
3. The method for generating task-based multi-round dialogue data according to claim 2, characterized in that: The preset conversation screening rules include: The two virtual objects in the conversation have correct identity recognition; The semantic similarity between each round of dialogue is not less than the similarity threshold; The number of pronouns in the conversation exceeds the quantity threshold; Updated the setting mission scenario.
4. The method for generating task-based multi-round dialogue data according to claim 1, characterized in that: The calling of the first language model to convert the candidate multi-round dialogue data into single-round data includes: Constructing a conversion prompt word, wherein the conversion prompt word is used to instruct the first language model to determine a core keyword from the last round of the candidate multi-round dialogue data; The conversion prompt word and the candidate multi-round dialogue data are input into the first large language model for generation to obtain single-round data, where the single-round data is generated by the first large language model according to the determined core keywords.
5. The method for generating task-based multi-round dialogue data according to claim 1, characterized in that: The calling of the second largest language model to generate the seed data to obtain a plurality of single-round instruction data in a set task scenario includes: Constructing and generating prompt words according to the seed data, and obtaining a plurality of single-round instructions in a set task scenario; The generated prompt words and the single-round instructions are input into the second largest language model for dialogue generation to obtain multiple single-round instruction data in the set task scenario, wherein the dialogue generation process of the second largest language model is implemented according to a self-guidance mechanism.
6. The method for generating task-based multi-round dialogue data according to claim 1, characterized in that: The generating of final multi-round dialogue data in a set task scenario based on each of the single-round instruction data includes: Constructing a matching pair according to the candidate multi-round dialogue data and the single-round data; The matching pairs are used as task prompt words generated from a single round to multiple rounds, and the task prompt words and each of the single-round instruction data are input into the second largest language model for generation, so as to obtain the final multiple-round dialogue data in the set task scenario.
7. A task-based multi-round dialogue data generation device, characterized in that: include: An acquisition module, used to acquire candidate multi-round dialogue data generated in a set task scenario, wherein two virtual objects in the dialogue in the candidate multi-round dialogue data have correct identity recognition; A conversion module, used for calling the first language model to convert the candidate multi-round dialogue data into single-round data; A generation module, used to use the single-round data as seed data, call the second largest language model to generate the seed data, and obtain a plurality of single-round instruction data in a set task scenario; The generation module is also used to generate final multi-round dialogue data in a set task scenario based on each single-round instruction data.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the method for generating task-based multi-turn dialogue data as claimed in any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for generating task-based multi-turn dialogue data as claimed in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for generating task-based multi-turn dialogue data as claimed in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Multi-round dialogue generation method and device for chat robot and chat robot
CN112231457A
Medical LLM model fine tuning method and related equipment
CN119128086A