Question and answer data generation method and device, equipment, storage medium and program product

By extracting knowledge points from the original file and expanding the problem, and combining the big model to generate Q&A data, the problem of low accuracy in the generation of Q&A data is solved, the coverage and accuracy of the data are improved, and the occurrence of knowledge errors is reduced.

CN119149685AInactive Publication Date: 2024-12-17IFLYTEK CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411065502.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-05
Publication Date
2024-12-17
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the prior art, the accuracy of question-and-answer data generation is mainly due to the possible "illusion" problems of the big model itself, which leads to knowledge errors in the automatically generated question-and-answer data, affecting the generalization ability of the artificial intelligence model.

Method used

By extracting original Q&A pairs and knowledge points from the original file, expanding questions, generating extended questions and extended answers, and generating Q&A data in combination with the big model, reducing knowledge errors caused by the big model illusion and improving the accuracy of the Q&A data.

Benefits of technology

It improves the accuracy of Q&A data generation, reduces the occurrence of knowledge errors, and enhances the coverage and accuracy of the generated Q&A data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149685A_ABST
    Figure CN119149685A_ABST
Patent Text Reader

Abstract

The invention provides a question and answer data generation method and device, equipment, a storage medium and a program product. The question and answer data generation method comprises the steps that original question and answer pairs and all knowledge points are extracted from an original file; performing problem expansion based on the original file to generate an expansion problem; determining a target knowledge point related to the extension problem from each knowledge point; according to the target knowledge point, generating an extension answer corresponding to the extension question; and generating question and answer data according to the original question and answer pairs, the extended questions and the extended answers. The question and answer data generation accuracy can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method, device, equipment, storage medium and program product for generating question and answer data. Background Art

[0002] Artificial intelligence technology is currently developing rapidly. The performance of artificial intelligence models depends largely on high-quality question and answer data. Question and answer data provides the necessary input for artificial intelligence models to improve the understanding ability and response quality of the artificial intelligence model's algorithm. Therefore, question and answer data is crucial for training and evaluating artificial intelligence models.

[0003] It is very costly to manually label question and answer data, and it is easy for the data to be incomplete or unbalanced, which in turn affects the generalization ability of the artificial intelligence model. Therefore, automatic generation of question and answer data replaces manual labeling. In related technologies, large models are usually used to automatically generate question and answer data. However, due to the "hallucination" problem that may exist in the large model itself, it is possible that the answers in the automatically generated question and answer data may contain knowledge errors, resulting in low accuracy in the generation of question and answer data. Summary of the invention

[0004] The present application provides a question and answer data generation method, apparatus, device, storage medium and program product to solve the problem of low accuracy in question and answer data generation.

[0005] According to a first aspect of an embodiment of the present application, a method for generating question and answer data is provided, comprising:

[0006] Extract original question-answer pairs and various knowledge points from the original documents;

[0007] Expanding the question based on the original file to generate an extended question;

[0008] Determine a target knowledge point related to the extended question from each of the knowledge points;

[0009] According to the target knowledge point, generating an extended answer corresponding to the extended question;

[0010] Question and answer data is generated according to the original question and answer pair, the extended question and the extended answer.

[0011] Optionally, determining a target knowledge point related to the extended question from each of the knowledge points includes:

[0012] Generate a first vector of the extended question and a second vector of each of the knowledge points;

[0013] Calculating the similarity between the first vector and each of the second vectors;

[0014] Determining, according to the similarity, each similar knowledge point of the extended question from each of the knowledge points;

[0015] Determine a target knowledge point related to the extended question from each of the similar knowledge points.

[0016] Optionally, determining a target knowledge point related to the extended question from each of the similar knowledge points includes:

[0017] Splicing the extended question and each of the similar knowledge points to obtain each spliced ​​text;

[0018] Generate a third vector of each of the concatenated texts;

[0019] Determining, according to each of the third vectors, the probability that the extended question is associated with each of the similar knowledge points;

[0020] According to the probability, a target knowledge point related to the extended question is determined from each of the similar knowledge points.

[0021] Optionally, generating an extended answer corresponding to the extended question according to the target knowledge point includes:

[0022] The target knowledge points are summarized and concluded to generate extended answers corresponding to the extended questions.

[0023] Optionally, summarizing the target knowledge points to generate an extended answer corresponding to the extended question includes:

[0024] Based on the target knowledge point, generating a first prompt word;

[0025] The first prompt word is input into the large model to obtain an extended answer output by the large model, wherein the first prompt word is used to instruct the large model to summarize the target knowledge point into an extended answer corresponding to the extended question.

[0026] Optionally, the original question-answer pair includes an original question and an original answer;

[0027] The step of expanding the question based on the original file to generate an extended question includes:

[0028] Expanding the original question in the original file to generate a first expanded question;

[0029] Expanding the knowledge point in the original document to generate a second expanded question;

[0030] An extended question is generated according to the first extended question and the second extended question.

[0031] Optionally, the step of expanding the original question in the original file to generate a first expanded question includes:

[0032] Based on the original question, generate a second prompt word;

[0033] The second prompt word is input into the large model to obtain a first extended question output by the large model, wherein the second prompt word is used to instruct the large model to generate a first extended question, and the first extended question is similar to and different from the original question.

[0034] Optionally, the step of expanding the knowledge point in the original file to generate a second expanded question includes:

[0035] Based on the knowledge point, generate a third prompt word;

[0036] The third prompt word is input into the large model to obtain a second extended question output by the large model, wherein the third prompt word is used to instruct the large model to generate a second extended question, and the second extended question is used to ask questions about the knowledge point from different angles.

[0037] According to a second aspect of an embodiment of the present application, there is provided a question-answer data generating device, comprising:

[0038] An extraction unit, used to extract original question-answer pairs and various knowledge points from the original file;

[0039] An extension unit, used for extending questions based on the original file to generate extended questions;

[0040] A processing unit, used to determine a target knowledge point related to the extended question from each of the knowledge points;

[0041] A first generating unit, configured to generate an extended answer corresponding to the extended question according to the target knowledge point;

[0042] The second generating unit is used to generate question and answer data according to the original question and answer pair, the extended question and the extended answer.

[0043] According to a third aspect of an embodiment of the present application, there is provided an electronic device, including a memory and a processor;

[0044] The memory is connected to the processor and is used to store programs;

[0045] The processor is used to implement the question and answer data generating method described in the first aspect by running the program in the memory.

[0046] According to a fourth aspect of an embodiment of the present application, a storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the question and answer data generating method described in the first aspect is implemented.

[0047] According to a fifth aspect of an embodiment of the present application, a computer program product is provided, comprising computer program instructions, which, when executed by a processor, enable the processor to execute the question and answer data generating method described in the first aspect.

[0048] In this application, questions are expanded based on the original file to generate extended questions, which can expand the scope of questions in the generated question and answer data and improve the coverage of the generated question and answer data. Each knowledge point is extracted from the original file, and the target knowledge point related to the extended question is determined from each knowledge point. The extended answer corresponding to the extended question is generated according to the target knowledge point. The content of the knowledge point is consistent with part of the content in the original file. The extended answer is directly generated based on the knowledge point related to the extended question in the original file. Compared with the automatic generation of question and answer data using a large model, it can reduce the occurrence of knowledge errors in the question and answer data due to the illusion of the large model, and improve the accuracy of the generated question and answer data. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0050] Figure 1 A flowchart of a method for generating question and answer data provided in an embodiment of the present application;

