A method and device for generating task-based multi-turn dialogue data

The method addresses identity cognition errors and enhances dialogue data quality by using two large language models to generate task-oriented multi-round dialogue data with correct identity recognition and conversion to single-round data, improving the diversity and authenticity of generated dialogues.

CN119783832BActive Publication Date: 2025-07-15LONGSHINE TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510268728.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-07
Publication Date
2025-07-15
Estimated Expiration
2045-03-07

AI Technical Summary

Technical Problem

In the prior art, the task-type multi-round dialogue data generation method has the problem that the data is not rich and diverse, the authenticity is poor, and the identity cognition error is prone to occur.

Method used

By obtaining candidate multi-round dialogue data generated in the setting task scenario, the dialogue data with correct identity cognition is selected, and using two large language models to convert it into single-round data and multiple single-round instruction data, finally generating multi-round dialogue data in the setting task scenario.

Benefits of technology

It improves the quality and authenticity of conversation data, ensures strong contextual relationships and rich diversity between multiple rounds of conversations, reduces the dependence and cost of manual participation, and is suitable for application software for smart customer service and virtual assistants.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119783832B_ABST
    Figure CN119783832B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for generating task-based multi-turn dialogue data, relating to the field of artificial intelligence technology. The method includes: obtaining candidate multi-turn dialogue data generated in a set task scenario, wherein the virtual objects of two dialogues in the candidate multi-turn dialogue data have correct identity recognition; calling a first large language model to convert the candidate multi-turn dialogue data into single-turn data; using the single-turn data as seed data, calling a second large language model to generate the seed data, and obtaining multiple single-turn instruction data in the set task scenario; generating final multi-turn dialogue data in the set task scenario based on each single-turn instruction data. Through the present application, the defects in the prior art that the generated task-based multi-turn dialogue is not rich and diverse enough, has poor authenticity, and is prone to identity recognition errors are overcome.
Need to check novelty before this filing date? Find Prior Art

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-turn 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 lies in being able to understand and respond to the natural language input of users, utilize the true intentions of users, execute user actions, and continuously provide assistance in multiple rounds until a specific task is completed or a problem is solved. In order to train a more accurate and efficient dialogue system, a large amount of high-quality dialogue data is required as support. However, manually creating and collecting such data is both time-consuming and expensive. Therefore, an automated method for generating task-based multi-turn dialogue data has become crucial.

[0003] In the prior art for generating task-based multi-turn dialogue data, one method is to use the self-instruct mechanism of a single pre-trained large language model (LLM) to generate dialogue content. First, define the settings of user intentions, scenarios, and tasks, and then provide a small amount of seed data (such as initial dialogue segments) for each intention or scenario. The large language model will automatically generate new multi-turn dialogue rounds based on this information until the pre-set task completion condition is met. However, the large language model is overly dependent on the quality of the seed data. In a multi-turn scenario, it is easy to repeat the logic in the seed dialogue data, unable to ensure rich and diverse data, and the authenticity of the data is also poor. Moreover, relying solely on a large semantic model to continuously generate, the controllability of the dialogue will be poor, and it is unable to dynamically adjust the logic and process of the dialogue in real time. Another commonly used method for generating task-based multi-turn dialogue data is to adopt a multi-Agent architecture, such as common frameworks like AutoGen and MetaGPT. In these frameworks, different Agent models respectively play the roles of users and assistants to conduct simulated conversations to imitate the interpersonal communication process in the real world. However, this method lacks training for identity recognition. During the process of the two models answering each other, it is often easy to have problems of identity recognition confusion. For example, the large model simulating the user is prone to making identity recognition errors and mistakenly taking itself as the assistant to reply, resulting in chaotic semantics in the generated dialogue. Summary of the Invention

[0004] The present invention provides a method and device for generating task-based multi-turn dialogue data to overcome the defects in the prior art that the generated task-based multi-turn dialogues 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-turn dialogue data, and the method includes the following steps:

[0006] Obtain candidate multi-turn dialogue data generated in a set task scenario, where the virtual objects of two dialogues in the candidate multi-turn dialogue data have correct identity recognition;

[0007] Call a first large language model to convert the candidate multi-turn dialogue data into single-turn data;

[0008] Use the single-turn data as seed data, and call a second large language model to generate the seed data to obtain multiple single-turn instruction data in the set task scenario;

