Domain-specific large language model training sample generation method and training method

By collecting and reconstructing the evolution trajectory of the optimization model, constructing instruction fine-tuning samples, and dynamically scheduling computation operators, the problems of low training data quality and low hardware resource utilization of mathematical optimization models are solved, thereby improving the model's inference and generalization capabilities and shortening the training cycle.

CN120892822BActive Publication Date: 2025-12-05SHANGHAI JIAOTONG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511433522.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-09
Publication Date
2025-12-05
Estimated Expiration
2045-10-09

AI Technical Summary

Technical Problem

In existing technologies, mathematical optimization models suffer from poor training data quality, low hardware resource utilization, and insufficient utilization of process information, which limits the model's reasoning and generalization capabilities when faced with complex combinations of constraints.

Method used

By collecting heterogeneous information from multiple data systems, structured process data is generated, the evolution trajectory of the optimization model is reconstructed, and instruction fine-tuning samples are constructed to perform customized training on the pre-trained large language model. At the same time, the implementation of key computational operators is dynamically scheduled to improve the utilization of hardware resources.

Benefits of technology

High-quality training samples were generated, which enhanced the model's understanding and reasoning abilities, shortened the training cycle, improved the model's adaptability to complex tasks, and increased the efficiency of hardware resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120892822B_ABST
    Figure CN120892822B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a training sample generation method and a training method of a domain-specific large language model, the training sample generation method comprises the following steps: collecting and preprocessing heterogeneous information in multiple data systems, generating structured process data related to a specific optimization task, and based on the structured process data, reconstructing an evolution track of an optimization model corresponding to the specific optimization task; and based on the evolution track of the optimization model, constructing instruction fine-tuning samples for customized training of a pre-trained large language model. The method provided by the application can solve the problem of poor training data quality in specific engineering applications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence, and more specifically, to a method for generating training samples and training a domain-specific large language model. Background Technology

[0002] Operations research, as a scientific decision-making method, is widely used to solve problems such as production scheduling, supply chain network planning, dynamic pricing, and resource allocation. These problems typically feature high variable dimensionality, complex constraints, and diverse objective functions, requiring the search for optimal solutions within a high-dimensional, non-convex decision space. Therefore, constructing a reasonable mathematical optimization model becomes the core of the decision system. However, existing model construction and training processes often suffer from coarse data organization and extraction methods, low utilization of process information, resulting in limited quality training data and low utilization of hardware resources during training. Summary of the Invention

[0003] This application provides a method for generating training samples and a training method for a domain-specific large language model, so as to at least solve the problem of poor training data quality in related technologies.

[0004] To achieve the above objectives, the embodiments of this application provide the following technical solutions.

[0005] In a first aspect, embodiments of this application provide a method for generating training samples for a domain-specific large language model, comprising: collecting and preprocessing heterogeneous information from multiple data systems to generate structured process data related to a specific optimization task, and reconstructing the evolution trajectory of an optimization model corresponding to the specific optimization task based on the structured process data; and constructing instruction fine-tuning samples based on the evolution trajectory of the optimization model for customized training of a pre-trained large language model.

[0006] In some embodiments, the step of collecting and preprocessing heterogeneous information from multiple data systems includes at least one of a code version control system, a project management system, a document management system, and an email service system.

[0007] In some embodiments, the step of collecting and preprocessing heterogeneous information from multiple data systems to generate structured process data related to a specific optimization task, and reconstructing the evolution trajectory of the optimization model corresponding to the specific optimization task based on the structured process data, includes: establishing a communication connection with the multiple data systems through an interface layer to obtain multi-source heterogeneous information distributed in the multiple data systems; performing semantic recognition and filtering on the multi-source heterogeneous information to extract information related to the specific optimization task and generate corresponding structured process data; and identifying the evolution nodes of the optimization model and corresponding content changes based on the structured process data, and reconstructing the evolution trajectory of the optimization model.

[0008] In some embodiments, the step of semantically recognizing and filtering the multi-source heterogeneous information, extracting information related to the specific optimization task, and generating corresponding structured process data includes: using natural language processing technology and / or pattern matching technology to identify and associate information belonging to the specific optimization task from the multi-source heterogeneous information, and generating corresponding structured process data.

[0009] In some embodiments, identifying the evolution nodes of the optimization model and the corresponding content changes based on the structured process data, and reconstructing the evolution trajectory of the optimization model, includes: performing time-series processing on the structured process data, identifying the evolution nodes of the optimization model based on the time-series information, and reconstructing the evolution trajectory of the optimization model based on the evolution nodes, wherein each evolution node corresponds to a model modification event with business meaning.

[0010] In some embodiments, the step of constructing instruction fine-tuning samples based on the evolution trajectory of the optimized model for customized training of a pre-trained large language model includes the following method for constructing instruction fine-tuning samples: constructing multiple sets of input-output sample pairs based on adjustment records contained in the evolution trajectory of the optimized model, wherein the input includes at least one of problem description, existing model version, and business feedback information, and the output includes at least one of updated model version, modeling strategy recommendation, and explanation of change reasons.

