A large model training data synthesis method, system, device and storage medium

By collecting and cleaning military corpus data from multi-source channels, using pre-trained language models to generate semantic vectors and performing cluster analysis, generating multi-theme context synthesis samples and performing multi-dimensional quality evaluation, the problem that data synthesis methods in the existing technology cannot simulate complex multi-theme scenarios and incomplete quality evaluation is solved, high-quality and diversified training data generation is achieved, and the cross-theme processing capability and training effect of the large model are improved.

CN120409710BActive Publication Date: 2025-09-02XIAMEN YUANTING INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510907023.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-02
Publication Date
2025-09-02
Estimated Expiration
2045-07-02

AI Technical Summary

Technical Problem

The existing training data synthesis method cannot simulate complex multi-themed application scenarios in the real world, the data quality evaluation mechanism is imperfect, and high-quality data that helps model optimization cannot be screened out, resulting in large models performing poorly in cross-themed tasks.

Method used

By collecting military corpus data from multi-source channels, cleaning and structured processing, semantic vectors are generated using pre-trained language models, clustering analysis forms topic clusters, generating multi-topic context synthesis samples, and filtering out high-quality training data through multi-dimensional quality evaluation, adjusting topic weights and synthesis strategies to optimize model training.

Benefits of technology

Multi-themed training data that is highly adapted to the training requirements of large-scale models is generated, which significantly improves the accuracy, generalization ability and robustness of large-scale models in multi-themed task processing, enhances the cross-themed processing capabilities of the model, and optimizes the training data generation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120409710B_ABST
    Figure CN120409710B_ABST
Patent Text Reader

Abstract

The present invention proposes a large-scale model training data synthesis method, system, device, and storage medium, including: pre-processing original military corpus data, generating semantic vectors using a pre-trained language model, dividing the semantic vectors into multiple topic clusters through cluster analysis, extracting keywords and representative samples from each topic cluster to form a topic ontology library; selecting related topic pairs based on a topic similarity matrix, and generating synthetic samples using predefined templates; controlling the language style of the synthetic samples through prompt word instructions to generate stylized samples; dividing the difficulty level of the stylized samples to obtain graded samples; performing multi-dimensional quality assessment and screening on the graded samples to obtain screened samples; using the screened samples to train a large language model, and adjusting the topic weights, updating the synthesis strategy, and optimizing the sample structure based on the performance of the large language model in various topic tasks. The present invention can provide high-quality and diverse training data for large-scale model training.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of training data technology, and in particular to a method, system, device and storage medium for synthesizing large-model training data. Background Art

[0002] In the field of artificial intelligence, the training performance of large models is closely related to the quality and diversity of training data. Existing training data synthesis methods have many shortcomings and cannot meet the training needs of large models in multi-topic scenarios.

[0003] On the one hand, traditional methods focus on synthesizing data from a single or a few topics, failing to simulate complex, multi-topic application scenarios in the real world. This results in poor performance of large models when handling cross-topic tasks, making them unable to effectively adapt to diverse practical application needs. On the other hand, the existing synthetic data generation process fails to adequately consider the training characteristics of large models. The structure and distribution of the data are poorly adapted to the requirements of large-scale model training, and imperfect quality assessment mechanisms prevent the selection of high-quality data that truly contributes to model optimization. These issues severely hinder the improvement of large-scale model training results.

[0004] In view of this, the present invention proposes a large-scale model training data synthesis method, system, device and storage medium, which can generate high-quality, diversified and multi-topic training data that adapts to the training needs of large models. Summary of the Invention

[0005] In order to solve the problems that existing technologies mostly focus on data synthesis of a single topic or a few topics, cannot simulate complex multi-topic application scenarios in the real world, and have imperfect quality assessment mechanisms that cannot screen out high-quality data that is truly helpful for model optimization, the present invention provides a large model training data synthesis method, system, device and storage medium to solve the above-mentioned technical defects.

[0006] In a first aspect, the present invention proposes a method for synthesizing large model training data, the method comprising the following steps:

[0007] S1. Collect original military corpus data from multiple sources, clean, standardize, remove duplicates, and perform structured conversion on the original military corpus data to form basic military corpus data;

[0008] S2. Generate semantic vectors for basic military corpus data using a pre-trained language model. Divide the semantic vectors into multiple topic clusters through cluster analysis. The topic clusters include combat command, weapons and equipment, tactics and strategies, logistics support, and electronic countermeasures. Keywords and representative samples from each topic cluster are extracted to form a topic ontology library.

[0009] S3, based on the topic similarity matrix of the topic ontology library, related topic pairs are selected and synthetic samples integrating multiple topic contexts are generated through predefined templates;

