Dialogue data generation method and device, equipment, storage medium and program product

By determining the target role and user input text in role-playing tasks, and using pre-trained large language model to generate multiple rounds of dialogue data, the problems of high cost and low efficiency of dialogue data generation in the existing technology are solved, and efficient and diversified dialogue data generation is achieved.

CN119862262APending Publication Date: 2025-04-22IFLYTEK CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411994929.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

In the prior art, the generation cost of dialogue data is high and the generation efficiency is low, and it is difficult for the base model to generate dialogues that conform to the character style in role-playing tasks.

Method used

By determining the input text of the target role and user and using a pre-trained large language model for multiple rounds of dialogue data generation, the probability tree is dynamically updated to improve the diversity and accuracy of dialogue data.

Benefits of technology

It realizes the generation of diversified and rich dialogue data at low cost and efficiently, improves the performance of role-playing models in role-playing tasks, and reduces the cost and time of dialogue data generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119862262A_ABST
    Figure CN119862262A_ABST
Patent Text Reader

Abstract

The invention provides a dialogue data generation method and device, equipment, a storage medium and a program product, and relates to the technical field of artificial intelligence. The method comprises the following steps: determining a target role input text corresponding to a target role, and determining a target user input text corresponding to a current dialogue round from a user input text library; inputting the target user input text and the dialogue data of the current to-be-generated multi-round dialogues into the role playing model to obtain user side dialogue data output by the role playing model, and updating the user side dialogue data into the dialogue data; inputting the target role input text and the dialogue data into a role playing model to obtain role side dialogue data which is output by the role playing model and used for playing the target role, and updating the role side dialogue data into the dialogue data; wherein the user input text library comprises user input texts corresponding to multiple human speaking modes. The dialogue data generation efficiency can be improved, and the dialogue data generation cost can be reduced.
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, device, equipment, storage medium and program product for generating dialogue data. Background Art

[0002] With the continuous development of artificial intelligence technology, the application of large language models is becoming more and more extensive. Among them, large language models can be applied to the field of role-playing. In the field of role-playing, the base large model cannot complete the role-playing task well. For example, there may be phenomena such as inconsistent character style and overly written chat. Therefore, it is necessary to construct dialogue data between humans and characters, that is, to construct training data specifically for role-playing tasks, so as to fine-tune the base large model in the field.

[0003] Currently, conversation data can be generated by manually annotating candidate replies or obtaining chat data between real users and large language models. However, the manual annotation method requires high capabilities of the annotators and has low annotation efficiency, resulting in high costs for generating conversation data and low efficiency for generating conversation data. At the same time, there may be a large amount of useless data in the chat data of real users that is not suitable for large language model training. The screening and processing of useless data requires a lot of time and effort, resulting in high costs for generating conversation data and low efficiency for generating conversation data. Summary of the invention

[0004] The present invention provides a conversation data generation method, device, equipment, storage medium and program product, which are used to solve the defects of high conversation data generation cost and low generation efficiency in the prior art, and realize a conversation data generation method with high efficiency and low cost.

[0005] The present invention provides a method for generating dialogue data, comprising: Determine the target role input text corresponding to the target role, and determine the target user input text corresponding to the current dialogue turn from the user input text library; Input the target user input text and the conversation data of the current multi-round conversation to be generated into the role-playing model, obtain the user-side conversation data output by the role-playing model, and update the user-side conversation data into the conversation data; Inputting the target role input text and the dialogue data into a role-playing model, obtaining dialogue data on the role playing the target role output by the role-playing model, and updating the dialogue data on the role side into the dialogue data; Among them, the user input text library includes user input texts corresponding to multiple human speaking modes, and the user input text corresponding to any of the human speaking modes is used to prompt the role-playing model to output a user-side dialogue that plays the human speaking mode; the role-playing model is a pre-trained large language model.

[0006] According to a method for generating dialogue data provided by the present invention, the step of determining the target user input text corresponding to the current dialogue turn from the user input text library includes: Determine a target probability tree corresponding to the user input text library; Based on the target probability tree, determining the target user input text from the user input text library; Among them, the target probability tree includes multiple leaf nodes, and the selection probabilities of the multiple leaf nodes include the selection probabilities of each user input text in the user input text library; the sum of the selection probabilities of all child nodes of any parent node except the leaf nodes in the target probability tree is equal to the selection probability of the parent node.

[0007] According to a method for generating dialog data provided by the present invention, the step of determining the target user input text from the user input text library based on the target probability tree comprises: Determine a probability variation set corresponding to the current dialogue turn; the probability variation set includes the probability variation of each node in the target probability tree; Based on the probability variation set, updating the selection probability of each node in the target probability tree; Based on the updated target probability tree, the target user input text is determined from the user input text library.

[0008] According to a method for generating dialog data provided by the present invention, the updating of the selection probability of each node in the target probability tree based on the probability variation set includes: Based on the probability change amount of each second-layer node of the target probability tree in the probability change amount set, updating the selection probability of each second-layer node in the target probability tree; the second-layer node is a child node of the root node of the target probability tree; The second layer node with child nodes is used as the target layer node; For any of the target layer nodes, based on the updated selection probability of the target layer node, the selection probability of each next layer node of the target layer node in the target probability tree is updated; based on the probability change amount of each next layer node of the target layer node in the probability change amount set, the selection probability of each next layer node of the target layer node in the target probability tree is updated; any of the next layer nodes is a child node of the target layer node; The next layer node with child nodes is taken as the target layer node, and the selection probability of each next layer node of the target layer node in the target probability tree is updated based on the updated selection probability of the target layer node for any target layer node, and the selection probability of each next layer node of the target layer node in the target probability tree is updated based on the probability change amount of each next layer node of the target layer node in the probability change amount set.

[0009] According to a method for generating dialogue data provided by the present invention, the step of determining a probability variation set corresponding to the current dialogue turn includes: Determine a value range set corresponding to the current dialogue turn; Based on the value range set, determining the probability variation set; The value range set includes the value range of the probability variation of each node in the target probability tree; and the value range set includes the value range determined based on the number of rounds of the current dialogue round.

[0010] According to a method for generating dialog data provided by the present invention, the step of determining a target probability tree corresponding to the user input text library comprises: Acquire multiple probability trees corresponding to the user input text library; The target probability tree is determined from the plurality of probability trees.

[0011] According to a method for generating dialogue data provided by the present invention, the target user input text and the dialogue data of the current multi-round dialogue to be generated are input into a role-playing model to obtain the user-side dialogue data output by the role-playing model, including: Determine a target topic from a topic library corresponding to the target role; Inputting the target user input text, the target topic and the dialogue data into a role-playing model to obtain user-side dialogue data output by the role-playing model; The subject library corresponding to the target role includes a plurality of conversational subjects related to the target role.

[0012] According to a method for generating dialogue data provided by the present invention, the step of determining a target role input text corresponding to a target role comprises: Determining the target character input text from a character input text library; The role input text library includes role input texts corresponding to a plurality of roles, and the role input text corresponding to any of the roles is used to prompt the role playing model to output a role-side dialogue for playing the role.