[0011] In some embodiments, after the step of constructing instruction fine-tuning samples based on the evolution trajectory of the optimization model for customized training of the pre-trained large language model, the method further includes: using a verification agent to perform business logic verification on the instruction fine-tuning samples and filtering out training samples with errors in business logic.

[0012] Secondly, embodiments of this application also provide a training method for a domain-specific large language model, comprising: constructing a performance model for selecting the implementation mode of key computational operators based on the network structure and hardware environment information of a pre-trained large language model; and training the pre-trained large language model using the instruction fine-tuning samples to generate a domain-specific large language model, wherein, during the training process, the implementation mode of key computational operators is dynamically scheduled based on the performance model; wherein, the instruction fine-tuning samples are obtained using any of the training sample generation methods for domain-specific large language models described above.

[0013] In some embodiments, the construction of a performance model for selecting key computational operator implementations based on the network structure and hardware environment information of a pre-trained large language model includes: statically analyzing the network structure of the pre-trained large language model and extracting operator parameter features of key computational operators; constructing a test library containing multiple key computational operator implementations, and performing benchmark tests on each implementation in the test library under multiple preset hardware environments and multiple operator parameter features to generate a test dataset; and constructing a performance model for selecting key computational operator implementations based on the test dataset, wherein the performance model takes operator parameter features and hardware environment information as input and outputs an identification of an implementation that meets preset performance selection rules.

[0014] In some embodiments, in the step of statically analyzing the network structure of the pre-trained large language model and extracting the operator parameter features of key computational operators, the key computational operator is a general matrix multiplication; the operator parameter features include: the typical matrix shape and data type of the input matrix.

[0015] Compared with existing technologies, the domain-specific large language model training sample generation method provided in this application reconstructs and optimizes the model's evolution trajectory by mining procedural knowledge contained in multiple data systems, thereby generating high-quality instruction fine-tuning samples with reasoning chains, enhancing the model's understanding and reasoning capabilities. Furthermore, the domain-specific large language model training method provided in this application fully utilizes existing computing resources through dynamic scheduling of key computational operators, enabling model training performance to approach the theoretical upper limit of hardware and significantly shortening the training cycle. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0017] Figure 1This is a flowchart illustrating an optional method for generating training samples for a domain-specific large language model according to an embodiment of this application.

[0018] Figure 2 This is a structural block diagram of an optional domain-specific large language model training sample generation device according to an embodiment of this application;

[0019] Figure 3 This is a flowchart illustrating an optional method for training a domain-specific large language model according to an embodiment of this application.

[0020] Figure 4 This is a structural block diagram of an optional domain-specific large language model training device according to an embodiment of this application;

[0021] Figure 5 This is a schematic diagram of the structure of an optional electronic device according to an embodiment of this application. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this disclosure clearer, the disclosure will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0023] The terminology used in the embodiments of this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of this disclosure. The singular forms “a,” “the,” and “the” as used in the embodiments of this disclosure and the appended claims are also intended to include the plural forms, and “multiple” generally includes at least two unless the context clearly indicates otherwise.

[0024] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0025] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that an article or device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such an article or device. Without further limitation, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the article or device that includes said element.

[0026] As described in the background section, the construction and training of mathematical optimization models in related technologies suffer from problems such as low utilization of process information, limited training data quality, and low utilization of hardware resources. In real-world applications, the construction of mathematical optimization models is often not a one-time event, but rather an iterative process that highly relies on the tacit knowledge of domain experts. Typically, it starts from a simplified basic model and gradually evolves into a more complete model through multiple rounds of interaction with business stakeholders and by addressing constantly evolving business constraints.

[0027] The evolution of mathematical optimization models contains knowledge assets more important than the final model code. Specifically, the evolution of a model from its initial version to its final version often records the thought process when facing specific business objectives, the trade-offs between different modeling strategies, and a deep understanding of the essence of the problem. However, this longitudinal process data, which exists in heterogeneous forms such as project documents, code version history, meeting minutes, and email communications, has not been systematically utilized in current technologies, and its potential value has been underestimated.

[0028] To address the aforementioned problems, one aspect of this application provides a method for generating training samples for a domain-specific large language model, comprising the following steps:

[0029] S110: Collect and preprocess heterogeneous information from multiple data systems to generate structured process data related to a specific optimization task, and reconstruct the evolution trajectory of the optimization model corresponding to the specific optimization task based on the structured process data; and

[0030] S120, Based on the evolution trajectory of the optimized model, construct instruction fine-tuning samples for customized training of the pre-trained large language model.

[0031] To address the aforementioned problems, one aspect of this application provides a method for training a domain-specific large language model, comprising:

[0032] S130, based on the network structure and hardware environment information of a pre-trained large language model, constructs a performance model for selecting the implementation methods of key computational operators; and

