Consistency learning-oriented sample enhancement and optimization method
By constructing a professional knowledge base and generating diverse positive and negative samples, and combining contrastive learning and learning rate scheduling strategies to optimize the training of large models, the problems of insufficient knowledge coverage and noise interference in large models in vertical domains are solved, thereby improving the adaptability and robustness of the models.
Patent Information
- Application Number
- CN202511455023.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-13
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2045-10-13
AI Technical Summary
Existing technologies suffer from insufficient domain knowledge coverage, limited semantic diversity, and noise interference in large-scale vertical domain models. This results in insufficient deep understanding and robust representation of professional knowledge, and the lack of dynamic optimization mechanisms during training affects the adaptability and stability of the models.
By extracting knowledge from unstructured text, a professional knowledge base is constructed, generating semantically consistent but diverse positive samples, and introducing misleading information to construct negative samples. Combined with contrastive learning and learning rate scheduling strategies, the large model is fine-tuned, and the ratio of positive to negative samples and the weight of the loss function are dynamically adjusted to achieve collaborative optimization of the training process.
It improves the adaptability and robustness of large models in vertical domains, reduces the probability of irrelevant information and incorrect answers, ensures the high quality and logical integrity of training data, and enhances the semantic consistency and discriminative ability of the model.
Smart Images

