A method and device for constructing thought chain data, electronic device and storage medium

By acquiring network data and using open source dialogue large models to rewrite and reverse generate it, we construct a thinking chain data set, which solves the problem of difficulty in controlling the quality of thinking chain data sets in the existing technology and achieves large-scale, high-quality thinking chain data generation. , which improves the model’s reasoning ability and answer accuracy.

CN117633170BActive Publication Date: 2024-09-10GLOBAL TONE COMM TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311470831.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-07
Publication Date
2024-09-10
Estimated Expiration
2043-11-07

AI Technical Summary

Technical Problem

The existing technology has the problems of time-consuming and labor-intensive, difficult to control quality and single style when constructing the thinking chain instruction data set. Especially when improving the reasoning ability of large models, the quality of thinking chain data is crucial to model performance, but it is difficult to be efficient. , cheaply generate high-quality thought chain data sets.

Method used

By obtaining the sample question and answer data crawled from the web, use the open source dialogue large model to rewrite the sample answer data and reversely generate the target question instructions, construct the thinking chain data, and ensure that the similarity between the target question instructions and the sample question instructions is greater than the preset similarity. , thereby generating high-quality thinking chain data.

Benefits of technology

It achieves large-scale, high-quality and convenient construction of thinking chain data, improves the model's reasoning ability and answer accuracy, solves the problem of difficult quality control of thinking chain data sets, and improves the model's performance in complex reasoning tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117633170B
    Figure CN117633170B
Patent Text Reader

Abstract

The disclosed embodiments disclose a method, device, electronic device and storage medium for constructing thought chain data, which belongs to the field of data processing technology. The method includes: obtaining sample question and answer data crawled from the network; wherein the sample question and answer data includes sample question instructions and sample answer data; rewriting the sample answer data based on the open source dialogue model to generate target answer data; reversely generating a target question instruction corresponding to the target answer data based on the open source dialogue model; in response to the similarity between the target question instruction and the sample question instruction being greater than a preset similarity, constructing thought chain data based on the target question instruction and the target answer data. In this way, thought chain data can be constructed on a large scale, with high quality and conveniently through a large amount of question and answer data on the network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a method and device for constructing thought chain data, an electronic device and a storage medium. Background Art

[0002] On November 30, 2022, ChatGPT (a large model of conversational language) was born, marking the arrival of the era of large conversational models. Since then, the industry and academia have officially entered the fourth paradigm era. ChatGPT has strong language understanding capabilities, rich text generation capabilities, and excellent knowledge representation capabilities. It can understand various instructions in multiple languages ​​input by humans and give effective responses. Based on ChatGPT's outstanding performance, since the launch of CHatGPT on November 30, 2022, in just two months, ChatGPT has attracted 100 million registered users, becoming the fastest application engine in history to reach 100 million users.

[0003] Generative AI (Artificial Intelligence) technology represented by ChatGPT has had a significant impact on the entire human production and life, and this impact will continue and intensify. More and more companies are following this trend and developing their own large dialogue models.

[0004] At present, the mainstream research and development route of large models is to improve the strength of the model based on the open source framework according to the three-step strategy. The three steps are: 1. Fine-tune the open source model using the instruction data set; 2. Manually judge the performance of the model after the first step of fine-tuning, and use the generated data to construct a reward model; 3. Combined with the reward model, use human reinforcement learning technology to correct the fine-tuned model generated in the first step. In the above three-step improvement method, the first step is the foundation and the most important of all steps. It directly and fundamentally determines the quality of the model; assuming that the performance of the fine-tuned model generated in the first step is relatively poor, then it can be said that the next two steps cannot change the poor performance.

[0005] However, in addition to the 3H concept, the evaluation and annotation of the quality of instruction data sets also requires that the data sets must contain thinking chain data. Studies have shown that thinking chain data can improve the reasoning ability of the model and optimize the model's answering ability, which is the finishing touch to improving the model's ability. There are three main common ways to obtain instruction data sets. One is manual construction; the second is to use open source data sets on the Internet; the third is to use self-instruct technology to automatically construct instruction data sets with the help of large models such as ChatGPT and GPT4. However, these three methods all have relatively large disadvantages in constructing special thinking chain instruction data sets. The main disadvantages of manual construction are time-consuming and labor-intensive; open source data sets on the Internet face the problem of being unable to control quality and control the field of data sets; self-instruct technology automatically constructs instruction data sets and also faces problems such as difficult quality control of thinking data sets and single style. Summary of the invention