[0033] S140, the pre-trained large language model is trained using the instruction fine-tuning samples to generate a domain-specific large language model. During the training process, the implementation of key computational operators is dynamically scheduled based on the performance model. The instruction fine-tuning samples are obtained using the training sample generation method for the domain-specific large language model described in the embodiments of this application.

[0034] As can be seen, the domain-specific large language model training sample generation method provided in this application reconstructs and optimizes the model's evolution trajectory by mining procedural knowledge contained in multiple data systems, thereby generating high-quality instruction fine-tuning samples with reasoning chains, enhancing the model's understanding and reasoning capabilities. Furthermore, the provided domain-specific large language model training method fully utilizes existing computing resources through dynamic scheduling of key computational operators, enabling the model training performance to approach the theoretical upper limit of hardware and significantly shortening the training cycle.

[0035] To enable those skilled in the art to better understand and implement this application, the concept, principles, and advantages of this application are described in detail below through specific embodiments and in conjunction with specific application scenarios and accompanying drawings.

[0036] The method for generating training samples for a domain-specific large language model provided in this application will be described in detail below.

[0037] Figure 1 The flowchart of an optional method for generating training samples for a domain-specific large language model according to an embodiment of this application is illustrated schematically. The method may include the following steps:

[0038] S110: Collect and preprocess heterogeneous information from multiple data systems to generate structured process data related to a specific optimization task, and reconstruct the evolution trajectory of the optimization model corresponding to the specific optimization task based on the structured process data.

[0039] In real-world projects, information related to the evolution of mathematical optimization models is typically stored across multiple data systems within an enterprise. For example, code modification information is stored in code version control systems (such as Git), requirement and defect information is recorded in project management systems (such as Jira), technical solutions and modeling approaches are recorded in document management systems (such as Confluence or SharePoint), and business feedback or ad-hoc decisions are usually recorded in email service systems. This step requires collecting raw information from these multiple data systems and performing targeted preprocessing operations to extract data relevant to the specific optimization task. This data is then uniformly transformed into structured process data to support subsequent trajectory reconstruction.

[0040] In some embodiments, step S110 further includes:

[0041] S111, establish communication connections with the multiple data systems through the interface layer to obtain multi-source heterogeneous information distributed in the multiple data systems.

[0042] Specifically, the interface layer can, under pre-configured access credentials, call the programmable interfaces of various data systems at set intervals to obtain, but not limited to: code commit history from the code version control system, work orders or requirement changes from project management tools, newly added or revised technical documents from the document library, and email communication records from the mail server. It is understood that the heterogeneous information types described above are merely examples; the types of information required to be collected in actual projects can be expanded or adjusted according to specific business processes and system configurations.

[0043] S112, perform semantic recognition and filtering on the multi-source heterogeneous information, extract information related to the specific optimization task, and generate corresponding structured process data.

[0044] Specifically, natural language processing and / or pattern matching technologies can be used to automatically identify and associate information belonging to a specific optimization task from heterogeneous information from multiple sources, such as code submission information, work order descriptions, document text, and email content.

[0045] For example, in practical applications, by parsing the commit history of the code version control system, we can identify all the modifications made to the same mathematical optimization model file; we can establish a correspondence between each code commit and the task or requirement change in the project management tool, thereby identifying the business motivation corresponding to each code adjustment; and we can extract natural language descriptions of "adding / modifying constraints" and "adjusting the objective function" from the document library or mail server.

[0046] As a concrete example, taking the specific optimization task of "optimizing the production schedule for the third quarter of a certain enterprise" as an example, assuming that this task is identified as "Q3_2025" in the project management tool, if the Git commit message contains the words "Q3_2025" or "Q3_schedule", the code commit can be associated with the work order Q3_2025. If Confluence has pages containing expressions such as "third quarter schedule adjustment" or "Q3 capacity optimization", these pages can be associated with work order Q3_2025 based on keyword matching. Similarly, if there are emails with the subject "suggestions for adjusting the production scheduling model" in a similar time period on the mail server, these emails can also be associated with work order Q3_2025 based on the time proximity rule. Through the above methods, structured process data related to specific optimization tasks can be effectively extracted and organized, providing a data foundation for the subsequent reconstruction of the model evolution trajectory.

[0047] S113, Based on the structured process data, identify the evolution nodes of the optimization model and the corresponding content changes, and reconstruct the evolution trajectory of the optimization model.

[0048] Specifically, the extracted structured process data can be processed chronologically, and the chronological order of various changes can be determined based on the timestamp information, version identifiers, and other information of each data record. Furthermore, based on this chronological information, multiple evolution nodes of the optimization model can be identified. Each evolution node corresponds to a model modification event with business significance, and the content change information involved in this event can be extracted, such as newly added or modified constraints in the model, adjustments to the objective function, etc. Based on the identified evolution nodes, a structured mathematical optimization model evolution trajectory can be constructed. For example, this trajectory may include, but is not limited to, the following content sequence:

[0049] [Initial problem description] → [Mathematical model version v1.0 + corresponding code version v1.0] → [Business feedback 1 "Constraint A needs to be considered"] → [Mathematical model version v2.0 + corresponding code version v2.0] → [Mathematical model version v2.1 + corresponding code version v2.1] → ... → [Final model version + final code version].

[0050] In some embodiments, to further improve the reconstruction quality of the optimization model evolution trajectory, a graph neural network (GNN) model can be introduced on the basis of structured process data to enhance the association ability of entities and relationships.

[0051] Compared to existing technologies, the aforementioned evolutionary trajectory not only records the version evolution of the optimization model over time, but also encodes the strategy adjustments made by domain experts based on business changes, their trade-offs and judgments regarding the objective function and constraints, and their gradual deepening understanding of the problem during the modeling process. Therefore, this evolutionary trajectory possesses a high information density and can provide crucial foundational data for subsequent model construction.

[0052] In contrast, existing technical solutions typically focus only on the final mathematical optimization model, failing to capture and learn the reasoning logic and evolutionary path of the model from its initial version (e.g., v1.0) to its final version (e.g., v_final). This deficiency means that large language models trained on data from existing technical solutions often know what to do but not why, resulting in limited reasoning and generalization capabilities when faced with new and unencountered complex combinations of constraints. Furthermore, existing technical solutions lag behind in data processing paradigms, lacking a method to automatically extract evolutionary information related to the optimization model's construction from multi-source, heterogeneous enterprise private data and further transform it into high-value training samples, rendering a large amount of procedural data unusable.

[0053] S120, Based on the evolution trajectory of the optimized model, construct instruction fine-tuning samples for customized training of the pre-trained large language model.

[0054] Specifically, multiple input-output sample pairs can be constructed based on the adjustment records contained in the evolution trajectory of the optimization model. The inputs can include problem descriptions, existing model versions, business feedback information, etc., while the outputs can include updated model versions, recommended modeling strategies, explanations of the reasons for changes, etc. Using this method, the iterative process of the optimization model can be structurally transformed into instruction-response formatted sample data. The generated instruction fine-tuning samples can be used as training data to train a pre-trained large language model for a specific task.

[0055] In some embodiments, the instruction fine-tuning samples can be further categorized into the following types: incremental learning samples, comparative learning samples, and final state learning samples.

[0056] The incremental learning samples simulate the iterative process of a mathematical optimization model, enabling the pre-trained large language model to modify and enhance existing mathematical optimization models. This capability is crucial for model maintenance in real-world projects. Incremental learning samples indicate the evolutionary logic between modeling inputs and outputs, allowing the large language model to learn, during training, how to update the existing model in a targeted manner driven by specific business feedback. As a concrete example, incremental learning samples can be constructed in the following form:

[0057] Input: {Problem description (P_v1), Mathematical model (M_v1), Code (C_v1), Business feedback: "Add constraint X"};

[0058] Output: {Mathematical model(M_v2), Code(C_v2)}.

[0059] The comparative learning samples represent trajectories with different implementations of the same constraint, used to simulate the process by which domain experts make trade-off decisions based on business objectives when faced with multiple alternative implementations. These comparative learning samples can train large language models to understand the advantages and disadvantages of different modeling techniques and their applicable scenarios, enabling them to learn the ability to make trade-off decisions. As a concrete example, comparative learning samples can be constructed in the following form:

[0060] Input: {Problem description (P), Constraints: "Y", Implementation method 1 (C_a), Implementation method 2 (C_b), Business objective: "Prioritize solution speed"};

[0061] Output: {Recommended implementation: C_b, Reason: "C_b has a higher degree of linearity. Although it sacrifices some accuracy, the solution time is significantly shortened, which is more suitable for online decision-making scenarios..."}.

[0062] The final-state learning samples are used to train a large language model to build a complete mathematical optimization model from scratch. The final-state learning samples simulate the complete modeling process from initial problem input to final model output in a real-world business scenario, and are suitable for task initialization. As a specific example, the final-state learning samples can be constructed in the following form:

[0063] Input: {Final problem description (P_final)};

[0064] Output: {Final mathematical model (M_final), Final code (C_final)}.

[0065] The instruction fine-tuning samples comprehensively depict the decision-making logic and modeling thinking of domain experts in the process of optimizing model construction and evolution from multiple dimensions. They can serve as high-quality training samples for subsequent instruction fine-tuning training of the pre-trained large language model. Based on the above instruction fine-tuning samples, a domain-specific large language model can be constructed, which has the ability to perform logical correction, constraint trade-offs, and solution evolution in a dynamic environment.

[0066] In some embodiments, the method further includes:

[0067] S121, the verification agent is used to perform business logic verification on the instruction fine-tuning sample, and the training samples with errors in business logic are filtered out.

[0068] To prevent semantically reasonable but logically inconsistent samples from being included in the training data for fine-tuning instructions, a validation agent with business reasoning capabilities can be introduced.