[0013] According to a method for generating dialogue data provided by the present invention, the input text of the target role and the dialogue data are input into a role-playing model to obtain dialogue data of a character playing the target role output by the role-playing model, including: Retrieving knowledge information related to the target character input text from a knowledge base corresponding to the target character; The target role input text, the knowledge information and the dialogue data are input into a role-playing model, and dialogue data on the role-playing side of the target role output by the role-playing model is obtained.

[0014] The present invention also provides a conversation data generating device, comprising: A text determination module is used to determine the target role input text corresponding to the target role, and determine the target user input text corresponding to the current dialogue turn from the user input text library; A first output module, configured to input the target user input text and the conversation data of the current multi-round conversation to be generated into the role-playing model, obtain the user-side conversation data output by the role-playing model, and update the user-side conversation data into the conversation data; A second output module, for inputting the target role input text and the dialogue data into a role-playing model, obtaining dialogue data on the role side of the target role output by the role-playing model, and updating the dialogue data on the role side into the dialogue data; Among them, the user input text library includes user input texts corresponding to multiple human speaking modes, and the user input text corresponding to any of the human speaking modes is used to prompt the role-playing model to output a user-side dialogue that plays the human speaking mode; the role-playing model is a pre-trained large language model.

[0015] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the above-mentioned methods for generating conversation data is implemented.

[0016] 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, the method for generating conversation data as described above is implemented.

[0017] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method for generating conversation data as described above is implemented.

[0018] The dialogue data generation method, device, equipment, storage medium and program product provided by the present invention determine the target role input text corresponding to the target role, and determine the target user input text corresponding to the current dialogue round from the user input text library, and the user input text library includes user input texts corresponding to multiple human speech modes, and the user input text corresponding to any human speech mode is used to prompt the role-playing model to output the user-side dialogue playing the human speech mode, so that in the current multi-round dialogue to be generated, user-side dialogue data of multiple different human speech modes can be generated, and finally the diversity and richness of the dialogue data are improved. Moreover, since the user input text library is written in advance, the user input text with better effect can be set in advance, so that the role-playing model can understand the human user's speech mode more accurately, thereby improving the generation accuracy of the user-side dialogue data, and the user-side dialogue data will be updated to the dialogue data, thereby also improving the generation accuracy of the role-side dialogue data; the target user input text and the dialogue data of the current multi-round dialogue to be generated are input into the role-playing model to obtain the role-playing model. The user-side dialogue data output by the model is obtained, and the user-side dialogue data is updated to the dialogue data, the target role input text and the dialogue data are input to the role-playing model, and the role-playing model outputs the role-playing model. The dialogue data on the role-playing side playing the target role is obtained, and the role-playing side dialogue data is updated to the dialogue data, so that the generation of each round of user-side dialogue needs to splice the historical dialogue data into the target user input text and the target role input text, so that the role-playing model can complete a reasonable reply based on the dialogue history, that is, improve the generation accuracy of the dialogue data; at the same time, through the above method, only one role-playing model is needed to complete the generation of user-side dialogue and role-side dialogue, without the need to separately build a human playing model, that is, without the training cost of the human playing model, and the role-playing model is a pre-trained large language model, thereby reducing the generation cost of dialogue data and improving the generation efficiency of dialogue data; at the same time, through the above method, dialogue data can be automatically generated, without the need to generate dialogue data through manual annotation or chat data of real users, thereby improving the generation efficiency of dialogue data and reducing the generation cost of dialogue data. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0020] Figure 1 It is a flow chart of the method for generating dialogue data provided by the present invention.

[0021] Figure 2 It is a schematic diagram of the division of human speech patterns provided by the present invention.

[0022] Figure 3 This is one of the structural schematic diagrams of the probability tree provided by the present invention.

[0023] Figure 4 This is the second structural schematic diagram of the probability tree provided by the present invention.

[0024] Figure 5 This is the third structural schematic diagram of the probability tree provided by the present invention.

[0025] Figure 6 This is the fourth structural schematic diagram of the probability tree provided by the present invention.

[0026] Figure 7 It is a structural schematic diagram of the conversation data generating device provided by the present invention.

[0027] Figure 8 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0028] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0029] With the continuous development of artificial intelligence technology, the application of large language models is becoming more and more extensive. Among them, large language models can be applied to the field of role-playing, that is, by inputting prompts, the large language model is required to play a specified character, which is usually a variety of IP characters, such as Sun Wukong, Zhu Bajie, etc.; or a virtual character with certain characteristics created by the user, such as a history teacher, a travel assistant, etc. In the field of role-playing, the base large model cannot complete the role-playing task well, for example, there may be phenomena such as inconsistent character style and overly written chats; therefore, it is necessary to construct dialogue data between humans and characters, that is, to construct training data specifically for role-playing tasks, in order to fine-tune the base large model in the field.

[0030] Currently, conversation data can be generated by manually annotating candidate replies or obtaining chat data between real users and large language models. However, the manual annotation method requires high capabilities of the annotators and has low annotation efficiency, resulting in high costs for generating conversation data and low efficiency for generating conversation data. At the same time, there may be a large amount of useless data in the chat data of real users that is not suitable for large language model training. The screening and processing of useless data requires a lot of time and effort, resulting in high costs for generating conversation data and low efficiency for generating conversation data.

[0031] Even if a single prompt is designed to require the human role-playing model to simulate the conversation data of human users, there are still many defects. Specifically, by designing a prompt, the human role-playing model is prompted to play the role of a human user and have a conversation with another role-playing model. However, the speaking patterns of human users in role-playing tasks are diverse and varied. Even if various speaking styles and samples are added to the single prompt, it is difficult for the human role-playing model to accurately understand the speaking patterns of human users in role-playing tasks. It is also necessary to fine-tune the base large language model to obtain the human role-playing model, that is, by obtaining a large amount of chat data between real users and role-playing models, on the basis of the base large language model, fine-tune and train an exclusive large model that can play the role of human users; although the model can be fine-tuned through massive data so that the human role-playing model can accurately understand the task, this method requires a large amount of real dialogue data, and a large amount of data integration and processing work including data cleaning, and it is necessary to manually allocate the proportion of training data based on experience, and continuously optimize the iterative model. The whole process is time-consuming and costly, resulting in a high cost of generating dialogue data and a low efficiency of generating dialogue data. Due to the difficulty in obtaining data and uneven data quality, the effect of model training is also difficult to guarantee, resulting in reduced accuracy in dialogue generation of the human role-playing model.

[0032] In view of the above problems, the present invention proposes the following embodiments. Figure 1-Figure 6 The conversation data generating method of the present invention is described.

[0033] Figure 1 is a flow chart of the method for generating dialogue data provided by the present invention, such as Figure 1 As shown, the conversation data generating method includes the following steps 110, 120 and 130.

[0034] Step 110, determining the target role input text corresponding to the target role, and determining the target user input text corresponding to the current dialogue turn from the user input text library.

[0035] Here, the target role is the role that the role-playing model needs to play. Further, in the current multi-round dialogue to be generated, there is only one target role, that is, a multi-round dialogue is a dialogue between a human user and a role.

[0036] In one embodiment, the target role is randomly selected from a plurality of roles, so that no user operation is required, thereby reducing the cost of generating the dialogue data and improving the efficiency of generating the dialogue data.