Figure CN120929892A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence, and in particular to a sample augmentation and optimization method for consistency learning. Background Technology
[0002] In large-scale model applications across vertical domains, constructing high-quality training samples is the core foundation for improving the model's domain adaptability. Traditional sample construction methods often face problems such as insufficient domain knowledge coverage, limited semantic diversity, and noise interference, which restrict the model's deep understanding of professional knowledge and its robust representation ability. Existing technologies mainly revolve around two types of methods: data augmentation techniques and positive and negative sample optimization construction techniques, but significant technical bottlenecks still exist.
[0003] (1) Data augmentation techniques: These techniques generate diverse samples through text transformation to improve the model's generalization ability. Typical methods include back-translation, syntactic structure transformation, and entity substitution. The advantage of these techniques is that they can expand the dataset without modifying the model parameters. However, their limitations are: ① Knowledge extraction relies on shallow rules, making it difficult to extract fine-grained terminological relationships and logical structures from unstructured data (such as equipment logs and expert manuals); ② The generated samples are mostly superficial transformations, making it difficult to guarantee semantic consistency and domain specialization, and easily introducing noise interference; ③ There is a lack of systematic design for negative samples, resulting in insufficient model resistance to misleading.
[0004] (2) Positive and negative sample optimization construction techniques: By constructing a combination of negative samples containing misleading information and highly consistent positive samples, the model's ability to accurately distinguish domain knowledge is enhanced. However, existing methods have the following drawbacks: ① Positive sample generation often adopts a single template strategy (such as synonym replacement), resulting in rigid question-answer pairs that are difficult to cover the complex expressions of real-world scenarios; ② Negative sample construction relies on random interference (such as entity replacement errors) and lacks targeted design based on domain knowledge conflicts, which reduces training effectiveness; ③ The training phase lacks a dynamic optimization mechanism, and a fixed ratio of positive and negative samples can easily lead to model overfitting or unstable convergence.
[0005] In recent years, hybrid construction methods have attempted to combine knowledge enhancement with adversarial generation strategies, such as injecting knowledge graphs to improve the professionalism of positive samples or introducing adversarial networks to generate negative samples. However, such methods still have key problems: ① Knowledge base construction relies on manually labeled structured data, making it difficult to efficiently utilize implicit knowledge in unstructured text; ② Sample generation and model training are disconnected, and no collaborative optimization mechanism is designed, resulting in low efficiency of knowledge injection; ③ The training strategy is static and cannot adapt to the difficulty distribution of samples in stages, restricting the model's ability to progressively learn complex logical relationships.
[0006] Therefore, there is an urgent need for a sample construction method for vertical domains, which can achieve efficient extraction of unstructured knowledge, controllable semantic diversity of sample generation, and dynamic collaborative optimization of the training process, so as to overcome the limitations of existing technologies on domain specialization, data quality, and model convergence stability. Summary of the Invention
[0007] To address the shortcomings of existing technologies, this invention proposes a sample augmentation and optimization method for consistency learning.
[0008] The specific technical solution is as follows: A sample augmentation and optimization method for consistency learning includes the following steps: S1: Extract knowledge from unstructured texts containing professional knowledge materials, interpretations of professional terms, historical practice data, and expert experience sets to obtain original question-answer pairs. Store these pairs to obtain a professional knowledge base for downstream tasks in vertical domains. S2: Process the original question-answer pairs using diversified strategies to generate semantically consistent but diverse augmented sample question-answer pairs. Expand or simplify the augmented sample question-answer pairs to obtain positive samples. Introduce interfering statements or factual errors into the augmented sample question-answer pairs to obtain negative samples. Adjust the ratio of positive to negative samples based on the accuracy of the large model. S3: The positive and negative samples are used as training data, and the parameters are fine-tuned based on the pre-trained large model and the professional knowledge base to obtain a professional large model; during the fine-tuning of the large model, a consistency constraint is applied to the positive samples to make the answers generated by the large model closer to the original standard answers in terms of semantics and content, and the original standard answers are the answers in the positive samples; for the negative samples, a reverse consistency constraint is applied to make the output results of the large model far away from incorrect or misleading answers, thereby enhancing the discrimination ability and robustness of the large model.
[0009] Furthermore, in S1, the professional knowledge data includes: professional equipment structure, operating procedure specifications, and troubleshooting guidelines; The explanation of the technical terms includes: technical terminology explanations, application scenario examples, and conceptual association diagrams; The historical practice data includes: monitoring data, work logs, and customer management system records; The set of expert experience includes: a set of problem-determination rules and a set of logical analysis rules.
[0010] Furthermore, the knowledge extraction operation for the aforementioned professional knowledge materials specifically involves: using text recognition software to collect related information within specific neighboring professional documents; constructing a semantic network using an intelligent text parsing system and extracting key information elements through feature association algorithms; and using a deep neural network based on the Transformer architecture for semantic modeling to accurately identify sentence units containing three core dimensions within the key information elements, generating question-answer pairs that conform to the structure of "problem manifestation, evaluation method + countermeasures"; the three core dimensions are: anomaly representation, quantitative evaluation, and handling strategy. The specific knowledge extraction operation for the interpretation of the professional terms is as follows: a terminology parsing engine is constructed based on knowledge graph technology to systematically extract the terminology ontology definition, applicable context and related characteristics; through an attention mechanism-driven neural network architecture, the structured information extracted by the terminology parsing engine is subjected to deep semantic processing to identify core sentence units containing terminology association failure manifestations, terminology adaptation evaluation standards and terminology standard application schemes, so as to achieve accurate capture and fusion of its multi-dimensional semantic features, and finally generate question-answer pairs that conform to the structure of "problem manifestation, evaluation method + countermeasures"; The specific steps for knowledge extraction from the historical practice data are as follows: Based on the structured features of the data, a data purification process is implemented, namely, using pattern recognition algorithms to complete noise elimination, format reduction, and abnormal symbol filtering to obtain standardized data; a bidirectional Transformer model is used to perform deep semantic parsing on the standardized data to extract technical elements that simultaneously contain abnormal features, detection standards, and processing solutions, and finally generate question-answer pairs that conform to the structure of "problem manifestation, evaluation method + countermeasures"; The specific steps for knowledge extraction from the expert experience set are as follows: A diagnostic rule base and a logical reasoning base are constructed based on expert experience. The diagnostic rule base contains specific standards, conditions, and bases for problem judgment, while the logical reasoning base contains the problem-solving path, steps, and logical thinking. The diagnostic rule base and the logical reasoning base are integrated to construct a multi-level knowledge topology system. A graph neural network is applied to perform representation learning on the rule hierarchy, capturing the complex relationships and hierarchical structure between rules. A decision tree algorithm is then combined to achieve intelligent retrieval and path reasoning of knowledge nodes, ultimately generating question-answer pairs that conform to the structure of "problem presentation, evaluation method + countermeasures" and integrate hierarchical information from the rule base.
[0011] Furthermore, S2 is specifically implemented through the following sub-steps: S2.1: Perform sample enhancement on each original question-answer pair in the professional knowledge base to obtain enhanced samples; the sample enhancement methods include: back translation, syntactic structure transformation, and entity substitution; The original question-and-answer pairs are enhanced using the back-translation method described above: the original question-and-answer pairs are translated from the source language to the target language through a translation model, and then translated back to the source language to generate question-and-answer pairs that are semantically consistent but have different forms. The original question-answer pairs are enhanced using the syntactic structure transformation method described above: syntactic analysis is performed on the original question-answer pairs to identify key components of the sentences; the key components include: subject, predicate, and object; the questions are reconstructed based on the key components of the sentences to generate new question-answer pairs; the methods of reconstructing the questions include: adjusting the word order of the sentences, introducing synonyms for substitution, changing the voice, splitting or merging sentences; The original question-and-answer pairs are enhanced by using the entity replacement method: identifying various entities in the original question-and-answer pairs, replacing the original entities with entities of the same or related categories, generating new question-and-answer pairs, thereby expanding the coverage and diversity of the samples, while ensuring that the replaced question-and-answer pairs remain semantically reasonable and correct. S2.2: Construct negative samples based on augmented samples. The construction methods include: inserting incorrect diagnostic steps into the answers of augmented samples to form logical interference type negative samples; randomly combining questions and answers from different augmented samples to establish question-answer pairs with incorrect associations to form semantic confusion type negative samples; and rearranging the order of standard operation process steps in the answers of augmented samples to form temporally disordered type negative samples. Simultaneously, the questions and answers in the enhanced samples are expanded or simplified to obtain positive samples. Expanding the questions includes adding background information, detailed descriptions, or related questions; simplifying the questions includes removing redundant information and non-critical descriptions; expanding the answers specifically involves supplementing explanations of principles, specific examples, related information, or adjusting the style of expression without deviating from the core meaning, making the answers more comprehensive and concrete; simplifying the answers specifically involves focusing on retaining core conclusions or facts, deleting secondary explanations, redundant embellishments, or compressing details, making the answers more direct and concise.
[0012] Furthermore, in the back-translation method, multiple translation models are selected to perform back-translation operations on the same original question-answer pair, resulting in question-answer pairs with the same semantics but in multiple forms.
[0013] Furthermore, in S2, the ratio of positive to negative samples is adjusted according to the accuracy of the large model, specifically as follows: Based on task requirements, the accuracy of the large model on the validation set is monitored in real time. When the accuracy does not reach the first preset threshold, the proportion of positive samples is kept higher than the initial proportion of negative samples to prioritize the training of the large model's correct understanding of core knowledge and basic reasoning ability. When the accuracy reaches the first preset threshold, the proportion of negative samples is gradually increased according to a preset step size until the target proportion is reached. At the same time, diversity indicators are checked to ensure that the adjusted training data can still evenly cover the task scenario, so as to dynamically adapt to the training stage of the large model and the characteristics of the task. The diversity indicators include sample semantic coverage and expression type distribution.
[0014] Furthermore, in S3, during the fine-tuning of the large model, a contrastive learning strategy is adopted, and the contrastive loss is set as follows: minimizing the representation distance between the original question-answer pair and the positive sample in the latent space, and maximizing the representation difference between the original question-answer pair and the negative sample; Meanwhile, the question-answering generation task is optimized through cross-entropy, and the task loss is set to include positive sample constraint loss and negative sample constraint loss. The positive sample constraint loss is to minimize the deviation between the output obtained by the large model with positive sample input and the answer in the positive sample, and the negative sample constraint loss is to maximize the deviation between the output obtained by the large model with negative sample input and the answer in the negative sample. The weights of contrastive loss and task loss are dynamically adjusted based on the training accuracy: When training a large model, if the model accuracy does not reach the preset threshold, the weights of task loss and contrastive loss are kept at the initial weight values; when the basic accuracy reaches the preset threshold, the weight of contrastive loss is gradually increased until the target weight is reached.
[0015] Furthermore, in S3, during the initial training phase of the large model, when the accuracy of the large model on the validation set has not reached the second preset threshold, the weights of the task loss and the contrastive loss are maintained at their initial weight values, with the weight of the task loss being higher than that of the contrastive loss. This stage focuses on stabilizing the basic performance of the large model, with the accuracy and generalization ability of the large model for basic tasks as the optimization objective, ensuring that the large model can correctly output the core tasks under standard input conditions. The core task outputs include: understanding the fault phenomenon, reasoning about the fault cause, and generating a repair plan. In this stage, consistency learning is introduced in the form of low-intensity regularization. The consistency constraints set on positive samples can both promote the stable output of the large model to closely resemble the original standard answer and avoid excessive consistency requirements from interfering with the model's convergence path. During training, a gentle learning rate scheduling strategy is used to ensure that the parameters of the large model gradually converge. The gentle learning rate scheduling strategy includes linear warm-up and slow decay. Once the baseline accuracy on the validation set has consistently reached the second preset threshold for multiple rounds, training enters the later stage. The weight of the contrastive loss is gradually increased by a preset step size until the target weight is reached, guiding the large model to strengthen the semantic consistency and discriminative ability of the representation space. Simultaneously, in the later stage of large model fine-tuning, the inference consistency of the large model is strengthened: this stage aims at consistency learning, by increasing the weight of positive sample consistency constraints and introducing misleading information from negative samples to impose reverse consistency constraints on the output of the large model, enabling the large model to maintain the correct inference trajectory when encountering perturbation information. Gradient pruning and learning rate scheduling strategies are adopted, and the balance coefficients of contrastive loss and task loss are dynamically adjusted in the loss function to avoid overfitting the consistency target and causing a decline in basic performance.
[0016] A sample augmentation and optimization apparatus for consistency learning includes a memory and one or more processors. The memory stores executable code, and when the one or more processors execute the executable code, they implement the sample augmentation and optimization method for consistency learning.
[0017] A computer-readable storage medium having a program stored thereon that, when executed by a processor, implements the aforementioned sample augmentation and optimization method for consistency learning.
[0018] The beneficial effects of this invention are: This invention ensures high-quality and logically complete training data through a designed positive and negative sample generation strategy. In constructing positive samples, diverse text transformation techniques are used to generate semantically equivalent but varied question-answer pairs, effectively enriching the model's input-output patterns. In constructing negative samples, misleading information and logical errors are introduced to enhance the model's ability to identify erroneous information. This invention not only improves the adaptability and robustness of large models in different scenarios but also significantly reduces the probability of irrelevant information and incorrect answers. Attached Figure Description
[0019] Figure 1 This is a flowchart of the sample augmentation and optimization method for consistency learning in this embodiment of the invention.
[0020] Figure 2 This is a flowchart of the method for constructing positive and negative samples in an embodiment of the present invention.
[0021] Figure 3 This is a schematic diagram of the sample augmentation and optimization device for consistency learning in an embodiment of the present invention. Detailed Implementation
[0022] The present invention will be described in detail below with reference to the accompanying drawings and preferred embodiments. The objectives and effects of the present invention will become clearer as a result. The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0023] Before providing a further detailed description of the embodiments of the present invention, the nouns and terms involved in the embodiments of the present invention will be explained, and the nouns and terms involved in the embodiments of the present invention shall be subject to the following interpretations.
[0024] (1) Contrastive learning strategy: Contrastive learning is a feature representation learning method based on sample relationship modeling. It guides a large language model to learn discriminative feature representations in the embedding space by constructing a contrast relationship between positive and negative samples. The core mechanism of this method is to apply vector space distance compression constraints to semantically similar instances (positive sample pairs) and vector space distance expansion constraints to irrelevant instances (negative sample pairs), thereby forming a feature distribution structure with high discriminativeness.
[0025] (2) Learning rate scheduling strategy: Learning rate scheduling is the core control mechanism in the training process of deep learning models. It achieves fine control of the training process by dynamically adjusting the parameter update step size. This strategy designs differentiated learning rate adjustment schemes based on the characteristics of the training stage: a higher learning rate is used in the early stage to accelerate model convergence, a gradual decay is used in the middle stage to balance exploration and development, and a small adjustment is implemented in the later stage to achieve fine-tuning.
[0026] (3) Gradient clipping: In the training process of deep learning models, gradient clipping is a key means to deal with the gradient explosion problem and ensure training stability. Unlike allowing gradients to grow freely, which may lead to excessive parameter update amplitude and difficulty in model convergence, gradient clipping constrains the gradients generated during backpropagation by setting reasonable threshold limits. When the calculated gradient norm exceeds the preset threshold, the gradient is scaled according to a certain ratio to keep it within the threshold range before being used for parameter updates, thus achieving a balance between gradient scale and training stability. However, gradient clipping also has certain limitations. On the one hand, if the threshold is set improperly, it may excessively suppress effective gradient information, affecting the convergence speed and learning effect of the model; on the other hand, for different model structures and task scenarios, it is necessary to repeatedly adjust the threshold parameters to achieve the best effect, which to some extent increases the tuning cost during the training process.
[0027] (4) Latent Space: refers to a low-dimensional continuous vector space to which the original high-dimensional data is mapped by the deep learning model through nonlinear transformation, where each point (vector) represents a compressed representation of the data features. This concept is the core of deep learning generative models (such as GAN, VAE, autoencoders, etc.), and its essence is to achieve efficient data representation, generation and manipulation through data compression and feature decoupling.
[0028] Based on the above architecture, this invention proposes a sample augmentation and optimization method for consistency learning, such as... Figure 1 As shown, the method includes the following steps: S1: Building a Professional Knowledge Base: This involves extracting and integrating various key information to form question-and-answer pairs (question + answer), which are then stored as initial samples in the professional knowledge base. Key information categories include: professional knowledge materials, interpretations of professional terminology, historical practice data, and collections of expert experience. Key information from unstructured text is collected using a combination of Natural Language Processing (NLP) and knowledge engineering techniques. After analysis by deep learning models (such as BERT and GPT, which are capable of text processing), core points are selected and extracted to generate question-and-answer pairs for archiving. This process aims to ensure high-quality and logical information while improving the clarity and reliability of the questions and answers.
[0029] The specific content and knowledge extraction operations for various key information types are as follows: Professional knowledge materials, i.e., knowledge documents related to a specific field, include: professional equipment structure, operating procedure specifications, and troubleshooting guidelines. The specific process for knowledge extraction from these materials is as follows: First, text recognition software is used to collect relevant information within specific domain-specific professional documents. Then, an intelligent text parsing system is used to construct a semantic network, and key information elements are extracted using feature association algorithms. Next, semantic modeling is performed using a deep neural network based on the Transformer architecture to accurately identify sentence units containing the three core dimensions (anomaly representation, quantitative assessment, and handling strategy) within the key information elements. Finally, question-and-answer pairs are generated that conform to the structure of "problem presentation, assessment method + response measures".
[0030] Professional terminology interpretation refers to the systematic explanation of professional terms and concepts within a field, including: technical terminology explanations, application scenario examples, and conceptual association diagrams. The knowledge extraction process for professional terminology interpretation specifically involves: constructing a terminology parsing engine based on knowledge graph technology to systematically extract the terminology's ontology definition, applicable context, and associated characteristics. Through an attention-driven neural network architecture (such as a Transformer-based model), the structured information extracted by the terminology parsing engine undergoes deep semantic processing, accurately identifying core sentence units containing terminology association failure manifestations, terminology adaptation evaluation standards, and terminology standard application schemes. This achieves precise capture and fusion of its multi-dimensional semantic features, ultimately generating question-answer pairs conforming to the structure of "problem manifestation, evaluation method + countermeasures."
[0031] Historical practice data refers to various types of information data retained during business operations and maintenance, including monitoring data, work logs, and customer management system records. The knowledge extraction process for historical practice data specifically involves: implementing a data purification process based on the structured characteristics of the data, i.e., using pattern recognition algorithms to eliminate noise, standardize formats, and filter out abnormal symbols to obtain normalized data. A bidirectional Transformer model (such as BERT and its variants) is then used to perform deep semantic analysis on the normalized data, extracting technical elements that simultaneously contain anomaly features, detection standards, and processing solutions, ultimately generating question-answer pairs that conform to the structure of "problem manifestation, evaluation method + response measures".
[0032] The expert experience set comprises the problem diagnosis and solution knowledge accumulated by domain experts through long-term practice, including a set of problem judgment rules and a set of logical analysis rules. The specific knowledge extraction operation for this expert experience set involves constructing a diagnostic rule base and a logical reasoning base based on expert experience. The diagnostic rule base contains specific standards, conditions, and bases for problem judgment, while the logical reasoning base contains the path, steps, and logical thinking for problem solving. The diagnostic rule base and logical reasoning base are integrated to construct a multi-level knowledge topology system. Graph neural networks are applied to represent the rule hierarchy, capturing the complex relationships and hierarchical structure between rules. A decision tree algorithm is then used to achieve intelligent retrieval and path reasoning of knowledge nodes, ultimately generating question-answer pairs that conform to the structure of "problem presentation, evaluation method + countermeasures" and integrate hierarchical information from the rule base.
[0033] S2: Construct positive and negative samples as training data for subsequent training of the large model. Specifically, process the original question-answer pairs in the knowledge base using diverse strategies to generate semantically consistent but varied positive samples, optimizing question wording while ensuring correct answers; corresponding negative samples are set to contain misleading information.
[0034] Furthermore, the ratio of positive to negative samples is dynamically adjusted. Specifically, based on task requirements, the accuracy of the large model on the validation set is monitored in real time to see if it reaches a first preset threshold (a threshold used to determine whether the large model has mastered the core knowledge base and to increase the proportion of negative samples; its core design is to guide the composition of training data). When the accuracy does not reach the first preset threshold, the initial ratio of positive samples to negative samples is automatically maintained higher (e.g., positive:negative = 5:1) to prioritize cultivating the large model's correct understanding of core knowledge and basic reasoning ability. When the accuracy reaches the first preset threshold, the proportion of negative samples is gradually increased according to a preset step size until the target proportion is reached (e.g., increasing the proportion of negative samples by 10% in each training round until the target proportion of positive:negative = 2:1 is adjusted). At the same time, diversity indicators such as sample semantic coverage and expression type distribution are verified to ensure that the adjusted training data can still evenly cover the task scenario. This dynamically adapts to the training stage and task characteristics of the large model, flexibly adjusts the ratio of positive to negative samples, and ensures the diversity and balance of training data, thereby providing high-quality and expressive data support for the training of the large model.
[0035] like Figure 2 As shown, the construction of positive and negative samples is achieved through the following sub-steps: S2.1: Enhance the initial samples in the knowledge base using any one of the following three methods to obtain enhanced samples: (1) Enhance the original question-answer pairs using back-translation techniques. Specifically, the original question-answer pairs are first translated from the source language to the target language using a translation model, and then translated back to the source language, thereby generating question-answer pairs with the same meaning but different forms. Furthermore, by changing different translation models, more question-answer pairs with the same meaning but different forms can be obtained. By selecting multiple translation models and combinations of question-answer pairs, the sample representation can be enriched and the diversity of training data can be improved.
[0036] (2) Enhance the original question-and-answer pairs by using syntactic structural transformation. Specifically, firstly, perform syntactic analysis on the original question-and-answer pairs to accurately identify key components such as the subject, predicate, and object of the sentences. Secondly, reconstruct the questions by adjusting the word order, introducing synonyms, changing the voice, splitting or merging sentences to generate new question-and-answer pairs, thereby improving the large model's ability to understand different forms of expression.
[0037] (3) Enhance the original question-answer pairs by using entity replacement technology. Specifically, first accurately identify the various entities in the original question-answer pairs, and then replace the original entities with entities of the same or related categories to generate new question-answer pairs, thereby expanding the coverage and diversity of the samples, while ensuring that the replaced question-answer pairs remain semantically reasonable and correct.
[0038] S2.2: Construct negative samples based on augmented samples. The construction of negative samples adopts multiple generation methods, including: inserting incorrect diagnostic steps into the answers of augmented samples to form logical interference type negative samples; randomly combining different questions and answers to establish question-answer pairs with incorrect associations to form semantic confusion type negative samples; and changing the order of standard operation process steps in the answers of augmented samples to form temporally disordered type negative samples.
[0039] Simultaneously, positive samples are obtained by expanding or simplifying the questions and answers in the augmented samples. Specifically, questions can be expanded by adding background information, detailed descriptions, or related questions to enrich their specificity and information content; or simplified by removing redundant information and non-critical descriptions to make the questions more concise and clear. Answers can be processed in a similar manner: when expanding, explanations of principles, specific examples, related information, or adjustments to the expression style can be added without deviating from the core meaning, making the answer more comprehensive and concrete; when simplifying, the focus is on retaining the core conclusions or facts, removing secondary explanations, redundant embellishments, or compressing details to make the answer more direct and concise. By combining expansion and simplification for both questions and answers, question-answer pairs of varying lengths and complexities can be generated, thereby enriching the expression of the samples and effectively improving the coverage, diversity, and applicability of the dataset.
[0040] S3: Using training data, a specialized large model is obtained by fine-tuning parameters based on a pre-trained large model and a professional knowledge base, enabling deep injection of domain-specific knowledge into the large model. During parameter fine-tuning, a contrastive learning strategy is employed to minimize the representation distance between the original question-answer pair and the positive sample question-answer pair in the latent space (encouraging the large model to maintain semantic consistency in the feature space through representation tightness) and maximize the representation difference between the original question-answer pair and the negative sample question-answer pair (improving the large model's ability to identify and distinguish tampered or erroneous information, ensuring that the large model forms a clear positive and negative sample discrimination boundary in the feature space). These two factors are used as the contrastive loss.
[0041] Simultaneously, the question-answering generation task is optimized using cross-entropy. The task loss includes positive sample constraint loss and negative sample constraint loss. For positive samples, the original standard answer (i.e., the answer in the positive sample) is the target. Cross-entropy is used to quantify the deviation between the output obtained by the large model from the original standard answer and the question input of the positive sample. The closer the output is to the original answer, the smaller the task loss (specifically, the positive sample constraint loss) is, thus forcing the large model to maintain reasoning consistency under different expressions. For negative samples, cross-entropy constraints are also used. If the output obtained by the large model from the question input of the negative sample is close to the incorrect answer (i.e., the answer in the negative sample), the task loss (specifically, the negative sample constraint loss) will increase sharply due to the significant difference from the original standard answer. This forces the large model to move away from the incorrect output and avoid being interfered with by misleading information.
[0042] In the early stages of large model training, when the baseline accuracy on the validation set has not yet reached the second preset threshold, the weights of the task loss and contrastive loss are maintained at their initial values, with the task loss having a higher weight than the contrastive loss. This phase prioritizes ensuring the output accuracy of the large model. Once the baseline accuracy on the validation set has consistently reached the second preset threshold over several rounds, training enters the later stage. The weight of the contrastive loss is gradually increased at a preset step size until the target weight is reached, guiding the large model to strengthen the semantic consistency and discriminative ability of the representation space. The second preset threshold is an indicator threshold for determining whether the large model possesses basic output accuracy and can be shifted to strengthening semantic consistency; its core design guides the weight allocation of the loss function.
[0043] Regarding consistency, the initial training phase focuses on stabilizing the basic performance of the large model. This stage prioritizes optimizing the model's accuracy and generalization ability for basic tasks, ensuring that the model can correctly understand fault phenomena, infer fault causes, and generate repair solutions under standard input conditions. In this phase, consistency learning is introduced through low-intensity regularization, applying weak consistency constraints (less than 0.2 in this example) only to positive samples. This encourages the large model's output to stably approximate the original standard answer while avoiding excessively strong consistency requirements from interfering with the model's convergence path. During training, positive samples are weighted with smaller consistency constraints, coupled with a gentle learning rate scheduling strategy (i.e., linear warm-up + slow decay) to ensure the large model parameters gradually converge, solidifying its basic performance.
[0044] In the later stages of training, the inference consistency of the large model is strengthened: the fine-tuning phase shifts to enhancing the consistent inference ability of the large model under non-standard conditions such as input perturbations and changes in expression. At this point, consistency learning becomes the main optimization objective. By increasing the weight of consistency constraints on positive samples and introducing misleading information from negative samples, a reverse consistency constraint is imposed on the output of the large model. That is, the loss value (i.e., penalty) is increased for outputting incorrect answers on negative samples, forcing the large model to output away from incorrect answers. This enables the large model to maintain the correct inference trajectory even when encountering perturbation information, enhancing the model's discrimination ability and robustness. During training, the sample difficulty is increased simultaneously. Strategies such as synonym rewriting, information omission, and word order perturbation are introduced into the input questions to enhance the diversity of training data. This enables the large model to maintain consistent inference for "effective inputs that are correct in the core but varied in form" and positively guides the large model to adapt to the diversity of effective inputs. To ensure the training stability during the strengthening stage, gradient pruning (limiting the maximum gradient norm) and learning rate scheduling strategies are adopted. The balance coefficients of contrastive loss and task loss are dynamically adjusted in the loss function to avoid overfitting the consistency target and causing a decline in basic performance.
[0045] Based on the aforementioned sample augmentation and optimization methods for consistency learning, this invention also provides a sample augmentation and optimization apparatus for consistency learning. For example... Figure 3 As shown, the device includes a memory and one or more processors. The memory stores executable code, and when the one or more processors execute the executable code, they are used to implement the sample augmentation and optimization method for consistency learning in the above embodiments.
[0046] This invention provides a sample augmentation and optimization device for consistency learning, which can be applied to any device with data processing capabilities, such as a computer. The sample augmentation and optimization device for consistency learning can be implemented in software, hardware, or a combination of both. Taking software implementation as an example, as a logical device, it is formed by the processor of any data processing device loading the corresponding computer program instructions from non-volatile memory into memory for execution. From a hardware perspective, such as... Figure 3 The diagram shown is a hardware structure diagram of any data processing-capable device in which the sample augmentation and optimization device for consistency learning of the present invention is located. (Except for...) Figure 3 In addition to the processor, memory, network interface, and non-volatile memory shown, any data processing device in which the system of the present invention is located in the embodiment may also include other hardware depending on the actual function of the data processing device, which will not be described in detail here.
[0047] The specific implementation process of the functions and roles of each unit in the above device can be found in the implementation process of the corresponding steps in the above method, and will not be repeated here.
[0048] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separate. 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 the present invention according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0049] This invention also provides a computer-readable storage medium storing a program thereon, which, when executed by a processor, implements the sample augmentation and optimization method for consistency learning described in the above embodiments.
[0050] The computer-readable storage medium can be an internal storage unit of any data-processing device in any of the foregoing embodiments, such as a hard disk or memory. The computer-readable storage medium can also be an external storage device of any data-processing device, such as a plug-in hard disk, smart media card (SMC), SD card, flash card, etc., mounted on the device. Furthermore, the computer-readable storage medium can include both internal storage units of any data-processing device and external storage devices. The computer-readable storage medium is used to store computer programs and other programs and data required by any data-processing device, and can also be used to temporarily store data that has been output or will be output.
[0051] This invention employs a positive and negative sample construction strategy, utilizing diverse text transformation techniques to generate semantically consistent yet varied positive sample question-answer pairs. Simultaneously, it introduces misleading information and logical errors to construct negative samples, ensuring high-quality training data and logical integrity, thereby improving the question-answering accuracy of the large model. Furthermore, by combining contrastive learning and learning rate scheduling strategies, the accuracy, stability, and adaptability of the large model in various tasks are enhanced.
[0052] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0053] The above description is merely a preferred embodiment of the present invention, intended to enable those skilled in the art to understand or implement the invention, and is not intended to limit the invention. Various modifications and variations can be made to the invention by those skilled in the art, and these modifications to the embodiments will be readily apparent. The general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the invention should be included within the protection scope of the invention.
Claims
1. A sample augmentation and optimization method for consistency learning, characterized in that, Includes the following steps: S1: Extract knowledge from unstructured texts containing professional knowledge materials, interpretations of professional terms, historical practice data, and expert experience sets to obtain original question-answer pairs. Store these pairs to obtain a professional knowledge base for downstream tasks in vertical domains. S2: Process the original question-answer pairs using diversified strategies to generate semantically consistent but diverse augmented sample question-answer pairs. Expand or simplify the augmented sample question-answer pairs to obtain positive samples. Introduce interfering statements or factual errors into the augmented sample question-answer pairs to obtain negative samples. Adjust the ratio of positive to negative samples based on the accuracy of the large model. S3: The positive and negative samples are used as training data, and the parameters are fine-tuned based on the pre-trained large model and the professional knowledge base to obtain a professional large model; during the fine-tuning of the large model, a consistency constraint is applied to the positive samples to make the answers generated by the large model closer to the original standard answers in terms of semantics and content, and the original standard answers are the answers in the positive samples; for the negative samples, a reverse consistency constraint is applied to make the output results of the large model far away from incorrect or misleading answers, thereby enhancing the discrimination ability and robustness of the large model.
2. The sample augmentation and optimization method for consistency learning according to claim 1, characterized in that, In S1, the professional knowledge information includes: professional equipment structure, operating procedure specifications, and troubleshooting guidelines; The explanation of the technical terms includes: technical terminology explanations, application scenario examples, and conceptual association diagrams; The historical practice data includes: monitoring data, work logs, and customer management system records; The set of expert experience includes: a set of problem-determination rules and a set of logical analysis rules.
3. The sample augmentation and optimization method for consistency learning according to claim 2, characterized in that, The specific steps for knowledge extraction from the aforementioned professional knowledge materials are as follows: Using text recognition software to collect related information within specific professional documents; constructing a semantic network using an intelligent text parsing system and extracting key information elements through feature association algorithms; and performing semantic modeling using a deep neural network based on the Transformer architecture to accurately identify sentence units containing three core dimensions within the key information elements, generating question-answer pairs that conform to the structure of "problem manifestation, evaluation method + countermeasures"; the three core dimensions are: anomaly representation, quantitative evaluation, and handling strategy. The specific steps for knowledge extraction for the interpretation of the professional terms are as follows: A terminology parsing engine is constructed based on knowledge graph technology to systematically extract the terminology ontology definition, applicable context, and related characteristics; through an attention-driven neural network architecture, the structured information extracted by the terminology parsing engine undergoes deep semantic processing to identify core sentence units containing terminology association failure manifestations, terminology adaptation evaluation standards, and terminology standard application schemes, thereby achieving accurate capture and fusion of its multi-dimensional semantic features, and ultimately generating question-answer pairs conforming to the structure of "problem manifestation, evaluation method + countermeasures"; The specific steps for knowledge extraction from the historical practice data are as follows: Based on the structured features of the data, a data purification process is implemented, namely, using pattern recognition algorithms to complete noise elimination, format reduction, and abnormal symbol filtering to obtain standardized data; a bidirectional Transformer model is used to perform deep semantic parsing on the standardized data to extract technical elements that simultaneously contain abnormal features, detection standards, and processing solutions, and finally generate question-answer pairs that conform to the structure of "problem manifestation, evaluation method + countermeasures"; The specific steps for knowledge extraction from the expert experience set are as follows: A diagnostic rule base and a logical reasoning base are constructed based on expert experience. The diagnostic rule base contains specific standards, conditions, and bases for problem judgment, while the logical reasoning base contains the problem-solving path, steps, and logical thinking. The diagnostic rule base and the logical reasoning base are integrated to construct a multi-level knowledge topology system. A graph neural network is applied to perform representation learning on the rule hierarchy, capturing the complex relationships and hierarchical structure between rules. A decision tree algorithm is then combined to achieve intelligent retrieval and path reasoning of knowledge nodes, ultimately generating question-answer pairs that conform to the structure of "problem presentation, evaluation method + countermeasures" and integrate hierarchical information from the rule base.
4. The sample augmentation and optimization method for consistency learning according to claim 1, characterized in that, S2 is specifically implemented through the following sub-steps: S2.1: Perform sample enhancement on each original question-answer pair in the professional knowledge base to obtain enhanced samples; the sample enhancement methods include: back translation, syntactic structure transformation, and entity substitution; The original question-and-answer pairs are enhanced using the back-translation method described above: the original question-and-answer pairs are translated from the source language to the target language through a translation model, and then translated back to the source language to generate question-and-answer pairs that are semantically consistent but have different forms. The original question-answer pairs are enhanced using the syntactic structure transformation method described above: syntactic analysis is performed on the original question-answer pairs to identify key components of the sentences; the key components include: subject, predicate, and object; the questions are reconstructed based on the key components of the sentences to generate new question-answer pairs; the methods of reconstructing the questions include: adjusting the word order of the sentences, introducing synonyms for substitution, changing the voice, splitting or merging sentences; The original question-and-answer pairs are enhanced by using the entity replacement method: identifying various entities in the original question-and-answer pairs, replacing the original entities with entities of the same or related categories, generating new question-and-answer pairs, thereby expanding the coverage and diversity of the samples, while ensuring that the replaced question-and-answer pairs remain semantically reasonable and correct. S2.2: Construct negative samples based on augmented samples. The construction methods include: inserting incorrect diagnostic steps into the answers of augmented samples to form logical interference type negative samples; randomly combining questions and answers from different augmented samples to establish question-answer pairs with incorrect associations to form semantic confusion type negative samples; and rearranging the order of standard operation process steps in the answers of augmented samples to form temporally disordered type negative samples. Simultaneously, the questions and answers in the enhanced samples are expanded or simplified to obtain positive samples. Expanding the questions includes adding background information, detailed descriptions, or related questions; simplifying the questions includes removing redundant information and non-critical descriptions; expanding the answers specifically involves supplementing explanations of principles, specific examples, related information, or adjusting the style of expression without deviating from the core meaning, making the answers more comprehensive and concrete; simplifying the answers specifically involves focusing on retaining core conclusions or facts, deleting secondary explanations, redundant embellishments, or compressing details, making the answers more direct and concise.
5. The sample augmentation and optimization method for consistency learning according to claim 4, characterized in that, In the back-translation method, multiple translation models are selected to perform back-translation operations on the same original question-answer pair, resulting in question-answer pairs with the same semantics but in multiple forms.
6. The sample augmentation and optimization method for consistency learning according to claim 1, characterized in that, In S2, the ratio of positive to negative samples is adjusted according to the accuracy of the large model, specifically as follows: Based on task requirements, the accuracy of the large model on the validation set is monitored in real time. When the accuracy does not reach the first preset threshold, the proportion of positive samples is kept higher than the initial proportion of negative samples to prioritize the training of the large model's correct understanding of core knowledge and basic reasoning ability. When the accuracy reaches the first preset threshold, the proportion of negative samples is gradually increased according to a preset step size until the target proportion is reached. At the same time, diversity indicators are checked to ensure that the adjusted training data can still evenly cover the task scenario, so as to dynamically adapt to the training stage of the large model and the characteristics of the task. The diversity indicators include sample semantic coverage and expression type distribution.
7. The sample augmentation and optimization method for consistency learning according to claim 1, characterized in that, In S3, during the fine-tuning of the large model, a contrastive learning strategy is adopted, and the contrastive loss is set as follows: minimizing the representation distance between the original question-answer pair and the positive sample in the latent space, and maximizing the representation difference between the original question-answer pair and the negative sample; Meanwhile, the question-answering generation task is optimized through cross-entropy, and the task loss is set to include positive sample constraint loss and negative sample constraint loss. The positive sample constraint loss is to minimize the deviation between the output obtained by the large model with positive sample input and the answer in the positive sample, and the negative sample constraint loss is to maximize the deviation between the output obtained by the large model with negative sample input and the answer in the negative sample. The weights of contrastive loss and task loss are dynamically adjusted based on the training accuracy: When training a large model, if the model accuracy does not reach the preset threshold, the weights of task loss and contrastive loss are kept at the initial weight values; when the basic accuracy reaches the preset threshold, the weight of contrastive loss is gradually increased until the target weight is reached.
8. The sample augmentation and optimization method for consistency learning according to claim 7, characterized in that, In S3, during the initial training phase of the large model, when the model's accuracy on the validation set has not reached the second preset threshold, the weights of the task loss and the contrastive loss are maintained at their initial values, with the task loss weight higher than the contrastive loss weight. This stage focuses on stabilizing the large model's basic performance, optimizing its accuracy and generalization ability for basic tasks. It ensures the large model can correctly output core tasks under standard input conditions, including understanding fault phenomena, reasoning about fault causes, and generating repair solutions. In this stage, consistency learning is introduced with low-intensity regularization. The consistency constraints set on positive samples ensure that the large model's output stably approximates the original standard answer while avoiding excessive consistency requirements from interfering with the model's convergence path. A gentle learning rate scheduling strategy is employed during training to ensure the large model's parameters gradually converge. This gentle learning rate scheduling strategy includes linear warm-up and slow decay. Once the baseline accuracy on the validation set has consistently reached the second preset threshold for multiple rounds, training enters the later stage. The weight of the contrastive loss is gradually increased by a preset step size until the target weight is reached, guiding the large model to strengthen the semantic consistency and discriminative ability of the representation space. Simultaneously, in the later stage of large model fine-tuning, the inference consistency of the large model is strengthened: this stage aims at consistency learning, by increasing the weight of positive sample consistency constraints and introducing misleading information from negative samples to impose reverse consistency constraints on the output of the large model, enabling the large model to maintain the correct inference trajectory when encountering perturbation information. Gradient pruning and learning rate scheduling strategies are adopted, and the balance coefficients of contrastive loss and task loss are dynamically adjusted in the loss function to avoid overfitting the consistency target and causing a decline in basic performance.
9. A sample augmentation and optimization device for consistency learning, characterized in that, The device includes a memory and one or more processors, wherein the memory stores executable code, and the one or more processors execute the executable code to implement the sample augmentation and optimization method for consistency learning as described in any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, It stores a program that, when executed by a processor, implements the sample augmentation and optimization method for consistency-oriented learning as described in any one of claims 1-8.
Citation Information
Patent Citations
Data processing method and device for positive and negative samples
CN109460453A
Chaotic engineering fault drilling scene generation method and device, equipment and storage medium
CN115828103A
Multi-modal large language model construction method and system
CN119398163A
Case question answering method based on large language model, medium and equipment
CN119692484A
Large language model knowledge correction method based on adaptive comparative learning
CN119808952A
Cited By
Knowledge enhancement-based power grid new energy operation fault discrimination method and system
CN121456770A
Data generation method based on small sample seeds and multi-round reinforcement and electronic equipment
CN121765062A
Data enhancement and generalization method and system for vertical large model in insurance field
CN121786191A
Education knowledge base content generation method and system based on AI big data
CN121835851A