[0069] The verification agent can automatically configure a simulated business environment by fine-tuning the problem description in the instruction sample based on the instructions constructed in the preceding steps. The simulated business environment includes one or more key business indicators (KPIs) and their corresponding expected thresholds. For example, costs need to be reduced by 10%, and the on-time delivery rate should not be less than 95%.

[0070] The verification agent executes the optimized model code (e.g., the final code C_final) in the instruction fine-tuning sample within a sandbox environment to obtain the corresponding solution results. Further, the verification agent compares the solution results with the expected thresholds of key business metrics in a simulated business environment. If the solution results do not meet the set business objectives, such as the on-time delivery rate being lower than the target threshold, the instruction fine-tuning sample is marked as a logically inconsistent sample for subsequent manual review, such as being added to a manual review pool.

[0071] By introducing the aforementioned agent-based business logic verification steps, training samples that are semantically reasonable but have errors in business logic can be eliminated, ensuring the final quality of training samples and improving the reliability of the subsequently trained domain-specific large language model in the business decision-making process.

[0072] The method for generating training samples for domain-specific large language models provided in this application proposes a data paradigm based on the optimization task modeling process. This data paradigm not only provides large language models with training corpora that fit real-world engineering tasks, but also constructs a benchmark system for measuring and enhancing the process reasoning and strategy planning capabilities of large language models in complex tasks. Compared to existing corpora primarily based on static question-answering, this application reconstructs the dynamic evolution process of optimization problems based on structured process data extracted from heterogeneous data systems. The generated training samples possess multi-step reasoning chains, multi-round feedback corrections, and trade-off features, which can improve the adaptability of large language models in real-world engineering tasks.

[0073] Furthermore, the method for generating training samples for a domain-specific large language model provided in this application can extract implicit knowledge and evolutionary logic from dormant, procedural private data within an enterprise, enabling the trained domain-specific large language model to not only know what to do, but also why it does so, thus possessing stronger reasoning and generalization capabilities. Additionally, through automated business logic verification based on intelligent agents, the accuracy of the training data is ensured, improving the reliability and practical value of the final model.

[0074] According to another aspect of the embodiments of this application, a training sample generation apparatus for implementing the above-described method for generating training samples for a domain-specific large language model is also provided. The apparatus for generating training samples for a domain-specific large language model provided in the embodiments of the present invention will be described below. The apparatus described below can be considered as the functional modules required to implement the method for generating training samples for a domain-specific large language model provided in the embodiments of the present invention. The apparatus described below can be referred to in correspondence with the method described above.

[0075] Figure 2This is a structural block diagram of an optional domain-specific large language model training sample generation device 200 according to an embodiment of this application. As shown in the figure, the device 200 may include:

[0076] The trajectory reconstruction unit 210 is used to collect and preprocess heterogeneous information from multiple data systems, generate structured process data related to a specific optimization task, and reconstruct the evolution trajectory of the optimization model corresponding to the specific optimization task based on the structured process data; and

[0077] The sample construction unit 220 is used to construct instruction fine-tuning samples based on the evolution trajectory of the optimized model, for customized training of the pre-trained large language model.

[0078] According to another aspect of the embodiments of this application, a method for training a domain-specific large language model is also provided. Figure 3 The flowchart of an optional domain-specific large language model training method according to an embodiment of this application is illustrated schematically. The method may include the following steps:

[0079] S130 constructs a performance model for selecting the implementation of key computational operators based on the network structure and hardware environment information of a pre-trained large language model.

[0080] Before formally training a large language model, joint hardware and model performance profiling can be performed to construct a performance model for selecting key computational operator implementations. First, a static analysis of the pre-trained large language model's network structure can be conducted to identify key computational operators and extract their corresponding parameter features. Under multiple preset hardware environments, a test library containing various implementations is executed to obtain performance datasets for each implementation under different combinations of operator parameter features and hardware configurations. Based on these test datasets, a performance model can be built using machine learning modeling or lookup table construction. The input to this performance model is operator parameter features and hardware environment information, and the output is the identifier of the implementation that satisfies preset performance selection rules. For example, for a specific shape's GEMM operation, a specific implementation from cuBLAS can be preferentially selected under a specific GPU model. The performance model constructed in this way can be dynamically invoked during actual training, providing optimized operator implementations for model training and improving training efficiency and resource utilization.

[0081] Specifically, step S130 may further include:

[0082] S131, statically analyze the network structure of the pre-trained large language model and extract the operator parameter features of key computational operators.

[0083] Specifically, static analysis refers to analyzing the model structure without performing the actual training process, obtaining the model's computational graph structure, identifying key computational operators, and extracting the corresponding operator parameter features. In this embodiment, static analysis can be performed on a pre-trained large language model (e.g., an LLaMA model based on the Transformer architecture) to extract the call information of key computational operators involved in its computational structure and their corresponding parameters.

[0084] Key computational operators refer to those that occupy the majority of computational resources and have a significant impact on the overall training performance during the training of large language models. These key computational operators include, but are not limited to, Generalized Matrix Multiplication (GEMM) and Softmax. For each type of key computational operator, its operator parameter features can be extracted. For example, for the GEMM operator, the extracted operator parameter features may include: the typical matrix shape of the input matrix (M, N, K triples) and the data type.