[0006] This disclosure section is provided to introduce concepts in a brief form, which will be described in detail in the detailed description section below. This disclosure section is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.

[0007] The embodiments of the present disclosure provide a thought chain data construction method, device, electronic device and storage medium to solve the above-mentioned technical problems.

[0008] In a first aspect, an embodiment of the present disclosure provides a method for constructing thought chain data, comprising: acquiring sample question and answer data crawled from the network; wherein the sample question and answer data comprises sample question instructions and sample answer data; rewriting the sample answer data based on an open source dialogue big model to generate target answer data; reversely generating a target question instruction corresponding to the target answer data based on the open source dialogue big model; in response to the similarity between the target question instruction and the sample question instruction being greater than a preset similarity, constructing thought chain data based on the target question instruction and the target answer data.

[0009] Optionally, in some embodiments, obtaining sample question and answer data crawled from the network includes: obtaining initial question and answer data crawled from the network; wherein the initial question and answer data includes initial question instructions and initial answer data; in response to the initial answer data including associated words, generating the sample question and answer data; wherein the sample question and answer data is the initial question and answer data, the sample question instructions are the initial question instructions, and the sample answer data is the initial answer data.

[0010] Optionally, in some embodiments, in response to the initial answer data including associated words, generating the sample question and answer data includes: in response to the initial answer data including associated words, verifying the initial answer data based on the open source dialogue big model; in response to the open source dialogue big model verifying the initial answer data, the result of the verification indicates that the initial answer data has true causal logic and correctness, thereby generating the sample question and answer data.

[0011] Optionally, in some embodiments, the sample answer data is rewritten based on the open source dialogue big model to generate target answer data, including: inputting the sample answer data into the open source dialogue big model, performing text semantic recognition on the sample answer data to obtain semantically recognized text; and rewriting the semantically recognized text according to preset rewriting rules to generate the target answer data.

[0012] Optionally, in some embodiments, the preset rewriting rules include: changing the associated words of the semantic recognition text, adjusting the sentence length of the semantic recognition text, changing the uncommon words and colloquial expressions of the semantic recognition text, adjusting the grammatical errors of the semantic recognition text, adjusting the incorrect vocabulary of the semantic recognition text, and adjusting at least one of the incorrect punctuation marks of the semantic recognition text.

[0013] Optionally, in some embodiments, before constructing the thought chain data based on the target question instruction and the target answer data, the method further includes: determining that the similarity between the target question instruction and the question instruction is greater than a preset similarity.

[0014] Optionally, in some embodiments, the method further includes: inputting the constructed thought chain data into a thought chain data set; based on the thought chain data set, fine-tuning the sample open source model to generate a target dialogue large model.

[0015] In a second aspect, an embodiment of the present application provides a thinking chain data construction device, comprising: an acquisition module, used to acquire sample question and answer data crawled from the network; wherein the sample question and answer data includes sample question instructions and sample answer data; a first generation module, used to rewrite the sample answer data based on an open source dialogue model to generate target answer data; a second generation module, used to reversely generate a target question instruction corresponding to the target answer data based on the open source dialogue model; a construction module, used to construct a thinking chain data based on the target question instruction and the target answer data in response to the similarity between the target question instruction and the sample question instruction being greater than a preset similarity.

[0016] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the thinking chain data construction method as described in the first aspect.

[0017] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the thought chain data construction method as described in the first aspect.

[0018] The method, device and electronic device for constructing thought chain data provided by the embodiments of the present disclosure first obtain sample question and answer data crawled from the network; wherein the sample question and answer data includes sample question instructions and sample answer data; then, the sample answer data is rewritten based on the open source dialogue model to generate target answer data; then, the target question instruction corresponding to the target answer data is reversely generated based on the open source dialogue model; finally, the thought chain data is constructed based on the target question instruction and the target answer data. In this way, the thought chain data can be constructed on a large scale, with high quality and conveniently through a large amount of question and answer data on the network. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0020] Figure 1 It is a schematic diagram of thought chain data;

