Electric power communication management file assisted compilation method and system based on large model fine tuning

In the automated compilation of power communication management files, the instruction and prompt database is established and the rank value of the decomposition matrix is ​​dynamically adjusted, and the large model is fine-tuned, which solves the problems of low fine-tuning efficiency and poor effect in the existing technology, and efficient and accurate file generation is achieved.

CN120218246APending Publication Date: 2025-06-27NARI INFORMATION & COMM TECH

Patent Information

Application Number
CN202510330868.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-20
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

In the automated compilation of power communication management documents, the fine-tuning efficiency is low and the effect is not good, making it difficult to generate files that meet user needs.

Method used

By establishing instructions and prompt databases, fine-tuning the weight matrix of the large model using supervised instruction data and prompt word templates, dynamically adjusting the rank value of the decomposition matrix to improve fine-tuning efficiency.

Benefits of technology

It realizes efficient large-scale fine-tuning, and can automatically generate power communication management files that meet user needs, improving the efficiency and accuracy of file compilation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120218246A_ABST
    Figure CN120218246A_ABST
Patent Text Reader

Abstract

The invention discloses an electric power communication management file assisted compilation method and system based on large model fine tuning, and the method comprises the steps: building an instruction and prompt database based on electric power communication management historical file data, and enabling the instruction and prompt database to comprise supervision instruction data and a prompt word template, the cue word template is used for guiding a large model to generate an electric power communication management file meeting user requirements; a large model is selected, supervision instruction data and a cue word template are used for conducting fine adjustment on a weight matrix of the large model by updating a decomposition matrix of an increment parameter matrix, a model fine adjustment module is built, and the rank value of the decomposition matrix is dynamically adjusted according to sparsity of the decomposition matrix; and receiving an instruction input by a user by using the large model subjected to fine tuning by the model fine tuning module, and generating and outputting an electric power communication management file. The fine tuning efficiency can be improved, and the electric power communication management file meeting the user requirement can be more accurately and automatically generated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical fields of natural language processing and power communication, and particularly relates to a method and system for assisting in the compilation of power communication management documents based on large model fine-tuning. Background Art

[0002] In the current power communication industry, the compilation of management documents is an important and complex task. Traditional methods rely on manual writing, which is not only time-consuming and laborious, but also difficult to ensure the accuracy and consistency of the documents. With the rapid development of natural language processing technology, especially the rise of instruction fine-tuning and prompt fine-tuning technologies, new possibilities have been provided for the automated compilation of power communication management documents. However, existing natural language processing models still have deficiencies in processing complex instructions in specific fields (such as power communication management) and need further optimization.

[0003] The use of large model technology to achieve document management and document generation has been applied in other technical fields. For example, the prior art document 1 (CN118132518) discloses a method and system for producing business orchestration documents in the field of medical care, elderly care, and rehabilitation based on a large model, including: (1) collecting materials existing in text form in the fields of medical care, elderly care, and rehabilitation, screening and generating retrieval vectors of knowledge fragments, and forming a knowledge database; (2) collecting business orchestration documents, calling prompt words to generate a large model to obtain generation instructions for business orchestration documents, and storing the orchestration documents, instructions, and knowledge in an example database; (3) using the example data as corpus to fine-tune the document generation large model; (4) during the application process, for materials in natural language form, retrieving the required knowledge and examples, forming the final prompt words, and calling the document generation large model to obtain business orchestration documents; (5) generating a score for the generated business orchestration documents and feeding it back to the document generation large model until a business orchestration document that meets the requirements is generated.

[0004] The prior art document 2 (CN118428490A) discloses a method, device, equipment, and storage medium for fine-tuning an enterprise management large model, including: obtaining a natural language question sent by a user terminal through a preset visual interface and performing data format conversion to obtain a target question; sending the target question to the enterprise management large model to be fine-tuned to obtain a question answer; sending the question answer to the user terminal through the preset visual interface, and obtaining feedback information sent by the user terminal for the question answer, and then determining a training question-answer pair based on the feedback information; storing the training question-answer pair in a preset database, and judging whether the data quantity in the preset database is greater than a preset quantity threshold; if the data quantity is greater than the preset quantity threshold, fine-tuning the enterprise management large model to be fine-tuned based on each training question-answer pair in the preset database to obtain a target enterprise management large model.

[0005] The disadvantage of the prior art document 1 is that the method of updating the model using the low-rank decomposition weight matrix requires presupposing the same eigen-rank for each incremental matrix. This method ignores the significant differences in the weight matrices between different modules and layers, so there is a significant performance difference from full-parameter fine-tuning. The disadvantage of the prior art document 2 is that this technical document only states that the model is continuously called for fine-tuning when the sample increment meets the requirements, without explaining the fine-tuning technique used. The above prior art documents all have the technical problems of low fine-tuning efficiency and the fine-tuning effect not meeting expectations. Therefore, how to achieve fine-tuning of large models in the field of power communication to meet user needs needs to be solved. Summary of the Invention

[0006] To solve the deficiencies in the prior art, the present invention provides a method and system for assisting in the compilation of power communication management documents based on large model fine-tuning, with high fine-tuning efficiency and capable of automatically generating power communication management documents that meet user requirements.

[0007] The present invention adopts the following technical solutions.

[0008] The first aspect of the present invention provides a method for assisting in the compilation of power communication management documents based on large model fine-tuning, including:

[0009] Establish an instruction and prompt database based on power communication management historical file data. The instruction and prompt database includes supervision instruction data and prompt word templates, and the prompt word templates are used to guide the large model to generate power communication management documents that meet user requirements;