[0010] S4. Control the language style of the synthesized samples through prompt word instructions to generate stylized samples, including: colloquial expression samples and formal command samples; classify the difficulty level of the stylized samples based on text length, structural complexity, vocabulary difficulty, and number of reasoning steps to obtain graded samples;

[0011] S5. Conduct multi-dimensional quality assessment and screening of graded samples to obtain screening samples;

[0012] S6. Use the screened samples to train the large language model. Based on the performance of the large language model in various topic tasks, adjust the topic weights, update the synthesis strategy, and optimize the sample structure.

[0013] Preferably, in step S2, a pre-trained language model is used to generate semantic vectors of basic military corpus data, the semantic vectors are divided into multiple topic clusters through cluster analysis, and keywords and representative samples of each topic cluster are extracted to form a topic ontology library, which specifically includes the following sub-steps:

[0014] S21. Use the BERT model to transform each text of the basic military corpus data into i Encode into a fixed-dimensional vector and use average pooling to output the semantic vector of the entire text;

[0015] S22, performing K-Means cluster analysis on the semantic vector to obtain clustering results;

[0016] S23. Construct a topic ontology library based on the clustering results, including: representing the topic semantic features with the cluster center vector; extracting keywords of each topic cluster through the TF-IDF algorithm; selecting N samples closest to the cluster center as representative samples, where N represents a natural number greater than 0.

[0017] Preferably, in step S2, it further includes:

[0018] Perform semantic rewriting, sentence reconstruction or context completion on the representative samples in the subject ontology library to generate extended samples, and then add the extended samples to the representative samples of the subject ontology library.

[0019] Preferably, in step S3, related topic pairs are selected based on the topic similarity matrix of the topic ontology library, and synthetic samples integrating multiple topic contexts are generated through a predefined template, which specifically includes the following sub-steps:

[0020] S31. Based on the calculated value of the topic similarity matrix, select the related topic pairs whose similarity is higher than the set threshold;

[0021] S32. Designing a predefined template for structured integration for each related topic pair, the predefined template including: setting a logical connection structure of the intersection topics and constructing a question template;

[0022] S33. Call the Qwen model to apply a predefined template to the associated topic pairs to generate synthetic samples.

[0023] Preferably, in step S4, the language style of the synthesized sample is controlled by the prompt word instruction to generate a stylized sample; the difficulty level of the stylized sample is divided based on the text length, structural complexity, vocabulary difficulty and number of reasoning steps to obtain a graded sample, which includes the following sub-steps:

[0024] S41, calling the Qwen model to generate a stylized sample based on the prompt word instruction for the synthetic sample;

[0025] S42. Calculate the difficulty score of the stylized sample. The calculation expression is:

[0026]

[0027] In the formula, Score(st i ) is the difficulty score; is the i-th stylized sample; w1, w2, w3 and w4 are weighting factors; Length is the text length; TreeDepth is the structural complexity; RareWordRatio is the vocabulary difficulty; ReasoningSteps is the number of reasoning steps;

[0028] S43. Map the obtained difficulty score to a preset score range, divide it into multiple levels of difficulty labels according to the preset score range, and obtain graded samples.

[0029] Preferably, in step S5, multi-dimensional quality assessment and screening are performed on the graded samples to obtain screened samples, which specifically includes the following sub-steps:

[0030] S51. Calculate the total score of the multi-dimensional quality assessment of the graded samples using the following expression:

[0031]

[0032] Where, Q(sc i ) is the total score of multi-dimensional quality assessment; sc i is the i-th graded sample; and is a configurable weight coefficient; Lang is the language quality score; Sem is the semantic consistency score; Topic is the topic relevance score;

[0033] S52. Sort the samples from high to low according to the total scores of the multi-dimensional quality assessment, and select the first K samples as screening samples, where K is a natural number greater than 0.

[0034] Further preferably, in step S5, the language quality score is calculated by using the PPL function, and the calculation expression is:

[0035]

[0036] Where Lang is the language quality score, n is the number of words in the graded sample; w j is the jth word of the classification sample; is the conditional probability prediction of the language model for the jth word;

[0037] The semantic consistency score is calculated using the following expression:

[0038]

[0039] Where Sem is the semantic consistency score; is the standard sentence in the basic military corpus data; is the semantic vector of the hierarchical sample encoded by the BERT model; is the semantic vector of a standard sentence encoded by the BERT model; Indicates the cosine similarity between the graded sample and the standard sentence;

[0040] The topic relevance score is calculated using the following expression:

[0041]

[0042] Where, Description of the topic of the k-th preset; is the semantic vector of the hierarchical sample encoded by the BERT model; The semantic vector for the topic description encoded by the BERT model; is the cosine similarity between the semantic vector of the classified sample and the semantic vector of the topic description.

[0043] In a second aspect, the present invention proposes a large model training data synthesis system, the system comprising:

[0044] The pre-processing module is configured to collect raw military corpus data from multiple sources, clean, standardize, remove duplicates, and perform structured conversion on the raw military corpus data to form basic military corpus data;

[0045] A topic modeling module is configured to generate semantic vectors of basic military corpus data using a pre-trained language model, divide the semantic vectors into multiple topic clusters through cluster analysis, and extract keywords and representative samples from each topic cluster to form a topic ontology library;

[0046] The data synthesis module selects related topic pairs based on the topic similarity matrix of the topic ontology library and generates synthetic samples that integrate multiple topic contexts through predefined templates;

[0047] The style control and difficulty adjustment module is configured to control the language style of the synthesized samples through prompt word instructions to generate stylized samples, including: colloquial expression samples and formal command samples; the difficulty level of the stylized samples is divided into different levels based on text length, structural complexity, vocabulary difficulty, and number of reasoning steps to obtain graded samples;

[0048] The data quality assessment module is configured to perform multi-dimensional quality assessment and screening on the graded samples to obtain screened samples;

[0049] The training feedback optimization module is configured to use the screened samples to train the large language model. Based on the performance of the large language model in various topic tasks, it adjusts the topic weights, updates the synthesis strategy, and optimizes the sample structure.

[0050] In a third aspect, the present invention proposes a terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of any of the above-mentioned large model training data synthesis methods are implemented.

[0051] In a fourth aspect, the present invention proposes a computer-readable storage medium, which stores a computer program, and is characterized in that when the computer program is executed by a processor, it implements the steps of any of the above-mentioned large model training data synthesis methods.

[0052] Compared with the prior art, the present invention has the following advantages:

[0053] (1) Highly adaptable to the training requirements of large models: This invention closely focuses on the characteristics of large model training for data synthesis. From data enhancement, topic fusion to quality assessment, the core goal is to improve the training effect of large models. It can generate multi-topic training data that meets the training requirements of large models, thereby significantly improving the accuracy, generalization ability and robustness of large models in multi-topic task processing.

[0054] (2) Significantly improve data diversity and quality: Through multi-source data acquisition, deeply customized synthesis strategies, and multi-dimensional quality assessment, rich, diverse, and high-quality training data can be generated. This not only covers multiple subject areas, but also effectively improves the semantic rationality, knowledge accuracy, and training adaptability of the data, providing sufficient and high-quality learning materials for large models.

[0055] (3) Enhanced cross-topic processing capabilities of large models: The data synthesis process emphasizes topic fusion and knowledge transfer, enabling large models to learn the associations between different topics and the way knowledge is integrated during training. This significantly enhances the ability of large models in cross-topic task processing, improves the generalization and practicality of the model, and enables it to better cope with complex and changing practical application scenarios.

[0056] (4) Optimizing the training data generation process: Introducing interactive generation mechanisms and reinforcement learning optimization strategies to achieve dynamic adjustment and optimization of the data synthesis and evaluation process, improving the efficiency and intelligence level of data generation, while reducing the cost of manual intervention, and forming an efficient and intelligent data synthesis and optimization system. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Other features, objects and advantages of the present application will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0058] Figure 1 is a flow chart of a method for synthesizing large model training data according to the present invention;

[0059] Figure 2 is a schematic diagram of a large model training data synthesis system according to the present invention;

[0060] Figure 3 It is a schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0061] The present application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely for the purpose of explaining the relevant invention and are not intended to limit the invention. It should also be noted that, for ease of description, only portions relevant to the relevant invention are shown in the accompanying drawings.

[0062] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0063] The present invention proposes a method for synthesizing large model training data. Figure 1 The flowchart of the large model training data synthesis method of the present invention is shown as follows: Figure 1 As shown, the method includes the following steps:

[0064] S1. Collect original military corpus data from multiple sources, clean, standardize, deduplicate, and structure the original military corpus data to form basic military corpus data.

[0065] In this embodiment, raw military corpus data is collected from multiple sources, including the internet, open source corpora (such as Wikipedia and Common Crawl), and internal enterprise data warehouses. This raw military corpus data includes, but is not limited to, high-quality military question-and-answer data and manuals. After collection, the raw military corpus data is cleaned, specifically by removing HTML tags, special characters, and non-text content, retaining only pure text information. The cleaned text is then standardized, converting the encoding format to UTF-8 and normalizing all punctuation to ensure consistency and correctness of the text format.

[0066] To further improve data quality, the SimHash algorithm (Similarity-sensitive Hash) is used to fingerprint the text. A Hamming distance threshold of 3 is set, and samples with a Hamming distance less than 3 are considered duplicates and removed, ensuring high uniqueness of the text in the dataset. The processed text is then segmented into paragraphs and converted into a structured JSON-formatted base corpus for storage. In this JSON-formatted base corpus, each paragraph corresponds to a record containing three fields: text content (text), data source (source), and timestamp (timestamp), facilitating subsequent querying, processing, and analysis. For example, the raw text "blood pressure ↑ requires vigilance!!!" collected from a medical forum is converted to the standardized text form "blood pressure rises require vigilance." after the aforementioned processing steps and stored in the JSON-formatted base corpus. This series of data collection and preprocessing steps provides high-quality, structured base corpus support for subsequent large-scale model training data synthesis.