[0085] S132, construct a test library containing various key computational operator implementation methods, and perform benchmark tests on each implementation method in the test library under multiple preset hardware environments and multiple operator parameter features to generate a test dataset.

[0086] Specifically, in order to select the most suitable implementation for the execution of key computational operators during actual training, a test library containing multiple implementations is pre-built. This test library covers multiple implementations of the same type of key computational operators. For example, for the GEMM operator, the implementations may include multiple specific implementations from different computational libraries (such as cuBLAS, cuDNN, CUTLASS, Triton, etc.).

[0087] To adapt to different enterprise-wide computing platforms, the benchmark tests are not limited to a single target hardware but are executed in multiple preset hardware environments. For each combination of hardware environment and parameter characteristics, each implementation in the test library is invoked to execute the preset benchmark suite. As a specific example, the parameter characteristics of the key computational operators extracted in the preceding steps (such as the M, N, K triples of GEMM, input data types, etc.) are used as input, and each implementation in the test library is invoked to execute the preset benchmark suite in each hardware environment.

[0088] Specific test metrics may include, but are not limited to: execution time (Latency), which is the actual time required to execute a single operator; computational throughput (TFLOPs), which is the number of floating-point operations completed per unit of time.

[0089] Based on the test results above, a test dataset was generated. This dataset records the performance metrics for different implementation methods under various hardware environments and parameter characteristics. This test dataset can be used to establish performance mapping relationships for different hardware environments and operator parameter characteristics.

[0090] S133, Based on the test dataset, a performance model is constructed for selecting the implementation mode of key computational operators. The performance model takes operator parameter characteristics and hardware environment information as input and outputs the implementation mode identifier that meets the preset performance selection rules.

[0091] Specifically, based on the test dataset, a performance model is constructed for selecting the implementation methods of key computational operators. This performance model outputs the identifiers of selected implementation methods that satisfy preset performance selection rules, given operator parameter characteristics and hardware environment information. The preset performance selection rules can be minimum execution time, maximum computational throughput, or a weighted combination of both. The performance model can be implemented using a machine learning model or a lookup table.

[0092] In some embodiments, the inputs to the performance model include: operator parameter features and hardware environment information. Specifically, for the GEMM operator, the operator parameter features include matrix shape parameters M, N, and K, data type, etc. The output of the performance model is one or more implementation method identifiers that satisfy preset performance selection rules, typically the implementation method with the best performance under the current conditions.

[0093] By building a performance model based on test data, an empirical performance landscape is established for a combination of specific hardware environments and model architectures, which can provide a data-driven basis for subsequent dynamic scheduling.

[0094] S140, the pre-trained large language model is trained using the instruction fine-tuning sample to generate a domain-specific large language model. During the training process, the implementation method of dynamically scheduling key computational operators is based on the performance model.

[0095] In this step, the pre-trained large language model is fine-tuned using the aforementioned instruction fine-tuning samples to obtain a domain-specific large language model optimized for a specific domain task. During this fine-tuning process, the performance model is further integrated to dynamically select and schedule the execution methods of key computational operators, thereby improving training efficiency.

[0096] Specifically, for each critical operator call during training (such as the GEMM operation), the training engine dynamically reads the operator parameter features of the operation (such as the dimensions M, N, and K of the input matrix, data type, etc.) and the current hardware environment (such as GPU model, memory bandwidth, etc.), and combines them as input to the performance model. The performance model outputs an operator implementation that satisfies preset rules under the current combination of operator parameter features and hardware environment based on the input combination. The training engine dynamically replaces the default operator implementation in the deep learning framework with this output, ensuring that the actually called operator implementation has better execution performance in the current environment.

[0097] In some embodiments, to implement the above scheduling operation, the computation graph of the model can be intercepted and rewritten, and the operator implementation method of the default scheduling in the deep learning framework can be replaced with the operator implementation method output by the performance model.

[0098] Furthermore, during training, operators not covered in the aforementioned performance profiling phase may be encountered, such as matrix shapes or data types not previously seen; or performance-critical operators for which there is no optimal implementation in the test library. For operators with unmatched implementations, adaptive kernel function generation or modification can be performed at runtime, specifically including the following methods:

[0099] The templated code generation method generates customized computing kernels for the currently unmatched operators based on preset high-performance computing templates (such as Triton language templates) through just-in-time (JIT) compilation.

[0100] The system supports both independent development and integration, providing interfaces that allow developers to integrate independently developed and deeply modified proprietary kernel functions to achieve targeted optimizations for specific enterprise models and hardware environments. These proprietary kernel functions can be incorporated into a dynamic scheduling library and dynamically selected and scheduled for use.

[0101] The method provided in this application constructs a closed-loop optimization mechanism by performing performance profiling before model training and real-time scheduling and modification of key computational operators during model training. This enables the optimal execution path of key computational operators to be achieved in any given private hardware environment, making the model training efficiency close to the theoretical peak performance of the hardware.

