A method for generating depreciation and amortization tables based on supervised fine-tuning and large models
By fine-tuning and training the large model through supervision, the problems of information extraction errors and insufficient structuring in the generation of depreciation and amortization tables were solved, and the automatic and accurate generation of depreciation and amortization tables was achieved.
Patent Information
- Application Number
- CN202511006788.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-22
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2045-07-22
AI Technical Summary
The existing technology has a low degree of automation when compiling depreciation and amortization tables, and there are problems such as information extraction errors, hallucinations, lack of structured output specifications and insufficient domain adaptability, resulting in a large workload for manual verification.
By fine-tuning the large model through supervision, using the training data set and mask operation, a trained large model is generated to automatically extract the target parameters, and the depreciation and amortization table is automatically generated by combining the straight-line method, the sum-of-the-years'-digits method and the double-declining balance method for calculation.
It improves the accuracy and standardization of information extraction, reduces the workload of manual verification, and realizes the automatic generation of depreciation and amortization tables.
Smart Images

Figure CN120509389B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of table generation, and in particular to a method for compiling a depreciation and amortization table based on supervised fine-tuning and a large model. Background Art
[0002] In the field of engineering economics, the current method for generating depreciation and amortization tables has a low degree of automation and requires manual extraction of input information from Party A documents. In the process of financial intelligent transformation, the automated generation of depreciation and amortization tables has long faced the bottleneck of unstructured data processing. Using a large language model can automatically extract input information from Party A documents, but directly using the interface provided on the Internet to extract information has the following problems: (1) The word length limit problem. The input word length of the large model is limited, and excessive information length will reduce the accuracy of the large model's answer. (2) The large model hallucination problem. The large model may answer professional questions with false information or extract incorrect information. When parsing asset contracts and policy documents, general large models are prone to factual hallucinations (such as fictitious residual value rates, confusing depreciation methods), or omit key terms (such as special tax exemption regulations). The generated results need to be manually verified repeatedly, which increases the workload. For example, the "double-declining balance method" is mistakenly identified as the "straight-line method", resulting in a logical error in the calculation of the entire table. (3) Output lacks structured specifications: The original large model output is mostly free text, requiring engineers to clean and translate it into standardized parameters (e.g., converting "five-year depreciation period" to the number "5"), making it difficult to directly connect to the report generation system. (4) Insufficient domain adaptability: Financial rules are highly specialized and dynamic (e.g., the new leasing standard ASC842), and the general model has not been fine-tuned for depreciation and amortization scenarios, resulting in deviations in the understanding of policy terminology and calculation logic. Summary of the Invention
[0003] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a method for compiling a depreciation and amortization table based on supervised fine-tuning and a large model.
[0004] The object of the present invention is achieved through the following technical solution: a method for compiling a depreciation and amortization table based on supervised fine-tuning and a large model, comprising the following steps:
[0005] S1: To extract construction cost information from historical engineering documents, we fine-tune the large model through supervised training.
[0006] S2: Automatically extract target parameters from input documents using a trained large model;
[0007] S3: Automatically calculate all parameters to be calculated using formulas in sequence according to the target parameters;
[0008] S4: Automatically generate a depreciation and amortization table based on all calculation results.
[0009] Preferably, the S1 further comprises the following steps:
[0010] S11: Construct a training data set based on historical engineering documents. The training data is a json file containing document information and the location information of the answer in the document.
[0011] S12: Construct a dataloader program and read the json file into memory through the dataloader program;
[0012] S13: Each time training data is generated, a 512-word interval is randomly selected and cut, and the answer content is automatically generated based on whether the interval contains the answer;
[0013] S14: Randomly reset the characters in the answer to different values;
[0014] S15: Based on the random answers, the training data is automatically regenerated into formatted training data and its weights are read using the large model;
[0015] S16: Mask the location information of the answer in the document so that the large model can only see the document information during training, thereby predicting the location information;
[0016] S17: Calculate the loss function using the cross entropy loss function;
[0017] S18: Using the loss function, calculate the gradient using the torch library, update the parameters using the adamw optimizer, and set the weight decay and learning rate;
[0018] S19: Repeat S15-S18 to train the large model and print the accuracy in real time. If the answers are correct for the preset number of training rounds, the trained large model is obtained.
[0019] Preferably, the S2 further comprises the following steps:
[0020] S21: Use Python's docx library to read the input document into memory according to its location;
[0021] S22: Cutting the document in the memory into first document blocks in an overlapping manner with a preset length and a preset step size;
[0022] S23: Use the torch library to read the trained large model;
[0023] S24: Generate a word segmenter using the transformer model;
[0024] S25: The input document is restructured into the structure of training data. The trained large model automatically generates and completes all answers to obtain the second document block.
[0025] S26: Use the word segmenter to map the second document block into word numbers;
[0026] S27: Input the word sequence numbers into the large model in order, and generate a text sequence based on the maximum probability mechanism;
[0027] S28: Use the word segmenter to reverse the text sequence and convert the word sequence number into a standardized JSON text sequence.
[0028] Preferably, the step S3 further comprises the following steps:
[0029] S31: Use the json library to convert the json text sequence into standard json data, and use the straight-line method, sum-of-the-years'-digits method, and double-declining balance method for calculations;
[0030] S32: Calculate the current amortization expense of intangible assets and other assets using the straight-line method; and calculate the current depreciation expense of fixed assets using different calculation methods;
[0031] S33: Calculate the annual net value of fixed assets, the annual net value of intangible assets and the annual net value of other assets respectively based on the current depreciation of fixed assets obtained by different calculation methods; the annual net value of fixed assets is obtained by deducting the current depreciation of fixed assets from the original value of fixed assets.
[0032] Preferably, the S4 further comprises the following steps:
[0033] S41: Use openpyxl library to read the default Excel table;
[0034] S42: Modify the default Excel spreadsheet based on the project name and amount extracted from the standard JSON data;
[0035] S43: Based on the operation period extracted from the standard JSON data, a for loop is used to fill in the default Excel table, filling only one column at a time, and then filling in the next column of information based on the previous column of information, and the loop stops when the operation period ends;
[0036] S44: Fill in the calculated total amount in the Operation Period + 1 column;
[0037] S45: Process the table title, merge 0 into the operation period + 1 column, center the title, and store the modified depreciation and amortization table.
[0038] Preferably, the preset length is 256, the preset step size is 128, and the large model is Qwen-7B-Chat-Int4.
[0039] The beneficial effects of the present invention are:
[0040] 1) This invention leverages the large model's ability to understand text, combined with a programming language capable of generating Excel, to reduce the problem of large models extracting illusory and erroneous information from input documents. The trained large model extracts all target information in a template-like manner and outputs it in a standardized format, facilitating subsequent work for engineers and reducing the workload for those compiling depreciation and amortization tables. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 Generate a flow chart of the methodology for preparing depreciation and amortization tables based on supervised fine-tuning and large models. DETAILED DESCRIPTION
[0042] The following will clearly and completely describe the technical solutions of the present invention in conjunction with the embodiments. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work shall fall within the scope of protection of the present invention.
[0043] First, some definitions of terms in this invention:
[0044] Dataloader program: a data reading program;
[0045] json: a data format;
[0046] Mask operation: Mainly used to block or select specific information during data processing and model training. The mask operation overlays a mask on the data to indicate which parts of the data should be ignored or retained.
[0047] Python: a programming language;
[0048] docx library: the name of the programming language library;
[0049] torch library: the name of the deep learning programming language library;
[0050] Transformer model: a model based on natural language processing programming languages;
[0051] Tokenizer: a word segmenter used to convert text into numerical sequences;
[0052] openpyxl library: A Python library for processing Excel files.
[0053] See Figure 1The present invention provides a technical solution: a method for compiling a depreciation and amortization table based on supervised fine-tuning and a large model, comprising the following steps:
[0054] S1: To extract construction cost information from historical engineering documents, we fine-tune the large model through supervised training.
[0055] S2: Automatically extract target parameters from input documents using a trained large model;
[0056] S3: Automatically calculate all parameters to be calculated using formulas in sequence according to the target parameters;
[0057] S4: Automatically generate a depreciation and amortization table based on all calculation results.
[0058] In this embodiment, the large model is fine-tuned in a supervised manner based on the feature extraction of information in the field of engineering cost. The fine-tuned large model not only eliminates the problems of hallucinations and erroneous information, but also extracts all target information in a template-like manner and outputs it in a standardized form.
[0059] In some embodiments, the S1 further comprises the following steps:
[0060] S11: Construct a training data set based on historical engineering documents. The training data is a json file containing document information and the location information of the answer in the document.
[0061] S12: Construct a dataloader program and read the json file into memory through the dataloader program;
[0062] S13: Each time training data is generated, a 512-word interval is randomly selected and cut, and the answer content is automatically generated based on whether the interval contains the answer;
[0063] S14: Randomly reset the characters in the answer to different values;
[0064] S15: Based on the random answers, the training data is automatically regenerated into formatted training data and its weights are read using the large model;
[0065] S16: Mask the location information of the answer in the document so that the large model can only see the document information during training, thereby predicting the location information;
[0066] S17: Calculate the loss function using the cross entropy loss function;
[0067] S18: Using the loss function, calculate the gradient using the torch library, update the parameters using the adamw optimizer, and set the weight decay and learning rate;
[0068] S19: Repeat S15-S18 to train the large model and print the accuracy in real time. If the answers are correct for the preset number of training rounds, the trained large model is obtained.
[0069] In this embodiment, the json file format in S11 is {"content":"Party A's document information","answer1":"104-106","answer2":"441-444","answer3":""}. Among them, concent is the document information; answer is the position information of the answer in the document, indicating which word it is. If it is not given in the document, the value of answer is empty. In S13, since the word length of the input document exceeds the limit, each time training data is generated, a 512-word interval is randomly selected and cut, and the document is marked to record the location information of the answer. Therefore, the answer content can be automatically generated based on whether the answer is contained in this interval. S14 is to enhance robustness. The format of the formatted training data in S15 is:
[0070] content:xxxxxxx,answer1=xx,answer2=xx,...,answerk=xx.
[0071] In some embodiments, the S2 further comprises the following steps:
[0072] S21: Use Python's docx library to read the input document into memory according to its location;
[0073] S22: Cutting the document in the memory into first document blocks in an overlapping manner with a preset length and a preset step size;
[0074] S23: Use the torch library to read the trained large model;
[0075] S24: Generate a word segmenter using the transformer model;
[0076] S25: The input document is restructured into the structure of training data. The trained large model automatically generates and completes all answers to obtain the second document block.
[0077] S26: Use the word segmenter to map the second document block into word numbers;
[0078] S27: Input the word sequence numbers into the large model in order, and generate a text sequence based on the maximum probability mechanism;
[0079] S28: Use the word segmenter to reverse the text sequence and convert the word sequence number into a standardized JSON text sequence.
[0080] In this embodiment, because the large model has a maximum input length problem, S22 uses overlapping cutting to avoid splitting important information into two. The structure of the input document constructed in S25 is: "content:xxxxxxx,answer1"
[0081] In some embodiments, the S3 further comprises the following steps:
[0082] S31: Use the json library to convert the json text sequence into standard json data, and use the straight-line method, sum-of-the-years'-digits method, and double-declining balance method for calculations;
[0083] S32: Calculate the current amortization expense of intangible assets and other assets using the straight-line method; and calculate the current depreciation expense of fixed assets using different calculation methods;
[0084] S33: Calculate the annual net value of fixed assets, the annual net value of intangible assets and the annual net value of other assets respectively based on the current depreciation of fixed assets obtained by different calculation methods; the annual net value of fixed assets is obtained by deducting the current depreciation of fixed assets from the original value of fixed assets.
[0085] In this embodiment, the calculation formulas for various calculation methods are as follows: (1) Straight-line method: Annual depreciation amount = original value of fixed assets * (1-residual value rate) / depreciation period. (2) Sum-of-the-years'-digits method: Annual depreciation amount = original value of fixed assets * (1-residual value rate) * number of remaining useful years / sum of years. (3) Double-declining balance method: ① Annual depreciation rate = 2 ÷ estimated useful life (years) × 100%; ② Annual depreciation amount = net book value of fixed assets at the beginning of each depreciation year × annual depreciation rate = (original cost of fixed assets - accumulated depreciation) × annual depreciation rate; ③ Depreciation amount for each of the last two years = (original cost of fixed assets - estimated net residual value - accumulated depreciation in previous years) ÷ 2 (Note: The depreciation expense for the last two years is the second to last year).
[0086] In some embodiments, the S4 further comprises the following steps:
[0087] S41: Use openpyxl library to read the default Excel table;
[0088] S42: Modify the default Excel spreadsheet based on the project name and amount extracted from the standard JSON data;
[0089] S43: Based on the operation period extracted from the standard JSON data, a for loop is used to fill in the default Excel table, filling only one column at a time, and then filling in the next column of information based on the previous column of information, and the loop stops when the operation period ends;
[0090] S44: Fill in the calculated total amount in the Operation Period + 1 column;
[0091] S45: Process the table title, merge 0 into the operation period + 1 column, center the title, and store the modified depreciation and amortization table.
[0092] In some embodiments, the preset length is 256, the preset step size is 128, and the large model is Qwen-7B-Chat-Int4.
[0093] The foregoing description is merely a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the form disclosed herein and should not be construed as excluding other embodiments. Rather, the present invention can be used in various other combinations, modifications, and environments and can be modified within the scope of the concept described herein through the above teachings or techniques or knowledge in the relevant field. Modifications and variations made by those skilled in the art that do not depart from the spirit and scope of the present invention are intended to be protected by the appended claims.
Claims
1. A method for compiling a depreciation and amortization table based on supervised fine-tuning and a large model, characterized by: The following steps are involved: S1: To extract construction cost information from historical engineering documents, we fine-tune the large model through supervised training. S2: Automatically extract target parameters from input documents using a trained large model; S3: Automatically calculate all parameters to be calculated using formulas in sequence according to the target parameters; S4: Automatically generate and prepare a depreciation and amortization table based on all calculation results; The S1 further comprises the following steps: S11: Construct a training data set based on historical engineering documents. The training data is a json file containing document information and the location information of the answer in the document. S12: Construct a dataloader program and read the json file into memory through the dataloader program; S13: Each time training data is generated, a 512-word interval is randomly selected and cut, and the answer content is automatically generated based on whether the interval contains the answer; S14: Randomly reset the characters in the answer to different values; S15: Based on the random answers, the training data is automatically regenerated into formatted training data and its weights are read using the large model; S16: Mask the location information of the answer in the document so that the large model can only see the document information during training, thereby predicting the location information; S17: Calculate the loss function using the cross entropy loss function; S18: Using the loss function, calculate the gradient using the torch library, update the parameters using the adamw optimizer, and set the weight decay and learning rate; S19: Repeat S15-S18 to train the large model and print the accuracy in real time. If the answer is correct for the preset number of training rounds, the trained large model is obtained; The S2 further comprises the following steps: S21: Use Python's docx library to read the input document into memory according to its location; S22: Cutting the document in the memory into first document blocks in an overlapping manner with a preset length and a preset step size; S23: Use the torch library to read the trained large model; S24: Generate a word segmenter using the transformer model; S25: The input document is restructured into the structure of training data. The trained large model automatically generates and completes all answers to obtain the second document block. S26: Use the word segmenter to map the second document block into word numbers; S27: Input the word sequence numbers into the large model in order, and generate a text sequence based on the maximum probability mechanism; S28: Use the word segmenter to reverse the text sequence and convert the word sequence into a standardized JSON text sequence; The S3 further comprises the following steps: S31: Use the json library to convert the json text sequence into standard json data, and use the straight-line method, sum-of-the-years'-digits method, and double-declining balance method for calculations; S32: Calculate the current amortization expense of intangible assets and other assets using the straight-line method; and calculate the current depreciation expense of fixed assets using different calculation methods; S33: Calculate the annual net value of fixed assets, the annual net value of intangible assets and the annual net value of other assets respectively based on the current depreciation of fixed assets obtained by different calculation methods; the annual net value of fixed assets is obtained by deducting the current depreciation of fixed assets from the original value of fixed assets.
2. The method for compiling a depreciation and amortization table based on supervised fine-tuning and a large model according to claim 1 is characterized in that: The S4 further comprises the following steps: S41: Use openpyxl library to read the default Excel table; S42: Modify the default Excel spreadsheet based on the project name and amount extracted from the standard JSON data; S43: Based on the operation period extracted from the standard JSON data, a for loop is used to fill in the default Excel table, filling only one column at a time, and then filling in the next column of information based on the previous column of information, and the loop stops when the operation period ends; S44: Fill in the calculated total amount in the Operation Period + 1 column; S45: Process the table title, merge 0 into the operation period + 1 column, center the title, and store the modified depreciation and amortization table.
3. The method for compiling a depreciation and amortization table based on supervised fine-tuning and a large model according to claim 1 is characterized in that: The preset length is 256, the preset step size is 128, and the large model is Qwen-7B-Chat-Int4.