[0037] In another embodiment, the target role is selected by the user, for example, multiple roles are provided for the user to choose, or the user directly inputs input text representing the target role.

[0038] Here, the target role input text is used to prompt the role playing model to output the role side dialogue data playing the target role. In other words, the target role input text is the role prompt.

[0039] The user input text library includes user input texts corresponding to a plurality of human speech modes, and the user input text corresponding to any of the human speech modes is used to prompt the role-playing model to output a user-side dialogue playing the human speech mode. The user input text is used to prompt the role-playing model to output a user-side dialogue playing the human user.

[0040] It should be understood that the user input text library includes user input texts corresponding to multiple human speech modes, and the target user input text corresponding to the current dialogue round is determined from the user input text library, so as to instruct the role-playing model to output the user-side dialogue data of the human speech mode corresponding to the target user input text in the current dialogue round based on the target user input text, and then in the current multiple dialogue rounds to be generated, user-side dialogue data of multiple different human speech modes can be generated, and finally the diversity and richness of the dialogue data are improved. And because the user input text library is written in advance, the user input text with better effect can be set in advance, avoiding the user from writing irregular and non-standard user input text, so that the role-playing model can accurately understand the human user's speech mode, thereby improving the generation accuracy of the user-side dialogue data.

[0041] It should be noted that the current conversation round includes user-side conversations and role-side conversations. Here, only the steps for generating conversation data for one conversation round are described. The method for generating conversation data for each conversation round in the multiple conversation rounds to be generated is the same.

[0042] In one embodiment, the target user input text corresponding to the current dialogue turn is randomly determined from the user input text library, thereby eliminating the need for user operation, thereby reducing the generation cost of dialogue data and improving the generation efficiency of dialogue data.

[0043] In another embodiment, the user selects the target user input text corresponding to the current dialogue turn from the user input text library.

[0044] Step 120, input the target user input text and the conversation data of the current multi-round conversation to be generated into the role-playing model, obtain the user-side conversation data output by the role-playing model, and update the user-side conversation data into the conversation data.

[0045] Here, the multi-round dialogue to be generated currently is the multi-round dialogue for which the dialogue data is to be generated currently. The dialogue data for the multi-round dialogue to be generated currently includes 0, 1 or more dialogues. The dialogue data can be regarded as the historical dialogue data for the multi-round dialogue to be generated currently, so that the generation of each round of user-side dialogue needs to splice the historical dialogue data into the target user input text, so that the role-playing model can complete a reasonable response based on the dialogue history, that is, improve the generation accuracy of the user-side dialogue data.

[0046] Among them, the role-playing model is a pre-trained large language model.

[0047] Furthermore, in order to improve the effect of generating dialogue data of the role-playing model, the pre-trained large language model can be fine-tuned to be more suitable for the role-playing task, thereby improving the generation accuracy of dialogue data applied to the role-playing task. Exemplarily, LoRA is fine-tuned on the basis of the base large language model through manually annotated role-playing data (dialogue data) to obtain the role-playing model.

[0048] Here, the user-side dialogue data is the user-side dialogue of the current dialogue round, and the user-side dialogue data conforms to the human speech pattern corresponding to the target user input text, thereby realizing a dialogue simulating the corresponding speech pattern of the human user.

[0049] Specifically, the user-side conversation data is updated to the conversation data of the current multi-round conversation to be generated, that is, the user-side conversation data is saved, so that the historical conversation data can be subsequently spliced ​​into the target user input text or the target character input text, and the generated conversation data can be obtained.

[0050] Step 130, input the target role input text and the dialogue data into the role-playing model, obtain the role-playing model output dialogue data of the role playing the target role, and update the role-playing data into the dialogue data.

[0051] This conversation data can be considered as the historical conversation data of the current multiple rounds of conversations to be generated. Therefore, the generation of each round of user-side conversation requires splicing the historical conversation data into the target character input text, so that the role-playing model can complete reasonable responses based on the conversation history, thereby improving the generation accuracy of the character-side conversation data.

[0052] Here, the character-side dialogue data is the character-side dialogue of the current dialogue round.

[0053] Specifically, the character-side dialogue data is updated to the dialogue data of the current multi-round dialogue to be generated, that is, the character-side dialogue data is saved, so that the historical dialogue data can be subsequently spliced ​​into the target user input text or the target character input text, and the generated dialogue data can be obtained.

[0054] It should be noted that, when the current dialogue round is the last dialogue round, the dialogue data updated in the current dialogue round is the final generated dialogue data. The number of rounds of the current multi-round dialogue to be generated can be preset as a fixed value, or can be dynamically updated, or set by the user in real time, which is not specifically limited here.

[0055] In the current dialogue round, the user-side dialogue can come first and the character-side dialogue can come later, for example, the human user asks questions first and the character answers later; or the user-side dialogue can come later and the character-side dialogue can come first.

[0056] It should be understood that the dialogue data generated by the embodiment of the present invention can be further used as training data to train the model applied to the role-playing task, and can also be used as test data to test the performance of the model applied to the role-playing task. Of course, the generated dialogue data can also be applied to other aspects, which will not be described one by one here.

[0057] The dialogue data generation method provided by the embodiment of the present invention determines the target role input text corresponding to the target role, and determines the target user input text corresponding to the current dialogue round from the user input text library, and the user input text library includes user input texts corresponding to multiple human speech modes, and the user input text corresponding to any human speech mode is used to prompt the role-playing model to output the user-side dialogue playing the human speech mode, so that in the current multi-round dialogue to be generated, user-side dialogue data of multiple different human speech modes can be generated, and finally the diversity and richness of the dialogue data are improved. Moreover, since the user input text library is written in advance, the user input text with better effect can be set in advance, so that the role-playing model can understand the human user's speech mode more accurately, thereby improving the generation accuracy of the user-side dialogue data, and the user-side dialogue data will be updated to the dialogue data, thereby also improving the generation accuracy of the role-side dialogue data; the target user input text and the dialogue data of the current multi-round dialogue to be generated are input into the role-playing model, and the user-side dialogue data output by the role-playing model is obtained. The target role input text and the dialogue data are input into the role-playing model to obtain the role-playing data of the target role output by the role-playing model, and the role-playing data is updated into the dialogue data, so that each round of user-side dialogue generation requires splicing the historical dialogue data into the target user input text and the target role input text, so that the role-playing model can complete a reasonable reply based on the dialogue history, that is, improve the generation accuracy of the dialogue data; at the same time, through the above method, only one role-playing model is needed to complete the generation of user-side dialogue and role-side dialogue, without the need to construct a human role-playing model separately, that is, without the need to train the human role-playing model, and the role-playing model is a pre-trained large language model, thereby reducing the generation cost of dialogue data and improving the generation efficiency of dialogue data; at the same time, through the above method, dialogue data can be automatically generated without the need to generate dialogue data through manual annotation or chat data of real users, thereby improving the generation efficiency of dialogue data and reducing the generation cost of dialogue data.

[0058] Based on any of the above embodiments, in the method, in the above step 110, determining the target user input text corresponding to the current dialogue turn from the user input text library includes: step 111 and step 112.

