Question and answer pair cleaning method and related apparatus
The question-answer pair cleaning method using multilingual large model quality inspection solves the problem of incomplete question-answer pair quality inspection in existing technologies, improves data cleaning effect, and ensures the smooth progress of large language model fine-tuning tasks.
Patent Information
- Application Number
- CN202510662642.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-21
- Publication Date
- 2026-11-24
AI Technical Summary
Current data cleaning solutions are insufficient to effectively remove illusions and irrelevant information from question-answer pairs, thus affecting the progress of fine-tuning tasks for large language models.
Question-answer pairs are generated using a first-language large model, and quality checks are performed using multiple second-language large models that differ from the first-language large model. The results of the comprehensive quality checks are used to process the question-answer pairs, including calculating quality check scores and making processing decisions.
This enabled more objective and comprehensive question-and-answer pair quality checks, improved data cleaning effectiveness, and ensured the progress of subsequent fine-tuning tasks and the quality of question-and-answer pairs.
Smart Images

Figure CN123159504A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data cleaning technology, and in particular to a question-and-answer pair cleaning method and related apparatus. Background Technology
[0002] Supervised-Finetuning (SFT) is a crucial stage in training large language models. It requires fine-tuning the large language model for specific tasks, and this process usually requires a large amount of labeled data. Question-answer pairs are a commonly used type of labeled data.
[0003] To ensure the quality of question-answer pairs, data cleaning is often performed before fine-tuning the large language model. However, current data cleaning mainly involves addressing accuracy, formatting, and consistency issues, and cannot remove misleading or irrelevant data from the question-answer pairs. This can significantly impact the progress of subsequent fine-tuning tasks. Summary of the Invention
[0004] In view of the above problems, this application provides a question-and-answer pair cleaning method and related apparatus to achieve the purpose of cross-data cleaning of question-and-answer pairs. The specific solution is as follows:
[0005] The first aspect of this application provides a question-and-answer pair cleaning method, the question-and-answer pair cleaning method comprising:
[0006] Generate question-answer pairs using a large first-language model;
[0007] The question-answer pairs are input into multiple second language large models to obtain the quality inspection results of each second language large model for the question-answer pairs. The multiple second language large models are different from the first language large model.
[0008] Based on the quality inspection results of the various second language large models, corresponding processing operations are performed on the question-answer pairs.
[0009] In one possible implementation, generating question-answer pairs through a large first-language model includes:
[0010] Get the original image containing text;
[0011] Obtain the first prompt word used to indicate the production of the question-and-answer pair;
[0012] The original image is fused with the first prompt word and then input into the first language model to obtain question-answer pairs output by the first language model that are associated with the text in the original image.
[0013] In one possible implementation, the step of inputting the question-answer pairs into multiple second language large-scale models to obtain the quality inspection results of each second language large-scale model for the question-answer pairs includes:
[0014] Obtain the second prompt word used to instruct the question-and-answer process for quality inspection;
[0015] The question-answer pair is fused with the second prompt word and then input into each second language big model to obtain the quality control score of each second language big model for the question-answer pair.
[0016] In one possible implementation, the step of fusing the question-answer pair with the second prompt word and inputting it into each second language large model to obtain a quality control score for the question-answer pair by each second language large model includes:
[0017] The multiple question-answer pairs are fused with the second prompt word and then input into each second language large model to obtain the original quality inspection score and confidence level of each second language large model output;
[0018] Obtain the weight of each second language big model in the multiple second language big models;
[0019] Based on the weights corresponding to each second language big model, as well as the original quality control score and confidence level output by each second language big model, the actual quality control score of each second language big model for the question-answer pair is calculated.
[0020] In one possible implementation, the step of performing corresponding processing operations on the question-answer pair based on the quality inspection results of the multiple second language large models includes:
[0021] The quality inspection status of the question-answer pair is determined based on the quality inspection scores of the multiple second language large models, and the quality inspection status includes qualified or unqualified.
[0022] If the quality inspection status of the question-and-answer pair is unqualified, the question-and-answer pair shall be processed.
[0023] In one possible implementation, determining the quality control status of the question-answer pair based on the quality control scores of the respective multiple second language large models includes:
[0024] Determine the number of large second language models whose quality inspection scores are greater than the corresponding score thresholds.
[0025] If the number of large models is greater than or equal to the corresponding number threshold, the quality inspection status of the question-answer pair is determined to be qualified;
[0026] If the number of large models is less than the number threshold, the quality inspection status of the question-answer pair is determined to be unqualified.
[0027] In one possible implementation, the processing operation on the question-answer pair includes:
[0028] The question-and-answer pairs are stored in a data pool, and the question-and-answer pairs in the data pool are corrected.
[0029] In one possible implementation, the correction of question-answer pairs in the data pool includes:
[0030] For each question-answer pair in the data pool, the question-answer pair quality inspection stage is entered, and the number of quality inspections for that question-answer pair is counted.
[0031] If the number of quality checks does not reach the corresponding threshold, return to the step of merging the question-answer pair with the second prompt word and inputting it into each second language large model; if the quality check status of the question-answer pair is qualified, the question-answer pair is migrated out of the data pool and stored; if the quality check status of the question-answer pair is unqualified, return to the step of entering the question-answer pair quality check stage.
[0032] When the number of quality inspections reaches the threshold, the question-and-answer pair correction stage begins. The question-and-answer pair is then input into the third language big model to obtain the correction result of the third language big model for the question-and-answer pair. The third language big model is different from the first language big model.
[0033] The corrected result of the question-and-answer pair is used as a new question-and-answer pair. The process of entering the question-and-answer pair quality inspection stage is repeated until the number of quality inspections reaches the threshold again. Then, the question-and-answer pair is removed from the data pool and discarded.
[0034] A second aspect of this application provides a question-and-answer pair cleaning apparatus, the question-and-answer pair cleaning apparatus comprising:
[0035] The question-answer pair generation module is used to generate question-answer pairs from a large first-language model.
[0036] The question-answer pair quality inspection module is used to input the question-answer pair into multiple second language large models respectively, so as to obtain the quality inspection result of each second language large model for the question-answer pair. The multiple second language large models are different from the first language large model.
[0037] The question-answer pair processing module is used to perform corresponding processing operations on the question-answer pairs based on the quality inspection results of the multiple second language large models.
[0038] A third aspect of this application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0039] The memory is used to store computer programs;
[0040] The processor is used to execute the computer program so that the electronic device can implement the question-answer pair cleaning method of the first aspect or any implementation thereof.
[0041] The fourth aspect of this application provides a computer program product including computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the question-and-answer pair cleaning method of the first aspect or any implementation thereof.
[0042] The fifth aspect of this application provides a computer storage medium carrying one or more computer programs that, when executed by an electronic device, enable the electronic device to perform the question-and-answer pair cleaning method described in the first aspect or any implementation thereof.
[0043] By employing the above technical solution, this application provides a question-and-answer pair cleaning method and related apparatus. The method generates question-and-answer pairs using a first language large-scale model; the question-and-answer pairs are then input into multiple second language large-scale models to obtain the quality inspection results from each second language large-scale model. These second language large-scale models differ from the first language large-scale model. Based on the quality inspection results of each of the multiple second language large-scale models, processing operations are performed on the question-and-answer pairs. This application, on the one hand, uses large-scale language models to mass-produce question-and-answer pairs; on the other hand, to prevent bias from a single model, it uses multiple other large-scale language models to perform quality inspections on the question-and-answer pairs separately, thereby conducting a more objective and comprehensive check on the quality of the question-and-answer pairs. Finally, corresponding processing operations are performed on the question-and-answer pairs based on these results, significantly improving the data cleaning effect and ensuring the progress of subsequent fine-tuning tasks. Attached Figure Description
[0044] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0045] Figure 1 A flowchart illustrating a question-and-answer pair cleaning method provided in an embodiment of this application;
[0046] Figure 2 This is a partial flowchart illustrating a question-and-answer pair cleaning method provided in an embodiment of this application;
[0047] Figure 3 This is another flowchart illustrating a question-and-answer pair cleaning method provided in an embodiment of this application;
[0048] Figure 4 This is another flowchart illustrating a question-and-answer pair cleaning method provided in an embodiment of this application;
[0049] Figure 5 This is another flowchart illustrating a question-and-answer pair cleaning method provided in an embodiment of this application;
[0050] Figure 6 This is another flowchart illustrating a question-and-answer pair cleaning method provided in an embodiment of this application;
[0051] Figure 7 This application provides a schematic diagram of the structure of a question-and-answer pair cleaning device.
[0052] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0053] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is for explaining specific embodiments only and is not intended to limit the scope of this application.
[0054] The embodiments of this application will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.
[0055] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of elements is not necessarily limited to those elements, but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0056] To facilitate understanding of this application, the relevant concepts involved in this application will be explained below:
[0057] OCR (Optical Character Recognition) is a technology that converts printed or handwritten text into a machine-readable format.
[0058] MLLM (Multimodal Large Language Model): Based on the Large Language Model (LLM), it incorporates other non-textual modal information to complete various multimodal tasks.
[0059] prompt (prompt word): used to trigger and guide an artificial intelligence language model to generate specific output text or sentence fragments.
[0060] GPT-4O: GPT-4O is an upgraded version of GPT-4 released by OpenAI. The "O" is an abbreviation for Omni, meaning "omnipotent," and it supports image input.
[0061] Qwen-VL: A Large Vision Language Model (LVLM) developed by Alibaba Cloud. It can take images, text, and bounding boxes as input, and output text and bounding boxes.
[0062] InternVL: A multimodal large model released by the Shanghai Artificial Intelligence Laboratory OpenGVLab, whose Chinese name is "Shusheng·Wanxiang".
[0063] Gemini: An artificial intelligence model released by Google DeepMind (an artificial intelligence lab established by Google's parent company Alphabet). It can simultaneously recognize five types of information: text, images, audio, video, and code. It can also understand and generate high-quality code in mainstream programming languages (such as Python, Java, and C++) and has a comprehensive security assessment.
[0064] Current data cleaning solutions mainly involve accuracy cleaning, formatting issue cleaning, and consistency issue cleaning. Accuracy cleaning primarily includes noise and incomplete data removal (cleaning data containing garbled characters or non-textual characters, and removing data with obvious errors or incomplete question-and-answer pairs), text correction and spell checking (using spell checking tools or manual correction of typos and recognition errors), and manual proofreading (manually checking key data when automated tools cannot determine correctness). Formatting issue cleaning mainly includes format standardization (unifying text format or units), deduplication (removing duplicate question-and-answer pairs to reduce redundancy), and consistent word segmentation and annotation (ensuring consistent word segmentation and annotation for the same word throughout the dataset, facilitating subsequent processing). Consistency issue cleaning includes language and grammar checks (using language models for grammar and context checks to detect inconsistencies in language usage) and contextual consistency checks (checking whether question-and-answer pairs are coherent and consistent in context, and filtering out inconsistent dialogues).
[0065] The main drawbacks of accurate cleaning include: during the noise reduction process, some valid data that is mistakenly identified as noise due to formatting issues may be accidentally deleted; automatic correction may incorrectly replace real but uncommon words with more common words, thereby changing the original meaning; and manual proofreading is costly, slow, and prone to human bias.
[0066] The main drawbacks of format cleaning include: format standardization may lead to information loss, for example, unifying region-specific terms may result in the loss of original regional information; improper handling may lead to the wrong deletion of synonymous or similar but not identical question-and-answer pairs; and the polysemy of words may cause uniform annotation to ignore context, thereby destroying the actual semantics of the data.
[0067] The main drawbacks of consistency cleaning include: complex grammatical checks may be too strict and not tolerant enough of variations of natural language (such as slang or colloquial expressions); in the absence of contextual information, ambiguity and contextual complexity may lead to misjudgments.
[0068] Clearly, the above data cleaning scheme is insufficient to remove data containing illusions or irrelevant information from question-answer pairs, and is not conducive to fine-tuning training of large language models.
[0069] To address the aforementioned issues, this application provides a question-answer pair cleaning method. On one hand, it uses a large language model to generate question-answer pairs in bulk. On the other hand, to prevent bias from a single model, this application uses multiple other large language models to perform quality checks on the question-answer pairs separately, thereby conducting a more objective and comprehensive quality check. Finally, corresponding processing operations are performed on the question-answer pairs based on this, significantly improving the data cleaning effect and ensuring the progress of subsequent fine-tuning tasks. The question-answer pair cleaning method of this application embodiment will be described in detail below with reference to the accompanying drawings.
[0070] See Figure 1 , Figure 1 This is a flowchart illustrating a question-and-answer pair cleaning method provided in an embodiment of this application. Figure 1 As shown in the embodiment of this application, a question-answer pair cleaning method may include steps S101 to S103, which are described in detail below.
[0071] S101 generates question-answer pairs using a first-language large model.
[0072] In this embodiment, by designing relevant prompt words, the prompt words and raw data are input into a large language model (first language model). The first language model can then generate a large number of related question-answer pairs, which contain questions and answers extracted from the raw data. For example, by fusing knowledge documents from a knowledge base with prompt words and inputting them into the first language model, the first language model can generate a large number of question-answer pairs based on the knowledge documents. The questions and answers in these pairs are related to the content of the knowledge documents.
[0073] In one possible implementation, question-answer pairs generated from images as raw data (hereinafter referred to as OCR question-answer pairs for ease of description) are often used in fine-tuning tasks of multimodal large models. Therefore, the batch generation and data cleaning of OCR question-answer pairs play a crucial role in improving the OCR recognition and understanding capabilities of multimodal large models. See also Figure 2 , Figure 2 This is a partial flowchart illustrating a question-and-answer pair cleaning method provided in an embodiment of this application. Figure 2 As shown in the embodiment of this application, a question-answer pair cleaning method is provided, wherein step S101 "generating question-answer pairs through a first language large model" may include steps S201 to S203, which are described in detail below.
[0074] S201, Obtain the original image containing text.
[0075] In this embodiment of the application, a large number of original images containing text can be obtained by means of user construction or extraction from existing databases or image sets. For example, original images can be crawled from online image data or open-source image and text datasets. Of course, if the crawled original images themselves are already labeled with OCR question-and-answer pairs, the OCR question-and-answer pairs can be directly retained for quality inspection in the subsequent step S102.
[0076] S202, Obtain the first prompt word used to indicate the production of the question-and-answer pair.
[0077] In this embodiment, prompt words (i.e., first prompt words) for question-answer pair generation can be pre-constructed to trigger and guide the first language large model to generate OCR question-answer pairs. In this case, the first language large model is a multimodal large language model. The following is an example of the first prompt words used to instruct question-answer pair generation:
[0078] Input: An image.
[0079] Question and Answer Formulation:
[0080] Questions: Based on the image, formulate {} questions. These questions can relate to key information extraction or information reasoning, but must be related to the content of the text in the image. Do not ask about text attributes such as color or size. The first question must ask about the OCR content in the image.
[0081] Answering the question: I will answer the question you just asked.
[0082] Question and answer example:
[0083] Question: Please tell me what is written on the picture?
[0084] Answer: The image shows a fat content of 3.0g / 100g.
[0085] Question: How much fat does this snack contain?
[0086] Answer: This snack contains 3.0g of fat per 100g.
[0087] Output format:
[0088] {{
[0089] "q1": "<Question 1>",
[0090] a1: "<Answer 1>",
[0091] "q2": "<Question 2>",
[0092] a2: "<Answer 2>", ...
[0094] }}
[0095] Note: The question-and-answer format must be varied.
[0096] S203, after fusing the original image with the first prompt word, input it into the first language large model to obtain the question-answer pair output by the first language large model that is related to the text in the original image.
[0097] In this embodiment, the first language model can be selected based on the application scenario of the question-and-answer pair. For example, the multimodal large language models currently available for producing OCR question-and-answer pairs include GPT-4O, Qwen-VL, InternVL, and Gemini. Each multimodal large language model has different strengths in OCR question-and-answer. Therefore, GPT-4O can be selected as the first language model when the application scenario involves English OCR question-and-answer, Qwen-VL can be selected when the application scenario involves Chinese OCR question-and-answer, InternVL can be selected when the application scenario involves handwritten OCR question-and-answer, and Gemini can be selected when the application scenario involves code-related OCR answers.
[0098] Taking the application scenario of English OCR question answering as an example, GPT-4O can be selected as the first language large model. The original image and the first prompt word are fused and then input into GPT-4O, and GPT-4O outputs OCR question answer pairs in batches.
[0099] S102, input the question-answer pairs into multiple second language large models to obtain the quality inspection results of each second language large model for the question-answer pairs. The multiple second language large models are different from the first language large model.
[0100] In this embodiment, for question-answer pairs generated by the first language large model, quality checks can be performed on the accuracy, formatting, and consistency of the question-answer pairs using multiple other language large models (i.e., second language large models) that are different from the first language large model. This yields the quality check results for each second language large model. This allows for multi-dimensional quality checks on batch-generated question-answer pairs based on multiple language large models, enabling cross-data cleaning, effectively preventing bias from a single model, and thus providing a more objective and comprehensive assessment of the validity of the question-answer pairs.
[0101] To facilitate understanding, let's continue using OCR question-and-answer pairs as an example. The second language large-scale model is also a multimodal large language model. In the application scenario of English OCR question-and-answer, GPT-4O is selected as the first language large-scale model to generate OCR question-and-answer pairs in batches. At this time, Qwen-VL, InternVL, and Gemini can be selected as the second language large-scale models. This allows Qwen-VL, InternVL, and Gemini to perform multi-dimensional quality checks on the OCR question-and-answer pairs, thereby obtaining the quality check score of each second language large-scale model for that question-and-answer pair. In one possible implementation, by designing prompt words, the second language large-scale model can output the corresponding quality check results for the question-and-answer pairs. See [link to documentation]. Figure 3 , Figure 3 This is another flowchart illustrating a question-and-answer pair cleaning method provided in an embodiment of this application. Figure 3As shown in the embodiment of this application, a question-answer pair cleaning method is provided, wherein step S102, "inputting the question-answer pairs into multiple second language large models to obtain the quality inspection results of each second language large model for the question-answer pairs", may include steps S301 to S302, which are described in detail below.
[0102] S301, Obtain the second prompt word used to instruct the quality inspection of the question-and-answer pair.
[0103] In this embodiment, prompt words (i.e., second prompt words) for question-answer pair quality control can be pre-constructed to trigger and guide each second language large model to perform quality control on the input question-answer pairs. The following are examples of second prompt words used to instruct question-answer pair quality control:
[0104] "Task Objectives"
[0105] Scoring OCR question-answer pairs generated from a large multimodal model requires judging issues such as OCR recognition errors and inconsistent answers, and giving a final quality control score to generate a high-quality training / evaluation dataset.
[0106] Evaluation perspective:
[0107] 1. Text accuracy dimension (character-level correctness, semantic correctness, formatting compliance)
[0108] 2. Question-answer pair consistency dimension (referring to pronoun consistency and semantic equivalence judgment)
[0109] 3. Logical rationality dimension (common sense rationality, business logic verification)
[0110] 4. Multimodal alignment (image-text consistency, impact on image quality)
[0111] Input data
[0112] 1. Original data format:
[0113] Input format:
[0114] {{
[0115] "image": xxx",
[0116] "q1": "<Question 1>",
[0117] a1: "<Answer 1>",
[0118] "q2": "<Question 2>",
[0119] a2: "<Answer 2>", ...
[0121] }}
[0122] Constraints
[0123] 1. In the end, all you need to do is give a reasonable and fair quality inspection score.
[0124] Output requirements
[0125] Quality inspection score: xxx”
[0126] S302, after fusing the question-answer pair with the second prompt word, input it into each second language large model to obtain the quality inspection score of each second language large model for the question-answer pair.
[0127] In this embodiment of the application, the question-answer pair and the second prompt word are merged and input into each second language big model. Each second language big model outputs its quality inspection score for the question-answer pair. The quality inspection score represents the quality inspection results of the second language big model on the accuracy, format and consistency of the question-answer pair.
[0128] To facilitate understanding, let's continue using OCR question-and-answer pairs as an example. In the application scenario of English OCR question-and-answer, GPT-4O is selected as the first language large-scale model to generate OCR question-and-answer pairs in batches. Correspondingly, Qwen-VL, InternVL, and Gemini are selected as multiple second language models to perform multi-dimensional quality checks on the OCR question-and-answer pairs. Specifically, the OCR question-and-answer pairs and second prompt words can be fused and then input into Qwen-VL, InternVL, and Gemini respectively, and the quality check scores of the OCR question-and-answer pairs output by Qwen-VL, InternVL, and Gemini can be obtained.
[0129] In one possible implementation, to ensure the reliability of the quality check scores, this application considers the confidence level and weights of the second language large-scale model to comprehensively calculate the quality check scores of the question-answer pairs. See [link to relevant documentation]. Figure 4 , Figure 4 This is another flowchart illustrating a question-and-answer pair cleaning method provided in an embodiment of this application. Figure 4 As shown in the embodiment of this application, a question-answer pair cleaning method is provided, wherein step S302, "merging the question-answer pair with the second prompt word and inputting it into each second language large model to obtain the quality inspection score of each second language large model for the question-answer pair", may include steps S401 to S403, which are described in detail below.
[0130] S401 integrates multiple question-answer pairs with second prompt words and inputs them into each second language large model to obtain the raw quality control score and confidence level of each second language large model output.
[0131] In this embodiment, the second prompt word may also include the confidence level that triggers and guides each second language big data model to simultaneously output the quality inspection score, thereby indicating the confidence level of the second language big data model in its current quality inspection. To this end, the question-answer pair and the second prompt word are merged and input into each second language big data model. Each second language big data model outputs its quality inspection score (i.e., the original quality inspection score) and confidence level for that question-answer pair. The confidence level ranges from 0 to 1; the closer it is to 1, the more confident the second language big data model is in its current quality inspection.
[0132] S402, obtain the weight of each second language big model in multiple second language big models.
[0133] In this embodiment of the application, based on the fine-tuning task and the OCR question-answering direction that each second language big model is good at, the weight of each second language big model in all second language big models can be determined, and the sum of the weights of all second language big models is 1.
[0134] S403. Based on the weights corresponding to each second language big model, as well as the original quality control score and confidence level output by each second language big model, calculate the actual quality control score of each second language big model for the question-answer pair.
[0135] In this embodiment of the application, for each second language large model, the actual quality inspection score of the second language large model for the question-answer pair can be calculated based on its weights, the original quality inspection score of the output, and the confidence level. Specifically, the actual quality inspection score = weight × original quality inspection score + confidence level × original quality inspection score.
[0136] To facilitate understanding, we will continue using OCR question-and-answer pairs as an example. In the application scenario of English OCR question-and-answer, GPT-4O is selected as the first language large-scale model to generate OCR question-and-answer pairs in batches. Correspondingly, Qwen-VL, InternVL, and Gemini are selected as multiple second language models to perform multi-dimensional quality checks on the OCR question-and-answer pairs. After fusing the OCR question-and-answer pairs and the second prompt words, they are input into Qwen-VL, InternVL, and Gemini respectively, to obtain the original quality check scores and confidence levels output by Qwen-VL, InternVL, and Gemini. Then, the weights corresponding to Qwen-VL, InternVL, and Gemini are obtained. Finally, based on the weights corresponding to Qwen-VL, InternVL, and Gemini, and the original quality check scores and confidence levels output by Qwen-VL, InternVL, and Gemini respectively, the actual quality check scores of Qwen-VL, InternVL, and Gemini for the OCR question-and-answer pairs are calculated.
[0137] S103, based on the quality inspection results of multiple second language large models, performs corresponding processing operations on the question-answer pairs.
[0138] In this embodiment, the quality inspection results of multiple second language models can be comprehensively considered to selectively retain or discard question-answer pairs. For example, when the quality inspection result of the second language model is either qualified or unqualified, the quality inspection state that appears most frequently among the multiple second language models can be determined as the quality inspection state of the question-answer pair. This determines whether the question-answer pair is qualified or unqualified. If it is qualified, the question-answer pair is retained; otherwise, if it is unqualified, it is discarded.
[0139] In one possible implementation, when the quality control result of the large second language model is a quality control score, the quality control status of the question-and-answer pair can be determined by combining the quality control scores of multiple large second language models, and the pair can then be dealt with accordingly. See also Figure 5 , Figure 5 This is a schematic diagram of another part of a question-and-answer pair cleaning method provided in an embodiment of this application. For example... Figure 5 As shown in the embodiment of this application, a question-answer pair cleaning method is provided, wherein step S103, "performing corresponding processing operations on the question-answer pairs according to the quality inspection results of multiple second language large models", may include steps S501 to S502, which are described in detail below.
[0140] S501 determines the quality control status of question-answer pairs based on the quality control scores of multiple second language models. The quality control status includes either qualified or unqualified.
[0141] In this embodiment, when the quality inspection result of the second language large model is a quality inspection score, the quality inspection status of the question-answer pair can be determined by combining the quality inspection scores of multiple second language large models. For example, the average quality inspection score of multiple second language large models can be calculated, and the average quality inspection score can be compared with the corresponding score threshold. If the average quality inspection score is greater than or equal to the score threshold, the quality inspection status of the question-answer pair is determined to be qualified; otherwise, if the average quality inspection score is less than the score threshold, the quality inspection score of the question-answer pair is determined to be unqualified.
[0142] S502, if the quality inspection status of the question-and-answer pair is unqualified, take action to handle the question-and-answer pair.
[0143] In this embodiment of the application, if the quality inspection status of a question-and-answer pair is unqualified, the question-and-answer pair can be discarded.
[0144] In one possible implementation, a voting method could be used to process the quality control scores of multiple large second language models to determine the quality control status of question-answer pairs. See also Figure 6 , Figure 6This is another flowchart illustrating a question-and-answer pair cleaning method provided in an embodiment of this application. Figure 6 As shown in the embodiment of this application, a question-answer pair cleaning method is provided, wherein step S501, "determining the quality inspection status of the question-answer pair based on the quality inspection scores of each of the multiple second language large models", may include steps S601 to S603, which are described in detail below.
[0145] S601, determine the number of large second language models whose quality inspection scores are greater than the corresponding score threshold.
[0146] In this embodiment of the application, the quality inspection score of each second language large model can be compared with the corresponding score threshold, thereby determining the number of large models with quality inspection scores greater than the score threshold among multiple second language large models.
[0147] To facilitate understanding, we will continue using OCR question-and-answer pairs as an example. In the application scenario of English OCR question-and-answer, GPT-4O is selected as the first language large model to generate OCR question-and-answer pairs in batches. Correspondingly, Qwen-VL, InternVL, and Gemini are selected as multiple second language models to perform multi-dimensional quality checks on the OCR question-and-answer pairs. After obtaining the quality check scores of Qwen-VL, InternVL, and Gemini for the OCR question-and-answer pairs, the quality check scores of Qwen-VL, InternVL, and Gemini are compared with the score threshold to determine the number of large models among Qwen-VL, InternVL, and Gemini whose quality check scores are greater than the score threshold.
[0148] S602, if the number of large models is greater than or equal to the corresponding quantity threshold, the quality inspection status of the question-answer pair is determined to be qualified.
[0149] In this embodiment of the application, if the number of large models is greater than or equal to the number threshold, it means that most of the second language large models have high quality inspection scores, and at this time the quality inspection status of the question-answer pair can be determined to be qualified.
[0150] S603, if the number of large models is less than the number threshold, the quality inspection status of the question-answer pair is determined to be unqualified.
[0151] In this embodiment of the application, if the number of large models is less than a preset threshold, it means that the quality inspection scores of most second language large models are low, and at this time it can be determined that the quality inspection status of the question-answer pair is unqualified.
[0152] To facilitate understanding, let's continue using OCR question-and-answer pairs as an example. In the application scenario of English OCR question-and-answer, GPT-4O is selected as the first language large model to generate OCR question-and-answer pairs in batches. Correspondingly, Qwen-VL, InternVL, and Gemini are selected as multiple second language models to perform multi-dimensional quality checks on the OCR question-and-answer pairs. After determining the number of large models among Qwen-VL, InternVL, and Gemini whose quality check scores are greater than a preset score threshold, if the number of such large models is greater than or equal to 2, that is, at least two of Qwen-VL, InternVL, and Gemini give high quality check scores, then the quality check status of the OCR question-and-answer pair is determined to be qualified. If the number of such large models is less than 2, that is, at least two of Qwen-VL, InternVL, and Gemini give low quality check scores, then the quality check status of the OCR question-and-answer pair is determined to be unqualified.
[0153] In one possible implementation, unqualified question-answer pairs can be corrected to prevent large batches of question-answer pairs from being discarded after quality inspection, ensuring a sufficient quantity and quality of question-answer pairs. To this end, an embodiment of this application provides a question-answer pair cleaning method, wherein step S502, "processing the question-answer pairs," may include the following steps:
[0154] Store the question-and-answer pairs in the data pool and then correct the question-and-answer pairs in the data pool.
[0155] In this embodiment, if the quality inspection status of a question-answer pair is unqualified, it can be stored in a data pool, and the question-answer pairs in the data pool can be further corrected. In real-world scenarios, when the number of question-answer pairs in the data pool is small, users can manually correct the questions and / or answers of the question-answer pairs.
[0156] In one possible implementation, when there are a large number of question-answer pairs in the data pool, manual correction cannot guarantee the correction effect. To address this, this application embodiment can use a new large language model to correct the question-answer pairs in the data pool, thereby improving the correction efficiency and achieving the acquisition of a sufficient quantity of high-quality question-answer pairs in the shortest possible time. In this regard, this application embodiment provides a question-answer pair cleaning method, wherein the step of "storing question-answer pairs in the data pool and correcting the question-answer pairs in the data pool" can be performed as follows:
[0157] For each question-answer pair in the data pool, the question-answer pair quality inspection stage is entered, and the number of quality inspections for that question-answer pair is counted.
[0158] If the number of quality checks does not reach the corresponding threshold, return to step S402; if the quality check status of the question-and-answer pair is qualified, migrate the question-and-answer pair out of the data pool and store it; if the quality check status of the question-and-answer pair is unqualified, return to the step of entering the question-and-answer pair quality check stage.
[0159] When the number of quality checks reaches the threshold, the question-and-answer pair correction stage begins. The question-and-answer pair is then input into the third language big model to obtain the correction result of the third language big model for the question-and-answer pair. The third language big model is different from the first language big model.
[0160] The corrected result of the question-and-answer pair is used as a new question-and-answer pair. The process of entering the question-and-answer pair quality inspection stage is repeated until the number of quality inspections reaches the threshold again. Then, the question-and-answer pair is removed from the question-and-answer pair data pool and discarded.
[0161] In this embodiment, since the same second language large model may give different quality inspection scores to the same question-answer pair at different times, if the question-answer pair is initially judged to be unqualified, it can be subjected to multiple rounds of quality inspection to avoid quality inspection errors of the second language large model. To this end, for each question-answer pair in the data pool (hereinafter referred to as question-answer pair 1), the question-answer pair quality inspection stage of question-answer pair 1 is entered. The number of quality inspections of question-answer pair 1 is counted and compared with the corresponding number threshold. If the number of quality inspections of question-answer pair 1 does not reach the number threshold, the process returns to step S402 to re-inspect question-answer pair 1. At this time, the quality inspection score of each second language large model for question-answer pair 1 can be obtained again to re-determine the quality inspection status of question-answer pair 1. If the quality inspection status of question-answer pair 1 is qualified, question-answer pair 1 is migrated out of the data pool and stored for subsequent fine-tuning tasks. If the quality inspection status of question-answer pair 1 is unqualified, the question-answer quality inspection stage is entered again, and the number of quality inspections of question-answer pair 1 is counted again and compared with the corresponding number threshold, and so on.
[0162] If the number of quality checks for question-answer pair 1 reaches a threshold, the question-answer pair correction stage begins. The question-answer pair is then input into a new large-scale language model (i.e., the third-language large-scale model), which corrects the questions and / or answers in the pair and outputs the correction result. It's important to note that the third-language large-scale model differs from the first-language large-scale model. Specifically, a third prompt word used to instruct the correction of the question-answer pair can be obtained. This prompt word is then fused with the question-answer pair before being input into the third-language large-scale model to obtain the correction result output by the model.
[0163] The corrected result of the question-answer pair is used as a new question-answer pair (hereinafter referred to as question-answer pair 2), and enters the question-answer pair quality inspection stage of question-answer pair 2. The number of quality inspections of question-answer pair 2 is counted and compared with the corresponding number threshold. If the number of quality inspections of question-answer pair 2 does not reach the number threshold, the process returns to step S402 to re-inspect question-answer pair 2. At this time, the quality inspection score of each second language large model for question-answer pair 2 can be obtained again to redetermine the quality inspection status of question-answer pair 2. If the quality inspection status of question-answer pair 2 is qualified, question-answer pair 2 is migrated out of the data pool and stored for subsequent fine-tuning tasks. If the quality inspection status of question-answer pair 2 is unqualified, the process re-enters the question-answer quality inspection stage, and the number of quality inspections of question-answer pair 2 is counted again and compared with the corresponding number threshold, and so on.
[0164] If the number of quality checks for question-answer pair 2 reaches the threshold, then question-answer pair 1 will be removed from the question-answer pair data pool and discarded.
[0165] Based on the above description, the question-and-answer pair cleaning method provided in this application can achieve batch generation and cross-data cleaning of question-and-answer pairs through a large language model, comprehensively judge the validity of data, improve the data cleaning effect, and ensure the progress of subsequent fine-tuning tasks. Furthermore, the large language model can also correct question-and-answer pairs that fail quality inspection, preventing the discarding of large batches of question-and-answer pairs after quality inspection, and ensuring that fine-tuning tasks have a sufficient number of high-quality question-and-answer pairs. Especially for OCR question-and-answer pairs, it can ensure the acquisition of high-quality data that is accurate in content and fits the image, controlling the data quality of OCR question-and-answer pairs before fine-tuning tasks, and improving the OCR recognition and question-and-answer capabilities of the multimodal language model.
[0166] The above describes a question-and-answer pair cleaning method provided by the embodiments of this application. The following describes the apparatus for performing the above question-and-answer pair cleaning method.
[0167] See Figure 7 , Figure 7 This is a schematic diagram of a question-and-answer pair cleaning device provided in an embodiment of this application. Figure 7 As shown in the figure, an embodiment of this application provides a question-and-answer pair cleaning device, comprising:
[0168] The question-answer pair generation module 701 is used to generate question-answer pairs using a first language large model.
[0169] The question-answer pair quality inspection module 702 is used to input question-answer pairs into multiple second language large models to obtain the quality inspection results of each second language large model for the question-answer pairs. The multiple second language large models are different from the first language large model.
[0170] The question-answer pair processing module 703 is used to perform corresponding processing operations on question-answer pairs based on the quality inspection results of multiple second language large models.
[0171] In one possible implementation, the question-answer pair generation module 701 is specifically used for:
[0172] Obtain the original image containing the text; obtain the first prompt word to indicate the generation of question-answer pairs; merge the original image and the first prompt word and input them into the first language large model to obtain the question-answer pairs output by the first language large model that are associated with the text in the original image.
[0173] In one possible implementation, the question-and-answer pair quality control module 702 is specifically used for:
[0174] Obtain a second prompt word to indicate the quality inspection of the question-answer pair; merge the question-answer pair with the second prompt word and input it into each second language big model to obtain the quality inspection score of each second language big model for the question-answer pair.
[0175] In one possible implementation, the question-answer pair quality inspection module 702, which fuses the question-answer pair with the second prompt word and inputs it into each second language large model to obtain the quality inspection score of each second language large model for the question-answer pair, is specifically used for:
[0176] Multiple question-answer pairs are fused with second prompt words and input into each second language big model to obtain the original quality inspection score and confidence level of each second language big model; the weight of each second language big model in multiple second language big models is obtained; based on the weight of each second language big model and the original quality inspection score and confidence level of each second language big model, the actual quality inspection score of each second language big model for question-answer pairs is calculated.
[0177] In one possible implementation, the question-answering pair handling module 703 is specifically used for:
[0178] The quality control status of a question-and-answer pair is determined based on the quality control scores of multiple second language models. The quality control status includes qualified or unqualified. If the quality control status of a question-and-answer pair is unqualified, the pair will be subject to processing.
[0179] In one possible implementation, the question-answer pair processing module 703, used to determine the quality status of question-answer pairs based on the respective quality scores of multiple second language large models, is specifically used for:
[0180] Determine the number of large second language models whose quality inspection scores are greater than the corresponding score threshold; if the number of large models is greater than or equal to the corresponding number threshold, determine that the quality inspection status of the question-answer pair is qualified; if the number of large models is less than the number threshold, determine that the quality inspection status of the question-answer pair is unqualified.
[0181] In one possible implementation, the question-answer pair processing module 703, used for processing question-answer pairs, is specifically used for:
[0182] Store the question-and-answer pairs in the data pool and then correct the question-and-answer pairs in the data pool.
[0183] In one possible implementation, the question-answer pair processing module 703, used to correct question-answer pairs in the data pool, is specifically used for:
[0184] For each question-and-answer pair in the data pool, the process enters the question-and-answer pair quality inspection stage, counting the number of quality inspections for that pair. If the number of quality inspections does not reach the corresponding threshold, the question-and-answer pair quality inspection module 702 is triggered to merge the question-and-answer pair with the second prompt word and input it into each second language large model. If the quality inspection status of the question-and-answer pair is qualified, the question-and-answer pair is migrated out of the data pool and stored. If the quality inspection status of the question-and-answer pair is unqualified, the process returns to the question-and-answer pair quality inspection stage. If the number of quality inspections reaches the threshold, the process enters the question-and-answer pair correction stage, inputting the question-and-answer pair into the third language large model to obtain the correction result of the third language large model for the question-and-answer pair. The third language large model is different from the first language large model. The correction result of the question-and-answer pair is used as a new question-and-answer pair, and the process returns to the question-and-answer pair quality inspection stage until the number of quality inspections reaches the threshold again, at which point the question-and-answer pair is migrated out of the data pool and discarded.
[0185] It should be noted that the detailed functions of each module in the embodiments of this application can be found in the corresponding disclosure of the above Q&A cleaning method embodiments, and will not be repeated here.
[0186] This application also provides an electronic device in its embodiments. See also... Figure 8 , Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device in this embodiment may include, but is not limited to, fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 8 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0187] like Figure 8 As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 into a random access memory (RAM) 803. When the electronic device is powered on, the RAM 803 also stores various programs and data required for the operation of the electronic device. The processing unit 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0188] Typically, the following devices can be connected to I / O interface 805: input devices 806 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 807 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 808 including, for example, memory cards, hard drives, etc.; and communication devices 809. Communication device 809 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 8 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have instead.
[0189] This application also provides a computer program product including computer-readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the question-and-answer pair cleaning methods provided in this application.
[0190] This application also provides a computer-readable storage medium carrying one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the question-and-answer pair cleaning methods provided in this application.
[0191] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0192] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0193] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0194] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A question-and-answer pair cleaning method, characterized in that, The question-and-answer pair cleaning method includes: Generate question-answer pairs using a large first-language model; The question-answer pairs are input into multiple second language large models to obtain the quality inspection results of each second language large model for the question-answer pairs. The multiple second language large models are different from the first language large model. Based on the quality inspection results of the various second language large models, corresponding processing operations are performed on the question-answer pairs.
2. The question-and-answer pair cleaning method according to claim 1, characterized in that, The generation of question-answer pairs through a first-language large model includes: Get the original image containing text; Obtain the first prompt word used to indicate the production of the question-and-answer pair; The original image is fused with the first prompt word and then input into the first language model to obtain question-answer pairs output by the first language model that are associated with the text in the original image.
3. The question-and-answer pair cleaning method according to claim 1 or 2, characterized in that, The step of inputting the question-answer pairs into multiple second language large-scale models to obtain the quality inspection results of each second language large-scale model for the question-answer pairs includes: Obtain the second prompt word used to instruct the question-and-answer process for quality inspection; The question-answer pair is fused with the second prompt word and then input into each second language big model to obtain the quality control score of each second language big model for the question-answer pair.
4. The question-and-answer pair cleaning method according to claim 3, characterized in that, The process of fusing the question-answer pair with the second prompt word and inputting it into each second language large-scale model to obtain the quality control score of each second language large-scale model for the question-answer pair includes: The multiple question-answer pairs are fused with the second prompt word and then input into each second language large model to obtain the original quality inspection score and confidence level of each second language large model output; Obtain the weight of each second language big model in the multiple second language big models; Based on the weights corresponding to each second language big model, as well as the original quality control score and confidence level output by each second language big model, the actual quality control score of each second language big model for the question-answer pair is calculated.
5. The question-and-answer pair cleaning method according to claim 3, characterized in that, The step of performing corresponding processing operations on the question-answer pairs based on the quality inspection results of the multiple second language large models includes: The quality inspection status of the question-answer pair is determined based on the quality inspection scores of the multiple second language large models, and the quality inspection status includes qualified or unqualified. If the quality inspection status of the question-and-answer pair is unqualified, the question-and-answer pair shall be processed.
6. The question-and-answer pair cleaning method according to claim 5, characterized in that, The step of determining the quality control status of the question-answer pair based on the quality control scores of the multiple second language large models includes: Determine the number of large second language models whose quality inspection scores are greater than the corresponding score thresholds. If the number of large models is greater than or equal to the corresponding number threshold, the quality inspection status of the question-answer pair is determined to be qualified; If the number of large models is less than the number threshold, the quality inspection status of the question-answer pair is determined to be unqualified.
7. The question-and-answer pair cleaning method according to claim 5, characterized in that, The processing operations for the question-and-answer pairs include: The question-and-answer pairs are stored in a data pool, and the question-and-answer pairs in the data pool are corrected.
8. The question-answer pair cleaning method according to any one of claims 7, characterized in that, The correction of question-answer pairs in the data pool includes: For each question-answer pair in the data pool, the question-answer pair quality inspection stage is entered, and the number of quality inspections for that question-answer pair is counted. If the number of quality checks does not reach the corresponding threshold, return to the step of merging the question-answer pair with the second prompt word and inputting it into each second language large model; if the quality check status of the question-answer pair is qualified, the question-answer pair is migrated out of the data pool and stored; if the quality check status of the question-answer pair is unqualified, return to the step of entering the question-answer pair quality check stage. When the number of quality inspections reaches the threshold, the question-and-answer pair correction stage begins. The question-and-answer pair is then input into the third language big model to obtain the correction result of the third language big model for the question-and-answer pair. The third language big model is different from the first language big model. The corrected result of the question-and-answer pair is used as a new question-and-answer pair. The process of entering the question-and-answer pair quality inspection stage is repeated until the number of quality inspections reaches the threshold again. Then, the question-and-answer pair is removed from the data pool and discarded.
9. A question-and-answer pair cleaning device, characterized in that, The question-and-answer pair cleaning device includes: The question-answer pair generation module is used to generate question-answer pairs from a large first-language model. The question-answer pair quality inspection module is used to input the question-answer pair into multiple second language large models respectively, so as to obtain the quality inspection result of each second language large model for the question-answer pair. The multiple second language large models are different from the first language large model. The question-answer pair processing module is used to perform corresponding processing operations on the question-answer pairs based on the quality inspection results of the multiple second language large models.
10. An electronic device, characterized in that, It includes at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program to enable the electronic device to implement the question-answer pair cleaning method as described in any one of claims 1 to 7.