[0102] This application provides an end-to-end, domain-specific large language model training method for industrial private data. This method maximizes the utilization of existing enterprise computing hardware resources through deep optimization of the underlying computation process. Compared to existing technologies that generally rely on general-purpose computing libraries for large language model training, this invention constructs a performance model and dynamic scheduling mechanism deeply coupled with the target hardware microarchitecture. This enables the training process to dynamically select the optimal implementation path for key operators under different parameter characteristics and hardware environments, thereby significantly improving computational efficiency.

[0103] The method provided in this application, through an empirically tested underlying computational optimization mechanism, can intelligently select the optimal operator implementation during model training and supports runtime kernel function rewriting and deep customization, thereby maximizing the computational potential of existing hardware platforms. Compared to traditional training processes, the training method provided in this application can shorten the training cycle of large language models from several weeks to several days, significantly reducing model development and iteration costs and improving engineering efficiency.

[0104] Furthermore, the domain-specific large language model training sample generation method and the entire training process provided in this application embodiment can be completed within a closed enterprise environment, thereby effectively ensuring the security and compliance of the enterprise's core business data. Moreover, through a self-developed hardware-aware optimization scheduling mechanism and kernel function generation technology, the core training capabilities are technically independent and controllable.

[0105] According to another aspect of the embodiments of this application, a training apparatus for implementing the above-described training method for a domain-specific large language model is also provided. The training apparatus for a domain-specific large language model provided by the embodiments of the present invention will be described below. The apparatus described below can be considered as functional modules required to implement the training method for the domain-specific large language model provided by the embodiments of the present invention. The apparatus described below can be referred to in correspondence with the method described above.

[0106] Figure 4 This is a structural block diagram of an optional domain-specific large language model training device 300 according to an embodiment of this application. As shown in the figure, the device 300 may include:

[0107] Performance model building unit 310 is used to build a performance model for selecting the implementation methods of key computational operators based on the network structure and hardware environment information of the pre-trained large language model; and

[0108] A dedicated model generation unit 320 is used to train the pre-trained large language model using the instruction fine-tuning samples to generate a domain-specific large language model. During the training process, the key computational operators are dynamically scheduled based on the performance model. The instruction fine-tuning samples are obtained using the training sample generation device for the domain-specific large language model described in this application embodiment.

[0109] This application also provides a schematic diagram of the structure of an electronic device. Figure 5 The present application provides a schematic diagram of the structure of an electronic device. As shown in the figure, the electronic device 1300 may include: a processor 1301 and a memory 1302 communicatively connected to the processor 1301; the memory 1302 stores a computer program; the processor 1301 executes the computer program stored in the memory 1302, causing the processor 1301 to perform the method described in any of the above embodiments.

[0110] The memory 1302 and the processor 1301 can be connected via bus 1303.

[0111] This application also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, are used to implement the methods described in any of the foregoing embodiments of this application.

[0112] This application also provides a chip for executing instructions, which is used to perform the methods described in any of the foregoing embodiments executed by an electronic device as described in any of the foregoing embodiments of this application.

[0113] This application also provides a computer program product, which includes a computer program that, when executed by a processor, can implement the methods described in any of the foregoing embodiments executed by an electronic device as described in any of the foregoing embodiments of this application.

[0114] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.

[0115] The modules described as separate components may or may not be physically separate. The components shown as modules 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 implement the solution of this embodiment according to actual needs.

[0116] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The unit composed of the above modules can be implemented in hardware or in the form of hardware plus software functional units.

[0117] The integrated modules implemented as software functional modules described above can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of this application.

[0118] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.

[0119] The memory may include high-speed random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device, and may also be a USB flash drive, external hard drive, read-only memory, disk or optical disc, etc.

[0120] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0121] The aforementioned storage media can be implemented from any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage media can be any available medium accessible to general-purpose or special-purpose computers.

[0122] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Alternatively, the storage medium can be an integral part of the processor. Both the processor and the storage medium can reside in application-specific integrated circuits (ASICs). Alternatively, the processor and storage medium can exist as discrete components in an electronic device or host device.

[0123] Compared to existing technologies, this invention achieves an order-of-magnitude performance improvement by replacing matrix factorization with SpMV and combining it with the parallel computing capabilities of GPUs. For example, on the ultra-large-scale problem "zib03", this invention reduces the solution time from 16.5 hours in COPT to approximately 15 minutes, a speedup of over 60 times. This invention only needs to store the original sparse matrix, completely avoiding the "filling" problem of matrix factorization, thus solving the memory bottleneck of traditional methods. This enables this invention to successfully solve problems such as PageRank and large-scale supply chain problems that traditional solvers cannot handle due to insufficient memory. The invention's unique GPU-friendly restart strategy effectively overcomes the inherent "tailing effect" of first-order methods, allowing the algorithm to maintain extremely fast iteration speed while stably converging to industrial-grade high accuracy (e.g., 10^6). -8 This invention possesses the ability to replace traditional solvers in demanding real-world applications. When implemented using C and CUDA C / C++, this invention offers more precise hardware control compared to earlier Julia prototypes, resulting in approximately 50% additional performance gains, demonstrating the superiority of this technical solution in engineering implementation.