[0051] Figure 2 A schematic diagram of a process of step 101 provided in an embodiment of the present application;

[0052] Figure 3 A schematic diagram of a process of step 202 provided in an embodiment of the present application;

[0053] Figure 4 A schematic diagram of a process of step 203 provided in an embodiment of the present application;

[0054] Figure 5 A schematic diagram of a process of step 102 provided in an embodiment of the present application;

[0055] Figure 6 A schematic diagram of a process of step 501 provided in an embodiment of the present application;

[0056] Figure 7 A schematic diagram of a process of step 502 provided in an embodiment of the present application;

[0057] Figure 8 A schematic diagram of the structure of a dual retrieval model provided in an embodiment of the present application;

[0058] Fig. 9 A schematic diagram of the structure of a question and answer data generating device provided in an embodiment of the present application;

[0059] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0060] At present, the tasks of question-answering data generation are usually divided into different task types according to the needs. Among them, the task types include the following four types: both the question and the answer need to be consistent with the original text; only the question needs to be consistent with the original text, but the answer does not need to be consistent with the original text; only the answer needs to be consistent with the original text, but the question does not need to be consistent with the original text; and neither the question nor the answer needs to be consistent with the original text.

[0061] When processing different types of original documents and performing various extraction tasks, a variety of methods are used to extract questions and answers. For example, for the extraction task of a two-role multi-round dialogue process file, which requires that both the question and the answer must be strictly consistent with the original text, the standardization of the two-role multi-round dialogue process file can be used to accurately extract information by writing specific rule codes. For ordinary documents such as contracts, the structure and content of ordinary documents may be complex and irregular. In this case, appropriate prompt words can be designed and the capabilities of large language models can be used to perform information extraction tasks.

[0062] When performing the task of constructing questions and answers, whether it is by writing precise rule codes or designing specific prompts and using large language models, the final extraction results need to be manually reviewed and screened. This is because rule-based extraction methods may not be able to fully cover all situations and there is a risk of incomplete coverage; and methods that rely on large models may cause knowledge errors in the generated answers due to the "hallucination" problem that the large models themselves may have.

[0063] Therefore, although large models can handle complex natural language tasks, when it comes to precise question answering, these models often fail to provide completely accurate answers, and the accuracy of question and answer extraction is not high enough. This may be due to the limitations of large models in understanding the context of questions, identifying key information, the existence of large model hallucinations, and generating accurate answers.

[0064] In addition, in the current practice of question and answer extraction, although large language models can cope with a wide range of question types, they still show limitations in certain specific fields or question types. The output of these models is limited by the number of generated tokens, and the current question and answer extraction methods often also contain manually formulated rules, which are difficult to fully cover all possible document content. Therefore, in the face of diverse query needs, this approach of relying on preset rules and limited generation capabilities may result in the inability to fully display all potential answers, thereby affecting the coverage of question and answer extraction.

[0065] In order to solve the problem of low accuracy in question and answer data generation, the present application provides a question and answer data generation method, apparatus, device, storage medium and program product.

[0066] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0067] Exemplary Implementation Environment

[0068] The question and answer data generation method according to the embodiment of the present disclosure can be executed by an electronic device such as a terminal device or a server. The terminal device can be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. The server can be an independent physical server, a server cluster composed of multiple physical servers, or a cloud server capable of cloud computing. The method can be implemented by a processor calling a computer-readable program instruction stored in a memory.

[0069] Exemplary Methods

[0070] See also Figure 1 In an exemplary embodiment, a method for generating question and answer data is provided. Figure 1 As shown in FIG. 1 , the process of the question-answer data generation method mainly includes:

[0071] Step 101, extracting original question-answer pairs and various knowledge points from the original file.

[0072] In an exemplary embodiment, the original files may include dialog flow files and regular files.

[0073] Dialogue flow files can be further divided into two-role multi-round dialogue flow files and multi-role multi-round dialogue flow files. Two-role multi-round dialogue flow files usually originate from dialogue scenarios in customer service centers, while multi-role multi-round dialogue flow files usually originate from multiple communication scenarios such as meetings and group discussions.

[0074] Regular documents, such as a book or a contract, also fall into the category of original documents.

[0075] In some embodiments, the original question-answer pair includes an original question and an original answer. The original question and the original answer appear in pairs, and there is a mapping relationship between the original question and the original answer. The content of the original question is consistent with part of the content in the original file, and the content of the original answer is consistent with part of the content in the original file. The accuracy of the original question and the original answer can be improved.

[0076] In an exemplary embodiment, the original question can be expressed as 1 , Q 2 ,……,Q n Indicates that the original answer can be expressed as A 1 , A 2 ,……,A n Indicates that the original question-answer pair can be represented by Q 1 A 1 , Q 2 A 2 ,……,Q n A n express.

[0077] In an exemplary embodiment, a knowledge point can be an independent information unit, each knowledge point is independent of each other, and there is no coupling relationship between them, so that each knowledge point can be processed and analyzed separately. For example, a knowledge point can be a legal provision, an event, or other information units, rather than simply taking a paragraph or a chapter as a knowledge point.

[0078] In an exemplary embodiment, knowledge points can be represented by chunks. 1 、chunk 2 、……、chunk n express.

[0079] In some embodiments, the original file may include files in multiple formats. Figure 2 As shown, step 101 includes:

[0080] Step 201, parse the original file to generate a parsed text.

[0081] In an exemplary embodiment, the original file may include files in various formats. For example, the original file may include files in various formats such as PDF (Portable Document Format), DOC (a format of text files), DOCX (a format of text files), MD (Markdown, a lightweight markup language), MOBI (an e-book file format), and MP3 (a data compression format).

[0082] In an exemplary embodiment, the parsed text is in a plain text format (e.g., txt format, Markdown format) to facilitate subsequent processing and analysis. The plain text format is also compatible with the input format of the large model.

[0083] In an exemplary embodiment, parsing the original file and generating the parsed text may include extracting text from images in the original file through OCR (Optical Character Recognition); may include converting table data in the original file into text in Markdown format to retain the original table structure and data; may also include processing the audio file in the original file through audio-to-text technology to convert the audio file in the original file into text; may also include using open source tools (such as pytessetact, PyPDF2, python-docx and other tools) to parse original files in PDF, DOC, DOCX and other formats.

[0084] Step 202: extracting original question-answer pairs from the parsed text.

[0085] In some embodiments, Figure 3 As shown, step 202 includes:

[0086] Step 301, generating a fourth prompt word based on the parsed text;

[0087] Step 302: input the fourth prompt word into the large model to obtain the original question-answer pair output by the large model.

[0088] Among them, the fourth prompt word is used to instruct the large model to extract the original question and answer pairs from the parsed text, and the content of the original question and answer pairs is consistent with part of the content in the original file.

[0089] In the exemplary embodiment, a large model (also called a foundation model) refers to a machine learning model with large-scale parameters and complex computing structure, which can process massive data and complete various complex tasks, such as natural language processing, computer vision, speech recognition, etc. Large models usually have billions or even hundreds of billions of parameters.

[0090] In an exemplary embodiment, the large model may specifically be a large language model (Large Language Models, LLMs for short), which refers to a deep learning model trained using a large amount of text data, and is intended to understand and generate natural language text.