[0010] Select a large model and fine-tune the weight matrix of the large model by updating the decomposition matrix of the incremental parameter matrix using the supervision instruction data and prompt word templates to construct a model fine-tuning module, where the rank value of the decomposition matrix is dynamically adjusted according to the sparsity of the decomposition matrix;

[0011] Use the large model fine-tuned by the model fine-tuning module to receive the instruction input by the user, and generate and output a power communication management document.

[0012] Optionally, establishing an instruction and prompt database based on power communication management historical file data includes:

[0013] Collect power communication management file text data as power communication management historical file data, and the power communication management file text data includes at least one of the following categories: planning management, construction management, operation management, technical management, equipment management, technical support, and special work;

[0014] Extract the text content from the power communication management file text data, and perform data cleaning on the extracted text content to obtain the text data after data cleaning;

[0015] Generate supervised instruction data based on the text data after data cleaning;

[0016] Construct a prompt template;

[0017] Store the supervised instruction data and the prompt template in the instruction and prompt database.

[0018] Optionally, the prompt template includes a standard template and a structure template. The standard template is a document generation template, including an input part for prompting the large model to generate a corresponding document based on the content of the input part. The structure template is a document generation template with a structure part, including an input part and a structure part, for prompting the large model to generate a document that conforms to the document structure set by the structure part based on the content of the input part.

[0019] Optionally, when using the supervised instruction data and the prompt template to fine-tune the weight matrix of the large model by updating the decomposition matrix of the incremental parameter matrix, set the weight matrix W of the large model in this round to where W0 is the weight matrix of the initial large model or the weight matrix of the large model after the previous round of iterative update, ΔW is the incremental parameter matrix, and decompose ΔW into two decomposition matrices A and B, the rank value r of the decomposition matrix is less than the rank value d of the incremental parameter matrix, and α is the ratio controlling the weight update, representing the proportion of the incremental parameter matrix in the parameters of the large model.

[0020] Optionally, dynamically adjust the rank value of the decomposition matrix according to the sparsity of the decomposition matrix, including:

[0021] Calculate the left singular vector, right singular vector and singular value of W0 according to the following formula:

[0022] W0 = UΣV T

[0023] where U and V are orthogonal matrices, representing the left singular vector and the right singular vector respectively, Σ is a diagonal matrix containing singular values, and the singular values in the diagonal matrix are arranged in descending order,

[0024] Dynamically select the maximum rank value r based on the cumulative contribution rate of the singular values max ;

[0025] The matrix A is initialized with the right singular vector of W0, that is, extract the first r max rows from the right singular vector V to obtain the decomposition matrix A;

[0026] The matrix B is initialized with the left singular vector of W0, that is, extract the first rmax Column to obtain the decomposition matrix B;

[0027] Calculate the proportion sparsity of the number of zero elements in the decomposition matrices A and B in this round of iteration to the total number of elements respectively A and sparsity B , sparsity A and sparsity B are used to characterize the sparsity of the decomposition matrices A and B respectively;

[0028] Select the minimum value of the sparsity of the decomposition matrices A and B as the sparsity sparsity of the incremental parameter matrix T = min(sparsity A , sparsity B ), after every t rounds of iteration, calculate the sparsity sparsity of the incremental parameter matrix updated in this round of iteration for the updated B and A T ' = min(sparsity A ', sparsity B '), when sparsity T ' is greater than sparsity T , adjust the rank value r of the decomposition matrix in the next round of iteration update according to the following formula new until the iteration update stops:

[0029] r new = r max *(1 - a * sparsity T ')

[0030] where a is an adjustment factor to control the influence of sparsity on the rank value, r new is the adjusted rank value, and the value is an integer within the range of 1 to r max .

[0031] Optionally, dynamically select the maximum rank value r max based on the cumulative contribution rate of singular values, including:

[0032] Calculate the cumulative contribution rate p of the first r singular values according to the following formula:

[0033]

[0034] where, σ i is the i-th singular value in the diagonal matrix Σ, and d is the number of singular values in the diagonal matrix Σ;

[0035] Determine the first r value whose cumulative contribution rate is greater than or equal to the cumulative contribution threshold as the maximum rank value r max .

[0036] The second aspect of the present invention provides a system for assisting in the compilation of power communication management documents based on large model fine-tuning, including:

[0037] An instruction and prompt database for establishing an instruction and prompt database based on historical power communication management file data, where the instruction and prompt database includes supervision instruction data and prompt word templates;

[0038] A model fine-tuning module for selecting a large model and fine-tuning the weight matrix of the large model by updating the decomposition matrix of the incremental parameter matrix using the supervision instruction data and prompt word templates to construct a model fine-tuning module, where the rank value of the decomposition matrix is dynamically adjusted according to the sparsity of the decomposition matrix;

[0039] A user interaction interface for receiving user instructions;

[0040] A text generation module for generating power communication management documents using the fine-tuned large model and returning them to the user through the user interaction interface.

[0041] Optionally, the user interaction interface further includes a user scoring module and a system performance optimization module. The user scoring module receives the immediate evaluation of each result generated by the large model by the user, and the system performance optimization module is used to optimize the large model regularly according to the user's immediate evaluation, large model performance data, and new document data.

[0042] The third aspect of the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the computer program is loaded into the processor, it implements the above-mentioned method for assisting in the compilation of power communication management documents based on large model fine-tuning.

[0043] The fourth aspect of the present invention provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, it implements the above-mentioned method for assisting in the compilation of power communication management documents based on large model fine-tuning.

[0044] Compared with the prior art, the beneficial effects of the present invention at least include:

[0045] 1. The present invention uses the knowledge in the field of power communication and power communication management documents as corpus to enhance the ability of the large model in this field, enabling it to generate communication management documents.

[0046] 2. The present invention combines low-rank adaptation and gradient approximation techniques to update model parameters. By introducing a low-rank matrix, the present invention reduces the number of parameters to be updated, thereby reducing computational and storage costs. Moreover, by dynamically adjusting the rank according to the sparsity of the decomposed matrix, i.e., the low-rank matrix, the rank value can be adaptively matched with the important features of the data, thus improving the performance and fine-tuning efficiency of the model and enabling the automatic generation of power communication management files that meet user requirements.

[0047] 3. The present invention creates a variety of instruction and prompt templates to meet the personalized compilation needs of users. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following-described drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings. Among them:

[0049] Figure 1 It is a schematic flowchart of a method for assisting in the compilation of a power communication management file based on large model fine-tuning provided by an embodiment of the present invention;

[0050] Figure 2 It is a schematic diagram of a prompt template provided by an embodiment of the present invention;

[0051] Figure 3 It is a schematic diagram of the structure of a system for assisting in the compilation of a power communication management file based on large model fine-tuning provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0052] To make the objectives, technical solutions, and advantages of the present invention clearer, the following will clearly and completely describe the technical solutions of the present invention in conjunction with the drawings in the embodiments of the present invention. The described embodiments are only a part of the embodiments of the present invention, not all of them. Based on the spirit of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the protection scope of the present invention.

