Multi-round dialogue data enhancement method and device, computer device, and storage medium
By constructing a knowledge point tree structure and a singly linked list path, question-answer pairs are generated and their format is converted to establish a dialogue prediction model. This solves the problem of insufficient accuracy of generative language models in multi-turn dialogue tasks and improves the accuracy and adaptability of dialogue prediction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WUHAN WANWUYUN DIGITAL OPERATION CO LTD
- Filing Date
- 2023-09-14
- Publication Date
- 2026-07-07
AI Technical Summary
In multi-turn dialogue tasks, generative language models have low accuracy in predicting the content generated.
By acquiring knowledge text corpora from the business database, a knowledge point tree structure is created. Knowledge singly linked list paths are traversed to generate question-answer pairs and perform format conversion. Answers are generated using a generative language model. A fine-tuning dataset is constructed to enhance the training of the generative language model and establish a dialogue prediction model.
It improves the accuracy and robustness of generative language models in multi-turn dialogue tasks, and enhances the understanding and adaptability of dialogue prediction models.
Smart Images

Figure CN117851550B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing technology, and in particular to a method, apparatus, computer device, and storage medium for multi-turn dialogue data augmentation. Background Technology
[0002] Data augmentation is a technique used to increase the amount and diversity of training data, aiming to improve the performance and generalization ability of machine learning models. It involves introducing transformations or perturbations into the original data to generate new training samples, thereby increasing the diversity of the training data and simulating various situations and changes that may occur in the real world. This mitigates overfitting and makes machine learning models more robust and adaptable to new data, improving their performance on real-world data and enabling them to better generalize and cope with different situations. Data augmentation techniques can be applied to machine learning tasks in various fields, such as computer vision, natural language processing, and speech recognition.
[0003] Generative language models are a class of machine learning models capable of automatically generating text or sentences. They learn the probability distribution of language from given input data through probabilistic modeling, thereby generating continuous text that conforms to grammatical and semantic rules. Generative language models generally require training, and the training process involves learning from a large amount of text data to capture the contextual relationships and semantic information between words. Simultaneously, generative language models also learn the distribution patterns of words or characters based on frequency and order statistics in the training data, and use these patterns to generate new text.
[0004] Generative language models can engage in multi-turn dialogues with user questions using provided contextual knowledge points. During this process, the generative language model receives input containing the user question and contextual information. Based on the knowledge points provided in the context, it performs knowledge retrieval to obtain knowledge relevant to the user question. This knowledge retrieval includes using retrieval algorithms, database queries, or other information retrieval techniques to find relevant knowledge resources. Simultaneously, the generative language model integrates the acquired knowledge with the user question, predicts dialogue based on the contextual knowledge points, and generates an answer or suggestion to respond to the user's question. Therefore, the dialogue prediction of generative language models relies heavily on the knowledge provided in the context, and is highly dependent on the accuracy and completeness of that knowledge. However, when faced with complex scenarios where the contextual knowledge points have a tree-like structure, generative language models may lack sufficient comprehension in multi-turn dialogue tasks, resulting in low accuracy of the predicted dialogue content. Therefore, improving the accuracy of the predicted answers generated by generative language models in multi-turn dialogue tasks is a problem that needs to be solved by those skilled in the art. Summary of the Invention
[0005] This invention provides a method, apparatus, computer device, and storage medium for multi-turn dialogue data augmentation, aiming to solve the problem of low accuracy in the content generated by generative language models in multi-turn dialogue tasks.
[0006] In a first aspect, embodiments of the present invention provide a multi-turn dialogue data augmentation method, including:
[0007] Obtain knowledge text corpus from the business database, create a knowledge point tree structure based on the knowledge text corpus, and then traverse the knowledge nodes in the knowledge point tree structure to create a knowledge singly linked list path;
[0008] Based on the path nodes in the knowledge singly linked list path, pair questions and answers are performed to obtain the first question and answer pair, and the format of the first question and answer pair is converted.
[0009] Obtain a seed task question, fill the seed task question into the knowledge singly linked list path, and use a generative language model to generate an answer for the filled knowledge singly linked list path. Then, perform pairwise question-answer pairing between the path nodes in the filled knowledge singly linked list path and the generated answer to obtain a second question-answer pair.
[0010] The first and second question-answer pairs are concatenated into a third question-answer pair, and the third question-answer pair is converted into a question-answer pair vector by a word segmenter to construct the fine-tuned dataset.
[0011] The generative language model is enhanced and trained using the fine-tuned dataset to establish a dialogue prediction model.
[0012] Dialogue prediction is performed using the aforementioned dialogue prediction model.
[0013] Secondly, embodiments of the present invention provide an apparatus for multi-turn dialogue data enhancement, comprising:
[0014] The path creation unit is used to obtain knowledge text corpus from the business database, create a knowledge point tree structure based on the knowledge text corpus, and then traverse the knowledge nodes in the knowledge point tree structure to create a knowledge singly linked list path.
[0015] The first question-and-answer pairing unit is used to perform pairwise question-and-answer pairing based on the path nodes in the knowledge single-linked list path to obtain the first question-and-answer pair, and to perform format conversion on the first question-and-answer pair.
[0016] The seed task acquisition unit is used to acquire seed task questions, fill the seed task questions into the knowledge single linked list path, generate answers for the filled knowledge single linked list path using a generative language model, and then pair the path nodes in the filled knowledge single linked list path with the generated answers to obtain a second question-answer pair.
[0017] The question-and-answer concatenation unit is used to concatenate the first question-and-answer pair and the second question-and-answer pair into a third question-and-answer pair, and to convert the third question-and-answer pair into a question-and-answer pair vector through a word segmenter to construct a fine-tuning dataset;
[0018] An enhanced training unit is used to enhance the training of the generative language model using the fine-tuned dataset, thereby establishing a dialogue prediction model.
[0019] A dialogue prediction unit is used to perform dialogue prediction using the dialogue prediction model.
[0020] Thirdly, embodiments of the present invention provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the multi-turn dialogue data enhancement method as described in the first aspect.
[0021] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the multi-turn dialogue data enhancement method as described in the first aspect.
[0022] This invention discloses a multi-turn dialogue data augmentation method, apparatus, and related medium. The invention first creates a knowledge point tree structure using a knowledge text corpus and traverses the knowledge nodes in the tree structure to create a knowledge singly linked list path. Next, it performs pairwise question-and-answer pairings based on the path nodes in the knowledge singly linked list path to obtain a first question-and-answer pair. Then, it fills the knowledge singly linked list path with seed task questions and generates answers using a generative language model. Finally, it performs pairwise question-and-answer pairings between the path nodes in the knowledge singly linked list path and the generated answers to obtain a second question-and-answer pair. The first and second question-and-answer pairs are then combined into a third question-and-answer pair, and a fine-tuned dataset is constructed to enhance and train the generative language model, thereby obtaining a dialogue prediction model. Finally, the dialogue prediction model is used for dialogue prediction. This invention converts the tree structure into a knowledge singly linked list path, enabling the dialogue prediction model to more accurately match contextual knowledge points and improving its understanding of knowledge points in multi-turn dialogue tasks. Combined with question-answer pair concatenation and merging, the dialogue prediction model can better understand and answer questions. Furthermore, by fine-tuning the dataset for enhanced training, the robustness and adaptability of the dialogue prediction model are improved, thereby increasing the accuracy of the generated answers and solving the problem of low accuracy in content generated by generative language models in multi-turn dialogue tasks. Attached Figure Description
[0023] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 A flowchart illustrating a multi-turn dialogue data augmentation method provided in an embodiment of the present invention;
[0025] Figure 2 This is a schematic diagram of a sub-process of a multi-turn dialogue data augmentation method provided in an embodiment of the present invention;
[0026] Figure 3 This is an example diagram of a knowledge point tree structure in a multi-turn dialogue data augmentation method provided in an embodiment of the present invention;
[0027] Figure 4 A schematic block diagram of a multi-turn dialogue data enhancement device provided in an embodiment of the present invention;
[0028] Figure 5 This is a sub-schematic block diagram of a multi-turn dialogue data enhancement device provided for an embodiment of the present invention. Detailed Implementation
[0029] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0030] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0031] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0032] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0033] Please see below. Figure 1 , Figure 1 The flowchart of a multi-turn dialogue data augmentation method provided in an embodiment of the present invention specifically includes steps S101 to S106.
[0034] S101. Obtain the knowledge text corpus from the business database, create a knowledge point tree structure based on the knowledge text corpus, and then traverse the knowledge nodes in the knowledge point tree structure to create a knowledge singly linked list path.
[0035] S102. Based on the path nodes in the knowledge singly linked list path, perform pairwise question-and-answer pairing to obtain the first question-and-answer pair, and perform format conversion on the first question-and-answer pair;
[0036] S103. Obtain the seed task question, fill the seed task question into the knowledge single linked list path, and use the generative language model to generate the answer to the filled knowledge single linked list path. Then, perform pairwise question-answer pairing between the path nodes in the filled knowledge single linked list path and the generated answer to obtain the second question-answer pair.
[0037] S104. The first question-and-answer pair and the second question-and-answer pair are concatenated into a third question-and-answer pair, and the third question-and-answer pair is converted into a question-and-answer pair vector by a word segmenter to construct the fine-tuning dataset;
[0038] S105. Enhance the training of the generative language model using the fine-tuned dataset to establish a dialogue prediction model.
[0039] S106. Use the dialogue prediction model to perform dialogue prediction.
[0040] This embodiment first creates a knowledge point tree structure based on the knowledge text corpus obtained from the business database, and traverses the knowledge nodes in the knowledge point tree structure to create a knowledge singly linked list path. Next, it performs pairwise question-and-answer pairing on the path nodes in the knowledge singly linked list path to obtain the first question-and-answer pair. Then, it fills the knowledge singly linked list path with seed task questions and generates answers using a generative language model. Next, it performs pairwise question-and-answer pairing on the path nodes in the knowledge singly linked list path and the generated answers to obtain the second question-and-answer pair. Finally, it combines the first and second question-and-answer pairs into a third question-and-answer pair and constructs a fine-tuned dataset to enhance the training of the generative language model, thereby obtaining a dialogue prediction model. Finally, it uses the dialogue prediction model to perform dialogue prediction. The dialogue prediction model constructed in this embodiment can accurately match knowledge points, narrow down the scope of knowledge points, and spontaneously initiate multi-turn dialogues based on existing knowledge points and corpora. Furthermore, the dialogue data from these multi-turn dialogues is of higher quality and larger quantity, enabling the dialogue prediction model to more accurately match contextual knowledge points. This improves the model's understanding of knowledge points in multi-turn dialogue tasks, thereby enhancing its generalization ability, dialogue fluency, and accuracy in dialogue prediction. In a specific embodiment, the business database contains a business data table, and the detailed data in the business data table includes knowledge text corpora, none of which have undergone data augmentation.
[0041] Combination Figure 2 As shown, in one embodiment, step S101 includes steps S201 to S204.
[0042] S201. Obtain structured text corpus, and calculate the number of knowledge point levels of the structured text corpus based on the field information of the structured text corpus;
[0043] S202. Assign knowledge nodes to the number of knowledge point levels to create a knowledge point tree structure;
[0044] S203. Obtain all first-level knowledge points in the knowledge point tree structure, and set each first-level knowledge point as the root node of the knowledge point tree structure. Then, perform a depth-first traversal on all knowledge nodes of the knowledge point tree structure starting from the root node to obtain the sub-path between all root nodes and each leaf node.
[0045] S204. Create the original knowledge singly linked list path, initialize an empty node, and point the empty node to the root node. Update the original knowledge singly linked list path using the sub-path to obtain the knowledge singly linked list path.
[0046] In this embodiment, structured text corpus is first acquired, and the number of knowledge point levels is calculated based on the field information of the structured text corpus. Next, knowledge nodes are assigned to the knowledge point levels to create a knowledge point tree structure. Then, based on the knowledge point tree structure, the first-level knowledge point is used as the root node, and a depth-first traversal is performed on all knowledge nodes starting from the root node to obtain the sub-paths between the root node and each leaf node. Finally, the original knowledge singly linked list path is updated using the sub-paths, thus obtaining the knowledge singly linked list path. This embodiment improves the quality of information retrieval by performing a depth-first traversal on the knowledge point tree structure to obtain the knowledge singly linked list path and by accurately matching the context knowledge points of the knowledge point tree structure. In practical applications, when a user needs to query a specific knowledge point or needs to obtain relevant information based on context, the dialogue prediction model can better provide accurate answers or solutions.
[0047] Structured text corpora are extracted by performing a GROUP BY operation on business data tables in a business database using the SQL programming language. The data is divided according to business type, deduplicated across different business types, and then redefined to extract structured data. Referring to Table 1, in a specific embodiment, the structured text corpus has five header fields: Question, Knowledge Point, Type 1, Type 2, and Answer. The data format of the fields under the header fields can be numeric, Boolean, or text characters. The number of knowledge point levels in the structured text corpus is calculated based on the header fields. For example, if the fields in the business database represent parent-child or hierarchical relationships, the number of knowledge point levels can be calculated by traversing these relationships.
[0048] question Knowledge Points Category 1 Category 2 Answer Question 1 Knowledge Point 1 Category A Category A1 Category A1 Question 1 Knowledge Point 1 Category A Category A2 Category A2 Question 2 Knowledge Point 2 Category B Category B1 Category B1 ...... ...... ...... ...... ......
[0049] Table 1
[0050] Combination Figure 3As shown, after calculating the number of knowledge point levels, a knowledge point tree structure is created by assigning nodes to knowledge points at each level. This can be done from top to bottom or from left to right to ensure each knowledge point has the correct position in the tree structure. From top to bottom: Knowledge points at each level are assigned from top to bottom according to the number of levels. Except for the root node and the bottom-level node, each knowledge point is a child node of the previous node and a parent node of the next node. From left to right: Within each level, knowledge points are assigned from left to right. As shown in Table 1, following the left-to-right division, "Question" is the root node, "Knowledge Point" is the first-level knowledge node, "Type 1" is the second-level knowledge node, "Type 2" is the third-level knowledge node, and "Answer" is the leaf node, i.e., the bottom-level node.
[0051] In one specific embodiment, depth-first traversal can be implemented using recursion or iteration. Taking the first-level knowledge point in the knowledge point tree structure as the root node, a depth-first traversal is performed on all knowledge points in the tree structure. Each knowledge point in the tree structure may have multiple child nodes or branches, requiring traversal of each child node one by one. Upon reaching a node, it is added to the pointer of the previous node, thus obtaining all sub-paths between the root node and each leaf node. The starting point of each sub-path is the root node, and the ending point is the currently traversed leaf node. Leaf nodes have no child nodes. After obtaining the sub-paths, an original singly linked list path is created, and an empty node is initialized and points to the root node. The original singly linked list path is then updated using the sub-paths, thus obtaining the final knowledge singly linked list path.
[0052] In one embodiment, step S102 includes:
[0053] Select the root path node of the knowledge singly linked list path as the starting point;
[0054] For each sub-path in the knowledge singly linked list path, all path nodes on the sub-path are paired up in order to obtain sub-question-answer pairs; wherein the sub-question-answer pairs include sub-question nodes and sub-answer nodes.
[0055] Set all sub-question-answer pairs into the first question-answer pair.
[0056] In this embodiment, the root path node of the knowledge singly linked list path is first used as the starting point for question-answer pairing. Then, for each sub-path, starting from the starting point, all path nodes on the sub-path are paired in sequence to construct a sub-question-answer pair containing a sub-question node and a sub-answer node. Finally, the set of all sub-question-answer pairs is used as the first question-answer pair. This embodiment constructs a chain-of-thought (COT) by converting the knowledge singly linked list path into sets of question-answer pairs. Each adjacent question-answer pair has a sequential relationship, and each node has only one unidirectional pointer, giving the chain-of-thought a hidden semantic logic. This facilitates inference and prediction in the generative language model during subsequent iterative training with fine-tuned datasets.
[0057] In one specific embodiment, a sliding window pattern can be used to construct question-answer pairs. Adjacent path nodes are retrieved from the knowledge singly linked list path in sequential order, with a window size of 2 and a step size of 1. Question-answer pairing is performed from left to right. For example, the knowledge singly linked list path includes multiple sub-paths (Router-1 to Router-N) as shown below:
[0058] Router-1: Question 1 → Knowledge Point 1 → Category A → Category A1 → Answer A1;
[0059] Router-2: Question 1 → Knowledge Point 1 → Category A → Category A2 → Answer A1; ...;
[0061] Router-N: Question N → Knowledge Point N → Category N → Category NN → Answer NN.
[0062] For sub-path Router-1, a sliding window with a window size of 2 and a step size of 1 is used for question-answer pairing. The first sliding window contains two sub-path nodes (Question 1, Knowledge Point-1). Then, it moves one step to the right, and the second sliding window contains two sub-path nodes (Knowledge Point-1, Category A). The sub-path node that appears first in the sliding window is used as the sub-question node, and the sub-path node that appears later in the sliding window is used as the sub-answer node, thus forming a sub-question-answer pair. This process is repeated until the far right, that is, all path nodes are constructed as sub-question-answer pairs.
[0063] In one embodiment, step S102 further includes:
[0064] Set the first question node in the first question-and-answer pair to the first prompt format, and set the first answer node in the first question-and-answer pair to the first answer format;
[0065] Obtain the first root node and the corresponding instruction task corresponding to the first question-and-answer pair;
[0066] The first root node is filled into the first question-and-answer pair as the first scene format, and the instruction task is filled into the first question-and-answer pair as the first instruction format, resulting in a first question-and-answer pair with the format instruction-hint-scene-answer.
[0067] In this embodiment, the first question node and the first answer node in the first question-and-answer pair are first set to the first prompt format and the first answer format, respectively. Then, the first root node and the corresponding instruction task of the first question-and-answer pair are obtained. Next, the first root node is filled into the first question-and-answer pair as the first scene format, and the instruction task of the first question-and-answer pair is filled into the first question-and-answer pair as the first instruction format. Thus, the first instruction format, the first prompt format, the first scene format, and the first answer format of the first question-and-answer pair can be obtained. Finally, they are combined to obtain the first question-and-answer pair with the format of instruction-prompt-scene-answer.
[0068] The instruction format describes the instructions or questions of the current scene or character and guides the subsequent dialogue; the prompt format represents the text form of the current question; the scenario format corresponds to the root node, representing the current dialogue scenario or character; and the completion format represents the answer or solution generated by the model based on the given question or instruction.
[0069] In one specific embodiment, the question node and answer node in the question-answer pair are converted to prompt format and answer format through format conversion. For example, the sub-question-answer pairs constructed by sub-path Router-1 are all converted to prompt format and answer format, resulting in Round-1 to Round-4 as shown below:
[0070] Round-1: {"user": "Question 1", "bot": "Which knowledge point in Question 1?"};
[0071] Round-2: {"user": "Knowledge Point-1", "bot": "Which category of Knowledge Point-1?"};
[0072] Round-3: {"user": "Category A", "bot": "Is it category A1 within category A?"};
[0073] Round-4: {"user": "Yes", "bot": "Answer A1"}.
[0074] In this context, Round-1 corresponds to the sub-question-answer pair constructed by the first sliding window of Router-1 (Question 1, Knowledge Point-1), Round-2 corresponds to the sub-question-answer pair constructed by the second sliding window of Router-1 (Knowledge Point-1, Category A), Round-3 corresponds to the sub-question-answer pair constructed by the third sliding window of Router-1 (Category A, Category A1), and Round-4 corresponds to the sub-question-answer pair constructed by the fourth sliding window of Router-1 (Category A1, Answer A1).
[0075] In Round-1, the question node (Question 1) is converted to a prompt format ("use r": "Question 1"), and the answer node (Knowledge Point-1) is converted to an answer format ("bot": "Which knowledge point of Question 1?"). It's important to note that the answer format here is based on the prompt format, and the answer format is also a specific representation of the knowledge point contained in the answer node; that is, the answer format ("bot": "Which knowledge point of Question 1?") is a specific representation of the answer node (Question 1). Similarly, in Round-2, the question node (Knowledge Point-1) is converted to a prompt format ("user": "Knowledge Point-1"), and the answer node (Category A) is converted to an answer format ("bot": "Which category of Knowledge Point-1?"). That is, the answer format ("bot": "Which category of Knowledge Point-1?") is a specific representation of the answer node (Category A). The conversion process for Rounds-3 and-4 is the same as for Rounds-1 and-2.
[0076] In another specific embodiment, the question-answer pair is constructed as a multi-turn dialogue, thereby simulating the context and discourse of conversational interaction. This better mimics real-life human-to-human conversations, improving the dialogue prediction model's ability to understand user-provided information and generating more meaningful responses based on context. This makes the text generated by the dialogue prediction model more coherent and contextual, enhancing its learning ability and enabling it to respond more appropriately to user instructions, questions, and requests. For example, the multi-turn dialogue from Round-1 to Round-4, after format conversion, is as follows:
[0077] {“instruction”: “Please act as a property management AI intelligent service assistant to provide services to users”;
[0078] "prompt": "user: Question 1"
[0079] “scenario”: “Question 1”
[0080] "completion": "bot: Which knowledge point in question one?"
[0081] {“instruction”: “Please act as a property management AI intelligent service assistant to provide services to users”;
[0082] "prompt": "user: Question 1"
[0083] “scenario”: “Question 1”
[0084] "completion": "bot: Which knowledge point in question one?"
[0085] {“instruction”: “Please act as a property management AI intelligent service assistant to provide services to users”;
[0086] "prompt": "user: Question 1 ##\n##bot: Which knowledge point in Question 1?"
[0087] “scenario”: “Question 1”
[0088] “completion”: “user: knowledge point-1”};
[0089] {“instruction”: “Please act as a property management AI intelligent service assistant to provide services to users”;
[0090] "prompt": "user: Question 1 ##\n##bot: Which knowledge point in Question 1? ##\n##user: Knowledge point - 1",
[0091] “scenario”: “Question 1”
[0092] "completion": "bot: Which category of knowledge point-1?"
[0093] {“instruction”: “Please act as a property management AI intelligent service assistant to provide services to users”;
[0094] "prompt": "user: Question 1 ##\n##bot: Which knowledge point of Question 1? ##\n##user: Knowledge point - 1 ##\n##bot: Which category of knowledge point - 1",
[0095] “scenario”: “Question 1”
[0096] “completion”: “user: Category A”};
[0097] {“instruction”: “Please act as a property management AI intelligent service assistant to provide services to users”;
[0098] "prompt": "user: Question 1 ##\n##bot: Which knowledge point of Question 1? ##\n##user: Knowledge point - 1 ##\n##bot: Which category of knowledge point - 1? ##\n##user: Category A",
[0099] “scenario”: “Question 1”
[0100] "completion": "bot: Is it category A1 within category A?"
[0101] {“instruction”: “Please act as a property management AI intelligent service assistant to provide services to users”;
[0102] "prompt": "user: Question 1 ##\n##bot: Which knowledge point in Question 1? ##\n##user: Knowledge point - 1 ##\n##bot: Which category of knowledge point - 1? ##\n##user: Category A ##\n##bot: Is it category A1 within category A?"
[0103] “scenario”: “Question 1”
[0104] "completion": "user: Yes"};
[0105] {“instruction”: “Please act as a property management AI intelligent service assistant to provide services to users”;
[0106] "prompt": "user: Question 1 ##\n##bot: Which knowledge point of Question 1? ##\n##user: Knowledge point - 1 ##\n##bot: Which category of knowledge point - 1? ##\n##user: Category A ##\n##bot: Is it category A1 within category A? ##\n##user: Yes",
[0107] “scenario”: “Question 1”
[0108] "completion": "bot: answer A1"}.
[0109] In one embodiment, step S103 includes:
[0110] The seed task question is populated into all path nodes of the knowledge singly linked list path;
[0111] Generative language models are used to generate corresponding answers for each path node.
[0112] For each of the aforementioned path nodes, the path node is paired with the corresponding answer to form the second question-answer pair;
[0113] Set the second question node in the second question-and-answer pair to the second prompt format, and set the second answer node in the second question-and-answer pair to the second answer format;
[0114] Obtain the second root node corresponding to the second question-and-answer pair, and set the second root node to the second scenario format of the second question-and-answer pair;
[0115] The seed task question is set to the second instruction format of the second question-and-answer pair.
[0116] In this embodiment, the obtained seed task is first populated into all path nodes of the knowledge singly linked list path. Then, a generative language model generates corresponding answers for each of the populated path nodes. Next, the path nodes and their corresponding answers are paired to form a second question-and-answer pair. Finally, the second question node and the second answer node in the second question-and-answer pair are set to the second hint format and the second answer format, respectively. The second root node corresponding to the second question-and-answer pair is set to the second scene format, and the populated seed task is set to the second instruction format, resulting in a second question-and-answer pair with the format instruction-hint-scene-answer. This embodiment expands the model's knowledge coverage by populating seed tasks, improving the model's ability to understand new knowledge and enabling it to have stronger logical response capabilities when encountering uncovered knowledge. The generative language model can be selected from existing natural language models based on the actual situation; for example, open-source natural language processing models such as GP T2 / ChatGLM / LlaMA2 can be used as generative language models.
[0117] In specific embodiments, the number of seed tasks can be set according to the model's performance or the actual needs of the task. For example, six seed tasks can be set, including negation questions, synonym replacement, redefinition that contradicts the conventional meaning, negation of affirmative forms in deductive reasoning, task interference, and repeated spurious samples. Among them, a negation question means constructing a question in a negative form, which requires the model to answer whether it is true or not. An example is {"instruction":"Please construct multi-turn question-and-answer dialogue data for each node of the following knowledge singly linked list, and construct a question in a negative form","prompt":"Question 1 → Knowledge Point - 1 → Category A → Category A1 → Answer A1"};
[0118] Synonym substitution means replacing keywords in the question with synonyms, challenging the model to understand and answer questions with similar meanings. Example: {"instruction":"Please construct multi-turn question-and-answer dialogue data for each node of the following knowledge singly linked list, and replace the keywords with synonyms","prompt":"Question 1→Knowledge Point-1→Category A→Category A1→Answer A1"};
[0119] A redefinition that contradicts the usual meaning means redefining a common concept or term so that it contradicts its usual meaning, requiring the model to answer the newly defined question. An example is: {"instruction":"Please construct multi-turn question-and-answer dialogue data for each node of the following knowledge singly linked list, and redefine a common concept or term so that it contradicts its usual meaning, and answer it as negative","prompt":"Question 1 → Knowledge Point - 1 Category A → Category A1 → Answer A1"};
[0120] In deductive reasoning, the negation-affirmation form represents constructing a deductive reasoning question with both negation and affirmation forms, which the model needs to answer correctly. The interference execution task represents adding interference information to the question, challenging the model's ability to identify and process interference information. An example is: {"instruction":"Please construct multi-turn question-and-answer dialogue data for each node of the following knowledge singly linked list, and add interference information to the question","prompt":"Question 1 → Knowledge Point - 1 → Category A → Category A1 → Answer A1"};
[0121] A duplicate spurious sample means constructing a question that involves a duplicate spurious sample. The model needs to correctly identify and answer this question. An example is: {"instruction":"Please construct multi-turn question-and-answer dialogue data for each node of the following knowledge singly linked list, and add a duplicate spurious sample question to the question","prompt":"Question 1 → Knowledge Point - 1 → Category A → Category A1 → Answer A1"}.
[0122] In one embodiment, step S104 includes:
[0123] Construct a first singly linked list set to store the first question-and-answer pair, and construct a second singly linked list set to store the second question-and-answer pair;
[0124] The data in the first singly linked list set and the second singly linked list set are preprocessed, including text cleaning, tokenization, and removal of delimiters;
[0125] The preprocessed first singly linked list set and the second singly linked list set are concatenated and merged to obtain the third singly linked list set.
[0126] Initialize the word segmenter and configure its parameters, including vocabulary size and special symbols;
[0127] The word segmenter converts the data in the third singly linked list set into text vectors.
[0128] The text vectors are formatted and then combined to form the fine-tuning dataset; wherein the format of the converted text vectors is instruction-hint-scenario-answer.
[0129] In this embodiment, firstly, a first singly linked list set is constructed and saved for the first question-and-answer pair, and a second singly linked list set is saved for the second question-and-answer pair. Secondly, the data in the first and second singly linked list sets undergo preprocessing, including text cleaning, tokenization, and removal of stop tags, to ensure that the text in the data in the first and second singly linked list sets meets the expected format and quality requirements. Then, the preprocessed first and second singly linked list sets are concatenated and merged to obtain a third singly linked list set. Next, the data in the third singly linked list set is converted into text vectors by a tokenizer after initialization and parameter configuration. Finally, the text vectors are converted into an instruction-hint-scene-answer format, and the format-converted text vectors are combined to construct a fine-tuning dataset.
[0130] This embodiment, by concatenating and merging the first and second singly linked list sets, can more accurately match the contextual knowledge points of the tree structure, thereby better understanding and answering questions. The resulting dialogue prediction model can then reason and generate accurate answers based on specific tree-structured knowledge points during dialogue, providing more in-depth and detailed responses. This embodiment also enables the dialogue prediction model to more accurately understand and apply domain-related knowledge by setting knowledge singly linked list paths and scene formats, thus better supporting complex dialogue tasks and technical fields (such as querying and reasoning, answering questions in specialized fields, understanding and parsing technical documents, etc.), and providing more professional and precise support in these tasks and fields. Through the knowledge chain structure set in this example, the dialogue prediction model can spontaneously ask questions of the interlocutor during multi-turn dialogues, narrowing the scope of knowledge points and thus enhancing the dialogue expression capabilities of the language model.
[0131] In a specific embodiment, the concatenation and merging process can involve combining samples from the first and second singly linked list sets according to specific rules. For example, samples can be selected alternately or randomly. The word segmenter can be selected based on the actual situation; for example, a BPE (Byte-Pair Encoding) word segmenter can be chosen. Furthermore, after combining the format-converted text vectors to construct a fine-tuning dataset, other features, such as labels and contextual information, can be added or adjusted in the fine-tuning dataset according to the specific task requirements.
[0132] In one embodiment, step S105 includes:
[0133] The fine-tuning dataset is divided into mini-batch data, and the generative language model is iteratively trained using the mini-batch data until the generative language model meets the convergence condition.
[0134] Obtain the evaluation metrics generated during iterative training, calculate the weighted average of the evaluation metrics, and use the weighted average as the model metric of the generative language model;
[0135] The model indicator with the highest weighted mean is selected as the optimal model indicator, and the optimal model indicator is used as the optimal model weight.
[0136] The optimal model weights are loaded into the generative language model to construct the dialogue prediction model.
[0137] In this embodiment, the fine-tuning dataset is first divided into small batches of data for iterative training of the generative language model. The evaluation metrics generated during the iterative training process are calculated, and the weighted average of the evaluation metrics is used as the model metric of the generative language model. The highest weighted average is then selected as the optimal model metric and further used as the optimal model weight. Finally, the optimal model weight is loaded into the generative language model to construct the dialogue prediction model.
[0138] This embodiment uses a fine-tuned dataset to iteratively train a generative language model to construct a dialogue prediction model. This allows the text input to the dialogue prediction model to more accurately match tree-structured knowledge points and to more accurately understand user questions or needs. By conducting multiple rounds of follow-up questions, the scope of knowledge points is narrowed, enabling the dialogue prediction model to provide more precise answers for specific domains or topics. Furthermore, it strengthens the application of contextual knowledge, thereby establishing more meaningful and coherent dialogues, providing more suitable solutions, and improving the user's dialogue interaction experience, enhancing user satisfaction and interaction effectiveness. Compared to existing technologies, the dialogue prediction model trained iteratively on the fine-tuned dataset can proactively initiate multi-round dialogues without needing to pre-set a fixed dialogue framework or questions. It possesses the ability to understand context and generate coherent dialogues, enabling proactive questioning, answering questions, and in-depth communication with users. Moreover, the dialogue prediction model constructed in this embodiment only requires fine-tuning of the existing generative language model, eliminating the need for secondary pre-training, saving significant time and computational resources. Simultaneously, optimization for specific tasks or domains allows the dialogue prediction model to be quickly applied to real-world scenarios.
[0139] In one specific embodiment, after constructing the dialogue prediction model, it is necessary to segment the text in the data to be enhanced into a sequence of words or sub-words using a word segmenter, so that it can be input into the dialogue prediction model for dialogue prediction. Specifically, the same word segmenter used during the data transformation of the third singly linked list set can be used to ensure that the word segmentation rules and vocabulary used in the input dialogue prediction model are the same, thereby maintaining the consistency of text processing. Then, the data to be enhanced is obtained. Specifically, the steps to obtain the data to be enhanced are: 1. Connect the data enhancement table according to the business database configuration and business requirements; 2. Use the GROUP BY operation of the SQL programming language to extract the secondary knowledge point type (knowledge_type2) from the table in the business database; 3. Execute the following SQL command:
[0140] SELECT knowledge_type,knowledge_type1,knowledge_type2;
[0141] FROM Knowledge)
[0142] GROUP BY knowledge_type,knowledge_type1,knowledge_type2.
[0143] In this implementation, `SELECT knowledge_type, knowledge_type1, knowledge_type2` selects data based on knowledge point type, primary knowledge point type, and secondary knowledge point type; `FROM Knowledge_type` specifies the data source as the "Knowledge" table. `GROUP BY knowledge_type, knowledge_type1, knowledge_type2` groups data based on knowledge point type, primary knowledge point type, and secondary knowledge point type. After obtaining the data to be enhanced, it is converted into an instruction + prompt format and input into the dialogue prediction model, which then generates the answer. This embodiment constructs the data to be enhanced into a data format similar to the fine-tuning dataset, enabling the dialogue prediction model to generate more diverse enhancement data. This helps to accurately match the context of the knowledge point tree structure, improving the knowledge extraction and organization capabilities of the dialogue prediction model. This allows the model to better understand the hierarchical structure and relationships of knowledge, extract accurate knowledge points from complex text, and organize them into a meaningful and structured form. Furthermore, after obtaining the answers generated by the dialogue prediction model, the answers can be post-processed. For example, the answers can be filtered, corrected, or modified according to specific rules to make the answer results more in line with the expected format, syntax, or requirements. The specific rules can be set according to task requirements and application scenarios.
[0144] In another specific embodiment, a validation set can be partitioned from the fine-tuning dataset. Evaluation metrics are calculated using the validation set, and the weighted average of these metrics is further calculated. During the iterative training of the generative language model, a predetermined number of evaluations is set, for example, 1000. Every 1000 training iterations, the weighted average of the evaluation metrics is calculated as the model metric, and then compared with the result of the previous calculation. The model metric with the higher weighted average is selected as the optimal model metric, until the generative language model meets the convergence condition. Specifically, the convergence condition can be achieved by monitoring the three most recently calculated model metrics. If these three metrics tend to stabilize and do not show significant improvement, the generative language model is considered to have converged, i.e., the convergence condition has been met.
[0145] Evaluation metrics include sentence perplexity (PPL), bilingual evaluation comprehension (BLEU), recall-oriented summary evaluation method-1 (ROGUE-1), recall-oriented summary evaluation method-2 (ROGUE-2), and longest common subsequence recall-oriented summary evaluation method (ROGUE-L).
[0146] In a specific embodiment, the sentence perplexity level (PPL) is calculated according to the following formula:
[0147]
[0148] Where m represents the number of samples, w represents the current word representation vector, i represents the index subscript value, and p represents the conditional probability;
[0149] Calculate the Bilingual Assessment Comprehension (BLEU) score using the following formula:
[0150]
[0151] In this formula, `candidate` represents the sentence generated by the generative language model, `c` represents the original text, and `n-gram` is a commonly used text representation method in natural language processing, used to segment text into n consecutive items, i.e., sentence segments (usually words or characters). A sentence segment with a length of 1 represents a single word (1-gram or unigram), and a sentence segment with a length of 2 represents two adjacent words (2-gram or 2-gram). The numerator of the formula indicates how many sentence segments appear in the labeled sentence in the sentence generated by the generative language model. The labeled sentence is the sentence obtained after converting the text vector into an instruction-hint-scenario-answer format. The denominator of the formula indicates the total number of sentence segments in the sentence generated by the generative language model. For example, for the sentence "I love natural language processing.", 1-gram is represented as: ["I", "love", "natural", "language", "processing", "."]; 2-gram is represented as: ["I love", "love natural", "natural language", "language processing", "processing."].
[0152] The recall-oriented summary evaluation method-1 (Rogue-1) and the recall-oriented summary evaluation method-2 (Rogue-2) are calculated according to the following formulas:
[0153]
[0154] Where S∈ReferenceSummaries represents the annotation set, and Count match (gram n ) represents the number of sentence segments (spans) that appear simultaneously in the sentences generated by the generative language model and the labeled sentences. Count(grams) n) represents the number of sentence segments appearing in the labeled sentence, and n represents the length of the sentence segment. N is 1 or 2. When N is 1, the length of the sentence segment is 1, and the calculated result is the recall-oriented summary evaluation method-1 (Rogue-1). When N is 2, the length of the sentence segment is 2, and the calculated result is the recall-oriented summary evaluation method-2 (Rogue-2).
[0155] The longest common subsequence recall-oriented summary evaluation method is calculated according to the following formula:
[0156]
[0157]
[0158]
[0159] Where LCS(X, Y) represents the length of the longest common subsequence of X and Y, X represents the sentence generated by the generative language model, Y represents the labeled sentence, m represents the length of the labeled sentence, n represents the length of the sentence generated by the model, and R lcs P represents recall rate. lcs F indicates precision. lcs Let represent the harmonic mean of recall and precision, and β represent the hyperparameter. Here, recall and precision have equal weights and are mutually restrictive; increasing recall usually leads to decreasing precision, and similarly, increasing precision usually leads to decreasing recall. Therefore, the harmonic mean of recall and precision ranges from 0 to 1. The higher the recall and precision, the closer the harmonic mean is to 1; the lower the recall and precision, the closer the harmonic mean is to 0.
[0160] After calculating all evaluation metrics, an initial weight is first assigned to each metric to represent its importance in the overall evaluation. For example, the initial weight for PPL is set to 0.3, for BLEU to 0.1, for ROGUE-1 to 0.1, for ROGUE-2 to 0.2, and for ROGUE-L to 0.3. These initial weights can be adjusted according to specific task requirements. Then, the calculated result of each evaluation metric is multiplied by its corresponding initial weight, and the average is calculated. The result is the weighted average of the evaluation metrics, which is used as the model metric. Alternatively, the optimal model metric can be used as the optimization objective during the training process of the generative language model. By adjusting the model parameters, the weighted average can be maximized to obtain the optimal model metric, which is then saved as the optimal model weight to a file on disk for subsequent deployment and use. In other embodiments, the model parameters can also be adjusted to minimize the weighted average, and the minimized weighted average can be used as the optimal model metric.
[0161] Furthermore, before iteratively training the generative language model, it needs to be pre-trained. The model weights of the pre-trained generative language model are then used as the initial model weights for iterative training. Additionally, the hyperparameters need to be initialized and fine-tuned. These hyperparameters can be optimized according to the specific task requirements; for example, learning rate, batch size, and training epochs can be selected as hyperparameters. During iterative training, a loss function needs to be defined based on the task type and objective to optimize the model. Specifically, the cross-entropy loss function can be used.
[0162] Figure 4 This is a schematic block diagram of a multi-turn dialogue data enhancement device 400 provided in an embodiment of the present invention. The device 400 includes:
[0163] The path creation unit 401 is used to obtain knowledge text corpus from the business database, create a knowledge point tree structure based on the knowledge text corpus, and then traverse the knowledge nodes in the knowledge point tree structure to create a knowledge singly linked list path.
[0164] The first question-and-answer pairing unit 402 is used to perform pairwise question-and-answer pairing based on the path nodes in the knowledge single-linked list path to obtain the first question-and-answer pair, and to perform format conversion on the first question-and-answer pair;
[0165] The seed task acquisition unit 403 is used to acquire seed task questions, fill the seed task questions into the knowledge single linked list path, generate answers for the filled knowledge single linked list path using a generative language model, and then pair the path nodes in the filled knowledge single linked list path with the generated answers to obtain a second question-answer pair.
[0166] The question-and-answer concatenation unit 404 is used to concatenate the first question-and-answer pair and the second question-and-answer pair into a third question-and-answer pair, and to convert the third question-and-answer pair into a question-and-answer pair vector through a word segmenter to construct a fine-tuning dataset;
[0167] The enhanced training unit 405 is used to enhance the training of the generative language model using the fine-tuned dataset, thereby establishing a dialogue prediction model.
[0168] The dialogue prediction unit 406 is used to perform dialogue prediction using the dialogue prediction model.
[0169] Combination Figure 5 As shown, in one embodiment, the path creation unit 401 includes:
[0170] The text corpus acquisition unit 501 is used to acquire structured text corpus and calculate the number of knowledge point levels of the structured text corpus based on the field information of the structured text corpus.
[0171] The tree structure creation unit 502 is used to allocate knowledge nodes according to the number of knowledge point levels and create a knowledge point tree structure.
[0172] The sub-path acquisition unit 503 is used to acquire all first-level knowledge points in the knowledge point tree structure, set each first-level knowledge point as the root node of the knowledge point tree structure, and perform a depth-first traversal of all knowledge nodes in the knowledge point tree structure starting from the root node to obtain the sub-path between all the root nodes and each leaf node.
[0173] The path update unit 504 is used to create an original knowledge singly linked list path, initialize an empty node, point the empty node to the root node, and update the original knowledge singly linked list path using the sub-path to obtain the knowledge singly linked list path.
[0174] In one embodiment, the first question-and-answer matching unit 402 includes:
[0175] The starting point selection unit is used to select the root path node of the knowledge singly linked list path as the starting point.
[0176] The sub-question-answer pairing unit is used to pair all path nodes on each sub-path in the knowledge singly linked list path in a sequential order to obtain a sub-question-answer pair; wherein the sub-question-answer pair includes a sub-question node and a sub-answer node.
[0177] The question-and-answer set unit is used to set all sub-question-and-answer pairs into the first question-and-answer pair.
[0178] In one embodiment, the seed task unit 402 further includes:
[0179] The first format setting unit is used to set the first question node in the first question-answer pair to a first prompt format, and to set the first answer node in the first question-answer pair to a first answer format;
[0180] The first root node instruction acquisition unit is used to acquire the first root node corresponding to the first question-answer pair and the corresponding instruction task.
[0181] The first format filling unit is used to fill the first root node into the first question-and-answer pair as the first scene format, and to fill the instruction task into the first question-and-answer pair as the first instruction format, so as to obtain the first question-and-answer pair in the format of instruction-hint-scene-answer.
[0182] In one embodiment, the seed task unit 403 includes:
[0183] A seed task filling unit is used to fill the seed task problem into all path nodes of the knowledge singly linked list path;
[0184] The path answer generation unit is used to generate corresponding answers for each path node using a generative language model.
[0185] The second question-and-answer pairing unit is used to pair each path node with its corresponding answer to form a second question-and-answer pair.
[0186] The second format setting unit is used to set the second question node in the second question-answer pair to a second prompt format, and to set the second answer node in the second question-answer pair to a second answer format;
[0187] The second root node instruction acquisition unit is used to acquire the second root node corresponding to the second question-and-answer pair and set the second root node to the second scenario format of the second question-and-answer pair;
[0188] The second format filling unit is used to set the filled seed task question into the second instruction format of the second question-answer pair.
[0189] In one embodiment, the question-and-answer splicing unit 404 includes:
[0190] The question-and-answer storage unit is used to construct a first singly linked list set to store the first question-and-answer pair, and to construct a second singly linked list set to store the second question-and-answer pair;
[0191] The preprocessing unit is used to preprocess the data in the first singly linked list set and the second singly linked list set. The preprocessing includes text cleaning, tokenization, and removal of delimiters.
[0192] The splicing and merging unit is used to splice and merge the preprocessed first singly linked list set and the second singly linked list set to obtain the third singly linked list set.
[0193] The segmenter configuration unit is used to initialize the segmenter and configure its parameters, including vocabulary size and special symbols.
[0194] A data conversion unit is used to convert the data in the third singly linked list set into text vectors through the word segmenter;
[0195] The format conversion unit is used to convert the format of the text vector and combine the format-converted text vectors to construct the fine-tuning dataset; wherein, the format of the converted text vector is instruction-hint-scenario-answer.
[0196] In one embodiment, the enhanced training unit 405 includes:
[0197] An iterative training unit is used to divide the fine-tuning dataset into mini-batch data and use the mini-batch data to iteratively train the generative language model until the generative language model meets the convergence condition.
[0198] The indicator evaluation unit is used to obtain the evaluation indicators generated during the iterative training process, calculate the weighted average of the evaluation indicators, and use the weighted average as the model indicator of the generative language model.
[0199] The model weight selection unit is used to select the model index with the highest weighted average as the optimal model index, and to use the optimal model index as the optimal model weight.
[0200] The weight loading unit is used to load the optimal model weights into the generative language model to construct the dialogue prediction model.
[0201] Since the embodiments of the apparatus and the embodiments of the method correspond to each other, please refer to the description of the embodiments of the method for the embodiments of the apparatus, which will not be repeated here.
[0202] This invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed, can perform the steps provided in the above embodiments. The storage medium may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0203] This invention also provides a computer device, which may include a memory and a processor. The memory stores a computer program, and when the processor calls the computer program in the memory, it can implement the steps provided in the above embodiments. Of course, the computer device may also include various network interfaces, power supplies, and other components.
[0204] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
[0205] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A multi-turn dialogue data augmentation method, characterized in that, include: Obtain knowledge text corpus from the business database, create a knowledge point tree structure based on the knowledge text corpus, and then traverse the knowledge nodes in the knowledge point tree structure to create a knowledge singly linked list path; Based on the path nodes in the knowledge singly linked list path, pair questions and answers are performed to obtain the first question and answer pair, and the format of the first question and answer pair is converted. Obtain a seed task question, fill the seed task question into the knowledge singly linked list path, and use a generative language model to generate an answer for the filled knowledge singly linked list path. Then, perform pairwise question-answer pairing between the path nodes in the filled knowledge singly linked list path and the generated answer to obtain a second question-answer pair. The first and second question-answer pairs are concatenated into a third question-answer pair, and the third question-answer pair is converted into a question-answer pair vector by a word segmenter to construct the fine-tuned dataset. The generative language model is enhanced and trained using the fine-tuned dataset to establish a dialogue prediction model. Dialogue prediction is performed using the aforementioned dialogue prediction model.
2. The multi-turn dialogue data augmentation method according to claim 1, characterized in that, The process of acquiring knowledge text corpus from the business database, creating a knowledge point tree structure based on the knowledge text corpus, and then traversing the knowledge nodes in the knowledge point tree structure to create a knowledge singly linked list path includes: Obtain structured text corpus, and calculate the number of knowledge point levels in the structured text corpus based on the field information of the structured text corpus; Assign knowledge nodes to the number of knowledge point levels to create a knowledge point tree structure; Obtain all first-level knowledge points in the knowledge point tree structure, set each first-level knowledge point as the root node of the knowledge point tree structure, and perform a depth-first traversal of all knowledge nodes in the knowledge point tree structure starting from the root node to obtain the sub-path between all root nodes and each leaf node. Create an original knowledge singly linked list path, initialize an empty node, and point the empty node to the root node. Update the original knowledge singly linked list path using the sub-path to obtain the knowledge singly linked list path.
3. The multi-turn dialogue data augmentation method according to claim 1, characterized in that, The step of pairing questions and answers based on path nodes in the knowledge singly linked list to obtain the first question-and-answer pair includes: Select the root path node of the knowledge singly linked list path as the starting point; For each sub-path in the knowledge singly linked list path, all path nodes on the sub-path are paired up in order to obtain sub-question-answer pairs; wherein the sub-question-answer pairs include sub-question nodes and sub-answer nodes. Set all sub-question-answer pairs into the first question-answer pair.
4. The multi-turn dialogue data augmentation method according to claim 2, characterized in that, The format conversion of the first question-and-answer pair includes: Set the first question node in the first question-and-answer pair to the first prompt format, and set the first answer node in the first question-and-answer pair to the first answer format; Obtain the first root node and the corresponding instruction task corresponding to the first question-and-answer pair; The first root node is filled into the first question-and-answer pair as the first scene format, and the instruction task is filled into the first question-and-answer pair as the first instruction format, resulting in a first question-and-answer pair with the format instruction-hint-scene-answer.
5. The multi-turn dialogue data augmentation method according to claim 2, characterized in that, The seed task problem is obtained by filling the knowledge singly linked list path with the seed task problem, and generating answers for the filled knowledge singly linked list path using a generative language model. Then, the path nodes in the filled knowledge singly linked list path and the generated answers are paired to obtain a second question-answer pair, including: The seed task question is populated into all path nodes of the knowledge singly linked list path; Generative language models are used to generate corresponding answers for each path node. For each of the aforementioned path nodes, the path node is paired with the corresponding answer to form the second question-answer pair; Set the second question node in the second question-and-answer pair to the second prompt format, and set the second answer node in the second question-and-answer pair to the second answer format; Obtain the second root node corresponding to the second question-and-answer pair, and set the second root node to the second scenario format of the second question-and-answer pair; The seed task question is set to the second instruction format of the second question-and-answer pair.
6. The multi-turn dialogue data augmentation method according to claim 1, characterized in that, The process of concatenating the first and second question-answer pairs into a third question-answer pair, and then converting the third question-answer pair into a question-answer pair vector using a word segmenter to construct the fine-tuned dataset includes: Construct a first singly linked list set to store the first question-and-answer pair, and construct a second singly linked list set to store the second question-and-answer pair; The data in the first singly linked list set and the second singly linked list set are preprocessed, including text cleaning, tokenization, and removal of delimiters; The preprocessed first singly linked list set and the second singly linked list set are concatenated and merged to obtain the third singly linked list set. Initialize the word segmenter and configure its parameters, including vocabulary size and special symbols; The word segmenter converts the data in the third singly linked list set into text vectors. The text vectors are formatted and then combined to form the fine-tuning dataset; wherein the format of the converted text vectors is instruction-hint-scenario-answer.
7. The multi-turn dialogue data augmentation method according to claim 6, characterized in that, The step of enhancing the generative language model using the fine-tuned dataset to establish a dialogue prediction model includes: The fine-tuning dataset is divided into mini-batch data, and the generative language model is iteratively trained using the mini-batch data until the generative language model meets the convergence condition. Obtain the evaluation metrics generated during iterative training, calculate the weighted average of the evaluation metrics, and use the weighted average as the model metric of the generative language model; The model indicator with the highest weighted mean is selected as the optimal model indicator, and the optimal model indicator is used as the optimal model weight. The optimal model weights are loaded into the generative language model to construct the dialogue prediction model.
8. A multi-turn dialogue data enhancement device, characterized in that, include: The path creation unit is used to obtain knowledge text corpus from the business database, create a knowledge point tree structure based on the knowledge text corpus, and then traverse the knowledge nodes in the knowledge point tree structure to create a knowledge singly linked list path. The first question-and-answer pairing unit is used to perform pairwise question-and-answer pairing based on the path nodes in the knowledge single-linked list path to obtain the first question-and-answer pair, and to perform format conversion on the first question-and-answer pair. The seed task acquisition unit is used to acquire seed task questions, fill the seed task questions into the knowledge single linked list path, generate answers for the filled knowledge single linked list path using a generative language model, and then pair the path nodes in the filled knowledge single linked list path with the generated answers to obtain a second question-answer pair. The question-and-answer concatenation unit is used to concatenate the first question-and-answer pair and the second question-and-answer pair into a third question-and-answer pair, and to convert the third question-and-answer pair into a question-and-answer pair vector through a word segmenter to construct a fine-tuning dataset; An enhanced training unit is used to enhance the training of the generative language model using the fine-tuned dataset, thereby establishing a dialogue prediction model. A dialogue prediction unit is used to perform dialogue prediction using the dialogue prediction model.
9. A computer device, characterized in that, The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the multi-turn dialogue data enhancement method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the multi-turn dialogue data enhancement method as described in any one of claims 1 to 7.