[0021] Figure 2 It is a schematic diagram of a question-answering example based on a thought chain;

[0022] Figure 3 is a flow chart of an embodiment of a method for constructing thought chain data according to the present disclosure;

[0023] Figure 4 is a flow chart of another embodiment of the method for constructing thought chain data according to the present disclosure;

[0024] Figure 5 It is a structural schematic diagram of an embodiment of a thinking chain data construction device according to the present disclosure;

[0025] Figure 6 It is a schematic diagram of the basic structure of an electronic device provided according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0026] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0027] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0028] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0029] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0030] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0031] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0032] At present, the mainstream research and development route of large models is to improve the strength of the model based on the open source framework according to the three-step strategy. The three steps are: 1. Fine-tune the open source model using the instruction data set; 2. Manually judge the performance of the model after the first step of fine-tuning, and use the generated data to construct a reward model; 3. Combined with the reward model, use human reinforcement learning technology to correct the fine-tuned model generated in the first step. In the above three-step improvement method, the first step is the foundation and the most important of all steps. It directly and fundamentally determines the quality of the model; assuming that the performance of the fine-tuned model generated in the first step is relatively poor, then it can be said that the next two steps cannot change the poor performance.

[0033] However, in addition to the 3H concept, the evaluation and annotation of the quality of instruction data sets also requires that the data sets must contain thinking chain data. Studies have shown that thinking chain data can improve the reasoning ability of the model and optimize the model's answering ability, which is the finishing touch to improving the model's ability. There are three main common ways to obtain instruction data sets. One is manual construction; the second is to use open source data sets on the Internet; the third is to use self-instruct technology to automatically construct instruction data sets with the help of large models such as ChatGPT and GPT4. However, these three methods all have relatively large disadvantages in constructing special thinking chain instruction data sets. The main disadvantages of manual construction are time-consuming and labor-intensive; open source data sets on the Internet face the problem of being unable to control quality and control the field of data sets; self-instruct technology automatically constructs instruction data sets and also faces problems such as difficult quality control of thinking data sets and single style.

[0034] Thinking chain data is crucial to improving the reasoning ability of large models. Especially when facing domain problems, large models trained by thinking chain data are often more logical and accurate in problem analysis and response.

[0035] The chain of thought (COT) is a reasoning process based on natural language, which includes three parts: input question, chain of thought (reasoning process) and output conclusion (such as Figure 1 As shown in Figure 2). Different from the traditional instruction mode, the mind chain instruction data focuses more on the reasoning process, so it can significantly improve the accuracy of large models in complex reasoning tasks. Figure 2 As shown, it shows that after the question is input, the conclusion is obtained according to the reasoning process.

[0036] Usually, the reasoning process and the conclusion are used as the output part of the thought chain data. That is, the usual thought chain data includes input instructions (Instruction) and output (Output).<Instruction,Output> form.

[0037] However, due to the strict logical structure of the thinking chain data, such data rarely exists on the Internet; how to efficiently and cheaply generate high-quality thinking chain data sets in large quantities has become a key point restricting the improvement of large model capabilities.

[0038] Therefore, the present application provides the following embodiments to solve the above problems.

[0039] Please refer to Figure 3 , which shows the process of an embodiment of the method for constructing thought chain data according to the present disclosure. The method for constructing thought chain data can be applied to electronic devices. Figure 3 The thought chain data construction method shown includes: steps 301 to 304.

[0040] Step 301: Obtain sample question and answer data crawled from the network.

[0041] In the first step, sample question and answer data can be crawled from the Internet using a crawler tool, where the sample question and answer data includes sample question instructions and sample answer data.

[0042] For example, the sample question and answer data may include a sample question instruction "write an article about campus safety", and sample answer data "campus safety is the premise for us to learn knowledge in various subjects, and safety is one of the primary tasks of the school. Therefore, campus safety must be concerned by everyone, and it must be implemented in a long-term and practical manner. School leaders and teachers have carefully designed many safety signs to remind us that safety is above all else. In order to thank the teachers for their care for us, the Young Pioneers should do the following: First, we must have a high degree of safety awareness and fully understand the importance of safety. Second, we must pay attention to preventing psychological safety."