[0053] As shown in FIG. 1, Embodiment 1 of the present invention provides a method for assisting in the compilation of a power communication management file based on large model fine-tuning, including the following:

[0054] Step 1: Establish an instruction and prompt database based on the historical file data of power communication management; the instruction and prompt database includes supervision instruction data and prompt templates.

[0055] The prompt templates are used to guide the large model to generate power communication management files that meet user requirements.

[0056] Step 1 specifically includes:

[0057] Step 1.1: Collect the text data of power communication management files as the historical file data of power communication management.

[0058] In the embodiments of the present invention, the collected texts cover all power communication management files issued by the company's system from March 2021 to March 2024. This compilation aims to provide comprehensive and systematic guidance and reference for power communication management for various departments and relevant personnel of the company, covering the full life cycle management from planning to implementation, from operation to maintenance.

[0059] The file compilation includes a total of seven categories, specifically including: planning management, construction management, operation management, technical management, equipment management, technical support, and special work. Each category covers a different number of files. The detailed situation of power communication management file categories is shown in the following table:

[0060] Table 1

[0061]

[0062] The categories in Table 1 include the following:

[0063] 1) Planning management: It contains 3 files, mainly involving the overall planning and design of the power communication system. These files provide a framework and guidance for the future development of the power communication system.

[0064] 2) Construction management: It contains 3 files, focusing on the construction management of power communication projects, mainly including the implementation plan for the construction of the power communication network.

[0065] 3) Operation management: It covers 17 files, which detail the management specifications for the daily operation and maintenance, fault handling procedures, operation monitoring, etc. of the power communication system. These files provide detailed operation guidelines for ensuring the stable operation of the system.

[0066] 4) Technical management: It contains 4 files, and the main content involves the communication technology solutions of the power communication system.

[0067] 5) Equipment management: There are 2 files in total, focusing on the management specifications of power communication equipment. These files provide comprehensive guidance for the full life cycle management of the equipment.

[0068] 6) Technical support: It contains 4 files, providing technical application solutions for the power communication system.

[0069] 7) Special work: It covers 4 files, mainly targeting specific power communication special work.

[0070] Step 1.2: Extract and preprocess the text data. Extract the text content from the power communication management file text data, and clean the extracted text content to obtain the text data after data cleaning.

[0071] When processing power communication management file documents, it is first necessary to extract the text content from the file documents. However, the extracted text usually contains many irrelevant noise characters, such as special symbols, format markers, and redundant whitespaces. Therefore, it is necessary to clean the extracted text content. The data cleaning includes the following steps:

[0072] 1) Remove special symbols: Identify and delete unnecessary special characters in the text, such as #, @, $, etc., to ensure the purity of the text content.

[0073] 2) Remove format markers: Format markers such as page numbers, headers, and footers in the document format should be removed to retain the pure text content.

[0074] Through the above cleaning steps, the quality of the extracted text can be greatly improved, laying a solid foundation for subsequent work such as model fine-tuning.

[0075] Step 1.3: Generate supervised instruction data based on the preprocessed power communication management file text data.

[0076] The above preprocessed text data is segmented into multiple parts according to the content such as titles, subtitles, and paragraphs, and corresponding instructions are generated according to the content of each part to obtain supervised instruction data, forming an instruction dataset.

[0077] Among them, the specific format of the supervised instruction data is as follows:

[0078] [{"instruction":"Write a notice on the key points of power communication network planning",

[0079] "input":"Notice on Issuing the Key Points of Power Communication Network Planning (2023 Edition) on March 19, 2023\nNotice from the Development Department of the State Grid and the National Dispatching Center on Issuing the Key Points of Power Communication Network Planning (2023 Edition)\nTo all branches, provincial (autonomous region, municipality) power companies, State Grid Economic Research Institute, China Electric Power Research Institute, State Grid Smart Energy Research Institute, State Grid Information and Communication Industry Group, State Grid Information and Communication Company, State Grid New Energy Group: ……",

[0080] "output":"Planning principles\nThe network planning is moderately advanced. Based on the medium- and long-term development needs of the power grid, conduct demand forecasting and network planning for power communication services. Accelerate the coverage of terminal communication, continuously improve communication bandwidth and reliability, and fully carry various traditional and emerging services of the power grid. ……"},

[0081] ……]

