Model fine-tuning method and system based on task priority and elastic weight solidification
Through the model fine-tuning method of task priority and elastic weight curing, catastrophic forgetting and resource consumption problems in wire mesh manufacturing are solved, and stable and efficient model adaptability and accuracy are achieved. It is suitable for wire mesh manufacturing in multi-task and multi-process scenarios.
Patent Information
- Application Number
- CN202510112842.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-24
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-01-24
AI Technical Summary
Traditional fine-tuning methods are difficult to solve catastrophic forgetting and resource consumption problems in multi-task scenarios of wire mesh manufacturing, resulting in the loss of memory of old tasks by the model, generating error messages, and affecting product quality and production efficiency.
The model fine-tuning method based on task priority and elastic weight solidification is adopted. Through data acquisition, task analysis, knowledge base construction, old task protection and model fine-tuning, the Fisher information matrix and EWC mechanism are used to dynamically adjust the model parameter weights, and knowledge migration and protection are combined with the knowledge graph.
A stable, efficient and low-power wire mesh manufacturing model is realized, adapted to a variety of complex production scenarios, reduced hallucinations, improved knowledge transfer efficiency and accuracy, and ensured the best weight memory of important task data sets.
Smart Images

Figure CN119578859B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of machine learning, and in particular to a model fine-tuning method and system based on task priority and elastic weight solidification. Background Art
[0002] The wire mesh manufacturing scenario has significant multi-task and multi-domain characteristics. There are significant differences in the knowledge and requirements between different tasks. In order to adapt to multi-task requirements, large models usually need to be fine-tuned multiple times when new tasks are added. However, traditional fine-tuning methods often find it difficult to cope with catastrophic forgetting and resource consumption problems in multi-domain scenarios.
[0003] Catastrophic forgetting refers to the loss of memory of old tasks when a model is training a new task. For example, in production process optimization and quality inspection, the historical operation data of the equipment and the parameters of a specific screen type play a decisive role in the performance of the model. Each time a new task is fine-tuned, the adjustment of the model may cause the forgetting of historical data. In addition, the screen manufacturing industry has extremely high requirements for the accuracy of the model, especially in environments with high precision requirements (such as the weaving process of screens of different specifications, the molding process of screens of special materials), and the accuracy of the generated content is directly related to product quality and production efficiency. Traditional fine-tuning methods lack the protection of old task knowledge when fine-tuning new tasks, which may cause the model to generate erroneous information or even hallucinations, that is, the model outputs fictitious information that does not conform to reality or logic. This may bring greater quality control risks and misleading suggestions in screen manufacturing.
[0004] Wire mesh manufacturing models usually need to consider multiple process tasks, including but not limited to process, materials, environmental protection, energy, etc. It is crucial to reasonably divide the weights of these different sub-tasks and train the model based on the weights.
[0005] How to provide a stable, efficient, low-power screen manufacturing model that can be adapted to a variety of complex production scenarios is a technical problem that needs to be solved. Summary of the invention
[0006] The technical task of the present invention is to solve the technical problem of how to provide a stable, efficient, and low-power wire mesh manufacturing model based on a model fine-tuning system with solidified task priorities and elastic weights, and the wire mesh manufacturing model can be adapted to a variety of complex production scenarios.
[0007] In a first aspect, the present invention provides a model fine-tuning method based on task priority and elastic weight solidification, comprising the following steps:
[0008] Data collection: Collect data related to wire mesh production and manufacturing as sample data, divide the sample data into multiple subsets according to the relevant links of wire mesh production and manufacturing, and sort the subsets by number. The data related to wire mesh production and manufacturing includes process tasks, quality feedback and improvement suggestions, material properties and processes, and data related to environmental protection and energy consumption;
[0009] Task analysis: Analyze the business weight and priority coefficient of each new task in the wire mesh manufacturing process based on the sorted subsets;
[0010] Knowledge base construction: Extract entities based on the screen manufacturing process, build a knowledge graph based on the entities and the relationships between them, and store the knowledge graph in the graph database in the form of structured information. The entities include material types, process steps, equipment status, defect types, energy consumption records, and emission standards related to screen manufacturing.
[0011] Old task protection: For the current screen manufacturing model obtained through historical sample training, the importance of model parameters to old tasks is calculated based on the Fisher information matrix, and the priority of model parameters is adjusted based on the knowledge graph;
[0012] Model fine-tuning: Based on the Fisher information matrix, the loss function of the screen manufacturing model under the new task is updated through EWC. When the current screen manufacturing model is fine-tuned by minimizing the loss function, the knowledge graph is queried and the predicted output and model parameters of the current screen manufacturing model are corrected based on the entities and relationships in the knowledge graph.
[0013] Preferably, during data collection, the collected sample data is preprocessed, and the preprocessed sample data is divided into multiple subsets according to the relevant links of screen production and manufacturing, and the data volume of the sample data in each subset meets the preset level, wherein the data preprocessing includes data cleaning and normalization operations;
[0014] When the pre-processed sample data is divided into subsets according to the relevant links of screen manufacturing, the following operations are performed:
[0015] For the sample data from different process tasks of screen manufacturing, the sample data are numbered according to the sequence of the process tasks, and the sample data are divided into multiple fine-tuning subsets based on the numbering;
[0016] For sample data involving different material properties and processes, they are divided according to data attributes, and each material or process-related sample data corresponds to a model fine-tuning subset;
[0017] For sample data involving quality feedback and improvement suggestions, they are divided according to the problem type or problem severity. Each problem type or severity corresponds to a model fine-tuning subset.
[0018] For sample data related to environmental protection energy consumption, they are divided according to energy consumption or environmental protection parameters. Each sample data related to energy consumption or environmental protection parameters corresponds to a model fine-tuning subset.
[0019] Preferably, when analyzing the business weight and priority coefficient of each new task in the screen manufacturing process based on the sorted subsets, the business weight and priority coefficient of each new task are determined based on the order of the subsets and the additional factors introduced, wherein the additional factors include the importance of the new task, the similarity and migration potential between the tasks, the amount of sample data in the model fine-tuning subset, and the impact of the task on the overall business goal;
[0020] Task The priority coefficient The calculation formula is as follows:
[0021] ,
[0022] in, Representation Task The importance coefficient is calculated as follows:
[0023] ,
[0024] Represents the number of all tasks, Representation Task The business weight of Representation Task The business weight of the task is determined by the importance definition rules of the wire mesh manufacturing enterprise to the current business;
[0025] Representation Task With the task The similarity between them is calculated as follows:
[0026] ,
[0027] in, Indicates that from the task Some sample data randomly selected from the corresponding model fine-tuning subset, Indicates that from the task Some sample data randomly selected from the corresponding model fine-tuning subset;
[0028] When calculating the similarity between tasks, the cosine similarity between the two tasks is calculated multiple times, and the average value of the multiple cosine similarities is used as the similarity coefficient between the two tasks.
[0029] Preferably, the old task protection includes the following steps:
[0030] Select representative old tasks as benchmarks and calculate the Fisher information value of each model parameter. For the selected tasks, the Fisher information value of each model parameter is calculated through the trained wire mesh manufacturing model. In the Fisher information matrix, the elements on the diagonal represent the influence of each model parameter on the gradient of the loss function, and the off-diagonal elements reflect the covariance relationship between the model parameters. A larger Fisher information value means that the corresponding model parameter is very important for the current task.
[0031] Create a weight matrix , where each row corresponds to a model parameter and the columns represent the Fisher information value under different tasks. In , the parameters with higher Fisher information values are marked as high priority;
[0032] Based on the knowledge graph, the model parameters closely related to the entity are checked and verified. Through the information provided by the knowledge graph, the priority marking of the model parameters in the weight matrix is further adjusted to ensure that all model parameters that have a significant impact on the process are correctly identified.
[0033] As an optimal choice, the loss function of the screen manufacturing model under the new task is The expression is:
[0034] ,
[0035] in, represents the loss of the current model weight under the new task, represents the introduced regularization term, Indicates the business weight of the task;
[0036] represents the first elements, the expression is as follows:
[0037] ,
[0038] in, Represents sample data selected from the subset corresponding to the old task , Indicates the wire mesh manufacturing model in the model parameters The following sample data The predicted probability of Indicates the model parameters for the current task The gradient of the log-likelihood function is, Represents the model parameters of the current task;
[0039] The expressions for updating model parameters are as follows:
[0040] ,
[0041] ,
[0042] in, represents the learning rate, It represents the loss function of the model parameters combined with the elastic weight consolidation method The gradient of Represents the new task loss on the model parameters The gradient of Represents the gradient information of the regularization term that combines EWC and the task’s business weight.
[0043] In a second aspect, the present invention provides a model fine-tuning system based on task priority and elastic weight solidification, which is used to implement fine-tuning of a screen manufacturing model through a model fine-tuning method based on task priority and elastic weight solidification as described in any one of the first aspects, wherein the system includes a data acquisition module, a task analysis module, a knowledge base construction module, an old task protection module, and a model fine-tuning module;
[0044] The data collection module is used to perform the following: collect data related to screen production and manufacturing as sample data, divide the sample data into multiple subsets according to the relevant links of screen production and manufacturing, and number and sort the subsets, wherein the data related to screen production and manufacturing includes process tasks, quality feedback and improvement suggestions, material properties and processes, and data related to environmental protection and energy consumption;
[0045] The task analysis module is used to perform the following: analyzing the business weight and priority coefficient of each new task in the wire mesh manufacturing process based on the sorted subsets;
[0046] The knowledge base construction module is used to perform the following: extract entities based on the screen manufacturing process, construct a knowledge graph based on the entities and the relationships between the entities, and store the knowledge graph in the graph database in the form of structured information, wherein the entities include material types, process steps, equipment status, defect types, energy consumption records and emission standards related to screen manufacturing;
[0047] The old task protection module is used to perform the following: for the current screen manufacturing model obtained through historical sample training, the importance of model parameters to the old tasks is calculated based on the Fisher information matrix, and the priority of the model parameters is adjusted based on the knowledge graph;
[0048] The model fine-tuning module is used to perform the following: based on the Fisher information matrix, the loss function of the wire mesh manufacturing model under the new task is updated through EWC, and when the current wire mesh manufacturing model is fine-tuned by minimizing the loss function, the knowledge graph is queried, and the predicted output and model parameters of the current wire mesh manufacturing model are corrected based on the entities and relationships in the knowledge graph.
[0049] Preferably, the data acquisition module is used to perform data preprocessing on the collected sample data, and divide the preprocessed sample data into multiple subsets according to the relevant links of screen production and manufacturing, and the data volume of the sample data in each subset meets the preset level, wherein the data preprocessing includes data cleaning and normalization operations;
[0050] When the pre-processed sample data is divided into subsets according to the relevant links of screen manufacturing, the data acquisition module is used to perform the following operations:
[0051] For the sample data from different process tasks of screen manufacturing, the sample data are numbered according to the sequence of the process tasks, and the sample data are divided into multiple fine-tuning subsets based on the numbering;
[0052] For sample data involving different material properties and processes, they are divided according to data attributes, and each material or process-related sample data corresponds to a model fine-tuning subset;
[0053] For sample data involving quality feedback and improvement suggestions, they are divided according to the problem type or problem severity. Each problem type or severity corresponds to a model fine-tuning subset.
[0054] For sample data related to environmental protection energy consumption, they are divided according to energy consumption or environmental protection parameters. Each sample data related to energy consumption or environmental protection parameters corresponds to a model fine-tuning subset.
[0055] Preferably, when analyzing the business weight and priority coefficient of each new task in the screen manufacturing process based on the sorted subsets, the task analysis module is used to perform the following: determining the business weight and priority coefficient of each new task based on the order of the subsets and the additional factors introduced, wherein the additional factors include the importance of the new task, the similarity and migration potential between the tasks, the data volume of the sample data in the model fine-tuning subset, and the impact of the task on the overall business goal;
[0056] Task The priority coefficient The calculation formula is as follows:
[0057] ,
[0058] in, Representation Task The importance coefficient is calculated as follows:
[0059] ,
[0060] Represents the number of all tasks, Representation Task The business weight of Representation Task The business weight of the task is determined by the importance definition rules of the wire mesh manufacturing enterprise to the current business;
[0061] Representation Task With the task The similarity between them is calculated as follows:
[0062] ,
[0063] in, Indicates that from the task Some sample data randomly selected from the corresponding model fine-tuning subset, Indicates that from the task Some sample data randomly selected from the corresponding model fine-tuning subset;
[0064] When calculating the similarity between tasks, the cosine similarity between the two tasks is calculated multiple times, and the average value of the multiple cosine similarities is used as the similarity coefficient between the two tasks.
[0065] Preferably, the old task protection module is used to perform the following:
[0066] Select representative old tasks as benchmarks and calculate the Fisher information value of each model parameter. For the selected tasks, the Fisher information value of each model parameter is calculated through the trained wire mesh manufacturing model. In the Fisher information matrix, the elements on the diagonal represent the influence of each model parameter on the gradient of the loss function, and the off-diagonal elements reflect the covariance relationship between the model parameters. A larger Fisher information value means that the corresponding model parameter is very important for the current task.
[0067] Create a weight matrix , where each row corresponds to a model parameter and the columns represent the Fisher information value under different tasks. In , the parameters with higher Fisher information values are marked as high priority;
[0068] Based on the knowledge graph, the model parameters closely related to the entity are checked and verified. Through the information provided by the knowledge graph, the priority marking of the model parameters in the weight matrix is further adjusted to ensure that all model parameters that have a significant impact on the process are correctly identified.
[0069] As an optimal choice, the loss function of the screen manufacturing model under the new task is The expression is:
[0070] ,
[0071] in, represents the loss of the current model weight under the new task, represents the introduced regularization term, Indicates the business weight of the task;
[0072] represents the first elements, the expression is as follows:
[0073] ,
[0074] in, Represents sample data selected from the subset corresponding to the old task , Indicates the wire mesh manufacturing model in the model parameters The following sample data The predicted probability of Indicates the model parameters for the current task The gradient of the log-likelihood function is, Represents the model parameters of the current task;
[0075] The expressions for updating model parameters are as follows:
[0076] ,
[0077] ,
[0078] in, represents the learning rate, It represents the loss function of the model parameters combined with the elastic weight consolidation method The gradient of Represents the new task loss on the model parameters The gradient of Represents the gradient information of the regularization term that combines EWC and the task’s business weight.
[0079] The model fine-tuning method and system based on task priority and elastic weight solidification of the present invention have the following advantages:
[0080] 1. Different tasks in the wire mesh manufacturing process are classified to obtain corresponding subsets, and the subsets are weighted according to the actual production rules. The production rules and requirement information are integrated into the model parameters, and the EWC protection strength is dynamically adjusted based on the task priority. Different protection strengths are set for the key weights of different tasks, and constraints are reduced for similar tasks and strengthened for important tasks, so that the model can remember and retain the optimal weights corresponding to the important task data set;
[0081] 2. Before fine-tuning, analyze the key weights in the model parameters, calculate their corresponding information matrix, and identify the model parameters that are particularly important for the old tasks. Use the EWC mechanism to protect these model parameters to prevent them from changing significantly during the fine-tuning of subsequent tasks.
[0082] 3. Limit fine-tuning based on the results of EWC, add regularization to important weights, and reduce the probability of their drastic changes;
[0083] 4. When fine-tuning the model, knowledge transfer is performed based on the knowledge graph to detect whether the model's answers have problems such as hallucinations. Structured information support is provided based on the knowledge graph to bring domain background knowledge to the model's fine-tuning process. At the same time, it helps the model transfer knowledge from previous tasks to new tasks, thereby improving the efficiency and accuracy of knowledge transfer. BRIEF DESCRIPTION OF THE DRAWINGS
[0084] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0085] The present invention is further described below in conjunction with the accompanying drawings.
[0086] Figure 1 This is a flowchart of a model fine-tuning method based on task priority and elastic weight solidification in Example 1. DETAILED DESCRIPTION
[0087] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it. However, the embodiments are not intended to limit the present invention. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments may be combined with each other.
[0088] The embodiments of the present invention provide a model fine-tuning method and system based on task priority and elastic weight solidification, which are used to solve the technical problem of how to provide a stable, efficient, and low-power wire mesh manufacturing model that can adapt to a variety of complex production scenarios.
[0089] Embodiment 1: The present invention provides a model fine-tuning method based on task priority and elastic weight solidification, including five steps: data collection, task analysis, knowledge base construction, old task protection and model fine-tuning.
[0090] Step S100 data collection: collect wire mesh production and manufacturing related data as sample data, divide the sample data into multiple subsets according to the wire mesh production and manufacturing related links, and number and sort the subsets, wherein the wire mesh production and manufacturing related data includes process tasks, quality feedback and improvement suggestions, material properties and processes, and environmental protection and energy consumption related data.
[0091] During the data collection process of this embodiment, data is collected from various links of the wire mesh manufacturing production process, such as production process data (such as production speed, equipment temperature), quality feedback data (such as defect type and distribution), material properties and process data (such as corrosion resistance, ductility, temperature, etc.) and energy consumption and environmental protection data (such as energy consumption records and emission standards). These data provide complete production background information for the model and are the basis for subsequent analysis.
[0092] In this embodiment, the collected sample data is preprocessed, and the preprocessed sample data is divided into multiple subsets according to the relevant links of silk screen production and manufacturing, and the data amount of sample data in each subset meets the preset level, wherein the data preprocessing includes data cleaning and normalization operations.
[0093] As a specific implementation of subset division, when the pre-processed sample data is divided into subsets according to the relevant links of screen production and manufacturing, the following operations are performed:
[0094] (1) For the sample data from different process tasks of screen manufacturing, number them according to the order of the process tasks, and divide the sample data into multiple fine-tuning subsets based on the numbering;
[0095] (2) For sample data involving different material properties and processes, they are divided according to data attributes, and each material or process-related sample data corresponds to a model fine-tuning subset;
[0096] (3) For sample data involving quality feedback and improvement suggestions, they are divided according to the problem type or problem severity. The sample data for each problem type or severity corresponds to a model fine-tuning subset;
[0097] (4) For sample data related to environmental protection energy consumption, they are divided according to energy consumption or environmental protection parameters. Each sample data related to energy consumption or environmental protection parameter corresponds to a model fine-tuning subset.
[0098] This embodiment divides the collected sample data into multiple subsets to achieve multi-task fine-tuning, thereby greatly reducing the demand for hardware. In addition, the amount of each type of data set is kept at the same level (here refers to the amount, the number of each type of data set should not be much different to avoid underfitting of certain tasks due to small samples), to prevent data imbalance from causing a decrease in fine-tuning effect.
[0099] Step S200 Task analysis: analyzing the business weight and priority coefficient of each new task in the screen manufacturing process based on the sorted subsets.
[0100] In this embodiment, when analyzing the business weight and priority coefficient of each new task in the screen manufacturing process based on the sorted subsets, the business weight and priority coefficient of each new task are determined based on the order of the subsets and the additional factors introduced, wherein the additional factors include the importance of the new task, the similarity and migration potential between tasks, the amount of sample data in the model fine-tuning subset, and the impact of the task on the overall business goal;
[0101] Task The priority coefficient The calculation formula is as follows:
[0102] ,
[0103] in, Represents the balance coefficient, ranging from , used to balance the impact of task importance and similarity on priority;
[0104] Representation Task The importance coefficient can usually be set according to the business needs or system indicators of screen manufacturing. The calculation formula is as follows:
[0105] ,
[0106] Represents the number of all tasks, Representation Task The business weight is determined by the enterprise's definition of the importance of the current business. For example, the proportion of quality feedback will be larger. Representation Task The business weight of the task is determined by the importance definition rules of the wire mesh manufacturing enterprise to the current business;
[0107] Representation Task With the task The similarity between , the higher the similarity, the closer the value is to 1, and the calculation formula is as follows:
[0108] ,
[0109] in, Indicates that from the task Some sample data randomly selected from the corresponding model fine-tuning subset, Indicates that from the task Some sample data randomly selected from the corresponding model fine-tuning subset; mainly focusing on the title, abstract, summary, etc.
[0110] When calculating the similarity between tasks, the cosine similarity between the two tasks is calculated multiple times, and the average value of the multiple cosine similarities is used as the similarity coefficient between the two tasks.
[0111] In this embodiment, during task analysis, the priority coefficients and weights of each task are analyzed based on the order of the subsets. The order of tasks is determined by the manufacturing process, but the priority does not entirely depend on the position in the process. Additional factors need to be introduced to determine the priority coefficient and weight of each task. These factors may include the importance of tasks, the similarity and migration potential between tasks, the amount and difficulty of data, and the impact of tasks on overall business goals. During multi-task fine-tuning, an appropriate priority coefficient is assigned to each task to determine the degree of protection for its corresponding weight. This priority setting is based on both the importance of the task itself and the similarity between the task and the new task. For different categories of tasks, their own importance and relevance to subsequent tasks need to be quantified to better adjust the training process.
[0112] Step S300: knowledge base construction: extract entities based on the wire mesh production and manufacturing process, construct a knowledge graph based on the entities and the relationships between them, and store the knowledge graph in a graph database in the form of structured information, wherein the entities include material types, process steps, equipment status, defect types, energy consumption records, and emission standards related to wire mesh production and manufacturing.
[0113] In this embodiment, by structurally representing the information such as processes, materials, product specifications, etc. in the field of wire mesh manufacturing as knowledge graphs, and using these structured information to guide the learning of new tasks during the fine-tuning process, the adaptability of the model and the accuracy of the generated content are improved. Specifically, the entities and relationships in the wire mesh manufacturing knowledge graph are defined based on the various types of data collected. For example, the relationship of "material type" includes "process steps", "possible defects", etc. These entities and relationships constitute the core structure of the knowledge graph. The knowledge graph is stored in a graph database, and each entity and relationship is represented as a node and an edge, and its attributes are stored. According to a certain product specification or material, the graph can quickly query the specific process flow and parameters required for its production. Based on the relationship between the correction methods, the model can obtain correction solutions for similar defects from the knowledge graph, which can reduce the risk of generating inaccurate information during the fine-tuning process, especially to avoid hallucinations under similar tasks.
[0114] Step S400: old task protection: for the current screen manufacturing model obtained through historical sample training, the importance of model parameters to the old tasks is calculated based on the Fisher information matrix, and the priority of the model parameters is adjusted based on the knowledge graph.
[0115] The specific implementation of old task protection includes the following steps:
[0116] (1) Select a representative old task as a benchmark and calculate the Fisher information value of each model parameter. For the selected task, the Fisher information value of each model parameter is calculated using the trained wire mesh manufacturing model. In the Fisher information matrix, the elements on the diagonal represent the influence of each model parameter on the gradient of the loss function, and the off-diagonal elements reflect the covariance relationship between the model parameters. A larger Fisher information value means that the corresponding model parameter is very important for the current task.
[0117] (2) Create a weight matrix , where each row corresponds to a model parameter and the columns represent the Fisher information value under different tasks. In , the parameters with higher Fisher information values are marked as high priority;
[0118] (3) Check and verify the model parameters that are closely related to the entity based on the knowledge graph. Using the information provided by the knowledge graph, further adjust the priority marking of the model parameters in the weight matrix to ensure that all model parameters that have a significant impact on the process are correctly identified.
[0119] Step S500 model fine-tuning: Based on the Fisher information matrix, the loss function of the screen manufacturing model under the new task is updated through EWC. When the current screen manufacturing model is fine-tuned by minimizing the loss function, the knowledge graph is queried, and the predicted output and model parameters of the current screen manufacturing model are corrected based on the entities and relationships in the knowledge graph.
[0120] In this embodiment, the loss function of the screen manufacturing model under the new task is The expression is:
[0121] ,
[0122] in, represents the loss of the current model weight under the new task, represents the introduced regularization term, Indicates the business weight of the task;
[0123] represents the first elements, the expression is as follows:
[0124] ,
[0125] in, Represents sample data selected from the subset corresponding to the old task , Indicates the wire mesh manufacturing model in the model parameters The following sample data The predicted probability of Indicates the model parameters for the current task The gradient of the log-likelihood function is, Represents the model parameters of the current task;
[0126] The expressions for updating model parameters are as follows:
[0127] ,
[0128] ,
[0129] in, represents the learning rate, It represents the loss function of the model parameters combined with the elastic weight consolidation method The gradient of Represents the new task loss on the model parameters The gradient of Represents the gradient information of the regularization term that combines EWC and the task’s business weight.
[0130] In this embodiment, the entire loss consists of two parts. The first part is , represents the loss of the current weight under the new task, which is the overlap with the traditional fine-tuning; the second part is a regularization term, in which, is the weight of the current task, is the optimal weight of the old task. The difference between the two is fused with the Fisher information matrix to increase the optimization difference penalty. That is, if the current weight differs too much from the weight that has a significant impact on the old task, the loss caused by the weight will be increased, so that the impact on the old task is taken into account when updating the weight. It integrates the importance information of actual application scenarios. For example, if the old task is a learning task for product quality feedback, and the quality is more important in the actual production rules, the value will be larger. Therefore, the proportion of the regularization term in the entire loss function will be increased, thereby increasing the penalty for weight differences. After obtaining the new loss function, the weights can be optimized based on gradient updates. The introduction of regularization terms has a constraining effect on the update of weights, ensuring that when important weights deviate from the target value of the old task, their change range is limited.
[0131] This embodiment uses the knowledge graph to calculate the correlation between different production links, quality control processes and environmental protection measures, and determines the priority based on business needs. Finally, the knowledge graph is used to assist decision-making, perform path query and reasoning prediction, identify key factors and causal chains, and optimize task priorities and weight distribution in the model training process, thereby improving model performance and practicality.
[0132] The knowledge graph covers entities such as material properties (such as corrosion resistance and ductility), process parameters (such as temperature and pressure), equipment status (such as normal operation and maintenance), defect types (such as cracks and deformation), energy consumption records and emission standards, and defines the relationships between them, such as "materials are used in processes" and "processes produce defects". Based on this knowledge graph, we can intuitively understand the direct or indirect relationships between entities through association analysis, perform causal reasoning to identify key drivers, and observe the expected impact of changes on the system through scenario simulation to guide decision-making in actual production. The knowledge graph begins to provide support at this stage, using its structured information (such as the association between different materials and processes) to improve the accuracy of the analysis. Through scenario importance analysis, the model can identify key factors that have a greater impact on process optimization, thereby providing a basis for subsequent weight definition.
[0133] The method of this embodiment combines task priority and dynamic weight protection mechanisms through elastic weight solidification to establish an effective multi-task fine-tuning process to deal with the catastrophic forgetting problem of the screen manufacturing model in multi-task and multi-process scenarios. The importance of the weight of the old task is calculated by EWC, and the weight protection strength is dynamically adjusted using the task priority coefficient, so that the model can retain the key knowledge of the old task to the greatest extent when adapting to the new task, ensuring the stability of the model. At the same time, the method of this embodiment introduces the screen manufacturing knowledge graph and knowledge transfer mechanism to structure the knowledge of different process parameters, material properties, quality standards, defect types, etc. The model can efficiently reuse this knowledge in the process of fine-tuning the new task, thereby generating content that conforms to the actual process logic and industry standards, significantly reducing the occurrence of hallucinations. In addition, the method adopts low-rank adaptive fine-tuning to adjust parameters in a lightweight manner, so that the model can be efficiently deployed on resource-constrained edge devices to meet the real-time and low power requirements of screen manufacturing. Overall, the method has significant advantages in achieving knowledge retention, adapting to new tasks, reducing hallucinations, and saving computing resources, and provides stable and efficient technical support for the intelligent upgrade of screen manufacturing.
[0134] Embodiment 2: The present invention provides a model fine-tuning system based on task priority and elastic weight solidification, including a data acquisition module, a task analysis module, a knowledge base construction module, an old task protection module and a model fine-tuning module.
[0135] The data acquisition module is used to perform the following: collect wire mesh production and manufacturing related data as sample data, divide the sample data into multiple subsets according to the wire mesh production and manufacturing related links, and number and sort the subsets. Among them, the wire mesh production and manufacturing related data includes process tasks, quality feedback and improvement suggestions, material properties and processes, and environmental protection and energy consumption related data.
[0136] During the data collection process of this embodiment, data is collected from various links of the wire mesh manufacturing production process, such as production process data (such as production speed, equipment temperature), quality feedback data (such as defect type and distribution), material properties and process data (such as corrosion resistance, ductility, temperature, etc.) and energy consumption and environmental protection data (such as energy consumption records and emission standards). These data provide complete production background information for the model and are the basis for subsequent analysis.
[0137] In this embodiment, the collected sample data is preprocessed, and the preprocessed sample data is divided into multiple subsets according to the relevant links of silk screen production and manufacturing, and the data amount of sample data in each subset meets the preset level, wherein the data preprocessing includes data cleaning and normalization operations.
[0138] As a specific implementation of subset division, when the pre-processed sample data is divided into subsets according to the relevant links of screen production and manufacturing, the data acquisition module is used to perform the following operations:
[0139] (1) For the sample data from different process tasks of screen manufacturing, number them according to the order of the process tasks, and divide the sample data into multiple fine-tuning subsets based on the numbering;
[0140] (2) For sample data involving different material properties and processes, they are divided according to data attributes, and each material or process-related sample data corresponds to a model fine-tuning subset;
[0141] (3) For sample data involving quality feedback and improvement suggestions, they are divided according to the problem type or problem severity. The sample data for each problem type or severity corresponds to a model fine-tuning subset;
[0142] (4) For sample data related to environmental protection energy consumption, they are divided according to energy consumption or environmental protection parameters. Each sample data related to energy consumption or environmental protection parameter corresponds to a model fine-tuning subset.
[0143] This embodiment divides the collected sample data into multiple subsets to achieve multi-task fine-tuning, thereby greatly reducing the demand for hardware. In addition, the amount of each type of data set is kept at the same level (here refers to the amount, the number of each type of data set should not be much different to avoid underfitting of certain tasks due to small samples), to prevent data imbalance from causing a decrease in fine-tuning effect.
[0144] The task analysis module is used to perform the following: analyzing the business weight and priority coefficient of each new task in the wire mesh manufacturing process based on the sorted subsets.
[0145] In this embodiment, when analyzing the business weight and priority coefficient of each new task in the screen manufacturing process based on the sorted subsets, the task analysis module is used to determine the business weight and priority coefficient of each new task based on the order of the subsets and the additional factors introduced, wherein the additional factors include the importance of the new task, the similarity and migration potential between tasks, the data volume of the sample data in the model fine-tuning subset, and the impact of the task on the overall business goal;
[0146] Task The priority coefficient The calculation formula is as follows:
[0147] ,
[0148] in, Represents the balance coefficient, ranging from , used to balance the impact of task importance and similarity on priority;
[0149] Representation Task The importance coefficient can usually be set according to the business needs or system indicators of screen manufacturing. The calculation formula is as follows:
[0150] ,
[0151] Represents the number of all tasks, Representation Task The business weight is determined by the enterprise's definition of the importance of the current business. For example, the proportion of quality feedback will be larger. Representation Task The business weight of the task is determined by the importance definition rules of the wire mesh manufacturing enterprise to the current business;
[0152] Representation Task With the task The similarity between , the higher the similarity, the closer the value is to 1, and the calculation formula is as follows:
[0153] ,
[0154] in, Indicates that from the task Some sample data randomly selected from the corresponding model fine-tuning subset, Indicates that from the task Some sample data randomly selected from the corresponding model fine-tuning subset; mainly focusing on the title, abstract, summary, etc.
[0155] When calculating the similarity between tasks, the task analysis module is used to calculate the cosine similarity between two tasks multiple times, and use the average value of the multiple cosine similarities as the similarity coefficient between the two tasks.
[0156] In this embodiment, during task analysis, the priority coefficients and weights of each task are analyzed based on the order of the subsets. The order of tasks is determined by the manufacturing process, but the priority does not entirely depend on the position in the process. Additional factors need to be introduced to determine the priority coefficient and weight of each task. These factors may include the importance of tasks, the similarity and migration potential between tasks, the amount and difficulty of data, and the impact of tasks on overall business goals. During multi-task fine-tuning, an appropriate priority coefficient is assigned to each task to determine the degree of protection for its corresponding weight. This priority setting is based on both the importance of the task itself and the similarity between the task and the new task. For different categories of tasks, their own importance and relevance to subsequent tasks need to be quantified to better adjust the training process.
[0157] The knowledge base construction module is used to perform the following: extract entities based on the wire mesh production and manufacturing process, build a knowledge graph based on the entities and the relationships between entities, and store the knowledge graph in the graph database in the form of structured information, where the entities include material types, process steps, equipment status, defect types, energy consumption records and emission standards related to wire mesh production and manufacturing.
[0158] In this embodiment, by structurally representing the information such as processes, materials, product specifications, etc. in the field of wire mesh manufacturing as knowledge graphs, and using these structured information to guide the learning of new tasks during the fine-tuning process, the adaptability of the model and the accuracy of the generated content are improved. Specifically, the entities and relationships in the wire mesh manufacturing knowledge graph are defined based on the various types of data collected. For example, the relationship of "material type" includes "process steps", "possible defects", etc. These entities and relationships constitute the core structure of the knowledge graph. The knowledge graph is stored in a graph database, and each entity and relationship is represented as a node and an edge, and its attributes are stored. According to a certain product specification or material, the graph can quickly query the specific process flow and parameters required for its production. Based on the relationship between the correction methods, the model can obtain correction solutions for similar defects from the knowledge graph, which can reduce the risk of generating inaccurate information during the fine-tuning process, especially to avoid hallucinations under similar tasks.
[0159] The old task protection module is used to perform the following: for the current screen manufacturing model obtained through historical sample training, the importance of the model parameters to the old tasks is calculated based on the Fisher information matrix, and the priority level of the model parameters is adjusted based on the knowledge graph.
[0160] As a specific implementation of the old task protection module, this module is used to perform the following operations:
[0161] (1) Select a representative old task as a benchmark and calculate the Fisher information value of each model parameter. For the selected task, the Fisher information value of each model parameter is calculated using the trained wire mesh manufacturing model. In the Fisher information matrix, the elements on the diagonal represent the influence of each model parameter on the gradient of the loss function, and the off-diagonal elements reflect the covariance relationship between the model parameters. A larger Fisher information value means that the corresponding model parameter is very important for the current task.
[0162] (2) Create a weight matrix , where each row corresponds to a model parameter and the columns represent the Fisher information value under different tasks. In , the parameters with higher Fisher information values are marked as high priority;
[0163] (3) Check and verify the model parameters that are closely related to the entity based on the knowledge graph. Using the information provided by the knowledge graph, further adjust the priority marking of the model parameters in the weight matrix to ensure that all model parameters that have a significant impact on the process are correctly identified.
[0164] The model fine-tuning module is used to perform the following: based on the Fisher information matrix, the loss function of the wire mesh manufacturing model under the new task is updated through EWC, and when the current wire mesh manufacturing model is fine-tuned by minimizing the loss function, the knowledge graph is queried, and the predicted output and model parameters of the current wire mesh manufacturing model are corrected based on the entities and relationships in the knowledge graph.
[0165] In this embodiment, the loss function of the screen manufacturing model under the new task is The expression is:
[0166] ,
[0167] in, represents the loss of the current model weight under the new task, represents the introduced regularization term, Indicates the business weight of the task;
[0168] represents the first elements, the expression is as follows:
[0169] ,
[0170] in, Represents sample data selected from the subset corresponding to the old task , Indicates the wire mesh manufacturing model in the model parameters The following sample data The predicted probability of Indicates the model parameters for the current task The gradient of the log-likelihood function is, Represents the model parameters of the current task;
[0171] The expressions for updating model parameters are as follows:
[0172] ,
[0173] ,
[0174] in, represents the learning rate, It represents the loss function of the model parameters combined with the elastic weight consolidation method The gradient of Represents the new task loss on the model parameters The gradient of Represents the gradient information of the regularization term that combines EWC and the task’s business weight.
[0175] In this embodiment, the entire loss consists of two parts. The first part is , represents the loss of the current weight under the new task, which is the overlap with the traditional fine-tuning; the second part is a regularization term, in which, is the weight of the current task, is the optimal weight of the old task. The difference between the two is fused with the Fisher information matrix to increase the optimization difference penalty. That is, if the current weight differs too much from the weight that has a significant impact on the old task, the loss caused by the weight will be increased, so that the impact on the old task is taken into account when updating the weight. It integrates the importance information of actual application scenarios. For example, if the old task is a learning task for product quality feedback, and the quality is more important in the actual production rules, the value will be larger. Therefore, the proportion of the regularization term in the entire loss function will be increased, thereby increasing the penalty for weight differences. After obtaining the new loss function, the weights can be optimized based on gradient updates. The introduction of regularization terms has a constraining effect on the update of weights, ensuring that when important weights deviate from the target value of the old task, their change range is limited.
[0176] The system of this embodiment can execute the method disclosed in Example 1 to achieve fine-tuning of the screen manufacturing model.
[0177] The above is a detailed introduction to the model fine-tuning method and system based on task priority and elastic weight solidification provided by the present invention. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the ideas of the present invention, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A model fine-tuning method based on task priority and elastic weight solidification, characterized in that: The steps include: Data collection: Collect data related to wire mesh production and manufacturing as sample data, divide the sample data into multiple subsets according to the relevant links of wire mesh production and manufacturing, and sort the subsets by number. The data related to wire mesh production and manufacturing includes process tasks, quality feedback and improvement suggestions, material properties and processes, and data related to environmental protection and energy consumption; Task analysis: Analyze the business weight and priority coefficient of each new task in the wire mesh manufacturing process based on the sorted subsets; Knowledge base construction: Extract entities based on the screen manufacturing process, build a knowledge graph based on the entities and the relationships between them, and store the knowledge graph in the graph database in the form of structured information. The entities include material types, process steps, equipment status, defect types, energy consumption records, and emission standards related to screen manufacturing. Old task protection: For the current screen manufacturing model obtained through historical sample training, the importance of model parameters to old tasks is calculated based on the Fisher information matrix, and the priority of model parameters is adjusted based on the knowledge graph; Model fine-tuning: Based on the Fisher information matrix, the loss function of the screen manufacturing model under the new task is updated through EWC. When the current screen manufacturing model is fine-tuned by minimizing the loss function, the knowledge graph is queried and the predicted output and model parameters of the current screen manufacturing model are corrected based on the entities and relationships in the knowledge graph.
2. The model fine-tuning method based on task priority and elastic weight solidification according to claim 1 is characterized in that: During data collection, the collected sample data is preprocessed, and the preprocessed sample data is divided into multiple subsets according to the relevant links of screen production and manufacturing, and the data volume of the sample data in each subset meets the preset level, wherein the data preprocessing includes data cleaning and normalization operations; When the pre-processed sample data is divided into subsets according to the relevant links of screen manufacturing, the following operations are performed: For the sample data from different process tasks of screen manufacturing, the sample data are numbered according to the sequence of the process tasks, and the sample data are divided into multiple fine-tuning subsets based on the numbering; For sample data involving different material properties and processes, they are divided according to data attributes, and each material or process-related sample data corresponds to a model fine-tuning subset; For sample data involving quality feedback and improvement suggestions, they are divided according to the problem type or problem severity. Each problem type or severity corresponds to a model fine-tuning subset. For sample data related to environmental protection energy consumption, they are divided according to energy consumption or environmental protection parameters. Each sample data related to energy consumption or environmental protection parameters corresponds to a model fine-tuning subset.
3. The model fine-tuning method based on task priority and elastic weight solidification according to claim 1 is characterized in that: When analyzing the business weight and priority coefficient of each new task in the wire mesh manufacturing process based on the sorted subsets, the business weight and priority coefficient of each new task are determined based on the order of the subsets and the additional factors introduced, where the additional factors include the importance of the new task, the similarity and migration potential between tasks, the amount of sample data in the model fine-tuning subset, and the impact of the task on the overall business goal; Task The priority coefficient The calculation formula is as follows: , in, represents the balance coefficient, Indicates the task The importance coefficient is calculated as follows: , Represents the number of all tasks, Indicates the task The business weight of Indicates the task The business weight of the task is determined by the importance definition rules of the wire mesh manufacturing enterprise to the current business; Indicates the task With the task The similarity between them is calculated as follows: , in, Indicates that from the task Some sample data randomly selected from the corresponding model fine-tuning subset, Indicates that from the task Some sample data randomly selected from the corresponding model fine-tuning subset; When calculating the similarity between tasks, the cosine similarity between the two tasks is calculated multiple times, and the average value of the multiple cosine similarities is used as the similarity coefficient between the two tasks.
4. The model fine-tuning method based on task priority and elastic weight solidification according to claim 1 is characterized in that: The old task protection includes the following steps: Select representative old tasks as benchmarks and calculate the Fisher information value of each model parameter. For the selected tasks, the Fisher information value of each model parameter is calculated through the trained wire mesh manufacturing model. In the Fisher information matrix, the elements on the diagonal represent the influence of each model parameter on the gradient of the loss function, and the off-diagonal elements reflect the covariance relationship between the model parameters. A larger Fisher information value means that the corresponding model parameter is very important for the current task. Create a weight matrix , where each row corresponds to a model parameter and the columns represent the Fisher information value under different tasks. In , the parameters with higher Fisher information values are marked as high priority; Based on the knowledge graph, the model parameters closely related to the entity are checked and verified. Through the information provided by the knowledge graph, the priority marking of the model parameters in the weight matrix is further adjusted to ensure that all model parameters that have a significant impact on the process are correctly identified.
5. The model fine-tuning method based on task priority and elastic weight solidification according to claim 1 is characterized in that: Loss function of the wire mesh manufacturing model under the new task The expression is: , in, represents the loss of the current model weight under the new task, represents the introduced regularization term, Indicates the business weight of the task; represents the first elements, the expression is as follows: , in, Represents sample data selected from the subset corresponding to the old task , Indicates the wire mesh manufacturing model in the model parameters The following sample data The predicted probability of Indicates the model parameters for the current task The gradient of the log-likelihood function is, Represents the model parameters of the current task; The expressions for updating model parameters are as follows: , , in, represents the learning rate, It represents the loss function of the model parameters combined with the elastic weight consolidation method The gradient of Represents the new task loss on the model parameters The gradient of Represents the gradient information of the regularization term that combines EWC and the task’s business weight.
6. A model fine-tuning system based on task priority and elastic weight solidification, characterized in that: Used to fine-tune the screen manufacturing model by a model fine-tuning method based on task priority and elastic weight solidification as described in any one of claims 1 to 5, the system includes a data acquisition module, a task analysis module, a knowledge base construction module, an old task protection module and a model fine-tuning module; The data collection module is used to perform the following: collect data related to screen production and manufacturing as sample data, divide the sample data into multiple subsets according to the relevant links of screen production and manufacturing, and number and sort the subsets, wherein the data related to screen production and manufacturing includes process tasks, quality feedback and improvement suggestions, material properties and processes, and data related to environmental protection and energy consumption; The task analysis module is used to perform the following: analyzing the business weight and priority coefficient of each new task in the wire mesh manufacturing process based on the sorted subsets; The knowledge base construction module is used to perform the following: extract entities based on the screen manufacturing process, construct a knowledge graph based on the entities and the relationships between the entities, and store the knowledge graph in the graph database in the form of structured information, wherein the entities include material types, process steps, equipment status, defect types, energy consumption records and emission standards related to screen manufacturing; The old task protection module is used to perform the following: for the current screen manufacturing model obtained through historical sample training, the importance of model parameters to the old tasks is calculated based on the Fisher information matrix, and the priority of the model parameters is adjusted based on the knowledge graph; The model fine-tuning module is used to perform the following: based on the Fisher information matrix, the loss function of the wire mesh manufacturing model under the new task is updated through EWC, and when the current wire mesh manufacturing model is fine-tuned by minimizing the loss function, the knowledge graph is queried, and the predicted output and model parameters of the current wire mesh manufacturing model are corrected based on the entities and relationships in the knowledge graph.
7. The model fine-tuning system based on task priority and elastic weight solidification according to claim 6 is characterized in that: The data acquisition module is used to perform data preprocessing on the collected sample data, and divide the preprocessed sample data into multiple subsets according to the relevant links of screen production and manufacturing, and the data volume of the sample data in each subset meets the preset level, wherein the data preprocessing includes data cleaning and normalization operations; When the pre-processed sample data is divided into subsets according to the relevant links of screen manufacturing, the data acquisition module is used to perform the following operations: For the sample data from different process tasks of screen manufacturing, the sample data are numbered according to the sequence of the process tasks, and the sample data are divided into multiple fine-tuning subsets based on the numbering; For sample data involving different material properties and processes, they are divided according to data attributes, and each material or process-related sample data corresponds to a model fine-tuning subset; For sample data involving quality feedback and improvement suggestions, they are divided according to the problem type or problem severity. Each problem type or severity corresponds to a model fine-tuning subset. For sample data related to environmental protection energy consumption, they are divided according to energy consumption or environmental protection parameters. Each sample data related to energy consumption or environmental protection parameters corresponds to a model fine-tuning subset.
8. The model fine-tuning system based on task priority and elastic weight solidification according to claim 6 is characterized in that: When analyzing the business weight and priority coefficient of each new task in the wire mesh manufacturing process based on the sorted subsets, the task analysis module is used to perform the following: determine the business weight and priority coefficient of each new task based on the order of the subsets and the additional factors introduced, wherein the additional factors include the importance of the new task, the similarity and transfer potential between the tasks, the data volume of the sample data in the model fine-tuning subset, and the impact of the task on the overall business goal; Task The priority coefficient The calculation formula is as follows: , in, represents the balance coefficient, Indicates the task The importance coefficient is calculated as follows: , Represents the number of all tasks, Indicates the task The business weight of Indicates the task The business weight of the task is determined by the importance definition rules of the wire mesh manufacturing enterprise to the current business; Indicates the task With the task The similarity between them is calculated as follows: , in, Indicates that from the task Some sample data randomly selected from the corresponding model fine-tuning subset, Indicates that from the task Some sample data randomly selected from the corresponding model fine-tuning subset; When calculating the similarity between tasks, the cosine similarity between the two tasks is calculated multiple times, and the average value of the multiple cosine similarities is used as the similarity coefficient between the two tasks.
9. The model fine-tuning system based on task priority and elastic weight solidification according to claim 6, characterized in that: The old task protection module used to perform the following: Select representative old tasks as benchmarks and calculate the Fisher information value of each model parameter. For the selected tasks, the Fisher information value of each model parameter is calculated through the trained wire mesh manufacturing model. In the Fisher information matrix, the elements on the diagonal represent the influence of each model parameter on the gradient of the loss function, and the off-diagonal elements reflect the covariance relationship between the model parameters. A larger Fisher information value means that the corresponding model parameter is very important for the current task. Create a weight matrix , where each row corresponds to a model parameter and the columns represent the Fisher information value under different tasks. In , the parameters with higher Fisher information values are marked as high priority; Based on the knowledge graph, the model parameters closely related to the entity are checked and verified. Through the information provided by the knowledge graph, the priority marking of the model parameters in the weight matrix is further adjusted to ensure that all model parameters that have a significant impact on the process are correctly identified.
10. The model fine-tuning system based on task priority and elastic weight solidification according to claim 6, characterized in that: Loss function of the wire mesh manufacturing model under the new task The expression is: , in, represents the loss of the current model weight under the new task, represents the introduced regularization term, Indicates the business weight of the task; represents the first elements, the expression is as follows: , in, Represents sample data selected from the subset corresponding to the old task , Indicates the wire mesh manufacturing model in the model parameters The following sample data The predicted probability of Indicates the model parameters for the current task The gradient of the log-likelihood function is, Represents the model parameters of the current task; The expressions for updating model parameters are as follows: , , in, represents the learning rate, It represents the loss function of the model parameters combined with the elastic weight consolidation method The gradient of Represents the new task loss on the model parameters The gradient of Represents the gradient information of the regularization term that combines EWC and the task’s business weight.
Citation Information
Patent Citations
Weak supervision entity alignment optimization method and system for cross-language knowledge graph
CN116108351A
Continuous learning method for reasonably forgetting visual task knowledge in open domain environment
CN117876765A