[0091] In an exemplary embodiment, generating a fourth prompt word based on the parsed text may be inputting the parsed text into a fourth prompt word template to generate the fourth prompt word. The fourth prompt word template includes the variable text, but does not include the specific parameter value of the variable text, so when the specific parameter value of the variable text changes, the fourth prompt word template does not need to be changed, and the fourth prompt word template only needs to be designed once. The fourth prompt word template may refer to extracting the original question-answer pair from the variable text. Inputting the parsed text into the fourth prompt word template to generate the fourth prompt word refers to using the parsed text as the specific parameter value of the variable text in the fourth prompt word template to generate the fourth prompt word.

[0092] Based on the parsed text, a fourth prompt word is generated, and the fourth prompt word is input into the big model to obtain the original question-answer pair output by the big model. The original question-answer pair is extracted from the parsed text by the big model. As many original question-answer pairs as possible can be extracted from the parsed text, and the fourth prompt word can ensure that the content of the original question-answer pair is consistent with part of the content in the original file.

[0093] Step 203, extracting various knowledge points from the parsed text.

[0094] In some embodiments, Figure 4 As shown, step 203 includes:

[0095] Step 401, generating a fifth prompt word based on the parsed text;

[0096] Step 402, input the fifth prompt word into the large model to obtain various knowledge points output by the large model.

[0097] Among them, the fifth prompt word is used to instruct the large model to extract various knowledge points from the parsed text.

[0098] In an exemplary embodiment, when the number of characters in the parsed text is less than or equal to a preset value, the fifth prompt word is directly generated based on the parsed text. When the number of characters in the parsed text is greater than a preset value, the parsed text is first split according to chapters or logical paragraphs to obtain each split sub-text, and the fifth prompt word is generated based on each split sub-text. For a long text, the text is first split and then each knowledge point is extracted, which can improve the efficiency of knowledge point extraction.

[0099] In an exemplary embodiment, generating the fifth prompt word based on the parsed text may be inputting the parsed text into the fifth prompt word template to generate the fifth prompt word. The fifth prompt word template includes the variable text, but does not include the specific parameter value of the variable text, so when the specific parameter value of the variable text changes, the fifth prompt word template does not need to be changed, and the fifth prompt word template only needs to be designed once. The fifth prompt word template may refer to extracting various knowledge points from the variable text. Inputting the parsed text into the fifth prompt word template to generate the fifth prompt word refers to using the parsed text as the specific parameter value of the variable text in the fifth prompt word template to generate the fifth prompt word.

[0100] Based on the parsed text, the fifth prompt word is generated, and the fifth prompt word is input into the big model to obtain the various knowledge points output by the big model. Through the guidance of the fifth prompt word, the big model can not only provide a comprehensive and well-organized compilation of knowledge points, but also greatly improve the understanding and utilization efficiency of the document content.

[0101] The original file is parsed to generate parsed text, the original question-answer pairs are extracted from the parsed text, and each knowledge point is extracted from the parsed text. The original files in different formats can be uniformly processed into parsed text in text format, and the original question-answer pairs and each knowledge point can be extracted from the parsed text, thereby improving the extraction efficiency of the original question-answer pairs and each knowledge point.

[0102] Step 102: Expand the question based on the original file to generate an expanded question.

[0103] Among them, expanding the questions of the original file refers to generating questions different from the original question-answer pairs in the original file based on the original file, that is, obtaining extended questions.

[0104] In some embodiments, question expansion of the original file can be achieved by rewriting the original question in the original question-answer pair extracted from the original file, for example, adjusting the subject, object, tense, etc. of the original question, or adjusting the scenario, expression, etc. of the original question.

[0105] Alternatively, this can be achieved by changing the declarative sentences in the original document into interrogative sentences.

[0106] In other embodiments, Figure 5 As shown, step 102 includes:

[0107] Step 501: Expand the original question in the original file to generate a first expanded question.

[0108] In an exemplary embodiment, the original question can be expressed as 1 , Q 2 ,……,Qn Indicates that the original question Q 1 The first extended question can be expanded using Q 1 1 , Q 1 2 ,……,Q 1 k Indicates that the original question Q 2 The first extended question can be expanded using Q 2 1 , Q 2 2 ,……,Q 2 k Indicates that the original question Q n The first extended question can be expanded using Q n 1 , Q n 2 ,……,Q n k express.

[0109] In some embodiments, step 501 may be implemented by rewriting the original question in the original file, for example, adjusting the subject, object, tense, etc. of the original question, or adjusting the scene, expression, etc. of the original question.

[0110] In other embodiments, Figure 6 As shown, step 501 includes:

[0111] Step 601, generating a second prompt word based on the original question;

[0112] Step 602: input the second prompt word into the large model to obtain the first extended question output by the large model.

[0113] The second prompt word is used to instruct the large model to generate a first extended question, and the first extended question is similar to but different from the original question.

[0114] In an exemplary embodiment, generating a second prompt word based on the original question may be to input the original question into a second prompt word template to generate the second prompt word. The second prompt word template includes the variable question, but does not include the specific parameter value of the variable question, so when the specific parameter value of the variable question changes, the second prompt word template does not need to be changed, and the second prompt word template only needs to be designed once. The second prompt word template may refer to generating a first extended question that is similar to but different from the variable question. Inputting the original question into the second prompt word template to generate the second prompt word refers to using the original question as the specific parameter value of the variable question in the second prompt word template to generate the second prompt word.

[0115] Based on the original question, a second prompt word is generated, and the second prompt word is input into the large model to obtain a first extended question output by the large model, wherein the second prompt word is used to instruct the large model to generate a first extended question, and the first extended question is similar to and different from the original question. By generating a series of first extended questions that are both similar to and different from the original question through the large model, the diversity and depth of the questions can be increased, and the question and answer content of the original document is further enriched, providing more perspectives and entry points for in-depth understanding and application of the knowledge of the original document, and can expand the scope of questions in the generated question and answer data, thereby improving the coverage of the generated question and answer data.

[0116] In an exemplary embodiment, the second prompt word includes a criterion for generating the first extended question, and the criterion is specifically as follows:

[0117] (1) Balance between similarity and difference: The generated first extended question should maintain a certain degree of similarity with the original question while also introducing some differences to increase the diversity and depth of the question;

[0118] (2) Answerability: Ensure that each of the first extended questions generated can be clearly answered through the original document to avoid questions that cannot be answered by the original document;

[0119] (3) Specificity and clarity: The first extended question should have clear and specific directions and avoid being vague or too broad to ensure the purpose and practicality of the first extended question;

[0120] (4) Characteristics of spoken Chinese: First, the extended questions should conform to the spoken Chinese expression habits and be close to the scenes of daily conversations, so that the questions are natural and smooth, and enhance affinity;

[0121] (5) Sentence diversity: First, expand the question by changing the sentence structure to avoid using repeated or single expressions to enrich the expression of the question;

[0122] (6) Independence: Ensure that each first extended question is independent and does not contain statements that refer to other questions or inherit previous questions, so that each first extended question can exist independently and is easy to understand and answer.

[0123] Step 502: Expand the knowledge points in the original document to generate a second expanded question.

[0124] In an exemplary embodiment, knowledge points can be represented by chunks. 1 、chunk 2 、……、chunk n Indicates. Knowledge point chunk 1 The second extended problem can be solved by Q c1 1 , Qc1 2 ,……,Q c1 k Indicates that knowledge point chunk 2 The second extended problem can be solved by Q c2 1 , Q c2 2 ,……,Q c2 k Indicates that knowledge point chunk n The second extended problem can be solved by Q cn 1 , Q cn 2 ,……,Q cn k express.