[0082] Specific meanings of the above data formats:

[0083] 1) Instruction: Clearly defines the task and guides the specific operations to be performed by the model or the content to be generated.

[0084] 2) input provides the necessary context or background information, enabling the model to generate relevant outputs based on this information. The existence of input helps improve the accuracy and consistency of the content generated by the model.

[0085] 3) output is the result expected to be generated by the model, which is the content produced after the model executes the instructions and utilizes the input.

[0086] Step 1.4: Construct a prompt template.

[0087] Specifically, the prompt template includes a standard template and a structure template. The standard template is a document generation template, including an input part, which is used to prompt the large model to generate a corresponding document based on the content of the input part. The structure template is a document generation template with a structure part, including an input part and a structure part, which is used to prompt the large model to generate a document that conforms to the document structure set by the structure part based on the content of the input part.

[0088] The construction process of the prompt template is as follows:

[0089] 1) Define the task type and objective:

[0090] Task type: Generation of power communication management file text

[0091] Objective: Generate a detailed and structured document based on the given input content.

[0092] 2) Construct the template structure:

[0093] As shown in Figure 2, in the embodiments of the present invention, the following two templates are constructed, including the standard template default and the structure template with_structure. Among them,

[0094] The standard template default is a basic document generation template that does not specify the structure of the document. The model will generate a comprehensive document based on ({input}). It simply requires the model to write a detailed document based on the given topic and ensure that the document has a good structure and covers all important aspects of the topic.

[0095] The structure template with_structure is a template with structured requirements. It requires generating a document based on the content {{input}} of the theme and the provided outline ({structure}), and ensuring that the document includes parts such as an introduction, main content, and conclusion. Through clear instructions and structure information, it helps the model understand the format and content requirements of the document. The provided outline and theme information ensure the content coherence and logic of the document, while the structure guidance of "introduction, main content, conclusion" helps the model generate a document structure that meets the standards. In this way, the model can generate a document with a good structure and clear content to meet the needs of users.

[0096] Step 1.5: Store the supervised instruction data and the prompt template in the instruction and prompt database.

[0097] Step 2: Select a large model and use the supervised instruction data and the prompt template in Step 1 to fine-tune the weight matrix of the large model by updating the decomposition matrix of the incremental parameter matrix, and construct a model fine-tuning module. Among them, the rank value of the decomposition matrix is dynamically adjusted according to the sparsity of the decomposition matrix.

[0098] When it is necessary to improve the generalization ability of a general large model for a specific task, fine-tuning is a very commonly used method. However, the model parameters of large models pre-trained in the general field are very large, so lightweight fine-tuning has attracted everyone's attention. In this system, the model fine-tuning module is of utmost importance. After the data processing step, the original text data has been converted into standard supervised instruction data plus the prompt template, and then the model can be fine-tuned. The steps are as follows:

[0099] Step 2.1: Model selection. In the present invention, the ChatGLM3-6B model is selected for fine-tuning. The ChatGLM3-6B model is known for its powerful infrastructure and comprehensive functional support, and is suitable for a variety of natural language processing tasks. Compared with other models, ChatGLM3-6B not only has higher performance, but also provides a more complete open-source sequence, enabling developers to flexibly customize and optimize. In addition, the architecture design and the diversity of the training dataset of this model make it perform particularly well in dealing with complex language tasks. Therefore, selecting the ChatGLM3-6B model as the basis of the present invention can better meet the needs of efficient and accurate language processing.

[0100] Step 2.2: Use LoRA (Low-Rank Adaptation) and combine it with gradient approximation technology to fine-tune the ChatGLM3-6B model.

[0101] LoRA is a new model fine-tuning technique that introduces low-rank matrices based on a pre-trained model to achieve efficient and fast model adaptation. While maintaining the performance of the pre-trained model, LoRA significantly reduces the computational resources and storage space required for fine-tuning, enabling high-quality model fine-tuning even with limited resources. At the same time, LoRA also has some deficiencies. This method requires the same eigen-rank to be preset for each incremental matrix, which limits the significant differences in weight matrices between different modules and layers, resulting in unstable effects after fine-tuning large models. The present invention combines LoRA technology with gradient approximation technology to ensure that the update direction of the low-rank matrix is as consistent as possible with that of the full-parameter matrix, thereby improving the adaptability of the model and the training effect. After freezing the weights of the pre-trained model, trainable low-rank decomposition matrices are injected into each layer of the Transformer architecture, thus significantly reducing the number of trainable parameters in downstream tasks.

[0102] Specifically, during the process of fine-tuning the weight matrix of the large model by updating the decomposition matrix of the incremental parameter matrix using supervised instruction data and prompt templates, the weight matrix W of the large model in this round is set to where W0 is the weight matrix of the initial large model or the weight matrix of the large model after the previous iteration update, ΔW is the incremental parameter matrix, and ΔW is decomposed into two decomposition matrices A and B, the rank value r of the decomposition matrix is less than the rank value d of the incremental parameter matrix, and α is the ratio controlling the weight update, representing the proportion of the incremental parameter matrix in the large model parameters.

[0103] Optionally, the rank value of the decomposition matrix is dynamically adjusted according to the sparsity of the decomposition matrix, including:

[0104] Calculate the left singular vector, right singular vector, and singular values of W0 according to the following formula:

[0105] W0 = UΣV T

[0106] where U and V are orthogonal matrices, representing the left singular vector and right singular vector respectively, Σ is a diagonal matrix containing singular values, and the singular values in the diagonal matrix are arranged in descending order,