[0067] Continue to refer Figure 1 The method for synthesizing large model training data proposed by the present invention further includes the following steps:

[0068] S2. Use a pre-trained language model to generate semantic vectors for basic military corpus data. Through cluster analysis, the semantic vectors are divided into multiple topic clusters, including combat command, weapons and equipment, tactics and strategies, logistics support, and electronic countermeasures. Keywords and representative samples of each topic cluster are extracted to form a topic ontology library covering a multi-dimensional military knowledge structure.

[0069] In this embodiment, semantic modeling based on Bert vectorization and Kmeans clustering analysis are performed on basic military corpus data to extract multiple topic tags and construct a topic ontology library. The topic ontology library includes topic names, keyword sets, and representative samples. The specific implementation process is as follows:

[0070] ① Input corpus processing

[0071] Given a basic military corpus dataset: , where s i Represents the i-th text (sentence or paragraph), the value range of i is [1, N], N is the total number of texts, and D represents the set consisting of N texts.

[0072] ②Semantic vector representation (Embedding)

[0073] Use the BERT model (Bidirectional Encoder Representations from Transformers, a pre-trained language model) to transform each text s i Encoded as a fixed-dimensional vector:

[0074] in .

[0075] Use average pooling to output the semantic vector representation of the entire text:

[0076]

[0077] in is the semantic vector of the entire text, is the vector representation of the jth word, and L is the length of the entire text that needs to be vectorized.

[0078] ③K-Means Clustering Analysis

[0079] make is the vector set of all samples. The goal of the clustering objective function is to minimize the sum of the squared distances from the sample points to the cluster center to which they belong:

[0080]

[0081]

[0082] Where K represents the number of clustered topics (which can be selected by the elbow rule or silhouette coefficient); represents the kth cluster (topic cluster); represents the center point of the kth cluster.

[0083] ④Build a subject ontology library

[0084] Based on the clustering results {C1, C2, ..., C K}Build the subject ontology library:

[0085] Topic semantic features: cluster center Representing the core semantics of the topic

[0086] Keyword extraction: Use the TermFrequency-Inverse Document Frequency (TF-IDF) + PMI (Pointwise Mutual Information) algorithm to extract the top N keywords for each topic cluster.

[0087] Representative samples: Select the N samples closest to the cluster center as representatives (N is a natural number greater than 0, with a typical value of 5).

[0088] Finally, the following topic representation is constructed :

[0089] .

[0090] In a specific embodiment, step S2 further includes:

[0091] Within a single topic, based on a small amount of seed data, semantic expansion, expression diversification and structural reconstruction are carried out to enhance the coverage and language diversity of the topic corpus. Implementation logic: Input content selection, select several representative texts from the clustered topic corpus ; Paraphrasing, using instructions to fine-tune the language model Qwen; generating equivalent rewriting template sentence reconstruction, extracting the grammatical structure of the original sentence and reorganizing it; context completion, constructing additional information through the prompt generation model; generating extended samples , and add the extended sample to the representative sample of the subject ontology library.

[0092] Continue to refer Figure 1 The method for synthesizing large model training data proposed by the present invention further includes the following steps:

[0093] S3. Select related topic pairs based on the topic similarity matrix of the topic ontology library, and generate synthetic samples that integrate multiple topic contexts through predefined templates.

[0094] In a specific embodiment, when synthesizing data based on a subject ontology library, the present invention first identifies related subject pairs by calculating a subject similarity matrix. Specifically, the steps are as follows:

[0095] ① Calculate the topic similarity matrix: Using the semantic feature vectors (i.e., cluster center vectors) of each topic in the topic ontology library, calculate the cosine similarity between each pair of topics to construct the topic similarity matrix. For example, for the topic clusters "combat command" and "weapons and equipment," calculate the cosine similarity between their semantic feature vectors.

[0096] ② Select related topic pairs: Set a similarity threshold (e.g., 0.7) and filter out topic pairs with similarities above the threshold from the similarity matrix to form a list of related topic pairs. For example, if the similarity between "battle command" and "weapons and equipment" is 0.75, which is higher than the threshold of 0.7, then they will be selected as a related topic pair.

[0097] ③ Design predefined templates: For each related topic pair, design a predefined template for structured fusion, including the intersection topic logical connection structure and question template. For example:

[0098] Intersection topic logical connection structure: "In the context of {combat command}, how to effectively use {weapons and equipment} to achieve combat objectives?"