[0009] Based on each single-turn instruction data, generate the final multi-turn dialogue data in the set task scenario.

[0010] In some embodiments, the obtaining candidate multi-turn dialogue data generated in a set task scenario includes:

[0011] In the set task scenario, call two candidate language models to simulate the virtual objects of two dialogues to generate dialogue, and obtain the original multi-turn dialogue data;

[0012] According to a preset dialogue screening rule, screen the original multi-turn dialogue data to obtain candidate multi-turn dialogue data, where the preset dialogue screening rule is used to screen out the dialogue data with incorrect identity recognition of the virtual object in the original multi-turn dialogue data.

[0013] In some embodiments, the preset dialogue screening rule includes:

[0014] The virtual objects of two dialogues have correct identity recognition;

[0015] The semantic similarity between each round of dialogue is not less than the similarity threshold;

[0016] The number of pronouns appearing in the dialogue exceeds the quantity threshold;

[0017] Update the set task scenario.

[0018] In some embodiments, the calling a first large language model to convert the candidate multi-turn dialogue data into single-turn data includes:

[0019] Construct a conversion prompt, which is used to instruct the first large language model to determine the core keyword from the last round of dialogue in the candidate multi-turn dialogue data;

[0020] Input the conversion prompt and the candidate multi-turn dialogue data into the first large language model for generation to obtain single-turn data, and the single-turn data is generated by the first large language model according to the determined core keyword.

[0021] In some embodiments, the second large language model is called to generate the seed data to obtain multiple single-round instruction data in a set task scenario, including:

[0022] Construct a generation prompt word according to the seed data, and obtain multiple single-round instructions in the set task scenario;

[0023] Input the generation prompt word and the single-round instructions into the second large 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 large language model is implemented according to the self-guidance mechanism.

[0024] In some embodiments, based on each of the single-round instruction data, generate the final multi-round dialogue data in the set task scenario, including:

[0025] Construct a matching pair according to the candidate multi-round dialogue data and the single-round data;

[0026] Use the matching pair as a task prompt word for generating from single-round to multi-round, and input the task prompt word and each of the single-round instruction data into the second large language model for generation to obtain the final multi-round dialogue data in the set task scenario.

[0027] The present invention also provides a task-based multi-round dialogue data generation device, which includes the following modules:

[0028] An acquisition module, configured to acquire candidate multi-round dialogue data generated in a set task scenario, wherein the virtual objects of two dialogues in the candidate multi-round dialogue data have correct identity recognition;

[0029] A conversion module, configured to call the first large language model to convert the candidate multi-round dialogue data into single-round data;

[0030] A generation module, configured to use the single-round data as seed data, and call the second large language model to generate the seed data to obtain multiple single-round instruction data in the set task scenario;

[0031] The generation module is further configured to generate the final multi-round dialogue data in the set task scenario based on each of the single-round instruction data.

[0032] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein when the processor executes the computer program, it implements the task-based multi-round dialogue data generation method as described in any one of the above.

[0033] The present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the task-based multi-turn dialogue data generation method as described in any one of the above.

[0034] The present invention also provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the task-based multi-turn dialogue data generation method as described in any one of the above.

[0035] The task-based multi-turn dialogue data generation method and device provided by the present invention, by obtaining candidate multi-turn 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-turn 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-turn dialogue data, improving the quality of the dialogue data. After the candidate multi-turn dialogue data is converted into single-turn data, multiple single-turn instruction data in the set task scenario are generated, so that the final multi-turn dialogue data in the set task scenario has rich diversity under the condition of ensuring data authenticity. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art one by one. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0037] Figure 1 is a flowchart of the task-based multi-turn dialogue data generation method provided by the present invention.

[0038] Figure 2 is a structural diagram of the task-based multi-turn dialogue data generation device provided by the present invention.

[0039] Figure 3 is a structural diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0040] To make the objectives, technical solutions, and advantages of the present invention clearer, the following will clearly and completely describe the technical solutions in the present invention with reference to the drawings in the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention.

[0041] The task-based multi-turn dialogue data generation method provided by the present invention can be applied to scenarios with artificial intelligence dialogue interaction, such as being deployed in application software such as intelligent customer service and virtual assistants, to generate high-quality multi-turn dialogue data, help the artificial intelligence algorithms or models in the application for training, improve the dialogue quality of the artificial intelligence algorithms or models, and meet different user needs.