[0043] Step 302: rewrite the sample answer data based on the open source dialogue model to generate target answer data.

[0044] Here, the open source dialogue big model can be but is not limited to the GPT4 dialogue big model and the Gewu dialogue big model.

[0045] Here, the open source dialogue model is used to rewrite the content of the sample answer data to make it meet the modeling requirements of the subsequent model construction. After rewriting, the target answer data is generated.

[0046] Step 303: Reversely generate target question instructions corresponding to the target answer data based on the open source dialogue model.

[0047] Then, the generated target answer data is input into the open source dialogue big model, and the open source dialogue big model reversely generates the target question instructions corresponding to the target answer data.

[0048] Step 304: In response to the similarity between the target question instruction and the sample question instruction being greater than a preset similarity, constructing thought chain data based on the target question instruction and the target answer data.

[0049] That is, after reversely generating the target question instructions corresponding to the target answer data based on the open source dialogue model, the similarity between the target question instructions and the question instructions can be judged. If the similarity is greater than the preset similarity, the thinking chain data can be constructed based on the target question instructions and the target answer data. By introducing the above-mentioned feedback mechanism, on the one hand, the strong correlation of the thinking chain questions and answers can be guaranteed, and the quality of the constructed thinking chain data can be further guaranteed. On the other hand, the correctness of the rewriting can be guaranteed to avoid semantic deviation caused by rewriting.

[0050] It should be noted that the above similarity judgment can still be implemented based on the open source dialogue big model, that is, the similarity between the target question instruction and the question instruction is compared through the open source dialogue big model.

[0051] Of course, comparison can also be achieved through other similarity algorithms, such as cosine similarity algorithm and Euclidean distance similarity algorithm.

[0052] Finally, a corresponding thought chain data can be generated based on a sample question and answer data crawled from the Internet.

[0053] In summary, the method for constructing thought chain data provided by the embodiment of the present disclosure first obtains sample question and answer data crawled from the network; wherein the sample question and answer data includes sample question instructions and sample answer data; then, the sample answer data is rewritten based on the open source dialogue model to generate target answer data; then, the target question instruction corresponding to the target answer data is reversely generated based on the open source dialogue model; finally, the thought chain data is constructed based on the target question instruction and the target answer data. In this way, the thought chain data can be constructed in a large scale, high quality and conveniently through a large amount of question and answer data on the network.

[0054] Optionally, in some embodiments, the above-mentioned step 301 of obtaining sample question and answer data crawled from the network may specifically include: obtaining initial question and answer data crawled from the network; wherein the initial question and answer data includes initial question instructions and initial answer data; in response to the initial answer data including associated words, generating sample question and answer data; wherein the sample question and answer data is the initial question and answer data, the sample question instructions are the initial question instructions, and the sample answer data is the initial answer data.

[0055] It should be noted that the initial question and answer data can be crawled from the network by using a crawler tool, and then the initial question and answer data can be tested to determine whether there are related words. If so, the initial question and answer data can be determined as the sample answer data used subsequently. If not, the initial question and answer data can be discarded.

[0056] By screening out the initial answer data with associated words, illogical answer data can be initially filtered out. When determining whether there are associated words, the initial question and answer data can be firstly processed by word segmentation.

[0057] The above-mentioned conjunctions may include but are not limited to "because", "so", "therefore", "however", "although", "therefore", etc.

[0058] Optionally, in some embodiments, the above steps generate sample question and answer data in response to the initial answer data including associated words, including: in response to the initial answer data including associated words, verifying the initial answer data based on the open source dialogue big model; in response to the open source dialogue big model, verifying the initial answer data and the result indicating that the initial answer data has real causal logic and correctness, thereby generating sample question and answer data.

[0059] That is, after determining that the initial answer data includes the associated words, the initial answer data can be verified for validity based on the open source dialogue model. The verification process mainly involves whether the initial answer data actually has causal logic and the correctness of the answer.

[0060] The above-mentioned causal logic can be understood as whether it conforms to the causal logic, such as whether the conjunctions are used correctly and whether the semantics before and after are logical.