[0099] Question template: "Given the scenario of {T_k1} ({T_k1} is a placeholder for a specific subject identifier), how should the combat mission be carried out with the support of {T_k2}?"

[0100] ④ Generate synthetic samples: The Qwen model is invoked, taking the associated topic pairs and predefined templates as input to generate synthetic samples that integrate multiple topic contexts. For example, if the prompt is "Based on the topics of combat command and weapons and equipment, generate a question and background description that integrates the two." The Qwen model will generate samples similar to the following:

[0101] Question: "In the context of modern joint operations, how can commanders rationally deploy new weapons and equipment based on battlefield conditions to achieve their combat intent?"

[0102] Answer: "Commanders need to integrate battlefield information, assess weapon and equipment performance and combat requirements, and formulate precise equipment deployment plans..."

[0103] Through the above steps, the present invention can effectively generate synthetic samples that integrate multi-topic contexts, thereby improving the model's ability to understand and process multi-topic tasks in the military field.

[0104] Continue to refer Figure 1 The method for synthesizing large model training data proposed by the present invention further includes the following steps:

[0105] S4, controlling the language style of the synthesized sample through prompt word instructions to generate stylized samples, including: colloquial expression samples and formal command samples;

[0106] The difficulty level of stylized samples is divided based on text length, structural complexity, vocabulary difficulty and number of reasoning steps to obtain graded samples.

[0107] In this embodiment, to enable the generated data to exhibit different linguistic styles in terms of register, tone, and vocabulary level, thereby enhancing the large model's adaptability to diverse forms of language expression, the present invention utilizes a method combining prompt control with the large model. Specifically, this involves inputting specific style prompts into the generative model, such as "Please answer the following question using formal written language:..." or "Explain the following concept using the tone of an academic paper:..." Based on these prompts, the generation function adjusts the linguistic style of the output text. First, to enable the generated data to exhibit different linguistic styles in terms of register, tone, and vocabulary level, thereby enhancing the large model's adaptability to diverse forms of language expression, the present invention utilizes a method combining prompt control with the Qwen model. Specifically, this involves inputting specific style prompts into the generative model, such as "Please answer the following question using formal written language:..." or "Explain the following concept using the tone of an academic paper:..." Based on these prompts, the generation function adjusts the linguistic style of the output text. The generation function can be expressed as:

[0108]

[0109] Output represents the output, and the Qwen model's input consists of context and style cues. This process ensures that the text generated by the model meets specific style requirements, such as formal, colloquial, academic, official, and expository, effectively expanding the model's ability to handle diverse text styles.

[0110] In a specific embodiment, the present invention implements language style control of the synthesized sample through the following steps:

[0111] When generating synthetic samples, specific prompt word instructions can be used to control the language style and generate stylized samples that meet the needs of specific scenarios. For example:

[0112] Sample popular expressions: When generating soldier training instructions, you can enter prompts like "Please use easy-to-understand language to write training instructions for soldiers:..." to guide the model to generate training instructions that are easy for soldiers to understand.

[0113] Formal command body sample: If the goal is to generate a combat order, the prompt can be set to "Draft a combat order in the tone of a formal order:...", so that the generated content meets the seriousness requirements of a combat order.

[0114] In addition, to meet the varying data sample difficulty requirements of large models at different training stages and capability levels, this paper designs a difficulty grading mechanism. This mechanism aims to generate training data samples that are progressively distributed from shallow to deep, optimizing the model training curve and generalization ability. The difficulty grading mechanism primarily evaluates synthetic samples based on the following metrics:

[0115] Text length: It can be calculated by the number of characters or words. Generally, longer texts require higher model comprehension capabilities.

[0116] Structural complexity (TreeDepth): Measured by analyzing the depth of the text's syntactic tree or the length of its dependency path. The more complex the structure, the stronger the grammatical processing capabilities required of the model.

[0117] Lexical difficulty (RareWordRatio): Counts the proportion of low-frequency words, terms, and abstract words in the text. A high proportion of difficult words increases the difficulty of understanding the text.

[0118] Reasoning Steps: Calculates the length of the logical reasoning chain in the text. Longer reasoning chains require the model to have stronger logical reasoning capabilities.

[0119] By combining the above indicators, the difficulty score of each synthetic sample is calculated as follows:

[0120]

[0121] In the formula, Score(st i ) is the difficulty score; is the i-th stylized sample; w1, w2, w3, and w4 are configurable weighting factors that can be adjusted according to specific training objectives; Length is the text length; TreeDepth is the structural complexity; RareWordRatio is the vocabulary difficulty; ReasoningSteps is the number of reasoning steps.

[0122] Based on the calculated scores, the samples are divided into different difficulty levels (such as L1–L5) according to the score range, providing hierarchical data support for model training.