[0107] Dynamically select the maximum rank value r based on the cumulative contribution rate of the singular values max ;

[0108] Matrix A is initialized with the right singular vector of W0, that is, the first r max rows are extracted from the right singular vector V to obtain the decomposition matrix A;

[0109] Matrix B is initialized with the left singular vectors of W0, that is, the first r max columns are extracted from the left singular vectors U to obtain the decomposition matrix B;

[0110] Calculate the proportion sparsity of the number of zero elements in the decomposition matrices A and B in this round of iteration to the total number of elements respectively A and sparsity B , sparsity A and sparsity B are used to characterize the sparsity of the decomposition matrices A and respectively;

[0111] Select the minimum value of the sparsity of the decomposition matrices A and B as the sparsity sparsity of the incremental parameter matrix T = min(sparsity A , sparsity B ), after every t rounds of iteration, calculate the sparsity sparsity of the incremental parameter matrix updated in this round of iteration for the updated B and A T ' = min(sparsity A ', sparsity B '), when sparsity T ' is greater than sparsity T , adjust the rank value r of the decomposition matrix in the next round of iterative update according to the following formula new until the iterative update stops:

[0112] r new = r max * (1 - a * sparsity T ')

[0113] where a is an adjustment factor that controls the impact of sparsity on the rank value, r new is the adjusted rank value, and takes an integer value within the range of 1 to r max .

[0114] The value range of a is [0.1, 1), and the value range of sparsity T is [0, 1].

[0115] Through sparsity calculation, it is avoided that the overall information is lost due to excessive sparsity of a certain matrix. Adjusting the rank value immediately after each iteration will affect the stability of model training. Therefore, it is set to judge whether the matrix becomes sparser after multiple steps. The larger the sparsity value, the smaller the rank can retain the key information of the original matrix.

[0116] Optionally, calculate the cumulative contribution rate p of the first r singular values according to the following formula:

[0117]

[0118] Among them, the cumulative contribution rate is used to measure the explanatory ability of each singular value in the matrix for the data. σ i is the i-th singular value in the diagonal matrix Σ, and d is the number of singular values in the diagonal matrix Σ; is the total energy of the matrix, represents the contribution rate of the i-th singular value.

[0119] Determine the first r value for which the cumulative contribution rate is greater than or equal to the cumulative contribution threshold as the maximum rank value r max .

[0120] In this way, screening the rank value through the cumulative contribution rate of singular values can make the rank value adaptively match the important features of the data. And it can retain most of the energy of the original matrix, so as to retain the key information of the original matrix to the greatest extent in the low-rank matrix approximation.

[0121] The strategy of dynamically adjusting the rank value avoids the overfitting problem caused by too high a model rank by controlling the complexity of the model.

[0122] Furthermore, among all the numbers of singular values in the range from the cumulative contribution rate threshold to 100%, select the largest number of singular values as the maximum rank value r max .

[0123] The specific process of Step 2.2 is as follows:

[0124] 1. For the pre-trained weight matrix LoRA restricts its update method, that is, the incremental parameter matrix ΔW of full-parameter fine-tuning is expressed as a low-rank approximation of two matrices B and A with smaller numbers of parameters:

[0125] W = W0 + ΔW = W0 + BA

[0126] Among them, W is the weight matrix of the pre-trained large model, W0 is the weight matrix of the initial large model or the weight matrix of the large model after the previous round of iterative update, and its dimension is d×d. This matrix represents the weights in the original large model. B and A are respectively two low-rank matrices introduced in LoRA fine-tuning, and the rank r is much smaller than d

[0127] It can be understood that updating W is equivalent to updating ΔW. In each iteration of training, LoRA calculates the gradient according to the loss function, and these gradients are backpropagated to A and B, and then these two matrices are updated through the gradient descent algorithm. Their values will be continuously adjusted as the training progresses, so their updates will affect ΔW.

[0128] It is understandable that when the model is updated, the gradient is not directly updated for the original weight matrix W0. Instead, the low-rank matrices A and B are optimized to indirectly update the incremental matrix ΔW = BA, and then W0 is optimized. This is approximately reflected in calculating the gradients for A and B instead of directly for W0.

[0129] 2. Given the input Output after adding LoRA

[0130] h = (W0 + ΔW)x = W0x + BAx

[0131] Where W0 is the weight matrix of the initial large model or the weight matrix of the large model after the previous round of iterative update, and ΔW is the incremental parameter matrix, representing the parameter update during fine-tuning.

[0132] 3. During training, in the update of the low-rank adaptation matrices B and A, gradient approximation techniques are used to reduce the complexity of gradient calculation.

[0133] Furthermore, gradient approximation techniques are used to initialize A and B and dynamically adjust the rank value r according to the sparsity of the matrix. The specific steps are as follows:

[0134] (1) Calculate the left singular vectors, right singular vectors, and singular values of W0.

[0135] W0 = UΣV T

[0136] Where, U and V are orthogonal matrices representing the left singular vectors and right singular vectors respectively, and ∑ is a diagonal matrix containing the singular values, arranged in descending order.

[0137] Specifically, the calculation method of the right singular vector V is as follows:

[0138] a. Calculate the matrix W0 T W0.

[0139] b. Calculate the matrix eigenvalues:

[0140] W0 T W0 - λI = 0

[0141] Solve for λ according to the formula, where λ is the matrix eigenvalue and I is the identity matrix.

[0142] c. Calculate the matrix eigenvectors:

[0143] (W0 T W0 - λI)v = 0

[0144] Solve for v according to the above formula, and v is the matrix eigenvector. Combine all the eigenvectors v into a d×d matrix V.

[0145] Specifically, the calculation method of the left singular vector U is as follows:

[0146] a. Calculate the matrix W0W0 T .

[0147] b. Calculate the matrix eigenvalues:

[0148] W0W0 T -λI = 0

[0149] Solve for λ according to the formula, where λ is the eigenvalue of W0W0 T and I is the identity matrix.

[0150] c. Calculate the matrix eigenvectors:

[0151] (W0 T W0 - λI)u = 0

[0152] Solve for u according to the above formula. u is the eigenvector of W0W0 T Merge all the eigenvectors u into a d×d matrix U.

[0153] Specifically, the calculation method of Σ is as follows:

[0154]

[0155] Calculate the diagonal element σ i , and the other elements are all 0. λ i is the eigenvalue when calculating the U matrix above.

[0156] (2) Dynamically select the maximum rank value r based on the cumulative contribution rate of singular values max , set the cumulative contribution rate threshold of singular values to 0.95. When the cumulative contribution rate of the current r singular values reaches 0.95, select the first r singular values. When the p value is relatively large, obtain the maximum rank value r max .

[0157] (3) Initialize the matrix B with the left singular vectors of W0, and extract the first r max columns from U to obtain B.

[0158] (4) Initialize the matrix A with the right singular vectors of W0, and extract the first r T rows from V max to obtain A.

[0159] (5) Calculate the proportion sparsity A of the number of zero elements in B and A to the total number respectively B .

[0160] (6) Selection of sparsity: sparsity T = min(sparsity A , sparsity B ).

[0161] (7) Dynamically adjust the rank. After every t iterations, calculate the sparsity sparsity T ' = min(sparsity A ', sparsity B '). When sparsity T ' is greater than sparsity T , adjust the rank value according to the function:

[0162] r new = r max * (1 - a * sparsity T '),

[0163] where a is the adjustment factor, and the value range of a is [0.1, 1], which controls the influence of sparsity on the rank. r new is the adjusted rank, and round r new downward to ensure its value is an integer between 1 and r max .

[0164] Furthermore, during actual training, ΔW = BA will be multiplied by the weight coefficient and merged with W0. α is a hyperparameter:

[0165]

[0166] where determines the proportion of the LoRA low-rank adaptation weight matrix BA obtained by fine-tuning on the downstream task in the final model parameters.

[0167] For example, given one or more downstream task data for large model fine-tuning, the larger the coefficient , the greater the influence of the fine-tuning weight, and the easier it is to overfit on the downstream task. The smaller the coefficient , the smaller the influence of the fine-tuning weight, the less obvious the fine-tuning effect, and the less the influence on the original model parameters.

[0168] Specifically, in this system, adjust the following key parameters. Refer to the parameter value list in Table 2 during the model fine-tuning process. The adjustment of these parameters helps to optimize the performance of the model and also control the use of computing resources.

[0169] Table 2

[0170]

[0171] Step 2.3: After fine-tuning is completed, compare the inference capabilities of the original model and the fine-tuned model.

[0172] Specifically, first, select a representative set of input texts and conduct inference tests on these two models. Record the output results of the models and compare their performance in terms of accuracy, consistency, and diversity. Pay particular attention to whether the fine-tuned model can generate more expected outputs.

[0173] Step 2.4: After the inference test, use the fine-tuned model to make predictions on the validation set and evaluate according to the BLEU score.

[0174] The purpose of the evaluation is to measure the generalization ability and performance improvement of the model. By comparing the performance of the original model and the fine-tuned model on these metrics, determine whether the fine-tuning has significantly improved the model's performance. In addition, qualitative analysis is also carried out to check the naturalness and relevance of the generated text through manual review, so as to comprehensively evaluate the advantages and disadvantages of the model.

[0175] Step 2.5: Select the fine-tuned model with the best performance and merge it with the original model to form a complete large language model (LLM).

[0176] This merging method can enable the model to have excellent performance on specific tasks while maintaining the ability for wide application. The merged model needs to be fully tested to verify its adaptability and performance on the tasks, and finally provide reliable and high-quality text generation services for users.

[0177] Step 3: Use the large model fine-tuned by the model fine-tuning module to receive the instructions input by the user and generate and output a power communication management file.

[0178] In order to efficiently assist users in writing power communication management files, integrate the text input by the user and the prompt word template and input them into the model together. The steps are as follows:

[0179] (1) Combine the text input by the user with the prompt template and format these texts using the preset prompt template.

[0180] 1) Receive user input and task instructions

[0181] User input: The system first receives the input text from the user

[0182] Task instructions: The task instructions provided by the user can be about text generation, question answering, etc.

[0183] 2) Select a suitable preset prompt word template