[0125] For example, if the knowledge point is that the shareholder of the company is Li San, the second extended question generated by question expansion based on the knowledge point may include: Who are the shareholders of the company? What is the equity structure of the company?

[0126] In some embodiments, step 502 may be to ask questions about various components of the knowledge points in the original document, such as subject, predicate, object, attributive, adverbial, complement, etc., to generate a second extended question; it may also be to ask questions about synonyms, near-synonyms, etc. of various components of the knowledge points in the original document.

[0127] For example, if the knowledge point is that the general manager of the company is Zhao Wu, the second extended question may include: Who is the general manager of the company? What is Zhao Wu's position in the company?

[0128] In other embodiments, Figure 7 As shown, step 502 includes:

[0129] Step 701, generating a third prompt word based on the knowledge point;

[0130] Step 702: input the third prompt word into the large model to obtain the second extended question output by the large model.

[0131] The third prompt word is used to instruct the large model to generate a second extended question, and the second extended question is used to ask questions about the knowledge point from different angles.

[0132] In an exemplary embodiment, generating a third prompt word based on a knowledge point may be inputting the knowledge point into a third prompt word template to generate the third prompt word. The third prompt word template includes the variable chunk, but does not include the specific parameter value of the variable chunk. Therefore, when the specific parameter value of the variable chunk changes, the third prompt word template does not need to be changed. The third prompt word template only needs to be designed once. The third prompt word template may refer to asking questions about the variable chunk from different angles to generate a second extended question. Inputting the knowledge point into the third prompt word template to generate the third prompt word refers to using the knowledge point as the specific parameter value of the variable chunk in the third prompt word template to generate the third prompt word.

[0133] Based on the knowledge points, a third prompt word is generated, and the third prompt word is input into the big model to obtain the second extended question output by the big model. The knowledge points are asked questions from different angles through the big model to generate a series of second extended questions corresponding to each knowledge point. The content of the knowledge point is consistent with part of the content in the original file. The second extended question can be obtained from the perspective of the original file itself, which can further expand the scope of questions in the generated question and answer data and improve the coverage of the generated question and answer data.

[0134] In an exemplary embodiment, the third prompt word includes a criterion for generating a second extended question, and the criterion is specifically as follows:

[0135] (1) Specificity and clarity: The second extended question should have clear and specific directions and avoid being vague or too broad to ensure the purpose and practicality of the second extended question;

[0136] (2) Sentence diversity: The second extended question can be changed into a variety of sentence structures, avoiding the use of repeated or single expressions to enrich the expression of the question;

[0137] (3) Independence: Ensure that each second extended question is independent and does not contain statements that refer to other questions or inherit previous questions, so that each second extended question can exist independently and is easy to understand and answer.

[0138] These criteria ensure that the second extended question can accurately reflect the content of the knowledge point and explore the knowledge point from multiple perspectives.

[0139] Step 503: Generate an extended question based on the first extended question and the second extended question.

[0140] In an exemplary embodiment, an extended question is generated based on the first extended question and the second extended question. The extended question may be generated by directly taking the set of the first extended question and the second extended question as the extended question. Alternatively, the first extended question and the second extended question may be subjected to sentence transformation to obtain the question after the sentence transformation, and the set of the first extended question, the second extended question and the question after the sentence transformation may be taken as the extended question.

[0141] The original question in the original file is expanded to generate a first extended question, the question is expanded on the knowledge point in the original file to generate a second extended question, and an extended question is generated based on the first extended question and the second extended question. The original question and knowledge point in the original file are expanded respectively, and the question is expanded from different perspectives to increase the diversity of the questions. This can expand the scope of the questions in the generated question and answer data and improve the coverage of the generated question and answer data.

[0142] Step 103, determining target knowledge points related to the extended question from various knowledge points.

[0143] In some embodiments, step 103 may be to calculate the number of overlapping characters between each knowledge point and the extended question, and determine the target knowledge point related to the extended question from each knowledge point based on the number of overlapping characters, wherein the number of overlapping characters between the target knowledge point and the extended question is greater than a threshold value for the number of overlapping characters.

[0144] In some other embodiments, step 103 includes: determining similar knowledge points of the expanded question from various knowledge points; and determining target knowledge points related to the expanded question from various similar knowledge points.

[0145] Determine the similar knowledge points of the extended question from each knowledge point, and determine the target knowledge points related to the extended question from each similar knowledge point. Through two screenings, the target knowledge points related to the extended question are determined from each knowledge point, which can improve the correlation between the target knowledge points and the extended question, and further improve the accuracy of the extended answer generated according to the target knowledge points.

[0146] In some embodiments, determining each similar knowledge point of the extended question from each knowledge point includes:

[0147] The extended question and each knowledge point are input into the retrieval model to obtain the similarity between the extended question and each knowledge point; based on the similarity, each similar knowledge point of the extended question is determined from each knowledge point.

[0148] Among them, the retrieval model is used to predict the similarity between the extended question and each knowledge point.

[0149] In an exemplary embodiment, similar knowledge points of the extended question are determined from various knowledge points according to the similarity, which can be implemented inside the retrieval model or outside the retrieval model.

[0150] In an exemplary embodiment, there are multiple implementations for determining similar knowledge points of the extended question from various knowledge points based on similarity, including but not limited to the following implementations:

[0151] Method 1

[0152] The similarities between the extended question and each knowledge point are sorted in descending order to obtain a first sorting result; the knowledge points corresponding to the first K similarities in the first sorting result are used as the similar knowledge points of the extended question. The value of K can be adjusted.

[0153] Method 2

[0154] Compare each similarity with a similarity threshold; and use the knowledge points corresponding to the similarities greater than the similarity threshold as the similar knowledge points of the extended question. The similarity threshold can be adjusted.

[0155] The similarity between the extended question and each knowledge point can be automatically obtained through the retrieval model, and further similar knowledge points of the extended question can be automatically determined from each knowledge point based on the similarity.

[0156] In some embodiments, the process of the retrieval model obtaining the similarity between the extended question and each knowledge point includes:

[0157] Generate a first vector of the extended question and a second vector of each knowledge point; and calculate the similarity between the first vector and each second vector.

[0158] In an exemplary embodiment, generating the first vector of the extended question and the second vector of each knowledge point may be by inputting the extended question and each knowledge point into BERT (Bidirectional Encoder Representation from Transformers) respectively, and obtaining the first vector of the extended question and the second vector of each knowledge point output by BERT. Inputting the extended question and each knowledge point into BERT respectively may be by inputting the extended question and each knowledge point into the same BERT model in sequence, or by inputting the extended question into a BERT model and inputting each knowledge point into another BERT model in sequence. Inputting the extended question into a BERT model and inputting each knowledge point into another BERT model in sequence, and using a dual-tower structure model to generate the first vector of the extended question and the second vector of each knowledge point, can enable parallel processing, thereby improving the efficiency of generating the first vector of the extended question and the second vector of each knowledge point.

[0159] In an exemplary embodiment, the similarity between the first vector and each second vector is calculated by using ES, Faiss or Milvus tools. ES (Elasticsearch) is a search server. Faiss is a library for high-dimensional vector indexing and clustering, supports multiple distance metrics, and performs well on large-scale data sets. Milvus is an open source feature vector similarity search engine.