[0061] The correctness of the answer can be understood as whether it corresponds to the initial question instruction. For example, if the "initial question instruction" is "What colors are apples available" and the answer to the initial answer data is "black", then it can be determined that the initial answer data is incorrect. When the verification result indicates that the initial answer data has true causal logic and correctness, the initial question and answer data is used as sample question and answer data for subsequent use.

[0062] Optionally, in some embodiments, the above step 302 rewrites the sample answer data based on the open source dialogue big model to generate target answer data, which may specifically include: inputting the sample answer data into the open source dialogue big model, performing text semantic recognition on the sample answer data to obtain semantic recognition text; and rewriting the semantic recognition text according to preset rewriting rules to generate target answer data.

[0063] Optionally, the preset rewriting rule may include at least one of the following:

[0064] 1. Change the associated words of the semantic recognition text.

[0065] Among them, changing the associated words of the semantic recognition text is mainly manifested in strengthening the logic of the sample answer data.

[0066] 2. Adjust the sentence length of semantic recognition text.

[0067] That is, adjust the length and complexity of the sentence. Sentences that are too long or too complicated will cause reading difficulties for the large model and affect the comprehension effect. Here, we can adopt the method of changing long sentences into short sentences.

[0068] 3. Change the semantic recognition text to identify uncommon words and colloquial expressions.

[0069] It should be noted that while keeping the original meaning unchanged, avoid using uncommon words and colloquial expressions, that is, use appropriate vocabulary to enhance the accuracy and authority of the sentence.

[0070] 4. Adjust grammatical errors in semantic recognition text.

[0071] 5. Adjust incorrect vocabulary in semantic recognition text.

[0072] 6. Adjust incorrect punctuation marks in semantic recognition text.

[0073] It should be noted that the data is rewritten by the above-mentioned preset rewriting rules to make it meet the modeling requirements of the subsequent model building. After rewriting, the target answer data is generated.

[0074] Optionally, in some embodiments, before constructing the thought chain data based on the target question instruction and the target answer data in the above step 304, the method further includes: determining that the similarity between the target question instruction and the question instruction is greater than a preset similarity.

[0075] Optionally, in some embodiments, the method further includes: inputting the constructed thought chain data into a thought chain data set; based on the thought chain data set, fine-tuning the sample open source model to generate a target dialogue large model.

[0076] After acquiring the thinking chain data, it can be stored in the thinking chain dataset. Finally, the thinking chain dataset can be used to fine-tune the sample open source model to generate the target dialogue model required by the user.

[0077] Combine the following Figure 4 The above process is explained in the following flow:

[0078] First, we crawl an initial question-answer pair from the Internet.<Instruction,Output> Then, filter based on Output, that is, determine whether there are related words. If so, filter through the dialogue model, that is, determine whether there is causal logic. From the perspective of text semantics, it has causal logic before and after and determines the correctness of this paragraph. If it passes, transform the Output, that is, rewrite it. Then reversely generate Instruction 1 based on the dialogue model. Then, filter through the dialogue model again, that is, compare the similarity between Instruction 1 and Instruction. If the similarity is greater than the preset similarity, a thinking chain data COT can be successfully generated.<Instruction1,Output1> .

[0079] The following is a specific example:

[0080] Suppose there is an original question-answer pair, the instruction is "Can I hide under a tree when it's thundering?", and the output is "Haha, I know the answer to this question! Let me put it this way, trees have a lot of water in their bodies, and big trees are relatively tall, so they are conductors and easily attract lightning. If you hide under a big tree, once it thunders, the lightning will stay along the trunk and then shock you. So you can't hide under a tree when it's thundering, unless you are not afraid of death."

[0081] The first step is to segment the output text, and then determine whether there are words such as "therefore", "so", "therefore", "cause", etc. If so, execute the second step, otherwise discard the data set; from the text, it can be seen that it contains the causal word "so".

[0082] The second step is to use the GPT4 large model to judge the Output and analyze whether the passage has causal logic. From the perspective of text semantics, it can determine whether the passage has causal logic before and after and the correctness of the passage.