[0059] Step 111: determine a target probability tree corresponding to the user input text library.

[0060] Among them, the target probability tree includes multiple leaf nodes, and the selection probabilities of the multiple leaf nodes include the selection probabilities of each user input text in the user input text library; the sum of the selection probabilities of all child nodes of any parent node except the leaf nodes in the target probability tree is equal to the selection probability of the parent node.

[0061] Here, the leaf node has no child nodes, that is, the terminal node of the target probability tree. Based on this, the selection probability of a leaf node corresponds to the selection probability of a user input text.

[0062] Here, the selection probability is a probability value corresponding to a node, and the selection probability is used to indicate the probability of selecting the corresponding user input text.

[0063] Step 112: Determine the target user input text from the user input text library based on the target probability tree.

[0064] Specifically, starting from the root node of the target probability tree, determine the target node with the highest selection probability from the child nodes of the root node; if the target node has child nodes, determine the next node with the highest selection probability from the child nodes of the target node; if the next node has child nodes, determine the next node as the target node, and return to the step of determining the next node with the highest selection probability from the child nodes of the target node until the next node has no child nodes; if the next node has no child nodes, determine the target user input text corresponding to the next node from the user input text library.

[0065] The method for generating dialogue data provided by the embodiment of the present invention determines a target probability tree corresponding to a user input text library, and determines a target user input text from the user input text library based on the target probability tree, thereby automatically determining a target user input text corresponding to a current dialogue turn from the user input text library using a probability tree structure, thereby reducing the cost of generating dialogue data and improving the efficiency of generating dialogue data without requiring user operation.

[0066] Based on any of the above embodiments, considering that a static target probability tree will make the generation of dialogue data of multiple rounds of dialogue appear rigid, that is, the dialogue data is not diverse and rich enough; based on this, in the method, the above step 112 includes step 1121, step 1122 and step 1123.

[0067] Step 1121, determining a probability variation set corresponding to the current dialogue turn.

[0068] The probability variation set includes the probability variation of each node in the target probability tree. The probability variation can be a negative value or a positive value. The sum of the probability variations of each child node of the same parent node in the probability variation set should be 0, thereby ensuring that the sum of the selection probabilities of all child nodes of the same parent node after the update is equal to the selection probability of the updated parent node.

[0069] It should be noted that in the same multi-round dialogue, the probability change sets corresponding to different dialogue rounds may be different, thereby improving the generation diversity and richness of dialogue data of the multi-round dialogue.

[0070] Step 1122: Based on the probability variation set, update the selection probability of each node in the target probability tree.

[0071] Specifically, for the selection probability of any node in the target probability tree, the selection probability of the node is added to the probability change of the node to obtain the updated selection probability of the node.

[0072] Step 1123: Determine the target user input text from the user input text library based on the updated target probability tree.

[0073] Specifically, starting from the root node of the updated target probability tree, determine the target node with the highest selection probability from the child nodes of the root node; if the target node has child nodes, determine the next node with the highest selection probability from the child nodes of the target node; if the next node has child nodes, determine the next node as the target node, and return to the step of determining the next node with the highest selection probability from the child nodes of the target node until the next node has no child nodes; if the next node has no child nodes, determine the target user input text corresponding to the next node from the user input text library.

[0074] The method for generating dialogue data provided by the embodiment of the present invention determines a probability variation set corresponding to the current dialogue round, and the probability variation set includes the probability variation of each node in the target probability tree, so as to update the selection probability of each node in the target probability tree based on the probability variation set, and determine the target user input text from the user input text library based on the updated target probability tree, thereby using a dynamic probability tree structure, that is, the selection probability of each node of the target probability tree is dynamically changed, thereby improving the diversity of the target user input text, ensuring that user-side dialogue data of different human speaking modes can be generated, thereby improving the diversity and richness of the user-side dialogue data, and finally improving the generation diversity and generation richness of dialogue data of multiple rounds of dialogue.

[0075] Based on any of the above embodiments, in the method, the above step 1122 includes: step 11221, step 11222, step 11223 and step 11224.

[0076] Step 11221: based on the probability change amount of each second-layer node of the target probability tree in the probability change amount set, update the selection probability of each second-layer node in the target probability tree.

[0077] The second layer node is a child node of the root node of the target probability tree. Furthermore, the selection probability of the root node (first layer node) is 1.

[0078] Specifically, for the selection probability of any second-layer node, the selection probability of the second-layer node is added to the probability change of the second-layer node to obtain the updated selection probability of the second-layer node.

[0079] Step 11222, taking the second layer node with child nodes as the target layer node.

[0080] It should be noted that if the second-layer node has child nodes, the selection probability of the child nodes of the second-layer node also needs to be dynamically updated; for ease of explanation, it is taken as the target layer node.

[0081] Step 11223, for any of the target layer nodes, based on the updated selection probability of the target layer node, updates the selection probability of each next layer node of the target layer node in the target probability tree; based on the probability change of each next layer node of the target layer node in the probability change set, updates the selection probability of each next layer node of the target layer node in the target probability tree.

[0082] Among them, any of the next-layer nodes is a child node of the target layer node.

[0083] Considering that the sum of the selection probabilities of all child nodes of any parent node except the leaf node in the target probability tree is equal to the selection probability of the parent node, based on this, after the selection probability of the target layer node (parent node) changes, the selection probability of each child node of the target layer node should also be adjusted accordingly to ensure that the sum of the selection probabilities of all child nodes of the updated target layer node is equal to the selection probability of the updated target layer node. Specifically, according to the original probability distribution ratio of each next layer node of the target layer node in the target probability tree before the update, based on the selection probability of the updated target layer node, the selection probability of each next layer node of the target layer node in the target probability tree is updated; for example, each next layer node of the target layer node in the target probability tree before the update includes a first node and a second node, the selection probability of the first node in the target probability tree before the update is 0.2, the selection probability of the second node in the target probability tree before the update is 0.1, and the selection probability of the updated target layer node is 0.33. Based on this, the selection probability of the first node after the update is 0.22, and the selection probability of the second node after the update is 0.11.

[0084] Specifically, for the selection probability of any next-layer node, the updated selection probability of the next-layer node is added to the probability change of the next-layer node to obtain the updated selection probability of the next-layer node.

[0085] Exemplarily, each next-layer node of the target layer node in the target probability tree before updating includes a first node and a second node, the selection probability of the first node in the target probability tree before updating is 0.2, the selection probability of the second node in the target probability tree before updating is 0.1, the selection probability of the target layer node after updating is 0.33, the probability change of the first node is 0.01, and the probability change of the second node is -0.01. Based on this, the selection probability of the first node after final update is 0.23, and the selection probability of the second node after final update is 0.1.

[0086] Step 11224, takes the next layer node with child nodes as the target layer node, and returns the step of updating the selection probability of each next layer node of the target layer node in the target probability tree based on the updated selection probability of the target layer node for any target layer node, and updating the selection probability of each next layer node of the target layer node in the target probability tree based on the probability change amount of each next layer node of the target layer node in the probability change amount set.