[0160] In some embodiments, determining the target knowledge point related to the extended question from each similar knowledge point can be performed by calculating the number of overlapping characters between each similar knowledge point and the extended question, and determining the target knowledge point related to the extended question from each similar knowledge point based on the number of overlapping characters, wherein the number of overlapping characters between the target knowledge point and the extended question is greater than a threshold value for the number of overlapping characters.

[0161] In some other embodiments, determining a target knowledge point related to the extended question from various similar knowledge points includes:

[0162] Splice the extended questions and similar knowledge points to obtain the spliced ​​texts;

[0163] Input each of the spliced ​​texts into a classification model to obtain a classification result corresponding to each of the spliced ​​texts; wherein the classification model is used to predict the relevance between the extended questions and similar knowledge points contained in the spliced ​​text;

[0164] According to the classification results corresponding to each spliced ​​text, the target knowledge points related to the extended question are determined from various similar knowledge points.

[0165] The classification model is used to automatically obtain the classification results corresponding to each spliced ​​text, and further, according to the classification results corresponding to each spliced ​​text, the target knowledge points related to the extended question are automatically determined from various similar knowledge points.

[0166] In an exemplary embodiment, according to the classification results corresponding to each concatenated text, the target knowledge point related to the extended question is determined from each similar knowledge point, which can be implemented inside the classification model or outside the classification model.

[0167] In an exemplary embodiment, the classification result may include the probability that the extended questions and similar knowledge points contained in the spliced ​​text are related; the classification result may also include that the extended questions and similar knowledge points contained in the spliced ​​text are related, or that the extended questions and similar knowledge points contained in the spliced ​​text are not related. The classification result includes that the extended questions and similar knowledge points contained in the spliced ​​text are related, or that the extended questions and similar knowledge points contained in the spliced ​​text are not related, and the first label value may be used to indicate that the extended questions and similar knowledge points contained in the spliced ​​text are related, and the second label value may be used to indicate that the extended questions and similar knowledge points contained in the spliced ​​text are not related. For example, the first label value is 1 and the second label value is 0.

[0168] In an exemplary embodiment, there are multiple implementation methods for determining target knowledge points related to the extended question from various similar knowledge points according to the classification results corresponding to each of the concatenated texts, including but not limited to the following methods:

[0169] Method 1

[0170] The classification results include the extended questions contained in the concatenated text and the probabilities associated with similar knowledge points.

[0171] The probabilities are sorted in descending order to obtain a second sorting result; similar knowledge points corresponding to the first N probabilities in the second sorting result are used as target knowledge points related to the extended question, wherein the value of N can be adjusted.

[0172] Method 2

[0173] The classification results include the extended questions contained in the concatenated text and the probabilities associated with similar knowledge points.

[0174] Compare each probability with the probability threshold; take similar knowledge points corresponding to probabilities greater than the probability threshold as target knowledge points related to the extended question. The probability threshold can be adjusted.

[0175] Method 3

[0176] The classification result includes whether the extended questions contained in the spliced ​​text are related to the similar knowledge points, or whether the extended questions contained in the spliced ​​text are not related to the similar knowledge points.

[0177] The similar knowledge points corresponding to the classification results related to the extended questions and similar knowledge points contained in the concatenated text are taken as the target knowledge points related to the extended questions.

[0178] In some embodiments, the process of the classification model obtaining the classification results corresponding to each of the concatenated texts includes:

[0179] Generate a third vector of each concatenated text;

[0180] According to each third vector, the probability of the extended question being associated with each similar knowledge point is determined, and a classification result is generated based on the probability.

[0181] In an exemplary embodiment, the third vector of each concatenated text is generated by inputting each concatenated text into BERT in sequence to obtain the third vector of each concatenated text output by BERT.

[0182] In an exemplary embodiment, there are many ways to generate classification results based on probability, including but not limited to the following ways:

[0183] Method 1

[0184] Directly use the probability as the classification result.

[0185] Method 2

[0186] Compare each probability with the probability threshold; determine the classification result corresponding to the spliced ​​text corresponding to the probability greater than the probability threshold as the extended question and similar knowledge point contained in the spliced ​​text are related; determine the classification result corresponding to the spliced ​​text corresponding to the probability less than or equal to the probability threshold as the extended question and similar knowledge point contained in the spliced ​​text are not related. The probability threshold can be adjusted.

[0187] In some embodiments, Figure 8 As shown, the dual retrieval model includes two parts. The first part is the retrieval model, and the second part is the classification model. The retrieval model adopts a double-tower structure model. Figure 8In the method, the extended question Q is input into a BERT model in the retrieval model, and each knowledge point Chunk is input into another BERT model in the retrieval model in turn to obtain a first vector (i.e., vector representation) of the extended question and a second vector (i.e., vector representation) of each knowledge point. The similarity between the first vector and each second vector is calculated by using ES, Faiss or Milvus tools in the retrieval model, and the similarity between the extended question and each knowledge point is sorted in descending order to obtain a first sorting result. The knowledge points corresponding to the top K similarities in the first sorting result (Top K) are used as the similar knowledge points of the extended question, wherein the value of K can be adjusted. The extended question Q and each similar knowledge point (Top K) are concatenated to obtain each concatenated text, each concatenated text is input into the BERT in the classification model, and the third vector of each concatenated text is obtained. The third vector of each concatenated text is input into the softmax layer in the classification model to obtain the probability of the extended question and similar knowledge points contained in the concatenated text, and the probabilities are sorted from large to small to obtain a second sorting result, and the similar knowledge points corresponding to the top N probabilities in the second sorting result are used as the target knowledge points related to the extended question, wherein the value of N can be adjusted.

[0188] Step 104, generating an extended answer corresponding to the extended question based on the target knowledge point.

[0189] In some embodiments, step 104 can be to directly use the target knowledge point as the extended answer corresponding to the extended question when the number of target knowledge points is one; or it can be to directly splice the target knowledge points to obtain the extended answer corresponding to the extended question when the number of target knowledge points is multiple.

[0190] In other embodiments, step 104 includes: summarizing the target knowledge points and generating extended answers corresponding to the extended questions.

[0191] Summarizing the target knowledge points and generating extended answers corresponding to extended questions can ensure that the extended answers do not miss key information and are relatively concise.

[0192] Extract each knowledge point from the original file, determine the target knowledge point related to the extended question from each knowledge point, summarize the target knowledge point, and generate an extended answer corresponding to the extended question. The content of the knowledge point is consistent with some content in the original file. The extended answer is generated by summarizing the target knowledge points related to the extended question in the original file. Compared with using a large model to automatically generate question and answer data, it can reduce the occurrence of knowledge errors in question and answer data due to large model hallucinations, and improve the accuracy of question and answer data generation.

[0193] In some embodiments, the target knowledge points are summarized and concluded to generate an extended answer corresponding to the extended question. The key words in the target knowledge points can be extracted, each key word is integrated into a sentence, and the integrated sentence is used as the extended answer corresponding to the extended question.

[0194] In some other embodiments, the target knowledge points are summarized and summarized to generate extended answers corresponding to the extended questions, including:

[0195] Based on the target knowledge point, generate the first prompt word;

[0196] The first prompt word is input into the large model to obtain an extended answer output by the large model, wherein the first prompt word is used to instruct the large model to summarize the target knowledge point into an extended answer corresponding to the extended question.