[0124] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.

[0125] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0126] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.

[0127] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the claims.

[0128] The above description is merely a specific implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the embodiments of this application should be covered within the protection scope of the embodiments of this application. Therefore, the protection scope of the embodiments of this application should be determined by the protection scope of the claims.

Claims

1. A method for generating training samples of a domain-specific large language model, characterized in that, The method comprises the following steps: collecting and preprocessing heterogeneous information in multiple data systems, generating structured process data related to a specific optimization task, and based on the structured process data, reconstructing the evolution track of the optimization model corresponding to the specific optimization task; and based on the evolution track of the optimization model, constructing instruction fine-tuning samples for customized training of a pre-trained large language model; the step of collecting and preprocessing heterogeneous information in multiple data systems, generating structured process data related to a specific optimization task, and based on the structured process data, reconstructing the evolution track of the optimization model corresponding to the specific optimization task, comprises: establishing communication connection with the multiple data systems through the interface layer to obtain multi-source heterogeneous information distributed in the multiple data systems; performing semantic recognition and screening on the multi-source heterogeneous information, extracting information related to the specific optimization task, and generating corresponding structured process data; and based on the structured process data, identifying the evolution nodes of the optimization model and the corresponding content changes, and reconstructing the evolution track of the optimization model; the step of based on the structured process data, identifying the evolution nodes of the optimization model and the corresponding content changes, and reconstructing the evolution track of the optimization model, comprises: performing time sequence arrangement on the structured process data, identifying the evolution nodes of the optimization model based on the time sequence information, and reconstructing the evolution track of the optimization model based on the evolution nodes, wherein each evolution node corresponds to a model modification event with business meaning; in the step of based on the evolution track of the optimization model, constructing instruction fine-tuning samples for customized training of a pre-trained large language model, the construction method of the instruction fine-tuning samples comprises: based on the adjustment records contained in the evolution track of the optimization model, constructing multiple groups of input-output sample pairs, wherein the input includes at least one of problem description, existing model version, and business feedback information, and the output includes at least one of updated model version, modeling strategy recommendation, and change reason explanation. 2.The method of claim 1, wherein, in the step of collecting and preprocessing heterogeneous information in multiple data systems, the multiple data systems comprise at least one of a code version control system, a project management system, a document management system, and a mail service system. 3.The method of claim 2, wherein, the step of performing semantic recognition and screening on the multi-source heterogeneous information, extracting information related to the specific optimization task, and generating corresponding structured process data, comprises: using natural language processing technology and / or pattern matching technology to identify and associate information belonging to the specific optimization task from the multi-source heterogeneous information, and generate corresponding structured process data. 4.The method of claim 1, wherein the domain-specific large language model is trained using a large amount of data in a specific domain. after the step of based on the evolution track of the optimization model, constructing instruction fine-tuning samples for customized training of a pre-trained large language model, further comprising: using a verification intelligent agent to perform business logic verification on the instruction fine-tuning samples, and filtering out training samples with errors in business logic.

5. A method for training a domain-specific large language model, the method comprising: The method comprises the following steps: based on the network structure and hardware environment information of the pre-trained large language model, constructing a performance model for selecting the implementation method of the key computing operator; and The instructions are used to fine-tune the sample to train the pre-trained large language model, and generate a domain-specific large language model. In the training process, the performance model is used to dynamically schedule the implementation of the key computing operator; wherein the instruction fine-tuning sample is obtained by using the training sample generation method of the domain-specific large language model as claimed in any one of claims 1 to 4. 6.The method of Claim 5, wherein, The network structure of the pre-trained large language model and the hardware environment information are used to construct a performance model for selecting the implementation of the key computing operator, including: statically analyzing the network structure of the pre-trained large language model, and extracting the operator parameter features of the key computing operator; constructing a test library containing multiple implementation methods of the key computing operator, performing benchmark tests on each implementation method in the test library under multiple preset hardware environments and multiple combinations of operator parameter features, and generating a test data set; and based on the test data set, a performance model for selecting the implementation of the key computing operator is constructed, and the performance model takes the operator parameter features and the hardware environment information as inputs and outputs the implementation method that meets the preset performance selection rule.

7. The method of claim 6, wherein the domain-specific large language model is trained by, In the step of statically analyzing the network structure of the pre-trained large language model and extracting the operator parameter features of the key computing operator, the key computing operator is a general matrix multiplication; the operator parameter features include: typical matrix shape and data type of the input matrix.

Citation Information

Patent Citations

  • Mixed integer programming joint optimization method, system and equipment for security constraint unit

    CN116011664A

  • Concept verification method and device based on pre-training language model, equipment and medium

    CN118133797A