[0087] It should be understood that the selection probability of each layer of nodes in the target probability tree (such as the third layer nodes, which are child nodes of the second layer nodes) is updated in the same way as the second layer nodes. Based on this, for ease of explanation, the next layer of nodes with child nodes are also used as target layer nodes.

[0088] The conversation data generation method provided by the embodiment of the present invention, through the above-mentioned method, starts from the root node of the target probability tree, and updates the selection probability of each layer of nodes in turn, thereby improving the update accuracy of the target probability tree, and then ensuring the accuracy of determining the target user input text, thereby improving the generation accuracy of user-side conversation data, and ultimately improving the generation accuracy of conversation data.

[0089] Based on any of the above embodiments, in the method, the above step 1121 includes: step 11211 and step 11212.

[0090] Step 11211, determine the value range set corresponding to the current dialogue turn.

[0091] The value range set includes the value range of the probability variation of each node in the target probability tree; and the value range set includes the value range determined based on the number of rounds of the current dialogue round.

[0092] Since the value range set includes a value range determined based on the number of rounds of the current dialogue round, in the same multi-round dialogue, the value range sets corresponding to different dialogue rounds may be different, and thus the probability change sets corresponding to different dialogue rounds may also be different, thereby improving the generation diversity and richness of the dialogue data of the multi-round dialogue.

[0093] Step 11212, based on the value range set, determine the probability variation set.

[0094] Specifically, for any node in the target probability tree, the probability variation of the node is randomly determined from the value range of the probability variation of the node, that is, the probability variation of the node is ensured to be within the value range of the probability variation of the node.

[0095] The conversation data generation method provided by the embodiment of the present invention can, through the above-mentioned method, have different value range sets corresponding to different conversation rounds, and thus different probability change sets corresponding to different conversation rounds can also be different, thereby improving the diversity of the target user input text, ensuring that user-side conversation data of different human speaking modes can be generated, thereby improving the diversity and richness of the user-side conversation data, and ultimately improving the generation diversity and richness of conversation data of multiple rounds of conversations.

[0096] Based on any of the above embodiments, in the method, the above step 111 includes step 1111 and step 1112.

[0097] Step 1111, obtaining multiple probability trees corresponding to the user input text library.

[0098] Considering the analysis of real user conversation data, the conversation types can be divided into several categories, such as the knowledge question type and the number of conversation topics, and then the probability tree corresponding to each category needs to be constructed. The tree structure of multiple probability trees is the same, but the selection probability of their nodes is different.

[0099] Here, any probability tree includes multiple leaf nodes, and the selection probabilities of the multiple leaf nodes include the selection probabilities of each user input text in the user input text library; the sum of the selection probabilities of all child nodes of any parent node except the leaf nodes in the probability tree is equal to the selection probability of the parent node.

[0100] Step 1112: Determine the target probability tree from the multiple probability trees.

[0101] In one embodiment, a target probability tree is randomly determined from a plurality of probability trees, thereby eliminating the need for user operation, thereby reducing the cost of generating the dialog data and improving the efficiency of generating the dialog data.

[0102] In another embodiment, a target probability tree is selected by a user from a plurality of probability trees.

[0103] The dialogue data generation method provided by the embodiment of the present invention obtains multiple probability trees corresponding to the user input text library, and determines the target probability tree from the multiple probability trees, thereby improving the diversity of the target user input text, ensuring that user-side dialogue data of different human speaking modes can be generated, thereby improving the diversity and richness of the user-side dialogue data, and ultimately improving the generation diversity and richness of dialogue data of multiple rounds of dialogues.

[0104] To facilitate understanding of the above embodiments, a specific embodiment is described herein.

[0105] First, if Figure 2 As shown in , after analyzing the real user conversation data, in the role-playing task, the user's speech type can be classified into knowledge questions and small talk according to whether it is a knowledge question, and knowledge questions can be divided into explicit questions and implicit mentions, and users can also interact deeply based on the historical conversations of multiple rounds of conversations; based on this, the user's speech type is divided into three types: topic switching, historical conversations, and meaningless. Topic switching is divided into explicit (explicit temperature) and implicit (implicit mentions). Historical conversations are divided into own opinions and non-own opinions. Own opinions are divided into explicit, implicit, and small talk, and non-own opinions are divided into explicit, implicit, and small talk. In addition, as Figure 2 As shown, the correspondingly constructed user input text library includes user input texts corresponding to 9 human speaking modes.

[0106] Secondly, actual tests have found that if a single prompt is designed according to the traditional method, even if all types of user speech are included, the large language model can only output one type of explicit question. Therefore, in order to solve this problem, a user input text library is designed to include a variety of human speech patterns, and a probability tree structure is designed to query the target user input text selected for the current dialogue turn according to the probability and progressively follow the tree structure.

[0107] Afterwards, since the speech pattern of each real user is different, four human user speech pattern categories are obtained by analyzing the real user conversation data and mainly dividing it according to the type of knowledge questions and the number of topics. Among them, the four human user speech pattern categories include the regular pattern category, which is characterized by the data ratio of explicit questions to implicit mentions of about 2:1; the four human user speech pattern categories also include the multi-explicit pattern, which is characterized by the existence of a large number of explicit questions and a large number of topics; the four human user speech pattern categories also include the less explicit pattern, which is specifically characterized by a small number of explicit questions, a large number of implicit mentions and small chats, and a small number of topics; the four human user speech pattern categories also include the single topic pattern, which is specifically characterized by the whole group of conversations revolving around only one topic. In addition, there are also a large number of meaningless conversations among actual users, but since the purpose of this case is to provide high-quality training data, a large number of meaningless conversation patterns are not simulated, so four probability trees are designed to correspond to the four human speech pattern categories, and the selection probability of meaningless nodes in the four probability trees is 0.

[0108] like Figure 3 As shown, Figure 3 The probability tree in is the probability tree corresponding to the regular pattern category. Figure 3 The probability tree structure in Figure 2 The structure in is exactly the same, that is, each node corresponds one to one. The root node of the probability tree corresponds to the user's speech type, so the selection probability of the root node is 1, which means that the total probability is 1; the leftmost child node of the root node 0.28 represents a 0.28 probability of choosing to switch topics each time; the middle child node of the root node 0.72 represents a 0.72 probability of choosing to target historical conversations each time; the rightmost child node of the root node indicates that meaningless expressions will not be selected; the leftmost child node of the root node 0.28 has two leaf nodes, of which the leaf node 0.18 represents explicit questions, that is, choose to use explicit questions after switching to a new topic, and the leaf node 0.1 represents implicit mentions, that is, choose to use implicit mentions after switching to a new topic, and so on, the meaning and selection probability of the remaining nodes can be obtained. The selection probability allocation strategy here is based on the conversation data of real users.

[0109] like Figure 4 As shown, Figure 4The probability tree in is the probability tree corresponding to the multi-explicit pattern category. Figure 4 The probability tree structure in Figure 2 The structure in is exactly the same, that is, each node corresponds one to one. The root node of the probability tree corresponds to the user's speech type, so the selection probability of the root node is 1, which means that the total probability is 1; the leftmost child node of the root node 0.43 represents that there is a 0.43 probability of choosing to switch topics each time; the middle child node of the root node 0.57 represents that there is a 0.57 probability of choosing to target historical conversations each time; the rightmost child node of the root node indicates that meaningless expressions will not be selected; the leftmost child node of the root node 0.43 has two leaf nodes, of which the leaf node 0.4 represents explicit questions, that is, choose to use explicit questions after switching to a new topic, and the leaf node 0.03 represents implicit mentions, that is, choose to use implicit mentions after switching to a new topic, and so on, the meaning and selection probability of the remaining nodes can be obtained. The distribution strategy of the selection probability here is based on the conversation data of real users.