[0042] The task-based multi-turn dialogue data generation method and device of the present invention will be described below with reference to the accompanying drawings. Figure 1 is a schematic flowchart of task-based multi-turn dialogue data generation provided by the present invention, as Figure 1 shown, the method includes the following steps 101 to 104, which will be described one by one below.

[0043] Step 101: Obtain candidate multi-turn dialogue data generated in a set task scenario.

[0044] In an embodiment of the present invention, first, according to the set task scenario, candidate multi-turn dialogue data generated is obtained. Among them, the multi-turn dialogue data can be generated using multi-Agent architectures in the prior art, such as common frameworks like AutoGen and MetaGPT. However, there may be identity recognition errors in the virtual objects in these multi-turn dialogue data. Identity recognition errors, that is, role relationship errors, specifically refer to the confusion of identities between two virtual objects in the dialogue data. Identity recognition errors will lead to semantic confusion in the dialogue data. For example, two virtual objects respectively simulate a user and an assistant, but during the dialogue process, the "user" regards itself as the "assistant" to conduct the dialogue, or the "assistant" regards itself as the "user" to conduct the dialogue, thus resulting in serious semantic confusion in the generated dialogue, making the quality of the dialogue data very poor and the authenticity low.

[0045] Therefore, it is necessary to screen the generated candidate multi-turn dialogue data to ensure that the two virtual objects in the multi-turn dialogue data have correct identity recognition. The screening process can use dialogue data with correct identity recognition as a reference for comparison. For example, calculate the semantic similarity of the dialogue text for the dialogue data and the reference. If the semantic similarity is greater than the threshold, it means it is consistent with the reference and has correct identity recognition, otherwise it means there is an identity recognition error. Finally, candidate multi-turn dialogue data is obtained through screening, and the two virtual objects in this candidate multi-turn dialogue data have correct identity recognition.

[0046] Step 102: Call the first large language model to convert the candidate multi-turn dialogue data into single-turn data.

[0047] Candidate multi-turn dialogue data is obtained in the set task scenario through step 101, providing a data basis for subsequent dialogue data generation. Next, the first large language model can be called to convert the candidate multi-turn dialogue data into single-turn data. The candidate multi-turn dialogue data includes multi-turn data generated by two virtual objects in the dialogue. For example, in the dialogue, 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 from the "user" to the "assistant". The first large language model is used to identify the core requests in these user requests or summarize these user requests to generate corresponding single-turn data to express the semantic information in the candidate multi-turn dialogue data, realizing the conversion and generation from multi-turn to single-turn.

[0048] Step 103: Use the single-turn data as seed data and call the second large language model to generate the single-turn data to obtain multiple single-turn instruction data in the set task scenario.

[0049] Here, the single-turn data generated by the first large language model is used as seed data, such as an initial dialogue segment, and then the second large language model is called to generate the seed data to obtain multiple single-turn instruction data in the set task scenario. In this process, multiple preset single-turn instructions can be obtained for generation, such as setting multiple user instructions, and the second large language model is made to generate multiple dialogue data corresponding to the user instructions within the set task scenario. This can improve the richness, diversity, and data quality.

[0050] Step 104: Based on each single-turn instruction data, generate the final multi-turn dialogue data in the set task scenario.

[0051] Here, each single-turn instruction data generated in step 103 is used as the basis for the dialogue to further generate the final multi-turn dialogue data in the set task scenario, thus realizing the conversion and generation from single-turn to multi-turn. The generation process can be completed by calling the second large language model. By constructing corresponding generation prompt words and then inputting the generation prompt words and the single-turn instruction data into the second large language model for generation. Since the multiple single-turn instruction data already has richness and diversity, the final multi-turn dialogue data generated in the set task scenario also has richness and diversity.

[0052] In the embodiments of the present invention, by obtaining candidate multi-turn dialogue data generated in a set task scenario, dialogue data with identity recognition is first screened out, overcoming the defect of identity recognition in the task-based multi-turn dialogue generated in the prior art. At the same time, the setting of the task scenario also ensures the authenticity of the constructed candidate multi-turn dialogue data, improving the quality of the dialogue data. After the candidate multi-turn dialogue data is converted into single-turn data, multiple single-turn instruction data in the set task scenario are generated, so that the final multi-turn dialogue data in the set task scenario has rich diversity under the scenario of ensuring data authenticity.

