Fine tuning data set construction method for large question and answer model in aerospace control software field
By preprocessing and extracting keywords from aerospace control software documents, semantically clear questions and answers are generated. Multiple large models are used for quality control, which solves the problem of the lack of question-and-answer datasets in aerospace control software, realizes the construction of high-quality datasets, and supports effective fine-tuning of large models.
Patent Information
- Application Number
- CN202511042636.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-28
- Publication Date
- 2025-11-28
AI Technical Summary
In the current technology, the field of aerospace control software lacks question-and-answer instruction datasets, which leads to the introduction of erroneous data during fine-tuning of large models and impairs model performance.
By converting aerospace control software documents into plain text, segmenting them into structured JSON text, extracting keywords, generating semantically clear questions and multiple candidate answers, and using multiple large models for quality control and ranking, a high-quality fine-tuning dataset is finally constructed.
It has enabled the generation of high-quality question-and-answer datasets in the field of aerospace control software, supports fine-tuning training of large models, and improves the accuracy and consistency of the datasets.
Smart Images

Figure CN121029926A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to a fine-tuning data set construction method for a question and answer large model in the field of aerospace control software, and belongs to the technical field of aerospace software large models. BACKGROUND
[0002] With the continuous development of computing power and large model technology, in the field of aerospace control software, the question and answer large model plays an important role in the software engineering life cycle such as software requirement analysis, design and testing. However, due to the privacy of data, open source large models are generally difficult to be directly applied in the field of aerospace control software. In order to solve this problem, fine-tuning technology has become a key means to improve the performance of the model on specific tasks. Fine-tuning of the large model requires an instruction data set, that is, a "question-answer" data pair. However, in the field of aerospace control software, document and software case data mostly exist in the form of technical documents in the development process, and there is a lack of instruction data set in the form of question and answer, which brings challenges to the fine-tuning of the large model.
[0003] In the related art, in order to construct the instruction data set from the text, the construction of the fine-tuning data set is often only relied on the prompt engineering, and the quality control of the question and answer is not considered, so that the generated data has problems such as irrelevance and error, thereby causing the large model training to introduce error data, damaging the parameter distribution of the large model, and causing poor answering effect and other problems.
[0004] Therefore, there is an urgent need for a fine-tuning data set construction method for a large model in the field of aerospace control software to solve the above problems. SUMMARY
[0005] The technical problem solved by the application is to overcome the shortcomings of the prior art, and a fine-tuning data set construction method for a question and answer large model in the field of aerospace control software is proposed, which can realize the generation of high-quality question and answer data set in the field of aerospace control software and support the fine-tuning training of the large model in the field of aerospace control software.
[0006] The technical solution of the application is as follows:
[0007] A fine-tuning data set construction method for a question and answer large model in the field of aerospace control software, comprising:
[0008] All original aerospace control software documents are converted into pure text form, and then each document is cut according to the chapter structure to form a structured JSON text corresponding to each chapter;
[0009] Key words are extracted from the structured JSON text; based on the obtained key words, a question set related to the key words and having clear semantics is generated;
[0010] For the question set, multiple candidate answers for each question are generated, and all candidate answers for each question are sorted and then fused into a coherent, comprehensive and accurate final answer;
[0011] Based on each question and the corresponding final answer, a fine-tuning data set is constructed.
[0012] Further, keyword extraction is performed on the structured JSON text, and the extraction method is:
[0013] 1) Perform word segmentation processing on the structured JSON text to obtain a preliminary candidate word set;
[0014] 2) For the preliminary candidate word set, each candidate word is calculated as follows:
[0015] Calculate the frequency of the candidate word appearing in the JSON text and the rarity of the candidate word appearing in the entire document to obtain the TF-IDF feature value of the candidate word;
[0016] Use the LDA model to perform topic analysis on the JSON text to calculate the probability feature value of the candidate word;
[0017] Determine whether the candidate word is a named entity in the knowledge graph by searching the word in Wikipedia, and calculate the importance feature value of the candidate word;
[0018] 3) Weight the TF-IDF feature value, probability feature value and importance feature value of each candidate word to obtain the comprehensive feature value of the corresponding candidate word;
[0019] 4) According to the comprehensive feature value of each candidate word, sort the comprehensive feature values from large to small, and select a certain number of keywords from front to back as the keywords of the chapter.
[0020] Further, based on the obtained keywords, a question set related to the keywords and with clear semantics is generated, specifically:
[0021] Based on the JSON text and the keywords, a question generation prompt template is constructed, which requires the constructed question to be related to the keywords;
[0022] Input the prompt template into three large models, Qwen3-32B, ChatGLM3-6B and DeepSeek-R1-671B, respectively, and use the large models to ask questions about the keywords in the JSON text to obtain a question set related to the keywords and with clear semantics.
[0023] Further, quality control is performed on the question set, specifically:
[0024] 1) Traverse each question in the generated question set, and for each question, perform the following operations:
[0025] Check if any of the keywords are included, if not, delete from the question set;
[0026] Calculate the perplexity of each question text, and delete the questions with perplexity exceeding the preset value from the question set;
[0027] 2) Similar question deduplication: calculate the vector representation of each question, and calculate the cosine similarity between vectors pairwise, and keep one of the questions with similar vectors, i.e. deduplicate similar questions.
[0028] Further, for the question set, generate multiple candidate answers for each question, specifically:
[0029] Take the JSON text as background knowledge, construct an answer generation prompt template, which contains background knowledge and the question set in the prompt template;
[0030] Input the prompt template into three large models Qwen3-32B, ChatGLM3-6B and DeepSeek-R1-671B respectively; each large model generates multiple candidate answers for each question.
[0031] Further, an automatic partial order answer sorting method is used to sort all candidate answers for each question, specifically:
[0032] In the question set, randomly sample multiple questions and all corresponding candidate answers as seed samples for sorting;
[0033] Use clustering algorithm to cluster the same question and all corresponding answers in the seed sample, and sort the answers in the same group according to the Euclidean distance, select the answer closest to the cluster center as the answer with high confidence, as the positive sample, and the K answers closest to the center point as the negative sample, thereby constructing the question and positive and negative example answer samples; K is a preset value;
[0034] After obtaining the question and positive and negative example answer samples, construct a sorting model, which is a Pairwise method, design a sorting score function f(q,a i ), for the question q to answer a i relatedness scoring;
[0035] Design the loss function:
[0036]
[0037] Where a i represents the positive sample, and a j represents the negative sample; the goal of this loss function is to make the predicted score difference as large as possible for the correctly sorted answers, i.e. when ai Sort in a j Previously, f(q,a) i )>f(q,a j ); for the ranking score function f(q,a) i ) to be optimized;
[0038] When the ranking score function f(q,a) i After training, the questions are ranked by relevance, and finally, for each question, a set number of answers with the highest ranking are retained.
[0039] Furthermore, after ranking the candidate answers, they are merged into a coherent, comprehensive, and accurate final answer, specifically as follows:
[0040] Construct a hint template for answer fusion. The hint template contains all the retained answers. The requirement is to use these answers as a multi-document summary to generate a coherent and comprehensive summary, without adding any content that is not present in these answers.
[0041] Furthermore, for the original aerospace control software documents, if they are in Word format, the pandoc tool is used to convert them into Markdown text; if they are in PDF format, RapidOCR is used to convert them into plain natural language text.
[0042] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.
[0043] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method described above.
[0044] The advantages of this invention compared to the prior art are:
[0045] (1) In view of the fact that the existing fine-tuning dataset construction method ignores the problem of data quality control, the present invention introduces a keyword extraction method in terms of question generation to avoid generating questions that are irrelevant to domain knowledge. In terms of question understanding and answer generation, compared with the existing method that only uses a single large model to generate one answer, the present invention uses multiple large models to read and understand the question and generate several answers to construct a set of a single question and multiple answers.
[0046] (2) To ensure the accuracy of the generated answers, this invention sorts and filters the answers, designing an answer quality ranking mechanism to obtain high-quality responses. This invention can generate high-quality question-and-answer datasets in the field of aerospace control software, supporting fine-tuning training of large models in the field of aerospace control software. Attached Figure Description
[0047] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0048] Figure 1 This is a flowchart illustrating the method for constructing a fine-tuning dataset for a large question-answering model in the field of aerospace control software, as described in this invention.
[0049] Figure 2 A flowchart for generating problems in embodiments of the present invention. Detailed Implementation
[0050] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0051] This invention proposes a method for constructing a fine-tuning dataset for a large question-answering model in the field of aerospace control software, such as... Figure 1 As shown, it includes:
[0052] Step 110: Data Preprocessing and Transformation
[0053] The original aerospace control software documents (Word and PDF formats) are preprocessed to convert the content into plain text suitable for subsequent processing, while retaining key information (such as table content). Long documents are also segmented according to their chapter structure to form structured JSON data. This not only ensures a consistent data format but also enables subsequent processing stages (such as keyword extraction and question generation) to be performed more efficiently and accurately within the given context.
[0054] In one specific implementation of the present invention, step 110 may include:
[0055] Sub-step A1: Raw data preparation. Collect document assets related to the aerospace control software (mainly in Word and PDF formats).
[0056] Sub-step A2: Document format conversion. Convert the Word document to Markdown format text using the pandoc tool, ensuring that structural information such as tables is not lost. Convert the PDF document to pure natural language text using RapidOCR, ensuring complete extraction of text information.
[0057] Sub-step A3: Document segmentation (chapter processing). According to the chapter structure existing in the document, the converted text content is segmented. Adopting an iterative approach, the text is divided by chapter to generate structured JSON data that conforms to the hierarchical nested relationship, with the format: {“Chapter Name”: xxx, “Context”: xxx}, where Chapter Name is the chapter number and Context is the corresponding content under the chapter.
[0058] Step 120: Keyword extraction
[0059] To avoid generating meaningless questions such as “Who wrote this document?” and “When was this document written?”, which are meaningless for domain question answering, and to avoid introducing or even damaging the data probability distribution of the large model itself, keyword extraction needs to be performed for each chapter text (Context). By limiting the scope of generated questions through extracted keywords, irrelevant or meaningless questions can be avoided. The keyword extraction step calculates the weight score of candidate words by performing word segmentation on the text, combining TF-IDF, topic words (LDA model), and external knowledge bases (such as Wikipedia and domain word lists), and finally selects the highest-scoring keywords. In one specific implementation of the present application, the above step 120 can include:
[0060] Sub-step B1: Candidate word generation. Perform word segmentation on each chapter's Context to obtain a preliminary set of candidate words.
[0061] Sub-step B2: keyword feature extraction. The features include the following three categories: first, TF-IDF feature. Calculate the frequency of the candidate word in the current document and the rarity of the appearance in the entire document set to determine its importance in the document. The higher the value of TF-IDF, the more important the word in the current document, and the more rare the word in the entire document set, the more important the word for the text; second, topic word feature extraction. Use the LDA (Latent Dirichlet Allocation) model to analyze the theme of the text to obtain the probability distribution of the text on different themes, and take the words with high probability as important features; third, external knowledge base feature. Determine whether the word belongs to the named entity in the knowledge graph by searching the word in Wikipedia, so as to determine the importance of the word; at the same time, compare whether the word appears in the aerospace field professional word table to evaluate the importance of the word.
[0062] Sub-step B3: feature weighting and sorting. Assign weights to each candidate word for the three types of features, and calculate the comprehensive feature score. For each word w i , there are three types of features, respectively denoted as f i 1 , f i 2 , f i 3 , respectively. Weighting the three types of features to obtain the final feature score, that is, f i = αf i 1 + βf i 2 + γf i 3 Sort all feature candidate words, and select the top N words with the highest scores as the keywords of the text.
[0063] Step 130: question generation. Based on the pre-extracted keywords and text content, generate a set of questions highly related to the keywords and with clear semantics, as shown in Figure 2 . In order to ensure the diversity and quality of the generated questions, a prompt template is designed, and multiple large models (Qwen3-32B, ChatGLM3-6B and DeepSeek-R1-671B) are used to generate candidate questions, and then quality screening and deduplication are performed. This step ensures that the generated questions cover the core information of the text and avoid irrelevant or meaningless questions. In one specific implementation of the present application, the above step 130 can include:
[0064] Sub-step C1: Construct a question generation prompt template, which is as follows: “Please construct a question set containing M questions based on the following text and keywords, in order to use large models to ask questions about keywords in the text. The questions constructed must be related to the keywords and as accurate and concise as possible. Text: [Context] Keywords: [w1, w2, …, w N ]\n”.
[0065] Sub-step C2: Input the prompt template into Qwen3-32B, ChatGLM3-6B, and DeepSeek-R1-671B three large models respectively, to generate a total of 3M question candidates, denoted as Q.
[0066] Sub-step C3: Control the quality of question generation. The steps of quality control are as follows: first, iterate through the 3M generated questions, and for each question, perform the following operations: for each question, first see if it contains any of the N keywords, and if not, delete it from the candidate question set; in order to ensure that the generated questions are coherent and conform to human language, use the ChatGLM3-6B model to calculate the perplexity of each question text, and delete questions with high perplexity from the candidate question set; second, similar question deduplication: use the Chinese and English semantic vector model BGE (BAAI General Embedding) to calculate the vector representation of each question, and calculate the cosine similarity between vectors pairwise, and keep one of the questions with similar vectors. Finally, the set of questions is denoted as with a size of The high-quality question set is used for subsequent answer generation.
[0067] Step 140: Question understanding and answer generation. Use large models to understand the questions generated in the previous step, and generate detailed and accurate answers based on the original text. By constructing appropriate prompt templates, input the background knowledge and questions into large models (also use multiple models to generate candidate answers), and generate multiple answers in an unsupervised manner. This step ensures that each question can be answered fully and from multiple angles, laying the foundation for subsequent answer sorting and fusion. In one specific implementation of the present application, the above step 140 can include:
[0068] Sub-step D1: Construct an answer generation prompt template. The constructed prompt template is as follows: “Background knowledge is: [Context], please answer the following questions based on the content of the above article, and generate M answers for each question: require to answer the above questions as detailed and accurate as possible, without changing the key information, and the answers cannot contain demonstrative pronouns such as ‘the article’, ‘according to this article’ etc.
[0069] Sub-step D2: Multi-model generates answer candidate set. The prompt is sent into the above three large models to generate answers, and for each question, the generated answers are 3M in total, and all the generated answer sets are denoted as A={A1, A2, …, A N}, wherein A i contains 3M answers returned by the large model for the question Q i .
[0070] Step 150: Answer sorting and fusion. Not all answers generated by the large model are correct, and the generated answers need to be sorted and fused. However, the training of the sorting model requires supervised data, and the construction of the training set by manual work is costly, and the number of annotations is small. In order to solve this problem, an automatic sorting method of constructing partial order answers is used to sort the answers. In this step, for multiple answer candidates of each question, the optimal answer is first screened out by the automatic sorting method, and then the candidate answers are integrated by using the answer fusion technology to generate a coherent, comprehensive and accurate final answer. This process not only improves the accuracy of the answer, but also effectively avoids the errors that may be generated by a single model, and finally forms a high-quality question and answer pair, providing a basis for subsequent fine-tuning data set construction. In one specific implementation manner of the present application, the above step 150 can include:
[0071] Sub-step E1: Seed sample construction. In the question set , n questions and their corresponding answer candidate sets are randomly sampled as seed samples of the sorting model;
[0072] Sub-step E2: Sample coarse annotation. The clustering algorithm (K-means) is used to cluster the same question and several answers, and the answers in the same group with the question are sorted according to the Euclidean distance, the answer closest to the cluster center is selected as the answer with high confidence, which is the positive sample, the K answers closest to the cluster center are selected as the negative sample, and the rest of the answers are the negative samples, and K is a set value;
[0073] Sub-step E3: Sorting model training. After obtaining the partial order relation of the answers, a sorting model is constructed, which is a Pairwise method. This method considers the most difficult-to-distinguish samples in the candidate answers as negative samples, instead of randomly sampling answers as negative samples, so as to better improve the accuracy of the sorting model. The optimization goal is to maximize the difference between the sorting of the positive samples and the negative samples by the model. Therefore, a sorting score function f(q, a i ) is designed to score the relevance of the answer a i for the question q. The definition of the sorting score function f is the cosine similarity of the vector representation of the question q and the answer a i . The loss function is designed as:
[0074]
[0075] where a i represents positive samples, i.e. samples where the question and the answer match; a j represents negative samples, i.e. samples where the answer is randomly sampled from the non-correct answers for the question; σ represents the sigmoid function, which maps the score difference to (0, 1). The goal of this loss function is to make the predicted score difference as large as possible for the correctly ordered answers, i.e. when a i is ordered before a j , then f(q, a i ) > f(q, a j ). f is optimized by the stochastic gradient descent algorithm.
[0076] Sub-step E4: After f is trained, the relevance ranking for the question can be performed, and finally for the question, the top answers are retained.
[0077] Sub-step E5: The top most relevant answers are fused. A template for answer fusion is constructed, which is as follows: "The following texts are all descriptions of a certain fact. Please perform multi-document summarization on these texts to generate a coherent and comprehensive summary, and note that no content that does not exist in these texts can be added. These texts are as follows: ".
[0078] The prompt template is the input of the large model. The prompt template is first constructed, then the content is filled in, and then the large model is sent to generate the result, so as to obtain the fused answer and question, and finally form the "question and answer" fine-tuning data set.
[0079] The above-described embodiments are only the preferred specific embodiments of the present application, and the usual changes and replacements made by those skilled in the art within the scope of the technical solutions of the present application should be included in the protection scope of the present application.
Claims
1. A method for constructing a fine-tuning dataset for a large question-answering model in the field of aerospace control software, characterized in that, include: All original aerospace control software documents were converted into plain text, and then each document was divided into blocks according to the chapter structure to form structured JSON text corresponding to each chapter. Extract keywords from structured JSON text; based on the obtained keywords, generate a set of questions that are related to the keywords and have clear semantics; For a set of questions, multiple candidate answers are generated for each question. Then, all candidate answers for each question are sorted and merged into a coherent, comprehensive and accurate final answer. Based on each question and its corresponding final answer, a fine-tuning dataset is constructed.
2. The method for constructing a fine-tuning dataset for a large question-answering model in the field of aerospace control software according to claim 1, characterized in that, Keyword extraction is performed on structured JSON text using the following method: 1) Perform word segmentation on the structured JSON text to obtain a preliminary set of candidate words; 2) For each candidate word in the initial candidate word set, perform the following calculations: Calculate the frequency of candidate words in the JSON text and their rarity in the entire document to obtain the TF-IDF feature values of the candidate words; The topic analysis of JSON text is performed using the LDA model to calculate the probability feature values of candidate words; The importance feature value of the candidate word is calculated by searching the word on Wikipedia to determine whether the candidate word belongs to the named entity in the knowledge graph. 3) The TF-IDF feature value, probability feature value, and importance feature value of each candidate word are weighted to obtain the comprehensive feature value of the corresponding candidate word; 4) Based on the comprehensive feature value of each candidate word, sort them from largest to smallest, and select a set number of keywords from the beginning to the end as the keywords of the chapter.
3. The method for constructing a fine-tuning dataset for a large question-answering model in the field of aerospace control software according to claim 1, characterized in that, Based on the obtained keywords, a set of questions that are related to the keywords and have clear semantics is generated, specifically: Construct a question-generating prompt template based on JSON text and keywords, requiring the constructed question to be relevant to the keywords; The prompt templates were input into three large models: Qwen3-32B, ChatGLM3-6B, and DeepSeek-R1-671B. The large models were used to ask questions about the keywords in the JSON text, resulting in a set of questions that were relevant to the keywords and had clear semantics.
4. The method for constructing a fine-tuning dataset for a large question-answering model in the field of aerospace control software as described in claim 3, characterized in that, Quality control of the problem set is performed as follows: 1) Iterate through each question in the generated question set. For each question, perform the following operations: Check if any one of the keywords is included; if not, remove it from the question set. Calculate the perplexity of each question text, and remove questions with perplexity exceeding a preset value from the question set; 2) Deduplication of similar problems: Calculate the vector representation of each problem and calculate the cosine similarity between each pair of vectors. For problems with similar vectors, keep one of them, that is, deduplication of similar problems.
5. The method for constructing a fine-tuning dataset for a large question-answering model in the field of aerospace control software according to claim 1, characterized in that, For the set of questions, generate multiple candidate answers for each question, specifically: Using JSON text as background information, we construct answer hint templates, which contain background information and a set of questions. The prompt templates were input into three large models: Qwen3-32B, ChatGLM3-6B, and DeepSeek-R1-671B. Each large model generated multiple candidate answers for each question.
6. The method for constructing a fine-tuning dataset for a large question-answering model in the field of aerospace control software according to claim 1, characterized in that, A sorting method that automatically constructs partial-order answers is used to sort all candidate answers for each question, specifically as follows: In the question set, multiple questions and all their corresponding candidate answers are randomly sampled as seed samples for sorting; Clustering algorithms are used to cluster the same question and all answers in the seed sample. The question is used as the sample centroid, and the answers are sorted in order of Euclidean distance from nearest to farthest. The answer with the closest cluster centroid is selected as the answer with high confidence and is used as the positive sample. The remaining answers are used as negative samples, thus constructing the question and positive and negative answer samples. After obtaining the question and positive / negative example answer samples, a ranking model is constructed. This ranking model is a pairwise method, and a ranking score function f(q,a) is designed. i For question q, the answer is a. i Scoring the relevance; Design the loss function: Among them, a i Let a represent a positive sample. j Let represent a negative sample; σ represents the sigmoid function; the goal of this loss function is to maximize the predicted score difference for correctly ranked answers, i.e., when α = α, the difference between the predicted and actual scores is maximized. i Sort in a j Previously, f(q,a) i )>f(q,a j ); for the ranking score function f(q,a) i Optimize; When the ranking score function f(q,a) i After training, the questions are ranked by relevance, and finally, for each question, a set number of answers with the highest ranking are retained.
7. The method for constructing a fine-tuning dataset for a large question-answering model in the field of aerospace control software as described in claim 6, characterized in that, After sorting the candidate answers, they are merged into a coherent, comprehensive, and accurate final answer, as follows: Construct a hint template that integrates all the answers. The hint template should contain all the answers that are retained. The task is to use these answers as a multi-document summary to generate a coherent and comprehensive summary, without adding any content that is not present in these answers.
8. The method for constructing a fine-tuning dataset for a large question-answering model in the field of aerospace control software according to claim 1, characterized in that, For original aerospace control software documents, if the document is in Word format, use the pandoc tool to convert it to Markdown text; if the document is in PDF format, use RapidOCR to convert it to plain natural language text.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 8.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Keyword-based long text question and answer pair generation system
CN111914062A
Text generation method and system based on prompt project and fine tuning technology
CN118095292A
Instruction fine tuning data set construction method and device
CN118966379A
Method for generating diversified instruction data in medical field based on large language model
CN119069138A
Intelligent question answering system based on large language model
CN119623646A