[0110] like Figure 5 As shown, Figure 5 The probability tree in is the probability tree corresponding to the less explicit pattern category. Figure 5 The probability tree structure in Figure 2 The structure in is exactly the same, that is, each node corresponds to each other. The probability tree structure can refer to the above description and will not be repeated here.

[0111] like Figure 6 As shown, Figure 6 The probability tree in is the probability tree corresponding to a single topic pattern category. Figure 6 The probability tree structure in Figure 2 The structure in is exactly the same, that is, each node corresponds to each other. The probability tree structure can refer to the above description and will not be repeated here.

[0112] Afterwards, considering that the static probability tree above would make the generation of dialogue data of multi-round dialogues appear rigid, that is, the diversity and richness of dialogue data are not enough; based on this, in order to improve the diversity and richness of dialogue data generation, a dynamic probability tree is designed based on the above probability tree, that is, the probability of each node of the probability tree changes dynamically. Different dynamic probability change rules are designed on each layer of the probability tree. According to the probability tree structure, the probability change set can be expressed as The matrix of .

[0113] Among them, the The matrix is ​​as follows: ; In the formula, represents the set of probability variables; the non-zero parameters in the first row of the matrix , , , representing the three second-level nodes of the probability tree, namely, corresponding to topic switching, historical dialogue, and meaningless; the non-zero parameters in the second row of the matrix 、 、 , , respectively represent the four third-level nodes of the probability tree, corresponding to the explicit and implicit, own and non-own views in the topic switching; the non-zero parameters in the third row of the matrix 、 、 , , , , representing the six fourth-level nodes of the probability tree, corresponding to explicit, implicit and idle chat in one’s own opinion, and explicit, implicit and idle chat in other people’s opinion.

[0114] There are actually 4 probability trees, so there are also 4 matrices corresponding to the probability variation set. The following is a detailed description of the matrix parameters under the 4 probability trees.

[0115] For the general mode category, , that is, it fluctuates randomly within the range of -0.1 to 0.1; similarly, , , This design is to ensure that the total probability after probability fluctuation is 1. Since the selection probability of the second-layer nodes of the probability tree has been redistributed after the random change of probability, the selection probability of the third-layer nodes also needs to be adjusted accordingly. The selection probability of each third-layer node is redistributed according to the probability distribution ratio of the original probability tree. Then, the probability change of the third-layer nodes is determined. , , , Similarly, the fourth-layer nodes also need to update the basic selection probability based on the selection probability updated by the third-layer nodes, and then perform dynamic probability fluctuations. ,in, Represents the number of rounds in the current multi-round dialogue. , , , , .

[0116] Similarly, for multiple display mode categories, the matrix of the probability variation set is designed as follows. , , ; , , , ; , , , , , .

[0117] Similarly, for the seldom displayed pattern category, the matrix of the probability variation set is designed as follows. , , ; , , , ; , , , , , .

[0118] Similarly, for a single topic pattern category, the matrix of the probability variation set is designed as follows. , , ; , , , ; , , , , , .

[0119] Based on any of the above embodiments, in the method, in the above step 120, the target user input text and the conversation data of the current multi-round conversation to be generated are input into the role-playing model to obtain the user-side conversation data output by the role-playing model, including: step 121 and step 122.

[0120] Step 121, determining a target theme from a theme library corresponding to the target role.

[0121] The subject library corresponding to the target role includes a plurality of conversational subjects related to the target role.

[0122] In one embodiment, the subject library corresponding to the target role can be preset. In another embodiment, the target role input text and the subject generation requirement text are input into a pre-trained large language model to obtain the subject library corresponding to the target role. In another embodiment, the subject library corresponding to the target role can be obtained by the user inputting multiple subjects.

[0123] Here, the target topic is used to prompt the role-playing model to output a user-side dialogue that plays the target topic, that is, to prompt the role-playing model to talk about topics that can be discussed when simulating a human user.

[0124] In one embodiment, a target topic is randomly determined from a topic library corresponding to the target role, thereby eliminating the need for user operation, thereby reducing the cost of generating dialogue data and improving the efficiency of generating dialogue data. For example, through a topic selection module, a topic is randomly selected from the topic library as a candidate topic for generating a multi-round dialogue.

[0125] In another embodiment, the user selects the target theme from a theme library corresponding to the target role.

[0126] In order to improve the quality of generating dialogue data of multi-round dialogues, in practical applications, the number of target topics can be multiple, for example, 2.

[0127] Step 122, input the target user input text, the target topic and the dialogue data into the role-playing model to obtain the user-side dialogue data output by the role-playing model.

[0128] The conversation data generation method provided by the embodiment of the present invention determines the target topic from the topic library corresponding to the target role, and the topic library corresponding to the target role includes multiple topics related to the target role that can be discussed, so that the target user input text, the target topic and the conversation data are input into the role-playing model to obtain the user-side conversation data output by the role-playing model, and then the user-side conversation data of multiple topics can be generated, and finally the generation diversity and generation richness of the conversation data are improved, that is, the generation quality of the conversation data is improved; and through the above method, the chat direction of the role-playing model can be controllably guided to improve the generation quality of the conversation data.

[0129] Based on any of the above embodiments, in the method, in the above step 110, determining the target role input text corresponding to the target role includes: determining the target role input text from a role input text library.

[0130] The role input text library includes role input texts corresponding to multiple roles, and the role input text corresponding to any of the roles is used to prompt the role-playing model to output the role-side dialogue of the role. That is, the role input text library is pre-built, and the role input text library includes roles that need to be played by the role-playing model, which can be various IP roles or non-IP roles. Based on this, the writing of the corresponding role input text needs to be completed in advance.

[0131] In one embodiment, the target character input text is randomly determined from the character input text library, so that no user operation is required, thereby reducing the cost of generating dialogue data and improving the efficiency of generating dialogue data. Further, the target character input text is sequentially determined from the character input text library, so that the dialogue data between the human user and all the characters in the character input text library can be obtained.

[0132] In another embodiment, the user selects the target role input text from the role input text library, for example, providing multiple roles for the user to select.

[0133] The dialogue data generation method provided by the embodiment of the present invention determines the target role input text from the role input text library, and the role input text library includes role input texts corresponding to multiple roles. The role input text corresponding to any role is used to prompt the role-playing model to output the role-playing role-side dialogue. Since the role input text library is written in advance, the role input text with better effect can be set in advance to avoid irregular and non-standard user input text written by the user, so that the role-playing model can accurately understand the role, thereby improving the generation accuracy of the role-side dialogue data. The role-side dialogue data is also used as historical dialogue data, so it can also improve the generation accuracy of the user-side dialogue data, thereby improving the generation quality of dialogue data of multiple rounds of dialogues.