[0197] In an exemplary embodiment, generating a first prompt word based on a target knowledge point may be inputting the target knowledge point into a first prompt word template to generate the first prompt word. The first prompt word template includes a variable called chunk, but does not include a specific parameter value of the variable chunk. Therefore, when the specific parameter value of the variable chunk changes, the first prompt word template does not need to be changed. The first prompt word template only needs to be designed once. The first prompt word template may refer to summarizing the variable chunk as an extended answer corresponding to the extended question. Inputting the target knowledge point into the first prompt word template to generate the first prompt word refers to using the target knowledge point as the specific parameter value of the variable chunk in the first prompt word template to generate the first prompt word.

[0198] The target knowledge points are summarized into extended answers corresponding to the extended questions through the large model, thereby improving the efficiency of generating extended answers corresponding to the extended questions.

[0199] Step 105, generating question-answer data based on the original question-answer pair, the extended question, and the extended answer.

[0200] In an exemplary embodiment, question and answer data is generated based on the original question and answer pair, the expanded question and the expanded answer. The expanded question and the expanded answer corresponding to the expanded question can be combined into an extended question and answer pair, and the set of the original question and answer pair and the expanded question and answer pair is used as the question and answer data.

[0201] In an exemplary embodiment, the original question can be expressed as 1 , Q 2 ,……,Q n Indicates that the original answer can be expressed as A 1 , A 2 ,……,A n Indicates that the original question-answer pair can be represented by Q 1 A 1, Q 2 A 2 ,……,Q n A n The first extended problem can be represented by Q 1 1 , Q 1 2 ,……,Q 1 k , Q 2 1 , Q 2 2 ,……,Q 2 k ,……,Q n 1 , Q n 2 ,……,Q n k Indicates. Knowledge points can be expressed as chunks. 1 、chunk 2 、……、chunk n The second extended problem can be expressed as c1 1 , Q c1 2 ,……,Q c1 k , Q c2 1 , Q c2 2 ,……,Q c2 k ,……,Q cn 1 , Q cn 2 ,……,Q cn k The extended problem includes the first extended problem and the second extended problem. 1 1 , Q 1 2 ,……,Q 1 k , Q 2 1 , Q 2 2 ,……,Q 2 k ,……,Q n 1 , Q n 2 ,……,Q n k , Q c1 1 , Qc1 2 ,……,Q c1 k , Q c2 1 , Q c2 2 ,……,Q c2 k ,……,Q cn 1 , Q cn 2 ,……,Q cn k} and knowledge points {chunk 1 、chunk 2 、……、chunk n} Input to Figure 8 The dual retrieval model shown obtains each target knowledge point related to the extended question output by the dual retrieval model, generates a first prompt word based on the target knowledge point, inputs the first prompt word into the large model, and obtains the extended answer output by the large model, wherein the first prompt word is used to instruct the large model to summarize the target knowledge point into an extended answer corresponding to the extended question, and combines the extended question and the extended answer corresponding to the extended question into an extended question and answer pair, manually screens the extended question and answer pairs to eliminate extended question and answer pairs that do not meet the requirements or are of low quality, and uses the collection of the original question and answer pairs and the screened extended question and answer pairs as question and answer data.

[0202] To expand the question Q 1 1 As an example, we elaborate on the generation expansion problem Q 1 1 The corresponding extended answer is A 1 1 The process of generating the extended answers corresponding to other extended questions is similar and will not be described in detail. 1 1 And knowledge points {chunk 1 、chunk 2 、……、chunk n} Input to Figure 8 The dual retrieval model shown in the figure consists of two parts: the first part is the retrieval model and the second part is the classification model. The retrieval model adopts a dual-tower structure model. 1 1 Input into a BERT model in the retrieval model, and convert each knowledge point {chunk 1 、chunk 2 、……、chunk n} is sequentially input into another BERT model in the retrieval model to obtain the extended question Q1 1 The first vector and each knowledge point {chunk 1 、chunk 2 、……、chunk n}, and calculate the similarity between the first vector and each second vector (i.e., Q 1 1 The first vector and chunk 1 The similarity between the second vector, Q 1 1 The first vector and chunk 2 The similarity between the second vector of 1 1 The first vector and chunk n ), we will expand the problem Q 1 1 The similarities between the knowledge points are sorted in descending order to obtain the first sorting result, and the knowledge points corresponding to the first K similarities in the first sorting result are {chunk i1 、chunk i2 、……、chunk iK}, as an extended question Q 1 1 Various similar knowledge points.