[0184] Template Library: The system includes a preset prompt template library of various types, such as: document generation templates, text classification templates, summary generation templates, etc. Each template has a different structure and function. In the present invention, the document generation template created in the above step 1.4 is used. The two templates provided in the present invention are newly added templates according to requirements, and the large model itself sets multiple templates for matching.

[0185] Template Matching: The system selects the most suitable template by comparing the user's input and task instructions. For example, if the user enters a topic and requests to generate a detailed document, the system will select a document generation template. If the user may request to generate a document containing an introduction, body, and conclusion. The system automatically fills in the corresponding structural information (such as introduction, body content, conclusion, etc.) in the template by parsing the task instructions.

[0186] Dynamic Content Filling: Placeholders in the template (such as {{input}}, {structure}, etc.) are dynamically filled according to the text entered by the user and task requirements. For example, if the user provides a specific topic, {{input}} in the template will be replaced with that topic; if the user requests a specific structure, the outline information will be filled into the {structure} section.

[0187] 3) Generate Instructions and Format the Output

[0188] Generate Instructions: The system generates specific instructions based on the selected prompt template, combined with the user's input and task requirements. These instructions will guide the large language model to generate output content that meets the requirements. These instructions will accurately convey the user's requirements and provide sufficient context information. These instructions will be provided as input to the large language model.