[0053] Compared with the prior art, the final multi-turn dialogue data generated in the embodiments of the present invention has higher quality. There are obvious improvements in both the richness of the data and the strong context correlation and dependency relationship between multi-turn dialogues, which can significantly help artificial intelligence algorithms or models in application software such as intelligent customer service and virtual assistants to be trained, improving 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 R & D cost of application software such as intelligent customer service and virtual assistants and accelerate the R & D cycle. And in the process of generating dialogue data in the embodiments of the present invention, it is all automated, without relying too much on manual participation, the data is easier to obtain, and the cost is low.

[0054] In some embodiments, the candidate multi-turn dialogue data is an important data basis for generating the final multi-turn dialogue data. The process of obtaining the candidate multi-turn dialogue data generated in the set task scenario is introduced below. First, in the set task scenario, two candidate language models are called to simulate two virtual objects of the dialogue to generate dialogue, obtaining the original multi-turn dialogue data.

[0055] Here, the task scenario can be determined after being set manually, such as travel schedule setting or train ticket reservation, etc. Based on these set task scenarios, two candidate language models can be constructed, such as large language models that can implement artificial intelligence dialogue functions. Then, these 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 having a dialogue through implementing the artificial intelligence dialogue function, and collecting the text data of the dialogue as the original multi-turn dialogue data. The number of dialogue data depends on the situation, for example, 1000 pieces are enough.

[0056] Since the candidate language models for simulating conversations may lack identity recognition training, there may be identity recognition errors in the virtual objects of two conversations in the original multi-turn conversation data. Therefore, in the embodiments of the present invention, the original multi-turn conversation data is screened according to a preset conversation screening rule to obtain candidate multi-turn conversation data. This preset conversation screening rule is used to screen out the conversation data with identity recognition errors in the virtual objects in the original multi-turn conversation data. In addition, there are probably low-quality conversation data with low context relevance in the original multi-turn conversation data, and these low-quality conversation data also need to be screened out. Therefore, the conversation screening rule not only needs to overcome the problem of identity recognition errors, but also needs to ensure that there is a strong context association in the conversation data, so as to improve the quality of the conversation data as a whole.

[0057] In the embodiments of the present invention, two candidate language models are used to simulate the virtual objects of two conversations to generate conversation data, and the conversation screening rule is used to eliminate the possible identity recognition errors in the conversation data, which can overcome the identity recognition errors in the multi-turn conversation data generated in the prior art, improve the authenticity and data quality of the conversation data, and provide a good data basis for subsequent conversation data generation.

[0058] In some embodiments, the preset conversation screening rule specifically includes: the virtual objects of the two conversations have correct identity recognition; the semantic similarity between each round of conversations is not lower than the similarity threshold; the number of pronouns appearing in the conversation exceeds the number threshold; the set task scenario is updated. The following will be described one by one.

[0059] First, the virtual objects of the two conversations have correct identity recognition, which is the main purpose of the conversation screening rule. The judgment standard can be compared using a reference. Specifically, conversation data with correct identity recognition can be obtained as a reference, and then for each round of original conversation data in the original multi-turn conversation data, the semantic similarity between the original conversation data and the reference is calculated, because the standards, semantics, and tones of the conversations of two virtual objects (such as a user and an assistant) are different. If there are identity recognition errors in the original conversation data, the semantic similarity calculated with the normal reference will surely be very low, otherwise the semantic similarity will be 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 are identity recognition errors, and this round of original conversation data needs to be screened out. In this way, it can be determined whether there are identity recognition errors in each round of original conversation data, and then screening can be carried out one by one.

[0060] Second, the semantic similarity between each round of conversations is not less than the similarity threshold. This rule ensures that there is a strong context dependency between multiple rounds of conversations in the original multi-round conversation data or that the context is coherent. By extracting the semantic features of each round of conversation, calculating the semantic similarity between the semantic features, and then comparing it with the preset similarity threshold, if it is lower than the similarity threshold, it indicates that the dependency between multiple rounds of conversations is weak and the context may be incoherent. Such original multi-round conversation data needs to be filtered out.

