A method and system for evaluating large-model multi-dimensional question-answer pair generation tasks
Through the multi-dimensional question and answer pair generation task evaluation method for large models, the uncertainty and high cost of the question and answer pair generation model performance evaluation in the existing technology are solved, a systematic evaluation process is realized, and the evaluation efficiency and consistency are improved. sex, promoting the development of related fields.
Patent Information
- Application Number
- CN202410343729.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-25
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-03-25
AI Technical Summary
The existing technology lacks effective quantitative indicators to evaluate the performance of question-answer pair generation models, especially in specific vertical fields, resulting in manual evaluation uncertainty, high cost, and inconsistency, making it difficult to effectively evaluate the quality of question-answer pairs.
An evaluation method for multi-dimensional question and answer pair generation tasks for large models is proposed. By obtaining text paragraphs, extracting question and answer pairs, calculating knowledge coverage, accuracy, richness, fluency and diversity indicators, combined with vectorization to evaluate model performance, it provides Systematic assessment process.
It achieves effective assessment of the quality of question and answer generation tasks from multiple dimensions, improves the efficiency and consistency of assessment, reduces the cost of manual assessment, and promotes the development of related fields and applications.
Smart Images

Figure CN118093344B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language processing, and in particular to a method and system for evaluating a large-model multi-dimensional question-answer pair generation task. Background Art
[0002] With the development of the field of Natural Language Processing (NLP), large language models (LLM) such as ChatGPT and LLaMA have shown strong competitiveness in many natural language processing tasks (such as knowledge question answering and open domain question answering). Traditional NLP methods often rely on rule-based or limited machine learning techniques to handle only specific tasks, which limits their ability to handle complex language tasks. In contrast, LLMs have surpassed these limitations through deeper and broader language understanding capabilities. For example, they are able to perform a variety of advanced tasks such as sentiment analysis, language generation, summarization, and translation, and in many cases approach or reach human-level performance. The training of a complete LLM usually follows a relatively common process: pre-training stage and fine-tuning stage. In the pre-training stage, the entire model is trained with a large amount of text containing human knowledge using an unsupervised training strategy, so that the model can learn and store knowledge. In the fine-tuning stage, the pre-trained model is fine-tuned using instruction data (usually in the form of question-answer pairs) so that the model can follow human instructions to complete the corresponding tasks, such as knowledge question answering.
[0003] Although some LLMs, such as ChatGPT, perform close to human performance on certain tasks in general domains, they are still poorly performing in these specific vertical domains due to the limitations of expertise in specific domains or the particularity of professional terms. In order to enhance the performance of LLM in specific vertical domains, fine-tuning through specific vertical domain instruction data has been proven to be an effective solution, such as ChatLaw in the legal field and HuaTuo in the medical field. In order to enhance the capabilities of LLM in specific vertical domains, it is often necessary to collect a large amount of supervised instruction fine-tuning data in specific domains to fine-tune LLM, and the collection or construction of instruction fine-tuning data for these specific domains is still a huge challenge. A possible solution is to use the text in a specific domain as the knowledge basis and introduce an instruction generation model to complete the synthesis of instruction data in a specific domain for downstream fine-tuning tasks. Since the instruction data for fine-tuning LLM usually exists in the form of question-answer pairs (Q-Apairs), although the Q-A pair extraction task is an application scenario of natural language processing, the Q-A pair extraction task has always lacked quantitative indicators to evaluate the quality of instruction generation data. Therefore, how to judge the quality of these synthetic data and then evaluate the performance of the instruction fine-tuning data generation model (question-answer generation model) is an urgent problem to be solved.
[0004] In some early work on question-answer pair generation, there are also some evaluation indicators to evaluate the performance of question-answer pair generation models, such as calculating the similarity between generated questions and labeled questions to measure the performance of question-answer pair extraction models. Specific evaluation indicators used include BLEU-1, BLEU-2, Rouge-1, Rouge-2, and Rouge-L. However, due to the particularity of the task form, the question-answer pairs generated by the model are relatively open and have no standard answers, which makes it difficult to measure the performance of the question-answer pair extraction model based on the similarity between the generated questions and the labeled questions. In addition, for actual task scenarios, the high quality generated based on deep understanding of knowledge is mainly reflected in the fact that question-answer pairs often require knowledge integration, knowledge reasoning, content organization and other aspects. Therefore, the content of the generated question-answer pairs is relatively complex, so these evaluation methods cannot effectively quantify the performance of the model.
[0005] Since there is no widely accepted automatic evaluation metric for the quality of question-answer pairs in the field of question-answer pair generation, the mainstream solution is to use manual evaluation to evaluate the quality of generated question-answer pairs. Although manual evaluation intuitively seems to be more capable of capturing the subtle differences in quantitative ability, it also comes with some significant challenges and limitations.
[0006] (1) Uncertainty of manual evaluation: A major problem with manual evaluation is its uncertainty. Since the evaluation process is highly dependent on individual judgment and subjectivity, this may lead to doubts about the reliability and validity of the evaluation results. For example, when evaluating the performance of a project or person, different evaluators may give different evaluations due to their background, experience, and bias. This uncertainty not only affects the consistency of the evaluation, but may also affect the quality of the decision.
[0007] (2) The cost of manual evaluation: Compared with automated quantitative evaluation methods, manual evaluation is often more time-consuming and costly. This includes the time and money spent on human resources for the evaluation process. In large-scale scenarios or where rapid feedback is required, the cost of manual evaluation may become a significant limiting factor.
[0008] (3) Inconsistency in manual evaluation: Another important issue with manual evaluation is inconsistency, which is caused by differences in evaluation criteria and quality between different evaluators. For example, two evaluators may have completely different views on the efficiency and effectiveness of the same project. This inconsistency not only makes it difficult to compare evaluation results, but may also lead to doubts about the fairness of the evaluation process. Summary of the invention
[0009] The purpose of the present invention is to provide an efficient method and system for evaluating large-model multi-dimensional question-answer pair generation tasks, so as to effectively evaluate the quality of question-answer pair (Q-Apairs) generation from multiple dimensions, and further promote the advancement of related fields and applications.
[0010] In order to solve the above technical problems, the present invention provides a method for evaluating a large-model multi-dimensional question-answer pair generation task, comprising the following steps:
[0011] Get the text paragraph;
[0012] Extracting question-answer pairs from text paragraphs using a question-answer pair extraction model; the question-answer pairs include questions and answers;
[0013] Extract entities and triples from text paragraphs and answers;
[0014] The knowledge coverage is calculated based on the entities and triples of the text paragraphs and answers;
[0015] Based on the entities and triples of the text paragraph, the accuracy is calculated;
[0016] Based on the entities in the answer and the length of the answer, the richness is calculated;
[0017] Based on the number of words and characters in the answer, the fluency was calculated;
[0018] Vectorize the question and answer to obtain a question vector and an answer vector;
[0019] Based on the question vector and the answer vector, the diversity evaluation index is calculated;
[0020] The performance of the question-answer pair extraction model is evaluated based on knowledge coverage, accuracy, richness, fluency, and diversity evaluation metrics.
[0021] Preferably, the diversity evaluation index is calculated based on the question vector and the answer vector, which specifically includes the following steps:
[0022] Based on the question vector and the answer vector, the similarity between questions and the similarity between answers are calculated;
[0023] The diversity evaluation index is calculated based on the similarity between questions and the similarity between answers.
[0024] Preferably, the calculation formulas for the similarity between questions and the similarity between answers are:
[0025]
[0026]
[0027] Among them: sim_score_q is the average similarity score between multiple questions generated by given knowledge content, sim_score_a is the average similarity score between the corresponding multiple answers; q k is the vector representation corresponding to the kth question; a k is the vector representation corresponding to the kth answer; q i is the vector representation corresponding to the i-th question; a i is the vector representation corresponding to the i-th answer;
[0028] The calculation formula of the diversity evaluation index is:
[0029] diversity_score=(1-sim_score_q)+(1-sim_score_a).
[0030] Among them: diversity_score is the diversity evaluation indicator.
[0031] Preferably, the calculation formula of the richness is as follows:
[0032] rich_score=α*mean_len+(1-α)*mean_ner_nums
[0033] Among them: α is the coefficient for adjusting the weights of the two sub-indicators; rich_score represents richness.
[0034] Preferably, the calculation formula of the fluency is as follows:
[0035]
[0036] Where: N represents the number of words or characters in the current answer; w i represents the i-th word or text; PPL(W) represents fluency.
[0037] Preferably, the knowledge coverage is calculated based on the entities and triples of the text paragraphs and the answers, which specifically includes the following steps:
[0038] Based on the entities in the text paragraph and the answer, the entity coverage is calculated;
[0039] Based on the triples of text paragraphs and answers, the relation triple coverage is calculated;
[0040] The knowledge coverage is calculated based on the entity coverage and relationship triple coverage.
[0041] Preferably, the calculation formula of the entity coverage is as follows:
[0042]
[0043] Where: ner_cover_ratio represents entity coverage; set(q i _ner_list) represents the entity set in the named entity list extracted from the question; set(p_ner_list) represents the entity set in the named entity list extracted from the knowledge content;
[0044] The calculation formula of the relationship triple coverage is as follows:
[0045]
[0046] Where: triple_cover_ratio represents the coverage of the relation triples; set(q i _triple_list) represents the triple set of the relation triple list extracted from the question; set(p_triple_list) represents the triple set of the relation triple list extracted from the knowledge content;
[0047] The calculation formula of the knowledge coverage is as follows:
[0048] cover_score=0.5*(triple_cover_ratio)+0.5*(ner_cover_ratio).
[0049] Preferably, the accuracy is calculated based on the entities and triples of the text paragraph, which specifically includes the following steps:
[0050] Based on the entities of the text paragraph, the correctness evaluation of the key concepts is calculated;
[0051] According to the triples of the text paragraph, the correctness evaluation of the triple concept matching is calculated;
[0052] Based on the correctness evaluation of the key concepts and the correctness evaluation of the triple concept matching, the accuracy is calculated.
[0053] Preferably, the calculation formula for evaluating the correctness of the key concept is:
[0054]
[0055] Where: q i _key_list is the key concept extracted from the i-th question, and p_key_list is the key concept extracted from the provided knowledge content;
[0056] The calculation formula for evaluating the correctness of the triple concept matching is:
[0057]
[0058] The calculation formula of the accuracy is:
[0059] accuracy_score=0.5*key_accuracy+0.5*triple_accuracy.
[0060] The present invention also provides a large-model multi-dimensional question-answer pair generation task evaluation system, comprising:
[0061] The acquisition module is used to obtain text paragraphs;
[0062] A question-answer pair extraction module, used to extract question-answer pairs from text paragraphs using a question-answer pair extraction model; the question-answer pairs include questions and answers;
[0063] Entity and triple extraction module, which is used to extract entities and triples from text paragraphs and answers;
[0064] A knowledge coverage calculation module is used to calculate the knowledge coverage based on the entities and triples of the text paragraphs and answers;
[0065] An accuracy calculation module, used to calculate the accuracy based on the entities and triples of the text paragraph;
[0066] A richness calculation module, used to calculate the richness according to the entity of the answer and the length of the answer;
[0067] A fluency calculation module is used to calculate the fluency according to the number of words and characters in the answer;
[0068] A vector module is used to vectorize questions and answers to obtain question vectors and answer vectors;
[0069] A diversity evaluation index calculation module is used to calculate the diversity evaluation index according to the question vector and the answer vector;
[0070] The evaluation module is used to evaluate the performance of the question-answer pair extraction model based on knowledge coverage, accuracy, richness, fluency, and diversity evaluation metrics.
[0071] Compared with the prior art, the present invention has the following beneficial effects:
[0072] The present invention can realize the effective generation of question-answer pairs (Q-Apairs) from multiple dimensions, thereby promoting the advancement of related fields and applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] The specific implementation modes of the present invention are further described in detail below with reference to the accompanying drawings.
[0074] Figure 1 It is the whole process architecture diagram of the evaluation system;
[0075] Figure 2 This is a diagram of the dimensions of the ChatGPT3.5-turbo evaluation system. DETAILED DESCRIPTION
[0076] Many specific details are set forth in the following description to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present invention, so the present invention is not limited to the specific implementation disclosed below.
[0077] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0078] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0079] The present invention is further described in detail below in conjunction with the accompanying drawings:
[0080] The present invention provides a method for evaluating a large-model multi-dimensional question-answer pair generation task, comprising the following steps:
[0081] Get the text paragraph;
[0082] Extracting question-answer pairs from text paragraphs using a question-answer pair extraction model; the question-answer pairs include questions and answers;
[0083] Extract entities and triples from text paragraphs and answers;
[0084] The knowledge coverage is calculated based on the entities and triples of the text paragraphs and answers;
[0085] Based on the entities and triples of the text paragraph, the accuracy is calculated;
[0086] Based on the entities in the answer and the length of the answer, the richness is calculated;
[0087] Based on the number of words and characters in the answer, the fluency was calculated;
[0088] Vectorize the question and answer to obtain a question vector and an answer vector;
[0089] Based on the question vector and the answer vector, the diversity evaluation index is calculated;
[0090] The performance of the question-answer pair extraction model is evaluated based on knowledge coverage, accuracy, richness, fluency, and diversity evaluation metrics.
[0091] Preferably, the diversity evaluation index is calculated based on the question vector and the answer vector, which specifically includes the following steps:
[0092] Based on the question vector and the answer vector, the similarity between questions and the similarity between answers are calculated;
[0093] The diversity evaluation index is calculated based on the similarity between questions and the similarity between answers.
[0094] Preferably, the calculation formulas for the similarity between questions and the similarity between answers are:
[0095]
[0096]
[0097] The calculation formulas for the similarity between questions and the similarity between answers are as follows:
[0098]
[0099]
[0100] Among them: sim_score_q is the average similarity score between multiple questions generated by given knowledge content, sim_score_a is the average similarity score between the corresponding multiple answers; q k is the vector representation corresponding to the kth question; a k is the vector representation corresponding to the kth answer; q i is the vector representation corresponding to the i-th question; a i is the vector representation corresponding to the i-th answer;
[0101] The calculation formula of the diversity evaluation index is:
[0102] diversity_score=(1-sim_score_q)+(1-sim_score_a)
[0103] Among them: diversity_score is the diversity evaluation indicator.
[0104] Preferably, the calculation formula of the richness is as follows:
[0105] rich_score=α*mean_len+(1-α)*mean_ner_nums
[0106] Among them: α is the coefficient for adjusting the weights of the two sub-indicators; rich_score represents richness.
[0107] Preferably, the calculation formula of the fluency is as follows:
[0108]
[0109] Where: N represents the number of words or characters in the current answer; w i represents the i-th word or text; PPL(W) represents fluency.
[0110] Preferably, the knowledge coverage is calculated based on the entities and triples of the text paragraphs and the answers, which specifically includes the following steps:
[0111] Based on the entities in the text paragraph and the answer, the entity coverage is calculated;
[0112] Based on the triples of text paragraphs and answers, the relation triple coverage is calculated;
[0113] The knowledge coverage is calculated based on the entity coverage and relationship triple coverage.
[0114] Preferably, the calculation formula of the entity coverage is as follows:
[0115]
[0116] Where: ner_cover_ratio represents entity coverage; set(q i _ner_list) represents the entity set in the named entity list extracted from the question; set(p_ner_list) represents the entity set in the named entity list extracted from the knowledge content;
[0117] The calculation formula of the relationship triple coverage is as follows:
[0118]
[0119] Where: triple_cover_ratio represents the coverage of the relation triples; set(q i _triple_list) represents the triple set of the relation triple list extracted from the question; set(p_triple_list) represents the triple set of the relation triple list extracted from the knowledge content;
[0120] The calculation formula of the knowledge coverage is as follows:
[0121] cover_score=0.5*(triple_cover_ratio)+0.5*(ner_cover_ratio).
[0122] Preferably, the accuracy is calculated based on the entities and triples of the text paragraph, which specifically includes the following steps:
[0123] Based on the entities of the text paragraph, the correctness evaluation of the key concepts is calculated;
[0124] According to the triples of the text paragraph, the correctness evaluation of the triple concept matching is calculated;
[0125] Based on the correctness evaluation of the key concepts and the correctness evaluation of the triple concept matching, the accuracy is calculated.
[0126] Preferably, the calculation formula for evaluating the correctness of the key concept is:
[0127]
[0128] Where: q i _key_list is the key concept extracted from the i-th question, and p_key_list is the key concept extracted from the provided knowledge content;
[0129] The calculation formula for evaluating the correctness of the triple concept matching is:
[0130]
[0131] The calculation formula of the accuracy is:
[0132] accuracy_score=0.5*key_accuracy+0.5*triple_accuracy.
[0133] The present invention also provides a large-model multi-dimensional question-answer pair generation task evaluation system, comprising:
[0134] The acquisition module is used to obtain text paragraphs;
[0135] A question-answer pair extraction module, used to extract question-answer pairs from text paragraphs using a question-answer pair extraction model; the question-answer pairs include questions and answers;
[0136] Entity and triple extraction module, which is used to extract entities and triples from text paragraphs and answers;
[0137] A knowledge coverage calculation module is used to calculate the knowledge coverage based on the entities and triples of the text paragraphs and answers;
[0138] An accuracy calculation module, used to calculate the accuracy based on the entities and triples of the text paragraph;
[0139] A richness calculation module, used to calculate the richness according to the entity of the answer and the length of the answer;
[0140] A fluency calculation module is used to calculate the fluency according to the number of words and characters in the answer;
[0141] A vector module is used to vectorize questions and answers to obtain question vectors and answer vectors;
[0142] A diversity evaluation index calculation module is used to calculate the diversity evaluation index according to the question vector and the answer vector;
[0143] The evaluation module is used to evaluate the performance of the question-answer pair extraction model based on knowledge coverage, accuracy, richness, fluency, and diversity evaluation metrics.
[0144] In order to better illustrate the technical effect of the present invention, the present invention provides the following specific embodiments to illustrate the above technical process:
[0145] Example 1: A method for evaluating large-scale multi-dimensional question-answer pair generation tasks, including the following five dimensions: richness, fluency, diversity, knowledge coverage and accuracy. The evaluation system process is as follows: Figure 1 shown.
[0146] 1. Richness Assessment:
[0147] The richness of a question-answer pair means that the answer covers multiple aspects or dimensions of information, rather than just simple surface information or simple knowledge questions and answers. A rich answer requires a deep understanding of the question and a detailed answer, especially for complex questions or questions that require detailed explanations.
[0148] For the richness evaluation of the question-answer pair generation task, the present invention mainly measures it from the following subdivision indicators, including:
[0149] (1.1) The average length of answers in question-answer pairs. As a directly perceptible indicator, longer content usually contains more information and is relatively richer in content. The average length of the corresponding answers to a given knowledge content generation question is calculated as a detailed richness evaluation indicator. The specific calculation is as follows:
[0150]
[0151] Where: q i It represents the answer corresponding to the i-th question in the question pair generated based on the current knowledge content; mean_len represents the average length of the answer in the question-answer pair; n represents the number of question-answer pairs.
[0152] (1.2) The average number of entities in the answers of the question-answer pair. The generation of answers needs to revolve around specific content. Entities are the basic concepts being described. The number of entities that appear can reflect the richness of the answers to the questions. In specific practice, the present invention uses a tool based on paddleNLP to extract entities. However, the present invention is not limited to a specific entity extraction method in entity extraction. Any entity extraction model in use can realize the statistics of the average number of entities in the answers generated in the question-answer pair generation model.
[0153]
[0154] Where: q i It represents the answer corresponding to the i-th question in the question pair generated based on the current knowledge content; ner_nums is the method for obtaining entities in the current question; mean_ner_nums represents the average number of entities in the answer of the question-answer pair.
[0155] The evaluation of richness consists of the above two parts, and the specific calculation is as follows:
[0156] rich_score=α*mean_len+(1-α)*mean_ner_nums
[0157] Among them: α is the coefficient for adjusting the weights of the two sub-indicators; rich_score represents richness.
[0158] 2. Fluency Assessment:
[0159] It is also an effective method to evaluate the performance of different models in the question-answer pair extraction task from the perspective of language fluency. The higher the fluency of the extracted question-answer pairs, the better the effect of the model knowledge point combination and the smoother the connection between sentences. Specifically, the fluency of the generated answers is measured by using a pre-trained language model to evaluate the generated answer perplexity (PPL). The specific calculation is as follows:
[0160]
[0161] Where: N represents the number of words or characters in the current answer; w i represents the i-th word or text; PPL(W) represents fluency.
[0162] In specific practice, the present invention uses Wenzhong-GPT2-110M-chinese-v2 as the basic model for calculating PPL. However, the present invention is not limited to the selection of a specific pre-trained language model in PPL calculation, and any pre-trained language model can be used to calculate the fluency of the answers generated in the question-answer generation model.
[0163] 3. Diversity Assessment:
[0164] In practical applications, question-answer pairs that are too similar lack practical significance and will introduce additional noise data to downstream fine-tuning tasks. In order to evaluate whether different methods have rich angles in asking questions about knowledge points in extracting questions, the diversity of question-answer pair generation effects is evaluated by calculating the differences between questions and answers in the generated question-answer pairs. The specific calculation follows the following process:
[0165] (3.1) Vectorization of questions and answers:
[0166] q i = embedding_model(q i )
[0167] a i = embedding_model(a i )
[0168] Wherein: embedding_model can be any text vectorization model. In the practice of the present invention, the BGE-large-1.5 vectorization model is used to realize the conversion from a piece of text to a vector;
[0169] (3.2) Calculation of similarity between questions and answers:
[0170]
[0171]
[0172] Among them: sim_score_q is the average similarity score between multiple questions generated by given knowledge content, sim_score_a is the average similarity score between the corresponding multiple answers; q k is the vector representation corresponding to the kth question; a k is the vector representation corresponding to the kth answer; q i is the vector representation corresponding to the i-th question; a i is the vector representation corresponding to the i-th answer;
[0173] The final diversity evaluation index is composed of the above two parts, and the specific calculation is as follows:
[0174] diversity_score=(1-sim_score_q)+(1-sim_score_a).
[0175] Among them: diversity_score is the diversity evaluation indicator.
[0176] 4. Knowledge coverage:
[0177] In order to evaluate the coverage of knowledge in original paragraphs by question-answer pairs (Q-Apairs) extracted from paragraphs by different models, the present invention introduces multiple knowledge measurement methods to measure the coverage of knowledge in the generated question-answer pairs.
[0178] (4.1) Entity-based coverage calculation.
[0179] The specific process is as follows:
[0180] First, entities in the paragraph are extracted by using an entity extraction (named entity recognition) and the frequency of the entities is counted. In the present invention, the extraction of entities is realized based on the paddleNLP tool, but the present invention is not limited to a specific entity extraction method in entity extraction. The named entity list extracted from the knowledge content is recorded as p_ner_list.
[0181] Then, the same entity extraction tool is used to extract the entities involved in the answers of the generated question-answer pairs. i , and the corresponding extracted named entity list is recorded as q i _ner_list.
[0182] Finally, the quality of the generated question-answer pairs is measured by calculating the coverage of the entities mentioned in the question and the entities in the paragraph. The higher the coverage, the more knowledge contained in the extracted answer, indicating a higher quality. The specific calculation is as follows:
[0183]
[0184] Where: ner_cover_ratio represents the coverage of the entity; set(q i _ner_list) represents the entity set in the named entity list extracted from the question; set(p_ner_list) represents the entity set in the named entity list extracted from the knowledge content.
[0185] (4.2) Coverage calculation based on relation triples.
[0186] The specific process is as follows:
[0187] First, all triples in the paragraph are extracted by using a relational triple extraction model, and the frequency of the triples is counted. In the present invention, a triple extraction method based on a syntactic dependency tree is used to extract entities, but the present invention is not limited to a specific triple extraction method in triple extraction. The relational triple list extracted from the knowledge content is denoted as p_triple_list.
[0188] Subsequently, the triples involved in the answers of the generated question-answer pairs are extracted by using the same triple extraction tool. i , and the corresponding extracted relation triple list is recorded as q i _triple_list.
[0189] Finally, the coverage of the triples mentioned in the question and the triples in the paragraph is calculated. The higher the coverage, the more knowledge the extracted answer contains and the higher the quality.
[0190]
[0191] Where: triple_cover_ratio represents the coverage of the relation triples; set(q i _triple_list) represents the triple set of the relation triple list extracted from the question; set(p_triple_list) represents the triple set in the relation triple list extracted from the knowledge content.
[0192] The final knowledge coverage is calculated as the average of the above two methods, which is calculated as follows:
[0193] cover_score=0.5*(triple_cover_ratio)+0.5*(ner_cover_ratio)
[0194] 5. Accuracy:
[0195] In order to measure whether the answers in the question-answer pairs extracted based on the knowledge content are accurate, it is necessary to evaluate the accuracy of the answers of the question-answer pair extraction model. The present invention measures the accuracy of the generated question-answer pairs by introducing multiple knowledge-related measurement methods.
[0196] (5.1) Correctness assessment of key concepts.
[0197] In order to evaluate whether the key content in the generated answer, including but not limited to key concepts such as {value, location, time}, appears in the original knowledge content paragraph. First, an entity extraction (named entity recognition) is used to extract the relevant concept entities in the paragraph, and the probability of the relevant concept appearing in the paragraph is calculated. The calculation is as follows:
[0198]
[0199] Where: q i _key_list is the key concept extracted from the i-th question, and p_key_list is the key concept extracted from the provided knowledge content. The extraction of key concepts does not depend on a specific entity extraction method. In the practice of the present invention, paddleNLP is used as an extraction tool.
[0200] (5.2) Evaluation of triple concept matching correctness.
[0201] In order to evaluate whether the knowledge content in the generated answer actually appears in the paragraph, we first use a relation triple to extract the relation triples in the paragraph and calculate the probability that the relation triples appear correctly in the paragraph. If two elements match and the third content cannot match, there may be a factual error. The specific calculation is as follows:
[0202]
[0203] Among them: triple_match_nums represents the number of triples of the answer that completely match the triples of the text paragraph; triple_unmatch_nums represents the number of triples of the answer that do not match the triples of the paragraph.
[0204] The definition of mismatch (conflict) is as follows: two of the three elements in the triple are matched, but the third one is not matched. Example: (a, b, c) and (a, b, d) are conflicting knowledge.
[0205] The final accuracy is calculated as the average of the above two methods and is calculated as follows:
[0206] accuracy_score=0.5*key_accuracy+0.5*triple_accuracy
[0207] Finally, in a complete multi-dimensional Q-Apairs generation task evaluation system method for large models, five different dimensions are used to represent the quality of the current synthesized Q-A pair data and to evaluate the performance of the Q-A pair extraction model. A schematic diagram of multiple dimensions for evaluating ChatGPT3.5-turbo based on the above process is shown in Figure 2.
[0208] The richness, fluency, diversity, knowledge coverage and accuracy are compared with the preset thresholds; if multiple dimensions of a sample do not meet the thresholds, it can be considered that the current sample quality is too low and can be processed subsequently: deleted or regenerated; by calculating multiple quality dimensions of the Q-Apairs generated by the Q-Apairs generation model, the performance differences of different Q-Apairs generation models can be evaluated and used as evaluation indicators for subsequent iterations of the Q-Apairs generation model.
[0209] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules, modules or units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units, modules or components can be combined or integrated into another device, or some features can be ignored or not executed.
[0210] The units may or may not be physically separated, and the components displayed as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0211] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0212] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a 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 part, and / or installed from a removable medium. When the computer program is executed by the central processing unit (CPU), the above-mentioned functions defined in the method of the present invention are executed. It should be noted that the above-mentioned computer-readable medium of the present invention can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, a system, device or device of an electrical, magnetic, optical, electromagnetic, infrared segment, or semiconductor, or any combination of the above.
[0213] 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 invention. 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 alternative implementations, 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 the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0214] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A method for evaluating large-scale multi-dimensional question-answer pair generation tasks. It is characterized in that The following steps are involved: Get the text paragraph; Extracting question-answer pairs from text paragraphs using a question-answer pair extraction model; the question-answer pairs include questions and answers; Extract entities and triples from text paragraphs and answers; Based on the entities in the text paragraph and the answer, the entity coverage is calculated; Based on the triples of text paragraphs and answers, the relation triple coverage is calculated; According to the entity coverage and the relationship triple coverage, the knowledge coverage is calculated; Based on the entities and triples of the text paragraph, the accuracy is calculated; Based on the entities in the answer and the length of the answer, the richness is calculated; Based on the number of words and characters in the answer, the fluency was calculated; Vectorize the question and answer to obtain a question vector and an answer vector; Based on the question vector and the answer vector, the similarity between questions and the similarity between answers are calculated; The diversity evaluation index is calculated based on the similarity between questions and the similarity between answers. The performance of the question-answer pair extraction model is evaluated based on knowledge coverage, accuracy, richness, fluency, and diversity evaluation metrics; The calculation formulas for the similarity between questions and the similarity between answers are as follows: Among them: sim_score_q is the average similarity score between multiple questions generated by given knowledge content, sim_score_a is the average similarity score between the corresponding multiple answers; q k is the vector representation corresponding to the kth question; a k is the vector representation corresponding to the kth answer; q i is the vector representation corresponding to the i-th question; a i is the vector representation corresponding to the i-th answer; The vector corresponding to the i-th question is q i And the vector corresponding to the i-th answer represents a i The calculation formula is: q i =embedding_model(q i ) a i =embedding_model(a i ) Among them: embedding_model uses the BGE-large-1.5 vectorization model to realize the transformation from a piece of text to a vector; The calculation formula of the diversity evaluation index is: diversity_score=(1-sim_score_q)+(1-sim_score_a) Among them: diversity_score is the diversity evaluation index; The calculation formula of the richness is as follows: rich_score=α*mean_len+(1-α)*mean_ner_nums Among them: α is the coefficient for adjusting the weights of the two sub-indicators; rich_score represents the richness; mean_len is the average length of the answer in the question-answer pair; mean_ner_nums is the average number of entities in the answer in the question-answer pair; The calculation formula for the average length of the answers in the question-answer pair is: Where: q i represents the answer corresponding to the i-th question in the question pair generated based on the current knowledge content; mean_len represents the average length of the answer in the question-answer pair; n represents the number of question-answer pairs; The calculation formula for the average number of entities in the answer of the question-answer pair is: Where: q i Indicates the answer corresponding to the i-th question in the question pair generated based on the current knowledge content; ner_nums is the method for obtaining entities in the current question; mean_ner_nums indicates the average number of entities in the answer of the question-answer pair; The calculation formula of the entity coverage is as follows: Where: ner_cover_ratio represents entity coverage; set(q i _ner_list) represents the entity set in the named entity list extracted from the question; set(p_ner_list) represents the entity set in the named entity list extracted from the knowledge content; The calculation formula of the relationship triple coverage is as follows: Where: triple_cover_ratio represents the coverage of the relation triples; set(q i _triple_list) represents the triple set of the relation triple list extracted from the question; set(p_triple_list) represents the triple set of the relation triple list extracted from the knowledge content; The calculation formula of the knowledge coverage is as follows: cover_score=0.5*(triple_cover_ratio)+0.5*(ner_cover_ratio).
2. According to claim 1, the method for evaluating the generation of multi-dimensional question-answer pairs for large models, It is characterized in that The calculation formula of the fluency is as follows: Where: N represents the number of words or characters in the current answer; w i represents the i-th word or text; PPL(W) represents fluency.
3. According to claim 1, the method for evaluating the generation of multi-dimensional question-answer pairs for large models, It is characterized in that Based on the entities and triples of the text paragraph, the accuracy is calculated, which includes the following steps: Based on the entities of the text paragraph, the correctness evaluation of the key concepts is calculated; According to the triples of the text paragraph, the correctness evaluation of the triple concept matching is calculated; Based on the correctness evaluation of the key concepts and the correctness evaluation of the triple concept matching, the accuracy is calculated.
4. According to claim 3, the method for evaluating the generation of multi-dimensional question-answer pairs for large models, It is characterized in that The calculation formula for the correctness evaluation of the key concepts is: Where: q i _key_list is the key concept extracted from the i-th question, and p_key_list is the key concept extracted from the provided knowledge content; The calculation formula for evaluating the correctness of the triple concept matching is: Where: triple_match_nums represents the number of triples of the answer that completely match the triples of the text paragraph; triple_unmatch_nums represents the number of triples of the answer that do not match the triples of the paragraph; The calculation formula of the accuracy is: accuracy_score=0.5*key_accuracy+0.5*triple_accuracy.
5. A large-model multi-dimensional question-answer pair generation task evaluation system, used to implement a large-model multi-dimensional question-answer pair generation task evaluation method as described in any one of claims 1-4, It is characterized in that include: The acquisition module is used to obtain text paragraphs; A question-answer pair extraction module, used to extract question-answer pairs from text paragraphs using a question-answer pair extraction model; the question-answer pairs include questions and answers; Entity and triple extraction module, which is used to extract entities and triples from text paragraphs and answers; A knowledge coverage calculation module is used to calculate the knowledge coverage based on the entities and triples of the text paragraphs and answers; An accuracy calculation module, used to calculate the accuracy based on the entities and triples of the text paragraph; A richness calculation module, used to calculate the richness according to the entity of the answer and the length of the answer; A fluency calculation module is used to calculate the fluency according to the number of words and characters in the answer; A vector module is used to vectorize questions and answers to obtain question vectors and answer vectors; A diversity evaluation index calculation module is used to calculate the diversity evaluation index according to the question vector and the answer vector; The evaluation module is used to evaluate the performance of the question-answer pair extraction model based on knowledge coverage, accuracy, richness, fluency, and diversity evaluation metrics.