[0189] (2) Model Processing and Output: Input the generated instructions into the large language model, and the large model will generate corresponding text according to the instruction content.

[0190] (3) Result Integration and Verification: Integrate the results output by the large model, and perform necessary verification and adjustment according to actual requirements to ensure that the generated text meets the user's requirements and standards.

[0191] Through the above steps, we can ensure that the user's requirements are efficiently transformed into appropriate power communication management documents, improving the writing efficiency and ensuring the accuracy and standardization of the content.

[0192] Combined Figure 3 As shown in the figure, Embodiment 2 of the present invention provides a power communication management document assistance compilation system based on large model fine-tuning, which executes the method provided in Embodiment 1. The system includes:

[0193] Instruction and Prompt Database, which is used to establish an instruction and prompt database based on the historical file data of power communication management. The instruction and prompt database includes supervision instruction data and prompt word templates;

[0194] Model Fine-tuning Module, which is used to select a large model and fine-tune the weight matrix of the large model by updating the decomposition matrix of the incremental parameter matrix using the supervision instruction data and prompt word templates, and construct a model fine-tuning module. Among them, the rank value of the decomposition matrix is dynamically adjusted according to the sparsity of the decomposition matrix;

[0195] User Interaction Interface, which is used to receive user instructions;

[0196] Text Generation Module, which is used to generate power communication management files using the fine-tuned large model and return them to the user through the user interaction interface.

[0197] Optionally, the user interaction interface further includes a user scoring module and a system performance optimization module. The user scoring module receives the immediate evaluation of the user for each result generated by the large model, and the system performance optimization module is used to optimize the large model regularly according to the user's immediate evaluation, large model performance data, and new document data.

[0198] The efficient operation of the user interaction interface can ensure the continuous improvement and adaptability of the model, meeting the growing needs of users.

[0199] The large model performance data includes the operating efficiency of the control model, including response time, resource consumption, and concurrent processing ability, ensuring stable service quality even under high load.

[0200] The system performance optimization module is used to optimize the large model regularly according to the user's immediate evaluation, large model performance data, and new document data. It can improve the generalization ability of the model and the accuracy of the generated text.

[0201] Embodiment 3 of the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the computer program is loaded into the processor, it implements the method for assisting in the compilation of power communication management files based on large model fine-tuning described in Embodiment 1.

[0202] Embodiment 4 of the present invention provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the method for assisting in the compilation of power communication management files based on large model fine-tuning described in Embodiment 1.

[0203] Compared with the prior art, the beneficial effects of the present invention at least include:

[0204] 1. The present invention enhances the capabilities of the large model in this field by using the knowledge in the field of power communication and power communication management documents as corpus, enabling it to generate communication management documents.

[0205] 2. The present invention combines low-rank adaptation and gradient approximation techniques to update model parameters. By introducing a low-rank matrix, the number of parameters to be updated is reduced, thus reducing the computational and storage costs. Moreover, by dynamically adjusting the rank according to the sparsity of the decomposed matrix, i.e., the low-rank matrix, the rank value can be adaptively matched with the important features of the data, thereby improving the performance and fine-tuning efficiency of the model and enabling the automatic generation of power communication management documents that meet user requirements.

[0206] 3. The present invention creates a variety of instruction and prompt templates to meet the personalized compilation needs of users.

[0207] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.

[0208] The present disclosure may be a system, a method, and / or a computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions thereon for causing a processor to implement various aspects of the present disclosure.

[0209] The computer-readable storage medium may be a tangible device that can retain and store instructions for use by an instruction execution device. The computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (non-exhaustive list) of the computer-readable storage medium include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disc (DVD), a memory stick, a floppy disk, a mechanically encoded device such as a punched card or raised structures in a groove having instructions stored thereon, and any suitable combination of the foregoing. The computer-readable storage medium used herein is not construed as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagated through a waveguide or other transmission medium (e.g., an optical pulse through an optical fiber cable), or an electrical signal transmitted through a wire.

[0210] The computer-readable program instructions described herein can be downloaded to various computing / processing devices from a computer-readable storage medium or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network may include copper transmission cables, optical fiber transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing / processing device.

[0211] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state-setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider). In some embodiments, by using the state information of the computer-readable program instructions to customize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), the electronic circuit can execute the computer-readable program instructions to implement various aspects of the present disclosure.

[0212] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: still modifications or equivalent replacements can be made to the specific embodiments of the present invention, and any modifications or equivalent replacements without departing from the spirit and scope of the present invention shall be covered by the protection scope of the claims of the present invention.

Claims

1. A method for assisting in the compilation of power communication management documents based on large model fine-tuning, characterized in that: include: Establishing an instruction and prompt database based on the power communication management history file data, wherein the instruction and prompt database includes supervision instruction data and prompt word templates, wherein the prompt word templates are used to guide the large model to generate a power communication management file that meets user requirements; Selecting a large model and fine-tuning the weight matrix of the large model by updating the decomposition matrix of the incremental parameter matrix using the supervision instruction data and the prompt word template, and constructing a model fine-tuning module, wherein the rank value of the decomposition matrix is ​​dynamically adjusted according to the sparsity of the decomposition matrix; The large model fine-tuned by the model fine-tuning module is used to receive instructions input by the user, and generate and output power communication management files.