[0134] Based on any of the above embodiments, in the method, in the above step 130, the target character input text and the dialogue data are input into the role-playing model to obtain the character-side dialogue data of the target character output by the role-playing model, including: step 131 and step 132.

[0135] Step 131: retrieve knowledge information related to the input text of the target character from the knowledge base corresponding to the target character.

[0136] Considering that in role-playing tasks, the role-playing model needs to conform to the personality required in the input text of the target role, so it usually requires more colloquial expressions. People often ask the role-playing model knowledge questions that belong to the role played by the role-playing model. Therefore, the role-playing model needs to have the ability to combine knowledge to respond, so as to solve the problem of large model hallucination. Based on this, it is necessary to introduce RAG (Retrieval-Augmented Generation). By building a knowledge base dedicated to the role played by the role-playing model, the role-playing model can combine knowledge to complete reasonable responses, reduce the occurrence of large model hallucination, and thus improve the accuracy of dialogue data generation, that is, improve the quality of dialogue data generation.

[0137] Specifically, a RAG system is constructed. The RAG system consists of two stages, namely the data preparation stage and the retrieval generation stage. Data preparation requires the design of all knowledge bases for the roles that the role-playing model needs to play, and finally obtains a knowledge base that can be used by the role-playing model through operations such as data sorting, segmentation, and vectorization. The construction of the knowledge base is an offline process, while the retrieval generation is an online process.

[0138] Here, the knowledge base corresponding to the target role includes a plurality of knowledge information related to the target role. Based on this, based on the target role input text, the corresponding knowledge information is retrieved from the knowledge base corresponding to the target role.

[0139] Step 132, input the target role input text, the knowledge information and the dialogue data into a role-playing model, and obtain the role-playing model output dialogue data of the role playing the target role.

[0140] The method for generating dialogue data provided by the embodiment of the present invention, through the above-mentioned method, constructs a knowledge base corresponding exclusively to the target role, so that the role-playing model can complete a reasonable response in combination with the knowledge information related to the input text of the target role, thereby reducing the occurrence of the large model hallucination phenomenon, thereby improving the generation accuracy of dialogue data on the role side, and further improving the generation accuracy of dialogue data for multiple rounds of dialogue, that is, improving the generation quality of dialogue data.

[0141] Based on the above embodiments, the present invention proposes a multi-prompt driven model self-dialogue generation method, that is, the target role input text and the target user input text are used together to drive the role-playing model to generate dialogue data, thereby making full use of the capabilities of the large language model to complete the automatic generation of training data for role-playing tasks, and significantly improving the generation efficiency of training data (dialogue data) in role-playing tasks. Specifically, based on the existing role-playing model, a variety of prompts are designed to drive the role-playing model to simulate the speaking patterns of different human users on the user side, and at the same time play the designated role on the model side, and only one role-playing model can be used to complete the tasks of simulating humans and simulating designated roles. Therefore, the present invention is a training-free method, which greatly reduces the development cycle, reduces costs, and has little reliance on the amount of data. Compared with the technical solution of a single prompt, the present invention can also greatly improve the accuracy and diversity of generating simulated human user dialogues.

[0142] The following is a description of the conversation data generating device provided by the present invention. The conversation data generating device described below and the conversation data generating method described above can be referenced to each other.

[0143] Figure 7 Schematic diagram of the structure of the conversation data generating device provided by the present invention. Figure 7 As shown, the conversation data generating device includes a text determination module 710 , a first output module 720 and a second output module 730 .

[0144] The text determination module 710 is used to determine the target role input text corresponding to the target role, and determine the target user input text corresponding to the current dialogue turn from the user input text library.

[0145] The first output module 720 is used to input the target user input text and the conversation data of the current multi-round conversation to be generated into the role-playing model, obtain the user-side conversation data output by the role-playing model, and update the user-side conversation data into the conversation data.

[0146] The second output module 730 is used to input the target role input text and the dialogue data into the role-playing model, obtain the role-playing model output dialogue data of the character playing the target role, and update the character-side dialogue data into the dialogue data.

[0147] Among them, the user input text library includes user input texts corresponding to multiple human speaking modes, and the user input text corresponding to any of the human speaking modes is used to prompt the role-playing model to output a user-side dialogue that plays the human speaking mode; the role-playing model is a pre-trained large language model.

[0148] The dialogue data generating device provided by the embodiment of the present invention determines the target role input text corresponding to the target role, and determines the target user input text corresponding to the current dialogue round from the user input text library, and the user input text library includes user input texts corresponding to multiple human speech modes, and the user input text corresponding to any human speech mode is used to prompt the role-playing model to output the user-side dialogue playing the human speech mode, so that in the current multi-round dialogue to be generated, user-side dialogue data of multiple different human speech modes can be generated, and finally the diversity and richness of the dialogue data are improved. Moreover, since the user input text library is written in advance, the user input text with better effect can be set in advance, so that the role-playing model can understand the human user's speech mode more accurately, thereby improving the generation accuracy of the user-side dialogue data, and the user-side dialogue data will be updated to the dialogue data, thereby also improving the generation accuracy of the role-side dialogue data; the target user input text and the dialogue data of the current multi-round dialogue to be generated are input into the role-playing model, and the user-side dialogue data output by the role-playing model is obtained. The target role input text and the dialogue data are input into the role-playing model to obtain the role-playing data of the target role output by the role-playing model, and the role-playing data is updated into the dialogue data, so that each round of user-side dialogue generation requires splicing the historical dialogue data into the target user input text and the target role input text, so that the role-playing model can complete a reasonable reply based on the dialogue history, that is, improve the generation accuracy of the dialogue data; at the same time, through the above method, only one role-playing model is needed to complete the generation of user-side dialogue and role-side dialogue, without the need to construct a human role-playing model separately, that is, without the need to train the human role-playing model, and the role-playing model is a pre-trained large language model, thereby reducing the generation cost of dialogue data and improving the generation efficiency of dialogue data; at the same time, through the above method, dialogue data can be automatically generated without the need to generate dialogue data through manual annotation or chat data of real users, thereby improving the generation efficiency of dialogue data and reducing the generation cost of dialogue data.

[0149] Figure 8 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 8As shown, the electronic device may include: a processor (processor) 810, a communication interface (Communications Interface) 820, a memory (memory) 830 and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other through the communication bus 840. The processor 810 can call the logic instructions in the memory 830 to execute the dialogue data generation method, which includes: determining the target role input text corresponding to the target role, and determining the target user input text corresponding to the current dialogue round from the user input text library; inputting the target user input text and the dialogue data of the current multi-round dialogue to be generated into the role-playing model, obtaining the user-side dialogue data output by the role-playing model, and updating the user-side dialogue data into the dialogue data; inputting the target role input text and the dialogue data into the role-playing model, obtaining the role-side dialogue data of playing the target role output by the role-playing model, and updating the role-side dialogue data into the dialogue data; wherein the user input text library includes user input texts corresponding to multiple human speaking modes, and the user input text corresponding to any of the human speaking modes is used to prompt the role-playing model to output the user-side dialogue playing the human speaking mode; the role-playing model is a pre-trained large language model.