[0203] The extended question Q 1 1 and each similar knowledge point {chunk i1 、chunk i2 、……、chunk iK} splicing, and obtain the spliced ​​text (i.e. Q 1 1 and chunk i1 The concatenated text, Q 1 1 and chunk i2 The concatenated text, ..., Q 1 1 and chunk iK The concatenated texts are input into the BERT in the classification model to obtain the third vectors of the concatenated texts, and the third vectors of the concatenated texts are input into the softmax layer in the classification model to obtain the probabilities of the extended questions and similar knowledge points contained in the concatenated texts, and the probabilities are sorted from large to small to obtain the second sorting result, and the similar knowledge points corresponding to the first N probabilities in the second sorting result are {chunk j1、chunk j2 、……、chunk jN}, as the target knowledge points related to the extended problem. Based on the target knowledge points {chunk j1 、chunk j2 、……、chunk jN}, generate the first prompt word, input the first prompt word into the large model, and obtain the extended answer A output by the large model 1 1 , where the first prompt word is used to instruct the large model to convert the target knowledge point {chunk j1 、chunk j2 、……、chunk jN}Summarize and expand the problem Q 1 1 The corresponding extended answer is A 1 1 .

[0204] And so on, generate the extended question Q 1 2 The corresponding extended answer is A 1 2 , ..., generate extended question Q 1 k The corresponding extended answer is A 1 k , generate the extended question Q 2 1 The corresponding extended answer is A 2 1 , generate the extended question Q 2 2 The corresponding extended answer is A 2 2 , ..., generate extended question Q 2 k The corresponding extended answer is A 2 k , ..., generate extended question Q n 1 The corresponding extended answer is A n 1 , generate the extended question Q n 2 The corresponding extended answer is A n 2 , ..., generate extended question Q n k The corresponding extended answer is A n k , generate the extended question Q c1 1 The corresponding extended answer is A c1 1, generate the extended question Q c1 2 The corresponding extended answer is A c1 2 , ..., generate extended question Q c1 k The corresponding extended answer is A c1 k , generate the extended question Q c2 1 The corresponding extended answer is A c2 1 , generate the extended question Q c2 2 The corresponding extended answer is A c2 2 , ..., generate extended question Q c2 k The corresponding extended answer is A c2 k , ..., generate extended question Q cn 1 The corresponding extended answer is A cn 1 , generate the extended question Q cn 2 The corresponding extended answer is A cn 2 , ..., generate extended question Q cn k The corresponding extended answer is A cn k The extended question and the corresponding extended answer are combined into an extended question-answer pair {Q 1 1 A 1 1 , Q 1 2 A 1 2 ,……,Q 1 k A 1 k , Q 2 1 A 2 1 , Q 2 2 A 2 2 ,……,Q 2 k A 2 k ,……,Q n 1 A n 1 , Q n2 A n 2 ,……,Q n k A n k , Q c1 1 A c1 1 , Q c1 2 A c1 2 ,……,Q c1 k A c1 k , Q c2 1 A c2 1 , Q c2 2 A c2 2 ,……,Q c2 k A c2 k ,……,Q cn 1 A cn 1 , Q cn 2 A cn 2 ,……,Q cn k A cn k}, the extended question-answer pairs are manually screened to eliminate the extended question-answer pairs that do not meet the requirements or are of low quality, and the collection of the original question-answer pairs and the screened extended question-answer pairs is used as the question-answer data.

[0205] In summary, in this application, questions are expanded based on the original file to generate extended questions, which can expand the scope of questions in the generated question and answer data and improve the coverage of the generated question and answer data. Each knowledge point is extracted from the original file, and the target knowledge point related to the extended question is determined from each knowledge point. The extended answer corresponding to the extended question is generated according to the target knowledge point. The content of the knowledge point is consistent with part of the content in the original file. The extended answer is directly generated based on the knowledge point related to the extended question in the original file. Compared with the use of a large model to automatically generate question and answer data, it can reduce the occurrence of knowledge errors in the question and answer data due to the illusion of the large model, and improve the accuracy of question and answer data generation.

[0206] Exemplary Devices

[0207] Accordingly, the embodiment of the present application also provides a question-answer data generating device, such as Fig. 9 As shown, the question and answer data generating device includes:

[0208] An extraction unit 901 is used to extract original question-answer pairs and various knowledge points from the original file;

[0209] An expansion unit 902, configured to expand a question based on the original file to generate an expanded question;

[0210] A processing unit 903 is used to determine a target knowledge point related to the extended question from each of the knowledge points;

[0211] A first generating unit 904 is used to generate an extended answer corresponding to the extended question according to the target knowledge point;

[0212] The second generating unit 905 is used to generate question and answer data according to the original question and answer pair, the extended question and the extended answer.

[0213] Optionally, the processing unit 903 includes:

[0214] A first generating subunit, used to generate a first vector of the extended question and a second vector of each of the knowledge points;

[0215] A first processing subunit, configured to calculate the similarity between the first vector and each of the second vectors;

[0216] A second processing subunit is used to determine, from each of the knowledge points, similar knowledge points of the extended question according to the similarity;

[0217] The third processing subunit is used to determine the target knowledge point related to the extended question from each of the similar knowledge points.

[0218] Optionally, the third processing sub-unit is specifically used to splice the extended question and each of the similar knowledge points to obtain each spliced ​​text; generate a third vector for each of the spliced ​​texts; determine the probability of the extended question and each of the similar knowledge points being related based on each of the third vectors; and determine the target knowledge point related to the extended question from each of the similar knowledge points based on the probability.

[0219] Optionally, the first generating unit 904 is specifically used to summarize the target knowledge points and generate an extended answer corresponding to the extended question.

[0220] Optionally, the first generation unit 904 is specifically used to generate a first prompt word based on the target knowledge point; input the first prompt word into the big model to obtain an extended answer output by the big model, wherein the first prompt word is used to instruct the big model to summarize the target knowledge point into an extended answer corresponding to the extended question.

[0221] Optionally, the original question-answer pair includes an original question and an original answer;

[0222] The extension unit 902 includes:

[0223] A first expansion subunit is used to expand the original question in the original file to generate a first expanded question;

[0224] A second expansion subunit is used to expand the knowledge point in the original file to generate a second expanded question;

[0225] The second generating subunit is used to generate an extended question according to the first extended question and the second extended question.

[0226] Optionally, the first expansion subunit is specifically used to generate a second prompt word based on the original question; input the second prompt word into the large model to obtain a first expanded question output by the large model, wherein the second prompt word is used to instruct the large model to generate a first expanded question, and the first expanded question is similar to and different from the original question.

[0227] Optionally, the second extension subunit is specifically used to generate a third prompt word based on the knowledge point; input the third prompt word into the large model to obtain a second extended question output by the large model, wherein the third prompt word is used to instruct the large model to generate a second extended question, and the second extended question is used to ask questions about the knowledge point from different angles.

[0228] The question-and-answer data generating device provided in this embodiment belongs to the same application concept as the question-and-answer data generating method provided in the above embodiments of this application, and can execute the question-and-answer data generating method provided in any of the above embodiments of this application, and has the corresponding functional modules and beneficial effects of executing the question-and-answer data generating method. For technical details not fully described in this embodiment, please refer to the specific processing content of the question-and-answer data generating method provided in the above embodiments of this application, and will not be repeated here.

[0229] The functions implemented by the above extraction unit 901, expansion unit 902, processing unit 903, first generation unit 904 and second generation unit 905 can be implemented by the same or different processors respectively, and the embodiment of the present application is not limited thereto.

[0230] It should be understood that the units in the above devices can be implemented in the form of a processor calling software. For example, the device includes a processor, the processor is connected to a memory, and instructions are stored in the memory. The processor calls the instructions stored in the memory to implement any of the above methods or realize the functions of each unit of the device, wherein the processor can be a general-purpose processor, such as a CPU or a microprocessor, etc., and the memory can be a memory in the device or a memory outside the device. Alternatively, the units in the device can be implemented in the form of hardware circuits, and the functions of some or all units can be realized by designing the hardware circuits. The hardware circuit can be understood as one or more processors; for example, in one implementation, the hardware circuit is an ASIC, and the functions of some or all of the above units are realized by designing the logical relationship of the components in the circuit; for another example, in another implementation, the hardware circuit can be implemented by PLD, taking FPGA as an example, which can include a large number of logic gate circuits, and the connection relationship between the logic gate circuits is configured by the configuration file, so as to realize the functions of some or all of the above units. All units of the above devices can be implemented in the form of a processor calling software, or in the form of hardware circuits, or in part by a processor calling software, and the remaining part is implemented in the form of hardware circuits.

[0231] In an embodiment of the present application, a processor is a circuit with the ability to process signals. In one implementation, the processor may be a circuit with the ability to read and run instructions, such as a CPU, a microprocessor, a GPU, or a DSP; in another implementation, the processor may implement certain functions through the logical relationship of a hardware circuit, and the logical relationship of the hardware circuit is fixed or reconfigurable, such as a hardware circuit implemented by an ASIC or PLD, such as an FPGA. In a reconfigurable hardware circuit, the process of the processor loading a configuration document to implement the hardware circuit configuration can be understood as the process of the processor loading instructions to implement the functions of some or all of the above units. In addition, it can also be a hardware circuit designed for artificial intelligence, which can be understood as an ASIC, such as an NPU, TPU, DPU, etc.

[0232] It can be seen that each unit in the above device can be one or more processors (or processing circuits) configured to implement the above method, such as: CPU, GPU, NPU, TPU, DPU, microprocessor, DSP, ASIC, FPGA, or a combination of at least two of these processor forms.

[0233] In addition, all or part of the units in the above device can be integrated together, or can be implemented independently. In one implementation, these units are integrated together and implemented in the form of a SOC. The SOC may include at least one processor for implementing any of the above methods or implementing the functions of each unit of the device. The type of the at least one processor may be different, for example, including a CPU and an FPGA, a CPU and an artificial intelligence processor, a CPU and a GPU, etc.

[0234] Exemplary Electronic Devices

[0235] The present application also provides an electronic device, see Fig.10 As shown, the device includes:

[0236] Memory 200 and processor 210;

[0237] The memory 200 is connected to the processor 210 and is used to store programs;

[0238] The processor 210 is used to implement the question and answer data generating method disclosed in any of the above embodiments by running the program stored in the memory 200.

[0239] Specifically, the electronic device may further include: a bus, a communication interface 220 , an input device 230 and an output device 240 .

[0240] The processor 210, the memory 200, the communication interface 220, the input device 230 and the output device 240 are connected to each other via a bus.

[0241] A bus may include a pathway that transfers information between components of a computer system.

[0242] The processor 210 may be a general-purpose processor, such as a general-purpose central processing unit (CPU), a microprocessor, etc., or an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the scheme of the present invention. It may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0243] The processor 210 may include a main processor, and may also include a baseband chip, a modem, and the like.