[0061] Third, the number of referring nouns appearing in the conversation exceeds the quantity threshold. This rule ensures that there is more semantic information in the original multi-round conversation data. For example, "user" conveys more content and intentions, improving the authenticity of the conversation data. Referring nouns can be "you, me, him, it", etc., or the names of specific things. By identifying these referring names appearing in the conversation and counting their quantities, and then making a judgment based on the quantity threshold, the original multi-round conversation data with the number of referring nouns lower than the quantity threshold is filtered out.

[0062] Fourth, the set task scenario is updated. This rule ensures that when the task scenario changes in the original multi-round conversation data, the set task scenario can be updated to ensure a strong correlation between the conversation and the task scenario. The update is a logical process such as the adjustment and change of the task scenario during the conversation. For example, in a certain original multi-round conversation data: "User" asks "Assistant" about the travel schedule. At this time, the task scenario is the travel schedule setting. After "Assistant" gives the travel schedule, "User" continues to ask "Assistant" what travel options are available. "Assistant" gives taking the train. At this time, the task scenario changes and is updated to train ticket reservation. "User" then instructs "Assistant" to help reserve a train ticket. The above original multi-round conversation data shows the change and adjustment of the task scenario.

[0063] In the embodiments of the present invention, by obtaining the preset conversation screening rules and screening the original multi-round conversation data, it can ensure that the conversation data has correct identity recognition, strong context dependency between multiple rounds of conversations, etc., improving the authenticity and data quality of the conversation data, and providing a good data basis for the subsequent generation of conversation data.

[0064] In some embodiments, after obtaining the candidate multi-round conversation data of the set task scenario, the first large language model is then called to convert the candidate multi-round conversation data into single-round data. The conversion process here can be a process of using the large language model to implement a conversion from multi-round conversation to single-round instruction. The main steps of this process are to determine the core keywords from the multi-round conversation, that is, the key points and main intentions of the conversation. For example, in the conversation between the user and the assistant, the core needs of the user need to be determined first. The following specifically describes the conversion process.

[0065] 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.

[0066] 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.

[0067] 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.

[0068] 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.

[0069] The conversion prompt word prompt can be:

[0070] “Based on the multi-round dialogue between the user assistant, rewrite the latest round of user requests into a complete single-round request;

[0071] Use the following steps to complete the task:

[0072] Read the conversation context carefully to ensure you understand the content and intent of each turn of conversation;

[0073] Identify the user’s core need or problem in the latest round of conversation;

[0074] Integrate the need or question into a complete and clear single-round request, ensuring that no important information is omitted;

[0075] Keep the tone and style of the original conversation;

[0076] Output format: The generated single-round request should be a complete declarative sentence or question that can exist independently and clearly express the user's needs;

[0077] Output requirements: Do not omit any important information and do not output information unrelated to the user's request;

[0078] The candidate multi-round dialogue data as input data can be:

[0079] "User: I want to order the XX Premium Membership;

[0080] Assistant: Okay, it has been ordered for you;

[0081] User: Can I watch "XXX" now;

[0082] Assistant: Yes, you have ordered the XX Premium Membership and can directly watch "XXX";

[0083] User: What about YYY."

[0084] After the final conversion is completed, the output single-round data can be: "I have ordered the XX Premium Membership. Can I watch "YYY" now."

[0085] In the embodiments of the present invention, by using the screened candidate multi-round dialogue data as input data to generate single-round data, the generation process from multi-round to single-round is realized. Subsequently, it can be used as a task guide to teach the second large language model to complete the generation process from single-round to multi-round, so as to facilitate the generation of final multi-round dialogue data.

[0086] 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.

[0087] First, a generation prompt word is constructed based on the seed data. The generation prompt word can also include the requirements for generating single-round instruction data. For example, the generated single-round instruction data must be in the set task scenario, and the seed data is used as an example in the generation prompt word.

[0088] Then, multiple single-round instructions in the set task scenario are obtained. Among them, the single-round instruction is used to instruct the second large language model to generate a specified number of instruction data according to the example in the generation prompt word in the set task scenario. This instruction data can form single-round dialogue data together with the seed data. That is to say, the single-round instruction is used to instruct the second large language model to use the seed data as an answer to generate the corresponding question.