[0123] Furthermore, during the data generation process, task prompts can be used to control the difficulty of the generated content. For example, the prompt "Please generate a summary suitable for beginners to understand" can be used to specify the difficulty of the generated content, thereby achieving precise control of the difficulty of the training data.

[0124] Through the above steps, the present invention can generate training data with different language styles and difficulty levels, meet the needs of large models at different training stages, and effectively improve the performance and generalization ability of the model.

[0125] Continue to refer Figure 1 The method for synthesizing large model training data proposed by the present invention further includes the following steps:

[0126] S5. Conduct multi-dimensional quality assessment and screening of graded samples to obtain screened samples.

[0127] S6. Use the selected samples to train the large language model. Based on the performance of the large language model on each topic task, adjust the topic weights, update the synthesis strategy, and optimize the sample structure. Preferably, the model performance evaluation results are fed back to step S3 to dynamically update the threshold and template design of the topic similarity matrix.

[0128] In the specific implementation process, the large model training data synthesis method proposed in the present invention realizes multi-dimensional quality assessment and screening of graded samples, as well as model feedback and iterative optimization based on the assessment results through the following steps:

[0129] ① Calculate the total multi-dimensional quality assessment score: For each graded sample, the following formula is used to calculate its total quality assessment score, comprehensively considering the three key dimensions of language quality, semantic consistency, and topic relevance. The scores for each dimension are multiplied by the corresponding weight coefficient and then summed to obtain the final total quality assessment score.

[0130]

[0131] Where, Q(sc i ) is the total score of multi-dimensional quality assessment; sc i is the i-th graded sample; and is a configurable weight coefficient; Lang is the language quality score; Sem is the semantic consistency score; Topic is the topic relevance score;

[0132] The language quality score (Lang) is calculated using the PPL (Perplexity) function to reflect the fluency of the text. The formula is as follows:

[0133]

[0134] Where Lang is the language quality score, n is the number of words in the graded sample; w j is the jth word of the classification sample; is the conditional probability prediction of the language model for the jth word; the lower the PPL value, the more natural the text grammar and the more appropriate the wording.

[0135] Semantic consistency score (Sem): The semantic vectors of the text and the standard sentence encoded by the BERT model are used to calculate the cosine similarity between the two. The formula is:

[0136]

[0137] Where Sem is the semantic consistency score, which measures the consistency between the sample and the standard expression; is the standard sentence in the basic military corpus data; is the semantic vector of the hierarchical sample encoded by the BERT model; is the semantic vector of a standard sentence encoded by the BERT model; Indicates the cosine similarity between the graded sample and the standard sentence;

[0138] Topic relevance score (Topic): This score ensures that the samples are closely related to the topic. It is also based on BERT model encoding, converting the graded samples and topic descriptions into semantic vectors and calculating the cosine similarity between the two:

[0139]

[0140] Where, Description of the topic of the k-th preset; is the semantic vector of the hierarchical sample encoded by the BERT model; The semantic vector for the topic description encoded by the BERT model; is the cosine similarity between the semantic vector of the classified sample and the semantic vector of the topic description.

[0141] ② Sample screening: Based on the calculated multi-dimensional quality assessment score Q(sc i ), sort all graded samples in descending order. Select the top K samples (K is a natural number greater than 0) as high-quality screening samples to ensure the quality of training data.

[0142] ③ Train and evaluate the large language model: The selected high-quality samples are used to train the large language model (LLM). After training, the model's performance on various topic-related tasks is evaluated, focusing on metrics such as precision, recall, and F1 score.

[0143] ④ Adjustment and Optimization: Dynamically adjust topic weights based on the actual performance of the large language model. For example, if the F1 score of the large language model on a certain topic declines, the sample weight of that topic will be increased accordingly, increasing its proportion in subsequent training. At the same time, based on common errors and deficiencies in model training, update the synthesis strategy, such as optimizing predefined templates and adding new prompt words, to generate data samples that better meet the needs. In addition, optimize the sample structure, such as adjusting text length and enriching vocabulary, to better meet the needs of different model training stages.

[0144] Through this closed-loop feedback and optimization mechanism, the present invention can continuously improve the quality of training data, thereby enhancing the performance of large language models in multi-topic tasks and improving their generalization ability and adaptability.

[0145] Further references Figure 2 As an implementation of the above method, the present invention provides a second embodiment of a structural diagram of a large model training data synthesis system 200. The system can be applied to various electronic devices. The large model training data synthesis system 200 includes the following modules:

[0146] The pre-processing module 210 is configured to collect raw military corpus data from multiple sources, clean, standardize, remove duplicates, and perform structural conversion on the raw military corpus data to form basic military corpus data;

[0147] The topic modeling module 220 is configured to generate semantic vectors of the basic military corpus data using a pre-trained language model, divide the semantic vectors into multiple topic clusters through cluster analysis, and extract keywords and representative samples from each topic cluster to form a topic ontology library;