2. The method for assisting in compiling power communication management documents based on large model fine-tuning according to claim 1 is characterized in that: Establish a command and prompt database based on power communication management historical file data, including: Collecting power communication management file text data as power communication management history file data, wherein the power communication management file text data includes at least one of the following categories: planning management, construction management, operation management, technical management, equipment management, technical support and special work; Extracting text content from the text data of the power communication management file, and performing data cleaning on the extracted text content to obtain text data after data cleaning; Generate supervision instruction data based on the text data after data cleaning; Construct a prompt word template; The supervisory instruction data and the prompt word template are stored in the instruction and prompt database.

3. The method for assisting in compiling power communication management documents based on large model fine-tuning according to claim 1 is characterized in that: The prompt word template includes a standard template and a structure template. The standard template is a document generation template, including an input part, which is used to prompt the large model to generate a corresponding document based on the content of the input part. The structure template is a document generation template with a structure part, including an input part and a structure part, which is used to prompt the large model to generate a document that conforms to the document structure set by the structure part based on the content of the input part.

4. The method for assisting in compiling power communication management documents based on large model fine-tuning according to claim 1 is characterized in that: In the process of fine-tuning the weight matrix of the large model by updating the decomposition matrix of the incremental parameter matrix using the supervision instruction data and the prompt word template, the weight matrix W of the large model in this round is set to Among them, W0 is the weight matrix of the initial large model or the weight matrix of the large model after the previous round of iterative update, ΔW is the incremental parameter matrix, which is decomposed into two decomposition matrices A and B. The rank value r of the decomposition matrix is ​​less than the rank value d of the incremental parameter matrix, α is the proportion of the control weight update, Characterizes the ratio of the incremental parameter matrix to the large model parameters.

5. The method for assisting in compiling power communication management documents based on large model fine-tuning according to claim 4 is characterized in that: The rank value of the decomposition matrix is ​​dynamically adjusted according to the sparsity of the decomposition matrix, including: The left singular vector, right singular vector and singular value of W0 are calculated as follows: W0=UΣV T Among them, U and V are orthogonal matrices, representing the left singular vector and the right singular vector respectively. Σ is a diagonal matrix containing singular values, and the singular values ​​in the diagonal matrix are arranged in descending order, Dynamically select the maximum rank value r based on the cumulative contribution rate of singular values max ; The matrix A is initialized by the right singular vectors of W0, that is, the first r are extracted from the right singular vectors V max Rows, get the decomposition matrix A; The matrix B is initialized by the left singular vector of W0, that is, the first r are extracted from the left singular vector U max Column, get the decomposition matrix B; Calculate the ratio of the number of zero elements to the total number of elements in the decomposition matrices A and B in this round of iteration respectively. A and sparsity B , sparsity A and sparsity B They are used to characterize the sparsity of decomposition matrices A and B respectively; Select the minimum value of the sparsity of the decomposition matrices A and B as the sparsity of the incremental parameter matrix T =min(sparsity A ,sparsity B ), after each t rounds of iteration, the sparsity of the incremental parameter matrix updated in this round of iteration is calculated for the updated B and A T ′ =min(sparsity A ′ ,sparsity B ′ ), when sparsity T ′ Greater than sparsity T When , the rank value r of the decomposition matrix in the next round of iterative update is adjusted according to the following formula new Until the iterative update stops: r new =r max *(1-a*sparsity T ′ ) Among them, a is the adjustment factor, which controls the impact of sparsity on the rank value, r new is the adjusted rank value, ranging from 1 to r max An integer in the range.

6. The method for assisting in compiling power communication management documents based on large model fine-tuning according to claim 5 is characterized in that: Dynamically select the maximum rank value r based on the cumulative contribution rate of singular values max ,include: The cumulative contribution rate p of the first r singular values ​​is calculated according to the following formula: Among them, σ i is the i-th singular value in the diagonal matrix Σ, and d is the number of singular values ​​in the diagonal matrix Σ; Determine the first r value whose cumulative contribution rate is greater than or equal to the cumulative contribution threshold and the maximum rank value r max .

7. A system for assisting the compilation of power communication management files based on large model fine-tuning using the method for assisting the compilation of power communication management files based on large model fine-tuning according to any one of claims 1 to 6, characterized in that: include: An instruction and prompt database, used to establish an instruction and prompt database based on the power communication management history file data, wherein the instruction and prompt database includes supervision instruction data and prompt word templates; A model fine-tuning module is used to select a large model and use the supervision instruction data and the prompt word template to fine-tune the weight matrix of the large model by updating the decomposition matrix of the incremental parameter matrix, thereby constructing a model fine-tuning module, wherein the rank value of the decomposition matrix is ​​dynamically adjusted according to the sparsity of the decomposition matrix; A user interaction interface, used to receive user instructions; The text generation module is used to generate power communication management files using the fine-tuned large model and return them to the user through the user interaction interface.

8. The power communication management document assisting compilation system based on large model fine-tuning according to claim 7 is characterized by: The user interaction interface also includes a user scoring module and a system performance optimization module, so that the user scoring module receives the user's instant evaluation of each result generated by the big model, and the system performance optimization module is used to regularly optimize the big model based on the user's instant evaluation, big model performance data and newly added document data.

9. An electronic device, comprising a processor and a storage medium; characterized in that: The storage medium is used to store instructions; The processor is configured to operate according to the instructions to execute the steps of the method according to any one of claims 1-6.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Enterprise management large model fine tuning method, device and equipment and storage medium

    CN118428490A

Cited By

  • Intelligent supervision water supply control method and device

    CN120779728A