[0083] Step 3: Rewrite the Output and polish its grammar to make it more standardized and the sentences more logical. The polishing result of the GPT4 large model is as follows Output*: "Haha, I can explain it. First of all, because trees contain a lot of water and adult trees are usually tall, they are considered good conductors. When there is a thunderstorm, lightning tends to pass along the trunk and eventually hit man-made objects on the ground. Therefore, avoid staying under a tree during a thunderstorm unless you want to risk your life."

[0084] Step 4: Generate an Instruction* based on the polished Output. The result generated by GPT4 is: "Please explain why you should avoid staying under a tree during a thunderstorm?";

[0085] Step 5: Use GPT4 to determine the similarity between the newly generated Instruction* and the original Instruction. If they are similar, they will be retained; if they are not similar, they will be removed. From the perspective of text semantics, the two are similar, so<Instruction*,Output*> It can be regarded as a set of COT data sets.

[0086] In summary, in the embodiment of the present application, GPT4 (an open source dialogue model) is introduced into the process of constructing thought chains, giving full play to its advantage of containing massive world knowledge. This method uses the massive world knowledge contained in GPT as well as judgment, polishing, and reverse deduction to construct high-thinking chain data on a large scale, with high quality and at a low cost, greatly improving the reasoning ability of the model.

[0087] And introduce a polishing mechanism to make the thought chain responses more logical.

[0088] In addition, a feedback mechanism is introduced to ensure the strong correlation between thinking chain questions and answers, further guaranteeing the quality of the constructed thinking chain data.

[0089] Further references Figure 5 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a thought chain data construction device 501. Figure 1 Corresponding to the embodiment of the thought chain data construction method shown, the device can be specifically applied to electronic devices.

[0090] The device includes:

[0091] The acquisition module 501 is used to acquire sample question and answer data crawled from the network; wherein the sample question and answer data includes sample question instructions and sample answer data.

[0092] The first generation module 502 is used to rewrite the sample answer data based on the open source dialogue model to generate target answer data.

[0093] The second generation module 503 is used to reversely generate a target question instruction corresponding to the target answer data based on the open source dialogue model.

[0094] The construction module 504 is used to construct thought chain data based on the target question instruction and the target answer data in response to the similarity between the target question instruction and the sample question instruction being greater than a preset similarity.

[0095] Optionally, in some embodiments, the acquisition module 501 is also specifically used to acquire initial question and answer data crawled from the network; wherein the initial question and answer data includes initial question instructions and initial answer data; in response to the initial answer data including associated words, the sample question and answer data is generated; wherein the sample question and answer data is the initial question and answer data, the sample question instructions are the initial question instructions, and the sample answer data is the initial answer data.

[0096] Optionally, in some embodiments, the acquisition module 501 is further specifically used to verify the initial answer data based on the open source dialogue big model in response to the initial answer data including associated words; in response to the open source dialogue big model verifying the initial answer data and the result indicating that the initial answer data has true causal logic and correctness, generate the sample question and answer data.

[0097] Optionally, in some embodiments, the first generation module 502 is further specifically used to input the sample answer data into the open source dialogue model, perform text semantic recognition on the sample answer data, and obtain semantically recognized text; and perform data rewriting on the semantically recognized text according to preset rewriting rules to generate the target answer data.

[0098] Optionally, in some embodiments, the preset rewriting rules include: changing the associated words of the semantic recognition text, adjusting the sentence length of the semantic recognition text, changing the uncommon words and colloquial expressions of the semantic recognition text, adjusting the grammatical errors of the semantic recognition text, adjusting the incorrect vocabulary of the semantic recognition text, and adjusting at least one of the incorrect punctuation marks.

[0099] Optionally, in some embodiments, the construction module is further specifically used to determine that the similarity between the target question instruction and the question instruction is greater than a preset similarity before constructing the thinking chain data based on the target question instruction and the target answer data.

[0100] Optionally, the device further comprises a model building module. The model building module is used to input the constructed thought chain data into a thought chain data set; based on the thought chain data set, fine-tune the sample open source model to generate a target dialogue model.

[0101] Reference below Figure 6 , which shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0102] like Figure 6 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In RAM 603, various programs and data required for the operation of the electronic device are also stored. The processing device 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0103] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0104] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0105] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0106] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0107] The computer-readable medium may be included in the electronic device, or may exist independently without being installed in the electronic device.