[0148] The data synthesis module 230 selects related topic pairs based on the topic similarity matrix of the topic ontology library and generates synthetic samples integrating multiple topic contexts through predefined templates;

[0149] The style control and difficulty adjustment module 240 is configured to control the language style of the synthesized sample through prompt word instructions to generate stylized samples, including: colloquial expression samples and formal command samples; and to classify the difficulty level of the stylized samples based on text length, structural complexity, vocabulary difficulty, and number of reasoning steps to obtain graded samples;

[0150] The data quality assessment module 250 is configured to perform multi-dimensional quality assessment and screening on the graded samples to obtain screened samples;

[0151] The training feedback optimization module 260 is configured to use the screened samples to train the large language model, adjust the topic weights, update the synthesis strategy and optimize the sample structure according to the performance of the large language model in each topic task.

[0152] In a third aspect, the present invention proposes a terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of any of the above-mentioned large model training data synthesis methods are implemented.

[0153] In a fourth aspect, the present invention proposes a computer-readable storage medium, which stores a computer program, and is characterized in that when the computer program is executed by a processor, it implements the steps of any of the above-mentioned large model training data synthesis methods.

[0154] Reference below Figure 3 , which shows a structural diagram of a computer system 300 suitable for implementing a terminal device or server of an embodiment of the present application. Figure 3 The terminal device or server shown is merely an example and should not limit the functions and scope of use of the embodiments of the present application.

[0155] like Figure 3 As shown, computer system 300 includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from a storage unit 308 into a random access memory (RAM) 303. Various programs and data required for the operation of computer system 300 are also stored in RAM 303. CPU 301, ROM 302, and RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to bus 304.

[0156] The following components are connected to the I / O interface 305: an input section 306 including a keyboard, mouse, and the like; an output section 307 including a liquid crystal display (LCD), speakers, and the like; a storage section 308 including a hard disk and the like; and a communication section 309 including a network interface card such as a LAN card or a modem. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to the I / O interface 305 as needed. Removable media 311, such as a magnetic disk, optical disk, magneto-optical disk, or semiconductor memory, is installed in the drive 310 as needed, so that computer programs read from the media can be installed in the storage section 308 as needed.

[0157] In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for executing the method illustrated in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via the communication portion 309 and / or installed from removable media 311. When the computer program is executed by the central processing unit (CPU) 301, the functions defined in the methods of this application are performed. It should be noted that the computer-readable medium described herein can be a computer-readable signal medium or a computer-readable medium, or any combination thereof. The computer-readable medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples of computer-readable media include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this application, a computer-readable medium may be any tangible medium that contains or stores a program for use by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, embodying computer-readable program code. Such a propagated data signal may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including, but not limited to, wireless, wire, optical cable, RF, or any suitable combination thereof.

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

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

[0160] The above description is merely a preferred embodiment of the present application and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of the invention herein is not limited to technical solutions formed by a specific combination of the aforementioned technical features. It also encompasses other technical solutions formed by any combination of the aforementioned technical features or their equivalents, without departing from the aforementioned inventive concept. For example, a technical solution formed by replacing the aforementioned features with (but not limited to) technical features with similar functions disclosed in this application.

Claims

1. A method for synthesizing large model training data, characterized in that: The following steps are involved: S1. Collecting original military corpus data from multiple sources, cleaning, standardizing, deduplicating, and structurally converting the original military corpus data to form basic military corpus data; S2. Generate semantic vectors of the basic military corpus data using a pre-trained language model, divide the semantic vectors into multiple topic clusters through cluster analysis, and extract keywords and representative samples from each topic cluster to form a topic ontology library, which specifically includes the following sub-steps: S21, use the BERT model to transform each text s of the basic military corpus data i Encode into a fixed-dimensional vector and use average pooling to output the semantic vector of the entire text; S22, performing K-Means cluster analysis on the semantic vector to obtain a clustering result; S23, constructing the subject ontology library based on the clustering results, including: representing the subject semantic features with the cluster center vector; extracting keywords of each subject cluster by the TF-IDF algorithm; selecting N samples closest to the cluster center as representative samples, where N represents a natural number greater than 0; Performing semantic rewriting, sentence reconstruction, or context completion on representative samples in the subject ontology library to generate extended samples, and adding the extended samples to the representative samples in the subject ontology library; S3, based on the topic similarity matrix of the topic ontology library, select related topic pairs, and generate synthetic samples integrating multiple topic contexts through a predefined template, specifically including the following sub-steps: S31. Based on the calculated value of the topic similarity matrix, select the related topic pairs whose similarity is higher than the set threshold; S32. Designing a predefined template for structured fusion for each of the related topic pairs, wherein the predefined template includes: setting a logical connection structure of the intersection topics and constructing a question template; S33, calling the Qwen model to apply the predefined template to the related topic pair to generate a synthetic sample; S4. Controlling the language style of the synthesized sample through prompt word instructions to generate stylized samples, including: colloquial expression samples and formal command samples; classifying the difficulty level of the stylized samples based on text length, structural complexity, vocabulary difficulty, and number of reasoning steps to obtain graded samples; S5. Perform multi-dimensional quality assessment and screening on the graded samples to obtain screened samples; S6. Use the screened samples to train a large language model, and adjust the topic weights, update the synthesis strategy, and optimize the sample structure based on the performance of the large language model in each topic task.