[0089] Taking "user" and "assistant" as examples, the seed data can be the answers of the "assistant", and the generated single-turn instruction data is the questions of the "user" for the "assistant". Of course, there can be multiple questions, so there will be multiple single-turn instruction data.

[0090] During the generation process, the generation prompt and the single-turn instruction are input into the second large language model for dialogue generation to obtain multiple single-turn instruction data in the set task scenario. The second large language model performs dialogue generation according to the self-instruct mechanism, which will not be elaborated here.

[0091] For example, the self-instruct generation prompt can be:

[0092] "You are an assistant for creating a single-turn instruction set. You can simulate more and richer user instructions based on the single-turn instruction input;

[0093] Requirements:

[0094] 1. Ensure that the generated instructions are not repeated with the examples;

[0095] 2. It can be a bit more complex (including more conditions, more convoluted logic, etc.);

[0096] 3. Ensure that the instructions and examples appear in the same large scenario (such as watching TV, checking the weather, listening to music, etc.)."

[0097] The seed data as an example can be: "Play the highlights of the third quarter of the game between Country X and Country Y last Wednesday night."

[0098] Multiple single-turn instructions in the set task scenario can be: "Please output 3 other user instructions."

[0099] The 3 single-turn instruction data finally output in the set task scenario can be:

[0100] "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;

[0101] 2. Check the weather forecast between 7 am and 9 am tomorrow. If the wind speed exceeds 30 kilometers per hour, suggest that I choose indoor activities instead of morning jogging;

[0102] 3. During dinner time (between 6 pm and 8 pm), randomly select some relaxing jazz music tracks from my music collection to play."

[0103] In an embodiment of the present invention, single-round data is used as seed data, and a second large language model is called to generate the seed data, obtaining a plurality of single-round instruction data. Since the seed data has rich diversity, the generated single-round instruction data also has rich diversity. And during the generation process, the set task scenario is restricted, making the single-round instruction data more authentic and not deviating from the real scenario.

[0104] In some embodiments, after generating a plurality of single-round instruction data through the second large language model, finally, based on each of the single-round instruction data, the final multi-round conversation data in the set task scenario is generated. The generation process here uses the idea of inverse generation because the selected candidate multi-round conversation data is used as input data to generate single-round data, realizing the generation process from multi-round to single-round, while here it is necessary to realize the inverse generation process from single-round to multi-round, which will be specifically described below.

[0105] First, a matching pair is constructed based on the candidate multi-round conversation data and the single-round data. This matching pair can serve as a task guide, representing the generation thinking from multi-round to single-round.

[0106] During the generation process, the matching pair can be used as a task prompt word for the generation from single-round to multi-round, and the task prompt word and each single-round instruction data are input into the second large language model for generation, obtaining the final multi-round conversation data in the set task scenario.

[0107] Here, the task prompt word is used as a task guide, which can also include requirements for dialogue generation, such as ensuring the coherence of the generated multi-round dialogue and the existence of a dependency relationship between the contexts. The task prompt word can enable the second large language model to learn the inverse generation process from single-round to multi-round according to the generation process from multi-round to single-round, so that each single-round instruction data can be used to generate the final multi-round conversation data in the set task scenario.

[0108] The following takes "user" and "assistant" as examples for illustration. The task prompt word can be:

[0109] "You are a multi-round dataset creation assistant. You can simulate the multi-round conversation data between the user and the assistant according to the user's single-round instruction input;

[0110] Requirements: 1. Ensure the coherence of the dialogue; 2. Maintain a strong dependency relationship between the contexts; 3. Make some conditional replacements, deletions, and additions among the multi-round user instructions;

[0111] The following is an example (i.e., the matching pair of the candidate multi-round conversation data and the single-round data): YYYYY.

[0112] One of the single-round instruction data as input data can be: "Input: I have subscribed to the XX Premium Membership. Can I watch 《YYY》 now?"

[0113] The generated final multi-round dialogue data can be:

[0114] "Output:

[0115] User: I want to watch action movies;

[0116] Assistant: You haven't subscribed to any membership packages yet~ Do you need to subscribe?

[0117] User: I want to subscribe to the XX Premium Membership;

[0118] Assistant: Okay, I have subscribed for you;

[0119] User: Can I watch 《XXX》 now?

[0120] Assistant: Yes, you have subscribed to the XX Premium Membership and can directly watch 《XXX》;