[0108] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains sample question and answer data crawled from the network; wherein the sample question and answer data includes sample question instructions and sample answer data; rewrites the sample answer data based on the open source dialogue model to generate target answer data; reversely generates target question instructions corresponding to the target answer data based on the open source dialogue model; and constructs thinking chain data based on the target question instructions and the target answer data.

[0109] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0110] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0111] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.

[0112] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0113] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0114] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0115] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0116] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A method for constructing thought chain data, characterized in that: include: Acquire sample question and answer data crawled from the network; wherein the sample question and answer data includes sample question instructions and sample answer data; Rewriting the sample answer data based on the open source dialogue model to generate target answer data; Reversely generate a target question instruction corresponding to the target answer data based on the open source dialogue model; In response to the similarity between the target question instruction and the sample question instruction being greater than a preset similarity, constructing thought chain data based on the target question instruction and the target answer data; The step of rewriting the sample answer data based on the open source dialogue model to generate target answer data includes: Inputting the sample answer data into the open source dialogue model, performing text semantic recognition on the sample answer data, and obtaining semantically recognized text; According to a preset rewriting rule, rewriting the semantically recognized text to generate the target answer data; The preset rewriting rules include: changing the associated words of the semantic recognition text, adjusting the sentence length of the semantic recognition text, changing the uncommon words and colloquial expressions of the semantic recognition text, adjusting the grammatical errors of the semantic recognition text, adjusting the incorrect vocabulary of the semantic recognition text, and adjusting at least one of the incorrect punctuation marks of the semantic recognition text.

2. The method for constructing thought chain data according to claim 1, characterized in that: The step of obtaining sample question and answer data crawled from the network includes: Acquire initial question and answer data crawled from the network; wherein the initial question and answer data includes initial question instructions and initial answer data; In response to the initial answer data including a connecting word, the sample question and answer data is generated; wherein the sample question and answer data is the initial question and answer data, the sample question instruction is the initial question instruction, and the sample answer data is the initial answer data.

3. The method for constructing thought chain data according to claim 2, characterized in that: In response to the initial answer data including the associated words, generating the sample question and answer data comprises: In response to the initial answer data including the associated words, verifying the initial answer data based on the open source dialogue macro model; In response to the open source dialogue big model verifying the initial answer data, the result of the verification indicates that the initial answer data has true causal logic and correctness, and the sample question and answer data is generated.

4. The method for constructing thought chain data according to claim 1, characterized in that: In response to the similarity between the target question instruction and the sample question instruction being greater than a preset similarity, before constructing the thought chain data based on the target question instruction and the target answer data, the method further includes: The similarity between the target question instruction and the sample question instruction is judged based on the open source dialogue model.

5. The method for constructing thought chain data according to claim 1, characterized in that: The method further comprises: Input the constructed thought chain data into the thought chain data set; Based on the thought chain dataset, fine-tune the sample open source model and generate a large target dialogue model.

6. A thought chain data construction device, characterized in that: include: An acquisition module is used to acquire sample question and answer data crawled from the network; wherein the sample question and answer data includes sample question instructions and sample answer data; A first generation module is used to rewrite the sample answer data based on the open source dialogue model to generate target answer data; A second generation module is used to reversely generate a target question instruction corresponding to the target answer data based on the open source dialogue model; A construction module, configured to construct thought chain data based on the target question instruction and the target answer data in response to the similarity between the target question instruction and the sample question instruction being greater than a preset similarity; The first generation module is further used to: input the sample answer data into the open source dialogue model, perform text semantic recognition on the sample answer data, and obtain semantic recognition text; According to a preset rewriting rule, rewriting the semantically recognized text to generate the target answer data; The preset rewriting rules include: changing the associated words of the semantic recognition text, adjusting the sentence length of the semantic recognition text, changing the uncommon words and colloquial expressions of the semantic recognition text, adjusting the grammatical errors of the semantic recognition text, adjusting the incorrect vocabulary of the semantic recognition text, and adjusting at least one of the incorrect punctuation marks of the semantic recognition text.

7. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.