[0150] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0151] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the dialogue data generation method provided by the above methods, which method includes: determining the target role input text corresponding to the target role, and determining the target user input text corresponding to the current dialogue round from the user input text library; inputting the target user input text and the dialogue data of the current multiple rounds of dialogue to be generated into a role-playing model, obtaining the user-side dialogue data output by the role-playing model, and updating the user-side dialogue data into the dialogue data; inputting the target role input text and the dialogue data into the role-playing model, obtaining the role-side dialogue data of the target role output by the role-playing model, and updating the role-side dialogue data into the dialogue data; wherein the user input text library includes user input texts corresponding to multiple human speaking modes, and the user input text corresponding to any of the human speaking modes is used to prompt the role-playing model to output the user-side dialogue of the human speaking mode; the role-playing model is a pre-trained large language model.

[0152] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented by a processor to execute the dialogue data generation method provided by the above-mentioned methods when executed, the method comprising: determining a target role input text corresponding to a target role, and determining a target user input text corresponding to a current dialogue round from a user input text library; inputting the target user input text and the dialogue data of the current multiple rounds of dialogue to be generated into a role-playing model, obtaining user-side dialogue data output by the role-playing model, and updating the user-side dialogue data into the dialogue data; inputting the target role input text and the dialogue data into the role-playing model, obtaining role-side dialogue data of the target role output by the role-playing model, and updating the role-side dialogue data into the dialogue data; wherein the user input text library includes user input texts corresponding to a plurality of human speaking modes, and the user input text corresponding to any of the human speaking modes is used to prompt the role-playing model to output a user-side dialogue that plays the human speaking mode; the role-playing model is a pre-trained large language model.

[0153] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0154] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0155] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for generating conversation data, characterized in that: include: Determine the target role input text corresponding to the target role, and determine the target user input text corresponding to the current dialogue turn from the user input text library; Input the target user input text and the conversation data of the current multi-round conversation to be generated into the role-playing model, obtain the user-side conversation data output by the role-playing model, and update the user-side conversation data into the conversation data; Inputting the target role input text and the dialogue data into a role-playing model, obtaining dialogue data on the role playing the target role output by the role-playing model, and updating the dialogue data on the role side into the dialogue data; The user input text library includes user input texts corresponding to a plurality of human speech modes, and the user input text corresponding to any of the human speech modes is used to prompt the role-playing model to output a user-side dialogue playing the human speech mode; The role-playing model is a pre-trained large language model.

2. The method for generating conversation data according to claim 1, characterized in that: The step of determining the target user input text corresponding to the current dialogue turn from the user input text library includes: Determine a target probability tree corresponding to the user input text library; Based on the target probability tree, determining the target user input text from the user input text library; Among them, the target probability tree includes multiple leaf nodes, and the selection probabilities of the multiple leaf nodes include the selection probabilities of each user input text in the user input text library; the sum of the selection probabilities of all child nodes of any parent node except the leaf nodes in the target probability tree is equal to the selection probability of the parent node.

3. The method for generating conversation data according to claim 2, characterized in that: The step of determining the target user input text from the user input text library based on the target probability tree includes: Determine a probability variation set corresponding to the current dialogue turn; the probability variation set includes the probability variation of each node in the target probability tree; Based on the probability variation set, updating the selection probability of each node in the target probability tree; Based on the updated target probability tree, the target user input text is determined from the user input text library.

4. The method for generating conversation data according to claim 3, characterized in that: The updating of the selection probability of each node in the target probability tree based on the probability variation set includes: Based on the probability change amount of each second-layer node of the target probability tree in the probability change amount set, updating the selection probability of each second-layer node in the target probability tree; the second-layer node is a child node of the root node of the target probability tree; The second layer node with child nodes is used as the target layer node; For any of the target layer nodes, based on the updated selection probability of the target layer node, the selection probability of each next layer node of the target layer node in the target probability tree is updated; based on the probability change amount of each next layer node of the target layer node in the probability change amount set, the selection probability of each next layer node of the target layer node in the target probability tree is updated; any of the next layer nodes is a child node of the target layer node; The next layer node with child nodes is taken as the target layer node, and the selection probability of each next layer node of the target layer node in the target probability tree is updated based on the updated selection probability of the target layer node for any target layer node, and the selection probability of each next layer node of the target layer node in the target probability tree is updated based on the probability change amount of each next layer node of the target layer node in the probability change amount set.

5. The method for generating conversation data according to claim 3, characterized in that: The determining of the probability variation set corresponding to the current dialogue turn includes: Determine a value range set corresponding to the current dialogue turn; Based on the value range set, determining the probability variation set; The value range set includes the value range of the probability variation of each node in the target probability tree; and the value range set includes the value range determined based on the number of rounds of the current dialogue round.

6. The method for generating conversation data according to any one of claims 2 to 5, characterized in that: The determining of the target probability tree corresponding to the user input text library includes: Acquire multiple probability trees corresponding to the user input text library; The target probability tree is determined from the plurality of probability trees.

7. The method for generating conversation data according to claim 1, characterized in that: The step of inputting the target user input text and the conversation data of the current multi-round conversation to be generated into the role-playing model to obtain the user-side conversation data output by the role-playing model includes: Determine a target topic from a topic library corresponding to the target role; Inputting the target user input text, the target topic and the dialogue data into a role-playing model to obtain user-side dialogue data output by the role-playing model; The subject library corresponding to the target role includes a plurality of conversational subjects related to the target role.

8. The method for generating conversation data according to claim 1, characterized in that: The step of determining the target role input text corresponding to the target role includes: Determining the target character input text from a character input text library; The role input text library includes role input texts corresponding to a plurality of roles, and the role input text corresponding to any of the roles is used to prompt the role playing model to output a role-side dialogue for playing the role.

9. The method for generating conversation data according to claim 1, characterized in that: The step of inputting the target role input text and the dialogue data into a role playing model to obtain dialogue data of a role playing the target role output by the role playing model includes: Retrieving knowledge information related to the target character input text from a knowledge base corresponding to the target character; The target role input text, the knowledge information and the dialogue data are input into a role-playing model, and dialogue data on the role-playing side of the target role output by the role-playing model is obtained.

10. A conversation data generating device, characterized in that: include: A text determination module is used to determine the target role input text corresponding to the target role, and determine the target user input text corresponding to the current dialogue turn from the user input text library; A first output module, configured to input the target user input text and the conversation data of the current multi-round conversation to be generated into the role-playing model, obtain the user-side conversation data output by the role-playing model, and update the user-side conversation data into the conversation data; A second output module, for inputting the target role input text and the dialogue data into a role-playing model, obtaining dialogue data on the role side of the target role output by the role-playing model, and updating the dialogue data on the role side into the dialogue data; The user input text library includes user input texts corresponding to a plurality of human speech modes, and the user input text corresponding to any of the human speech modes is used to prompt the role-playing model to output a user-side dialogue playing the human speech mode; The role-playing model is a pre-trained large language model.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the method for generating conversation data according to any one of claims 1 to 9 is implemented.

12. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for generating conversation data according to any one of claims 1 to 9 is implemented.

13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for generating conversation data according to any one of claims 1 to 9 is implemented.