[0121] User: What about 《YYY》?

[0122] Another single-round instruction data as input data can be: "If it doesn't rain tomorrow, help me buy a 《XXXX》 pass that includes a cruise, after 3 pm."

[0123] The generated final multi-round dialogue data can also be:

[0124] "Output:

[0125] User: I want to know the price of the 《XXXX》 pass;

[0126] Assistant: The price of the 《XXXX》 pass varies according to different seasons and specific included items. When do you plan to go?

[0127] User: I plan to go tomorrow, if it doesn't rain;

[0128] Assistant: I see. According to the weather forecast, it will be sunny tomorrow and suitable for traveling. The 《XXXX》 pass after 3 pm, including the cruise item, costs 150 yuan. Do you need me to book it for you?

[0129] User: Please help me confirm if it includes all the scenic spots;

[0130] Assistant: Okay, the 《XXXX》 pass includes all the main scenic spots in the scenic area and a cruise service; there are no additional charges;

[0131] User: Alright, then help me buy one;

[0132] Assistant: Okay, I have booked the XXXX through ticket for you after 3 pm tomorrow, which includes the cruise service. Please check the ticket information carefully and arrive on time. If you have any other questions, please feel free to contact us at any time.”

[0133] In an embodiment of the present invention, by using the generation processes of candidate multi-round dialogue data and single-round data as task guidance, the second large 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.

[0134] The task-based multi-round dialogue data generation device provided by the present invention will be described below. The task-based multi-round dialogue data generation device described below can be correspondingly referred to the task-based multi-round dialogue data generation method described above.

[0135] As Figure 2 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 configured to acquire candidate multi-round dialogue data generated in a set task scenario, where the virtual objects of two dialogues in the candidate multi-round dialogue data have correct identity recognition; the conversion module 202 is configured to call the first large language model to convert the candidate multi-round dialogue data into single-round data; the generation module 203 is configured to use the single-round data as seed data and call the second large language model to generate the seed data to obtain a plurality of single-round instruction data in the set task scenario; the generation module 203 is further configured to generate the final multi-round dialogue data in the set task scenario based on each single-round instruction data.

[0136] 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 above can correspond to each other. Therefore, the beneficial effects of the task-based multi-round dialogue data generation device will not be elaborated here.

[0137] Figure 3 Illustrates a schematic physical structure diagram of an electronic device, as Figure 3As shown in the figure, the electronic device may include: a processor 310, a communications interface 320, a memory 330, and a communication bus 340. Among them, the processor 310, the communications interface 320, and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logical instructions in the memory 330 to execute the method for generating task-based multi-turn dialogue data. The method includes: obtaining candidate multi-turn dialogue data generated in a set task scenario, where the virtual objects of two dialogues in the candidate multi-turn dialogue data have correct identity recognition; calling a first large language model to convert the candidate multi-turn dialogue data into single-turn data; using the single-turn data as seed data, calling a second large language model to generate the seed data to obtain multiple single-turn instruction data in the set task scenario; and generating final multi-turn dialogue data in the set task scenario based on each single-turn instruction data.

[0138] In addition, when the logical instructions in the above-mentioned memory 330 can be implemented in the form of software functional units and sold or used as an independent product, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.

[0139] On the other hand, the present invention also provides a computer program product. The computer program product includes a computer program that 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 method for generating task-based multi-turn dialogue data provided by the above-mentioned various methods. The method includes: obtaining candidate multi-turn dialogue data generated in a set task scenario, where the virtual objects of two dialogues in the candidate multi-turn dialogue data have correct identity recognition; calling a first large language model to convert the candidate multi-turn dialogue data into single-turn data; using the single-turn data as seed data, calling a second large language model to generate the seed data to obtain multiple single-turn instruction data in the set task scenario; and generating final multi-turn dialogue data in the set task scenario based on each single-turn instruction data.

[0140] In another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the task-based multi-turn dialogue data generation method provided by the above-mentioned various methods. The method includes: obtaining candidate multi-turn dialogue data generated in a set task scenario, wherein the virtual objects of two dialogues in the candidate multi-turn dialogue data have correct identity recognition; calling a first large language model to convert the candidate multi-turn dialogue data into single-turn data; using the single-turn data as seed data, calling a second large language model to generate the seed data, and obtaining multiple single-turn instruction data in the set task scenario; and generating final multi-turn dialogue data in the set task scenario based on each single-turn instruction data.