2. The large model training data synthesis method according to claim 1, characterized in that: In step S4, the language style of the synthesized sample is controlled by prompt word instructions to generate a stylized sample; the difficulty level of the stylized sample is divided based on text length, structural complexity, vocabulary difficulty, and number of reasoning steps to obtain a graded sample, which includes the following sub-steps: S41, calling the Qwen model to generate a stylized sample for the synthetic sample according to the prompt word instruction; S42. Calculate the difficulty score of the stylized sample. The calculation expression is: In the formula, Score(st i ) is the difficulty score; is the i-th stylized sample; w1, w2, w3 and w4 are weighting factors; Length is the text length; TreeDepth is the structural complexity; RareWordRatio is the vocabulary difficulty; ReasoningSteps is the number of reasoning steps; S43: Map the obtained difficulty score to a preset score interval, divide it into multiple levels of difficulty labels according to the preset score interval, and obtain graded samples.

3. The large model training data synthesis method according to claim 1, characterized in that: In step S5, multi-dimensional quality assessment and screening are performed on the graded samples to obtain screened samples, which specifically includes the following sub-steps: S51. Calculate the total score of the multi-dimensional quality assessment of the graded samples using the following expression: Where, Q(sc i ) is the total score of multi-dimensional quality assessment; sc i is the i-th graded sample; and is a configurable weight coefficient; Lang is the language quality score; Sem is the semantic consistency score; Topic is the topic relevance score; S52. Sort the samples from high to low according to the total scores of the multi-dimensional quality assessment, and select the first K samples as the screening samples, where K is a natural number greater than 0.

4. The large model training data synthesis method according to claim 3, characterized in that: In step S5, the language quality score is calculated using the PPL function, and the calculation expression is: Where Lang is the language quality score, n is the number of words in the graded sample; w j is the jth word of the graded sample; is the conditional probability prediction of the language model for the j-th word; The semantic consistency score is calculated by the following calculation expression: Where Sem is the semantic consistency score; is the standard sentence in the basic military corpus data; is the semantic vector of the graded sample encoded by the BERT model; is the semantic vector of the standard sentence encoded by the BERT model; represents the cosine similarity between the graded sample and the standard sentence; The topic relevance score is calculated using the following expression: Where, Description of the topic of the k-th preset; is the semantic vector of the graded sample encoded by the BERT model; is the semantic vector of the topic description encoded by the BERT model; It is the cosine similarity between the semantic vector of the classified sample and the semantic vector of the topic description.

5. A large model training data synthesis system, used to implement the large model training data synthesis method according to any one of claims 1 to 4, characterized in that: The system comprises: a preprocessing module configured to collect original military corpus data from multiple source channels, and perform cleaning, standardization, deduplication and structural conversion on the original military corpus data to form basic military corpus data; a topic modeling module configured to generate semantic vectors of the basic military corpus data using a pre-trained language model, divide the semantic vectors into a plurality of topic clusters through cluster analysis, the topic clusters including combat command, weapons and equipment, tactics and strategies, logistics support, and electronic countermeasures, extract keywords and representative samples from each topic cluster to form a topic ontology library; A data synthesis module selects related topic pairs based on the topic similarity matrix of the topic ontology library and generates synthetic samples integrating multiple topic contexts through a predefined template; a style control and difficulty adjustment module configured to control the language style of the synthesized sample through prompt word instructions to generate stylized samples, including: colloquial expression samples and formal command samples; and to classify the difficulty level of the stylized samples based on text length, structural complexity, vocabulary difficulty, and number of reasoning steps to obtain graded samples; A data quality assessment module is configured to perform multi-dimensional quality assessment and screening on the graded samples to obtain screened samples; The training feedback optimization module is configured to use the screened samples to train a large language model, adjust the topic weights, update the synthesis strategy and optimize the sample structure according to the performance of the large language model in each topic task.

6. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the large model training data synthesis method as described in any one of claims 1 to 4 are implemented.

7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the large model training data synthesis method as described in any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • KGQG method for data enhancement based on dynamic prompt large model

    CN118446301A

  • Intelligent question answering system construction method and system based on LLM large language model

    CN119691140A