[0244] The memory 200 stores a program for executing the technical solution of the present invention, and may also store an operating system and other key services. Specifically, the program may include a program code, and the program code includes a computer operation instruction. More specifically, the memory 200 may include a read-only memory (ROM), other types of static storage devices that can store static information and instructions, a random access memory (RAM), other types of dynamic storage devices that can store information and instructions, a disk storage, a flash, and the like.

[0245] The input device 230 may include a device for receiving data and information input by a user, such as a keyboard, a mouse, a camera, a scanner, a light pen, a voice input device, a touch screen, a pedometer, or a gravity sensor.

[0246] Output device 240 may include devices that allow information to be output to a user, such as a display screen, printer, speaker, etc.

[0247] The communication interface 220 may include any transceiver or the like to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Network (WLAN), etc.

[0248] The processor 210 executes the program stored in the memory 200 and calls other devices, which can be used to implement each step of any question and answer data generation method provided in the above embodiments of the present application.

[0249] Exemplary computer program products and storage media

[0250] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the question and answer data generation method according to various embodiments of the present application described in any of the above embodiments of this specification.

[0251] The computer program product may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0252] In addition, the embodiment of the present application may also be a storage medium on which a computer program is stored. The computer program is executed by a processor to execute the steps of the question and answer data generating method according to various embodiments of the present application described in any of the above embodiments of this specification, and specifically the following steps may be implemented:

[0253] Step 101, extracting original question-answer pairs and various knowledge points from the original file;

[0254] Step 102, expanding the question based on the original file to generate an extended question;

[0255] Step 103, determining target knowledge points related to the extended question from various knowledge points;

[0256] Step 104, generating an extended answer corresponding to the extended question according to the target knowledge point;

[0257] Step 105, generating question-answer data based on the original question-answer pair, the extended question, and the extended answer.

[0258] For the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0259] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0260] The steps in the methods of each embodiment of the present application can be adjusted in order, combined and deleted according to actual needs, and the technical features recorded in each embodiment can be replaced or combined.

[0261] The modules and sub-modules in the devices and terminals in the various embodiments of the present application can be combined, divided and deleted according to actual needs.

[0262] In the several embodiments provided in the present application, it should be understood that the disclosed terminals, devices and methods can be implemented in other ways. For example, the terminal embodiments described above are only schematic, for example, the division of modules or submodules is only a logical function division, and there may be other division methods in actual implementation, for example, multiple submodules or modules can be combined or integrated into another module, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.

[0263] The modules or submodules described as separate components may or may not be physically separated, and the components of the modules or submodules may or may not be physical modules or submodules, that is, they may be located in one place, or they may be distributed on multiple network modules or submodules. Some or all of the modules or submodules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0264] In addition, each functional module or submodule in each embodiment of the present application may be integrated into one processing module, or each module or submodule may exist physically separately, or two or more modules or submodules may be integrated into one module. The above-mentioned integrated modules or submodules may be implemented in the form of hardware or in the form of software functional modules or submodules.

[0265] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0266] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly by hardware, software units executed by a processor, or a combination of the two. The software units may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0267] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0268] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for generating question and answer data, characterized in that: include: Extract original question-answer pairs and various knowledge points from the original documents; Expanding the question based on the original file to generate an extended question; Determine a target knowledge point related to the extended question from each of the knowledge points; According to the target knowledge point, generating an extended answer corresponding to the extended question; Question and answer data is generated according to the original question and answer pair, the extended question and the extended answer.

2. The question-answer data generating method according to claim 1, characterized in that: The step of determining a target knowledge point related to the extended question from each of the knowledge points includes: Generate a first vector of the extended question and a second vector of each of the knowledge points; Calculating the similarity between the first vector and each of the second vectors; Determining, according to the similarity, each similar knowledge point of the extended question from each of the knowledge points; Determine a target knowledge point related to the extended question from each of the similar knowledge points.

3. The question-answer data generating method according to claim 2, characterized in that: The step of determining a target knowledge point related to the extended question from each of the similar knowledge points includes: Splicing the extended question and each of the similar knowledge points to obtain each spliced ​​text; Generate a third vector of each of the concatenated texts; Determining, according to each of the third vectors, the probability that the extended question is associated with each of the similar knowledge points; According to the probability, a target knowledge point related to the extended question is determined from each of the similar knowledge points.

4. The question-answer data generating method according to claim 1, characterized in that: Generating an extended answer corresponding to the extended question according to the target knowledge point includes: The target knowledge points are summarized and concluded to generate extended answers corresponding to the extended questions.

5. The question-answer data generating method according to claim 4, characterized in that: The step of summarizing the target knowledge points and generating an extended answer corresponding to the extended question includes: Based on the target knowledge point, generating a first prompt word; The first prompt word is input into the large model to obtain an extended answer output by the large model, wherein the first prompt word is used to instruct the large model to summarize the target knowledge point into an extended answer corresponding to the extended question.

6. The question-answer data generating method according to claim 1, characterized in that: The original question-answer pair includes an original question and an original answer; The step of expanding the question based on the original file to generate an extended question includes: Expanding the original question in the original file to generate a first expanded question; Expanding the knowledge point in the original document to generate a second expanded question; An extended question is generated according to the first extended question and the second extended question.

7. The question-answer data generating method according to claim 6, characterized in that: The step of expanding the original question in the original file to generate a first expanded question includes: Based on the original question, generate a second prompt word; The second prompt word is input into the large model to obtain a first extended question output by the large model, wherein the second prompt word is used to instruct the large model to generate a first extended question, and the first extended question is similar to and different from the original question.

8. The question-answer data generating method according to claim 6, characterized in that: The step of expanding the knowledge point in the original file to generate a second expanded question includes: Based on the knowledge point, generate a third prompt word; The third prompt word is input into the large model to obtain a second extended question output by the large model, wherein the third prompt word is used to instruct the large model to generate a second extended question, and the second extended question is used to ask questions about the knowledge point from different angles.

9. A question-answer data generating device, characterized in that: include: An extraction unit, used to extract original question-answer pairs and various knowledge points from the original file; An extension unit, used for extending questions based on the original file to generate extended questions; A processing unit, used to determine a target knowledge point related to the extended question from each of the knowledge points; A first generating unit, configured to generate an extended answer corresponding to the extended question according to the target knowledge point; The second generating unit is used to generate question and answer data according to the original question and answer pair, the extended question and the extended answer.

10. An electronic device, characterized in that: including memory and processor; The memory is connected to the processor and is used to store programs; The processor is used to implement the question and answer data generating method according to any one of claims 1 to 8 by running the program in the memory.

11. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, the method for generating question and answer data according to any one of claims 1 to 8 is implemented.

12. A computer program product, characterized in that The method comprises computer program instructions, which, when executed by a processor, enable the processor to execute the question and answer data generating method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Document answering method and apparatus, and electronic device and non-volatile storage medium

    WO2026199851A1