[0141] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without creative work.

[0142] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing 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.

[0143] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate 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-turn dialogue data, characterized in that including: Obtain candidate multi-turn dialogue data generated in a set task scenario, where the virtual objects of two dialogues in the candidate multi-turn dialogue data have correct identity recognition; Call a first large language model to convert the candidate multi-turn dialogue data into single-turn data; Use the single-turn data as seed data, and call a second large language model to generate the seed data to obtain multiple single-turn instruction data in the set task scenario; Generate final multi-turn dialogue data in the set task scenario based on each single-turn instruction data; The obtaining of the candidate multi-turn dialogue data generated in the set task scenario includes: In the set task scenario, call two candidate language models to simulate the virtual objects of two dialogues to generate dialogue, and obtain original multi-turn dialogue data; According to a preset dialogue screening rule, screen the original multi-turn dialogue data to obtain candidate multi-turn dialogue data, where the preset dialogue screening rule is used to screen out the dialogue data with incorrect identity recognition of virtual objects in the original multi-turn dialogue data.

2. The task-based multi-turn dialogue data generation method according to claim 1, wherein The preset dialogue screening rule includes: The virtual objects of two dialogues have correct identity recognition; The semantic similarity between each round of dialogue is not less than the similarity threshold; The number of referring nouns appearing in the dialogue exceeds the quantity threshold; Update the set task scenario.

3. The task-based multi-turn dialogue data generation method according to claim 1, wherein The calling of the first large language model to convert the candidate multi-turn dialogue data into single-turn data includes: Construct a conversion prompt, which is used to instruct the first large language model to determine the core keyword from the last round of dialogue in the candidate multi-turn dialogue data; Input the conversion prompt and the candidate multi-turn dialogue data into the first large language model for generation to obtain single-turn data, and the single-turn data is generated by the first large language model according to the determined core keyword.

4. The task-based multi-turn dialogue data generation method according to claim 1, wherein The calling of the second large language model to generate the seed data to obtain multiple single-turn instruction data in the set task scenario includes: Construct a generation prompt according to the seed data, and obtain multiple single-turn instructions in the set task scenario; Input the generation prompt and the single-turn instructions into the second large language model for dialogue generation to obtain multiple single-turn instruction data in the set task scenario, where the dialogue generation process of the second large language model is implemented according to a self-guidance mechanism.

5. The task-based multi-turn dialogue data generation method according to claim 1, characterized in that The generating of the final multi-turn dialogue data in the set task scenario based on each single-turn instruction data includes: Construct a matching pair according to the candidate multi-turn dialogue data and the single-turn data; Use the matching pair as a task prompt for generating from single-turn to multi-turn, and input the task prompt and each single-turn instruction data into the second large language model for generation to obtain the final multi-turn dialogue data in the set task scenario.

6. A task-based multi-turn dialogue data generation device, characterized in that including: An obtaining module, configured to obtain candidate multi-turn dialogue data generated in a set task scenario, where the virtual objects of two dialogues in the candidate multi-turn dialogue data have correct identity recognition; A conversion module, configured to call a first large language model to convert the candidate multi-turn dialogue data into single-turn data; A generation module, configured to use the single-round data as seed data, call a second large language model to generate the seed data, and obtain multiple single-round instruction data in a set task scenario; The generation module is further configured to generate final multi-round dialogue data in a set task scenario based on each of the single-round instruction data; The obtaining of candidate multi-round dialogue data generated in a set task scenario includes: In a set task scenario, call two candidate language models to simulate virtual objects of two conversations for dialogue generation to obtain original multi-round dialogue data; According to a preset dialogue screening rule, screen the original multi-round dialogue data to obtain candidate multi-round dialogue data, where the preset dialogue screening rule is used to screen out dialogue data with incorrect identity recognition of virtual objects in the original multi-round dialogue data.

7. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the task-based multi-round dialogue data generation method according to any one of claims 1 to 5.

8. 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, it implements the task-based multi-round dialogue data generation method according to any one of claims 1 to 5.

9. A computer program product comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the task-based multi-round dialogue data generation method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Medical LLM model fine tuning method and related equipment

    CN119128086A