Automatic accounting entry compiling method and system based on large language model

By pre-training and fine-tuning the large language model, combined with intermediate state entries processing and decoder, the problem of time-consuming and low accuracy in accounting entries is solved, and higher compilation accuracy and numerical accuracy are achieved.

CN120013696APending Publication Date: 2025-05-16ZHEJIANG UNIV
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510487282.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-18
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

The prior art has problems such as time-consuming and labor-consuming and error-prone in the compilation of accounting entries, and the existing automatic generation methods are not very accurate when dealing with complex accounting matters.

Method used

The automatic accounting entries preparation method based on the large language model is adopted. By performing secondary pre-training and fine-tuning of the general large language model, combined with intermediate state entries processing and intermediate state entries decoder, the accuracy of accounting entries is improved.

Benefits of technology

It significantly improves the accuracy of accounting entries and the accuracy of numerical calculations, and reduces the time and error rate of manual compilation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120013696A_ABST
    Figure CN120013696A_ABST
Patent Text Reader

Abstract

The invention discloses an accounting entry automatic compilation method and system based on a large language model, and the method comprises the steps: introducing an intermediate-state entry based on the logic relation between accounting items and accounting entries and a numerical calculation method, obtaining the corresponding intermediate-state entry for the accounting items, and storing the intermediate-state entry in a database; constructing a ''accounting item-intermediate state entry-accounting entry'' triple data set; the accounting items and the intermediate state entry are used as question and answer pairs, the question and answer pairs are used for pre-training and fine tuning of a general large language model, a financial and accounting large model is obtained through training, intermediate state entry data output by the financial and accounting large model is input into an intermediate state entry decoder for decoding, and a corresponding accounting entry is output. According to the method, the logical relationship between the accounting items and the accounting entry and a numerical calculation method are fully utilized, so that the system can better understand and process the accounting entry compilation task, and the accuracy of accounting entry logic is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of financial data processing, and relates to a method and system for automatically compiling accounting entries based on a large language model. Background Art

[0002] Accounting entries, also known as "bookkeeping formulas", are records that list the corresponding accounting subjects and their amounts for each accounting event (also known as "economic transactions") according to the principle of double-entry bookkeeping. Accounting entries can clearly reflect the amount of each accounting subject under a certain accounting event, and are an important part of the process of filling out accounting vouchers. From the perspective of the accounting entry preparation workflow, accounting entry preparation is a process that takes a natural language text describing the content of an accounting event as input, and converts the input into a text with a high degree of formatting, a strict correspondence with the input, and a definite standard answer based on the corresponding accounting standards and knowledge. Table 1 gives a specific example of an accounting entry preparation task.

[0003] Table 1 An example of input and output content of an accounting entry preparation task

[0004] At present, the accounting entries of enterprises are usually prepared by accountants manually preparing accounting entries for accounting events based on existing accounting knowledge. This method is not only time-consuming and labor-intensive, but also prone to errors. Some methods have explored the method of automatically generating accounting entries through simple classifiers and other artificial intelligence models. However, since accounting entries involve more complex calculations, logical judgments, etc., the accuracy of such methods is not satisfactory when dealing with complex accounting events.

[0005] Based on this, the present invention utilizes the existing large language model and combines it with an original data format "intermediate entry" for processing, and proposes a method for automatically compiling accounting entries that can greatly improve the accuracy. Summary of the invention

[0006] The purpose of the present invention is to provide a method and system for automatically compiling accounting entries based on a large language model in view of the deficiencies of the prior art. Although a large language model with strong natural language understanding and generation capabilities can be used in the prior art to implement the accounting entry compilation task, the existing general large model is directly used for the accounting entry compilation task, and its training process is only to add accounting matters and accounting entries directly as context or question-answer pairs to the training data of the large model, which cannot enable the large model to better learn the logic and calculation details in the entry compilation process. Therefore, in the process of compiling accounting entries, various problems such as entry logic recognition errors and numerical calculation errors will also occur. The present invention performs secondary pre-training and fine-tuning on the existing general large language model and combines the introduction of intermediate entry processing, and combines the intermediate entry decoder at the same time, so that it can be better used for accounting entry compilation tasks and greatly improve the accuracy of accounting entries.

[0007] In order to solve the above technical problems, the present invention provides the following technical solutions: A method for automatically compiling accounting entries based on a large language model, comprising: 1) Collect accounting data sets and organize their corresponding accounting entry texts as the standard input and final output of the accounting entry preparation task; 2) Based on the logical relationship and numerical calculation method between accounting events and accounting entries, intermediate entries are introduced, and the corresponding intermediate entries are obtained for the accounting events in the accounting event data set, and a triple data set of "accounting event-intermediate entry-accounting entry" is constructed; 3) For the triple data set, the accounting items and intermediate entries therein are used as question-answer pairs, which are used for pre-training and fine-tuning of the general large language model to train a large accounting model, which can receive input accounting items and output corresponding intermediate entries under guidance; 4) Input the intermediate entry data output by the financial accounting model into the intermediate entry decoder for decoding, and output the corresponding accounting entry.

[0008] In the above technical solution, further, the intermediate entry is composed of an identifier and substantive content, wherein the identifier is in the form of an English phrase enclosed by angle brackets, with a total of <para> 、 <name> 、 <pos> 、 <num> 、 <spe>and <endpara>There are six types, which correspond to paragraph, account name, position, value, special item and end respectively. They are used to mark the nature and meaning of the content that appears after the identifier in the intermediate entry. The substantive content is a single word, phrase, short sentence or functional formula, which is used to express the substantive meaning related to the specific accounting entry in the intermediate entry.

[0009] Furthermore, the intermediate entry is composed of a specific three-level structure, which is: (1) Primary structure: intermediate entries An intermediate entry contains all the necessary information to prepare the corresponding accounting entry. An intermediate entry consists of one or more paragraphs, starting with the first <para>The appearance of the identifier marks the beginning of the entire intermediate entry; The identifier appears when and only when all paragraph contents are finished. <endpara>, indicating that the entire intermediate entry is complete. In an intermediate entry, <endpara>The identifier appears only once; (2) Secondary structure: paragraph By identifier <para>Indicates the beginning of a paragraph. <para>All lines after the identifier appear belong to the current paragraph until the next <para>Appear or <endpara>The identifier appears, which is a paragraph; A paragraph contains the complete information required to write a single accounting entry. <para>The content immediately following the paragraph on the same line is the substantive content of the paragraph, which is the text used to describe the matters in the paragraph. The content will eventually be output as is in the output accounting entries; The content starting from the second line of a paragraph to the last line of the paragraph is the information of the specific subjects contained in the paragraph, where each line corresponds to one subject; (3) Three-level structure: subjects The information of a subject is arranged in order. <name> 、 <pos>,as well as <num>or <spe>It is expressed by three identifiers and corresponding substantive content; among which: Identifier <name>The substantive content is the name of the subject; Identifier <pos>The substantive content indicates the position of the account in the final accounting entry, which is used to determine whether the account appears as a debit, a credit or not in the accounting entry; Identifier <num>or <spe>The substantive content is the value of the account: If the value of the account is directly given in the text of the accounting event entered by the user and does not require additional calculation or reasoning, use <num>, the substantive content is the value given in the text; if the value of the account is not given directly in the text of the accounting item, but requires additional calculation or reasoning to obtain, use <spe>, its substantive content is the function name and parameters used in the calculation or reasoning. These parameters are the account names that appear in this intermediate entry, and the function name indicates the specific method of calculating these parameters. The calculation result is the value of this account; The contents of one subject will appear on the same line, and then the next subject will appear on a new line, and this will be repeated until all the subjects contained in a paragraph appear.

[0010] Furthermore, the identifier <pos>The substantive content and its meaning include the following: Debit: This account will appear on the debit side of the accounting entry; Credit: This account will appear on the debit side of the accounting entry; Does not appear: This account will not appear in accounting entries; Positive debit: If the value of this account is positive, it appears on the debit side of the accounting entry, otherwise it appears on the credit side of the accounting entry; Positive credit: If the value of this account is positive, it appears on the credit side of the accounting entry, otherwise it appears on the debit side of the accounting entry; Positive debit only: If the value of this account is positive, it will appear on the debit side of the accounting entry, otherwise it will not appear in the accounting entry; Positive credit only: If the value of this account is positive, it will appear on the credit side of the accounting entry, otherwise it will not appear in the accounting entry.

[0011] Furthermore, the intermediate entry decoder is a program module for processing intermediate entries. The intermediate entry decoder receives the intermediate entries composed of the specific three-level structure output by the large accounting model, performs structured recognition and storage on the contents, calculates the account values, and generates corresponding accounting entries in text form for output presentation.

[0012] Furthermore, the intermediate entry decoder performs structured recognition and storage on the received intermediate entry, including: 1) Content extraction and format checking From the received intermediate entries, extract the first <para>Identifiers start with <endpara>The intermediate entry content ending with the identifier is saved. If the above content is not detected, an error message is returned; 2) Paragraph segmentation From the intercepted intermediate entries, according to <para>Where the identifier appears, each intermediate entry is divided into several sections and saved separately; 3) Subject division From each paragraph, according to <name>The positions of the identifiers and the line breaks are used to identify the various subjects contained in each paragraph and save each subject as a different object, storing the identifiers and their substantive contents in each subject as variables under the object; in particular, for <spe>The content after the identifier, including the function name and parameter names, is identified and saved separately.

[0013] Furthermore, the intermediate entry decoder includes a calculation module, in which calculation logic corresponding to all function names is stored; the calculation subject values ​​include: For markers <spe>The corresponding account value needs to be calculated, so the intermediate entry decoder processes each paragraph as follows: Sequentially traverse all the subjects in the paragraph; If the value of the current subject is known, the identifier is <num>, or <spe>But if it has been calculated, continue traversing; If the value of the current account is unknown, the identifier is <spe>If the value of each subject corresponding to each parameter name is known and has not been calculated, then determine whether all the values ​​of each subject corresponding to the saved parameter name are known; if so, calculate the value of each subject according to the <spe>The function name, parameter name and its corresponding value recorded in the calculation module are called to calculate the value corresponding to the function name and save it in the subject object; in this process, the calculation module saves the calculation process in text form according to a preset format to form an explanatory text; At this point, the value of an item is calculated, and then the items in the paragraph are traversed downward until the values ​​of all items in the paragraph are known; After the calculation of one paragraph is completed, the above process is repeated for the next paragraph until all paragraphs have been executed.

[0014] Furthermore, after all the account values ​​of all paragraphs are calculated, the intermediate entry decoder integrates all paragraphs according to the identifier <pos>It identifies the substantive content of the accounting entries in each paragraph and their credit and debit directions, and combines them into a standardized accounting entry text based on the name, value, and credit and debit direction of the account; at the same time, the explanatory text previously saved in the calculation process will also be attached to the end of the accounting entry text, together as the output of the intermediate entry decoder.

[0015] Furthermore, the pre-training and fine-tuning are performed using the open source general large model Baichuan2-7B-Chat and the large model training framework LLaMa-Factory, and the training data consists of the question-answer pairs and the general corpus collected from the Internet in a ratio of 2:3.

[0016] An automatic accounting entry preparation system based on a large language model, used to implement any of the above methods, the system comprising: The accounting model is used to receive accounting event input, encode it according to the preset three-level structure to form intermediate entries, and output it to the intermediate entry decoder; The intermediate entry decoder includes a calculation module, which performs structured recognition and storage on the received intermediate entries, calculates the subject values ​​based on the calculation module, and finally generates corresponding accounting entries in text form for output presentation.

[0017] The beneficial effects of the present invention are: The present invention constructs a large language model and system for accounting entry preparation tasks, combines the accounting entry knowledge with innovative design and introduces intermediate entries, and through the intermediate entry decoder, fully utilizes the logical relationship and numerical calculation method between accounting matters and accounting entries, so that the system of the present invention can better understand and process accounting entry preparation tasks, ensuring the accuracy of accounting entry logic and the precision of numerical calculation. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 : The training process, reasoning process and intermediate state entry decoder workflow structure diagram of the model in the system of the present invention. DETAILED DESCRIPTION

[0019] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0020] According to an embodiment of the present invention, the automatic accounting entry preparation method based on the large language model of the present invention is as follows: Figure 1 As shown, the steps include: 1) Collect the accounting event-accounting entry binary dataset. This dataset is the standard input and output when humans perform the accounting entry preparation task, where: The accounting matter text is the input information received by humans when performing the task under the traditional method. In the method of the present invention, this part of data will be used as the "user input" content in the training data; The accounting entry text is the text output by the human brain after processing the input content when humans perform the task under the traditional method. This part of data will not be directly added to the training data, but will be used as a reference for compiling intermediate entry data and ultimately evaluating the accuracy of the method described in the present invention.

[0021] 2) This paper designs an original semi-structured data format "intermediate entries", which expresses the logical relationship between accounting events and accounting entries, numerical calculation methods and other information in text form. For each accounting event-accounting entry tuple in the training data set, the corresponding intermediate entry is written through manual processing, thereby constructing the "accounting event-intermediate entry-accounting entry" tuple data set.

[0022] 3) For the obtained triple data set, the accounting matters and intermediate entries are used as question-answer pairs for pre-training and fine-tuning of the general large language model, so as to train a financial accounting large model that can receive input accounting matters and output corresponding intermediate entries; specifically, the pre-training and fine-tuning are carried out using the open source general large model Baichuan2-7B-Chat and the large model training framework LLaMa-Factory, and the training data is composed of the above-mentioned question-answer pairs and the general corpus collected on the Internet in a ratio of 2:3.

[0023] 4) Write an intermediate entry decoder in the form of a Python language computer program. The decoder can decode, calculate, and process the intermediate entry data and output the corresponding accounting entries.

[0024] 5) The above-mentioned accounting big model and intermediate entry decoder are packaged into a system, which can complete the complete process of accounting entry preparation task: after the user inputs the accounting matter text into the system, it is first processed by the accounting big model and outputs the corresponding intermediate entry; then the intermediate entry decoder processes the obtained intermediate entry, outputs the corresponding accounting entry, and finally returns it to the user.

[0025] Detailed description of intermediate state entries and their decoders: This section will specifically introduce the data format of the "intermediate entry" mentioned in the above technical solution, as well as the important component of the intermediate entry decoder. Table 2 shows an intermediate entry and its corresponding input and output examples. The following will introduce the composition and interpretation method of the intermediate entry in combination with this example.

[0026] Table 2 An example of the contents of a triplet of "accounting event-intermediate entry-accounting entry"

[0027] 1) Intermediate entries Definition: Intermediate entries are a semi-formatted data structure that is original to the present invention and stored in text form, and can express information such as the logical relationship between accounting events and accounting entries, numerical calculation methods, etc. In the method described in the present invention, the intermediate entry data used in the training data are all manually compiled by humans according to the writing specifications of the intermediate entries, and are used as output content in the training data of the large model. The trained large model is expected to automatically output intermediate entries with standardized formats and correct content based on the accounting event content input by the user.

[0028] Content composition: The intermediate entry consists of [identifier] and [substantive content]. The identifier is an English phrase enclosed by angle brackets. <para> 、 <name> 、 <pos> 、 <num> 、 <spe>and <endpara>There are five types of identifiers, which are used to mark the nature and meaning of the content that appears after the identifier in the intermediate entry. The substantive content can be expressed in various forms, such as single words, phrases, short sentences, and functional expressions, which are used to express the substantive meaning related to specific accounting entries in the intermediate entry. For example, in the example in Table 2, for " <name>An identifier-substance pair such as "Bank Deposit" is interpreted as follows: <name>The label indicates that what will follow is a subject name, and the content of the name is "bank deposits".

[0029] Content reading method: (1) Primary structure: intermediate entries An intermediate entry contains all the necessary information for writing the corresponding accounting entry. An intermediate entry consists of one or more paragraphs. There is no special identifier to mark the beginning of the entire intermediate entry, but the first paragraph in the intermediate entry. <para>An identifier (representing the start of a "paragraph" of the secondary structure) appears to mark the beginning of the entire intermediate entry.

[0030] If and only if all paragraph contents are finished, the identifier will appear <endpara>, indicating that the entire intermediate entry is complete. In an intermediate entry, <endpara>The identifier will only appear once.

[0031] (2) Secondary structure: paragraph The identifier that represents the beginning of a paragraph is <para>(para means paragraph); a <para>All lines after the identifier appear belong to the current paragraph until the next <para>appears (indicating the end of the current paragraph and the beginning of the next paragraph) or <endpara>The example in Table 2 contains two paragraphs.

[0032] Next, we introduce each paragraph (i.e. each <para>) and how to read it. In general, a paragraph generally corresponds to the complete information required to write a single accounting entry. In terms of format, the first thing that appears in each paragraph is the identifier. <para>, indicating the beginning of a paragraph; <para>The content immediately following the paragraph on the same line is a paragraph describing the matters in the paragraph, which will be output as is in the final accounting entry. In the example of Table 2, since this paragraph describes the accounting behavior of confirming and recording the main business income, the descriptive text of the first paragraph is "Confirming the main business income", which also appears as is in the final output.

[0033] The content starting from the second line of a paragraph to the last line of the paragraph is the information of the specific subjects contained in the paragraph, where each line corresponds to one subject.

[0034] (3) Three-level structure: subjects The information of an account is expressed by a complete line. This line consists of three fields. The identifiers and meanings of these fields are explained as follows: The first position is <name>The content of the field is the name of the account. In the example of Table 2, the first account of the first paragraph is named "Bank Deposits".

[0035] In the second position appears <pos>Field (pos means position), its content is the position of this account in the final accounting entry. The possible contents and their meanings are shown in the following table: Table 3 <pos>Possible contents of the field and their meaning

[0036] The field that appears in the third position is the value of the account, and its identifier is <num>or <spe>One of them is determined by the nature of the account in this entry: If the value of the account is directly given in the text of the accounting transaction entered by the user and does not require additional calculation or reasoning, use <num>to mark the field, and the content of the field is the value given in the text. In the example of Table 2, the amount of the bank deposit account has been directly given in the user input, which is 1,130 yuan, so the third field of the bank deposit account is <num>field, the value is 1130.

[0037] If the value of the subject is not given directly in the text and requires additional calculation or reasoning, use <spe>To mark the field (spe means special), the content of the field is a function name and its parameters. These parameters are the account names that appear in this intermediate entry, and the function name indicates the specific method of calculating these parameters. The calculation result is the value of this account. In the example of Table 2, the value of the "output tax amount" account is not directly given in the accounting items entered by the user, and needs to be calculated based on the values ​​of other accounts. Therefore, the value field corresponding to this account needs to be marked with <spe>Tag. The specific content of the numeric field of this account is " <spe>"VAT amount (bank deposit, VAT rate)", which means that the value of this account needs to be calculated based on the values ​​of the two accounts "bank deposit" and "VAT rate", and the function for calculating these two parameters is "VAT amount", and the specific calculation method of this function is: VAT amount (x, y) = x / (1+y)*y. Combining the above information, the specific value of this account can be calculated. The process of identifying functions and parameters and calculating specific values ​​will be completed by the intermediate entry decoder module, which will be introduced later.

[0038] In summary, a subject contains three fields <name> <pos> <num>(or <spe>As mentioned above, the content of a subject will appear on the same line, and then a new line will appear with the next subject, and this will be repeated until all the subjects included in a paragraph appear.

[0039] 2) Intermediate state entry decoder The intermediate entry decoder is a program module for processing intermediate entries. In the method described in the present invention, the intermediate entry decoder receives the intermediate entry in the string form output by the large model, analyzes and interprets its content, and generates the corresponding accounting entry in text form, which is presented to the user as the final output.

[0040] The specific workflow of intermediate entries is as follows: (1) Content extraction and format checking From the string output by the large model, extract the first <para>Identifiers start with <endpara>The intermediate state entry content ending with the identifier is saved for subsequent processing. If the above content is not detected, it means that the output content of the large model is incorrect and an error message is returned.

[0041] (2) Paragraph segmentation From the intermediate entries, according to <para>and <endpara>Where the identifier appears, the intermediate entry is divided into several paragraphs and saved separately.

[0042] (3) Subject division From each paragraph, according to <name> <pos> <num>(or <spe>) identifier and the position of the line break, identify the various subjects contained in each paragraph, save each subject as a different object, and store the field values ​​in each subject as variables under the object. In particular, for <spe>The content after the identifier will be identified and saved separately through string-related algorithms, including the function name and parameter names.

[0043] At this point, the contents of the entire intermediate entry are identified and stored in a highly structured manner, and can be easily further processed through Python programs and other means.

[0044] (4) Calculation of subject values As mentioned above, the values ​​of some accounts are not directly given in the user input, so the value fields of these accounts are <spe>The mark indicates that special calculations are required to obtain the values ​​of these items. Specifically, the intermediate entry decoder will process each paragraph as follows: Sequentially traverse all the subjects in the paragraph; If the value of the current account is known (the identifier of the value field is <num>, or <spe>But it has been calculated), then continue to traverse; If the value of the current account is unknown (the identifier of the value field is <spe>and has not been calculated yet), then determine whether the values ​​of all the items that need to be used as calculation parameters are all known; If yes, then according to the subject <spe>The function name, parameters and corresponding values ​​recorded in the field call the pre-developed calculation module to calculate the value corresponding to the function and save it in the subject object. <spe>The result of the function calculation in the field is a numeric value, which will become the corresponding numeric value of this account.

[0045] In particular, for a small number of calculation steps that are relatively complex and involve a large number of process variables, setting a separate account for each process variable will make the entire intermediate state entry too long, which is not conducive to the correct understanding and output of the large model. Therefore, the method described in the present invention is specially designed for such scenarios: if the name of an account ( <name>) is "special treatment", then its <spe>The result of the function in the field through the calculation module will be a complete paragraph ( <para>), rather than a single value. In this paragraph calculated by the function, all account value fields will be <num>Type of field, that is, no additional calculation is required. When all paragraphs are subsequently integrated for output, the paragraph saved in the "special processing" account value will replace the original paragraph. Other accounts in the original paragraph will not be integrated and output.

[0046] In addition, during the above calculation process, the calculation module will also save the specific calculation process and formulas in text form according to the preset format. These explanatory texts will be used in the "output content generation" step.

[0047] At this point, the value of an item is calculated. Then, continue to traverse the items in the paragraph until all the item values ​​in the paragraph are known. After the calculation of a paragraph is completed, repeat the above process for the next paragraph until all paragraphs are executed.

[0048] (5) Output content generation After all the account values ​​of all the paragraphs are calculated, the intermediate entry decoder will integrate all the paragraphs according to <pos>The value of the field identifies the accounts and their debit and credit directions in each paragraph that need to be output in the accounting entries, and combines them into a standardized accounting entry text based on the names, values, and debit and credit directions of these accounts. At the same time, the explanatory text previously saved during the calculation process will also be attached to the end of the accounting entry text (Note: Due to the length of the explanatory text, this content is omitted in the output part of the example in Table 2).

[0049] The combination of accounting entries of each paragraph and explanatory text content is the output of the intermediate entry decoder. This content will be presented to the user as the final output of the entire system.

[0050] In addition, in order to test the effect of the present invention, 100 accounting entries in the basic accounting practice stage were used to compile test data, and the large model system obtained by this method and the common general large model were tested. The test standards and results are as follows: Table 4 Evaluation criteria for accounting entry preparation tasks

[0051] Table 5 Evaluation results

[0052] According to an embodiment of the present invention, the present invention provides an automatic accounting entry preparation system based on a large language model, which is used to implement the method described in any one of the above items, and the system includes: The accounting model is used to receive accounting event input, encode it according to the preset three-level structure to form intermediate entries, and output it to the intermediate entry decoder; The intermediate entry decoder includes a calculation module, which performs structured recognition and storage on the received intermediate entries, calculates the subject values ​​based on the calculation module, and finally generates corresponding accounting entries in text form for output presentation.

[0053] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0054] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0055] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0056] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0057] The specific implementation methods described herein are merely examples of the spirit of the present invention. Those skilled in the art may make various modifications or additions to the specific implementation methods described or replace them with similar methods, but they will not deviate from the spirit of the present invention or exceed the scope defined by the attached claims.< / pos> < / num> < / para> < / spe> < / name> < / spe> < / spe> < / spe> < / spe> < / num> < / spe> < / spe> < / spe> < / num> < / pos> < / name> < / endpara> < / para> < / endpara> < / para> < / spe> < / num> < / pos> < / name> < / spe> < / spe> < / spe> < / num> < / num> < / spe> < / num> < / pos> < / pos> < / name> < / para> < / para> < / para> < / endpara> < / para> < / para> < / para> < / endpara> < / endpara> < / para> < / name> < / name> < / endpara> < / spe> < / num> < / pos> < / name> < / para> < / pos> < / spe> < / spe> < / spe> < / num> < / spe> < / spe> < / name> < / para> < / endpara> < / para> < / pos> < / spe> < / num> < / spe> < / num> < / pos> < / name> < / spe> < / num> < / pos> < / name> < / para> < / endpara> < / para> < / para> < / para> < / endpara> < / endpara> < / para> < / endpara> < / spe> < / num> < / pos> < / name> < / para>

Claims

1. A method for automatically compiling accounting entries based on a large language model, characterized in that: These include: 1) Collect accounting data sets and organize their corresponding accounting entry texts as the standard input and final output of the accounting entry preparation task; 2) Based on the logical relationship and numerical calculation method between accounting events and accounting entries, intermediate entries are introduced, and the corresponding intermediate entries are obtained for the accounting events in the accounting event data set, and a triple data set of "accounting event-intermediate entry-accounting entry" is constructed; 3) For the triple data set, the accounting items and intermediate entries therein are used as question-answer pairs, which are used for pre-training and fine-tuning of the general large language model to train a large accounting model, which can receive input accounting items and output corresponding intermediate entries under guidance; 4) Input the intermediate entry data output by the financial accounting model into the intermediate entry decoder for decoding, and output the corresponding accounting entry.

2. The method for automatically compiling accounting entries based on a large language model according to claim 1 is characterized in that: The intermediate entry is composed of an identifier and substantive content, wherein the identifier is in the form of an English phrase enclosed by angle brackets. <para> 、 <name> 、 <pos> 、 <num> 、 <spe>and <endpara> There are six types, which correspond to paragraph, account name, position, value, special item and end respectively. They are used to mark the nature and meaning of the content that appears after the identifier in the intermediate entry. The substantive content is a single word, phrase, short sentence or functional formula, which is used to express the substantive meaning related to the specific accounting entry in the intermediate entry.< / endpara> < / spe> < / num> < / pos> < / name> < / para> 3. The method for automatically compiling accounting entries based on a large language model according to claim 2, characterized in that: The intermediate state entries are composed of a specific three-level structure, which is: (1) Primary structure: intermediate entries An intermediate entry contains all the necessary information to prepare the corresponding accounting entry. An intermediate entry consists of one or more paragraphs, starting with the first <para> The appearance of the identifier marks the beginning of the entire intermediate entry;< / para> The identifier appears when and only when all paragraph contents are finished. <endpara>, indicating that the entire intermediate entry is complete. In an intermediate entry, <endpara> The identifier appears only once;< / endpara> < / endpara> (2) Secondary structure: paragraph By identifier <para>Indicates the beginning of a paragraph. <para>All lines after the identifier appear belong to the current paragraph until the next <para>Appear or <endpara> The identifier appears, which is a paragraph;< / endpara> < / para> < / para> < / para> A paragraph contains the complete information required to write a single accounting entry. <para> The content immediately following the paragraph on the same line is the substantive content of the paragraph, which is the text used to describe the matters in the paragraph. The content will eventually be output as is in the output accounting entries;< / para> The content starting from the second line of a paragraph to the last line of the paragraph is the information of specific subjects contained in the paragraph, where each line corresponds to one subject; (3) Three-level structure: subjects The information of a subject is arranged in order. <name> 、 <pos>,as well as <num>or <spe> It is expressed by three identifiers and corresponding substantive content; among which:< / spe> < / num> < / pos> < / name> Identifier <name> The substantive content is the name of the subject;< / name> Identifier <pos> The substantive content indicates the position of the account in the final accounting entry, which is used to determine whether the account appears as a debit, a credit or not in the accounting entry;< / pos> Identifier <num>or <spe>The substantive content is the value of the account: If the value of the account is directly given in the text of the accounting event entered by the user and does not require additional calculation or reasoning, use <num>, the substantive content is the value given in the text; if the value of the account is not given directly in the text of the accounting item, but requires additional calculation or reasoning to obtain, use <spe> , its substantive content is the function name and parameters used in the calculation or reasoning. These parameters are the account names that appear in this intermediate entry, and the function name indicates the specific method of calculating these parameters. The calculation result is the value of this account;< / spe> < / num> < / spe> < / num> The contents of one subject will appear on the same line, and then the next subject will appear on a new line, and this will be repeated until all the subjects contained in a paragraph appear.

4. The method for automatically compiling accounting entries based on a large language model according to claim 3 is characterized in that: The identifier <pos> The substantive content and its meaning include the following:< / pos> Debit: This account will appear on the debit side of the accounting entry; Credit: This account will appear on the debit side of the accounting entry; Does not appear: This account will not appear in accounting entries; Positive debit: If the value of this account is positive, it appears on the debit side of the accounting entry, otherwise it appears on the credit side of the accounting entry; Positive credit: If the value of this account is positive, it appears on the credit side of the accounting entry, otherwise it appears on the debit side of the accounting entry; Positive debit only: If the value of this account is positive, it will appear on the debit side of the accounting entry, otherwise it will not appear in the accounting entry; Positive credit only: If the value of this account is positive, it will appear on the credit side of the accounting entry, otherwise it will not appear in the accounting entry.

5. The method for automatically compiling accounting entries based on a large language model according to claim 3 is characterized in that: The intermediate entry decoder is a program module for processing intermediate entries. The intermediate entry decoder receives the intermediate entries composed of the specific three-level structure output by the large accounting model, performs structured recognition and storage on the contents, calculates the account values, and generates corresponding accounting entries in text form for output presentation.

6. The method for automatically compiling accounting entries based on a large language model according to claim 5, characterized in that: The intermediate entry decoder performs structured recognition and storage on the received intermediate entry, including: 1) Content extraction and format checking From the received intermediate entries, extract the first <para>Identifiers start with <endpara> The intermediate entry content ending with the identifier is saved. If the above content is not detected, an error message is returned;< / endpara> < / para> 2) Paragraph segmentation From the intercepted intermediate entries, according to <para> Where the identifier appears, each intermediate entry is divided into several sections and saved separately;< / para> 3) Subject division From each paragraph, according to <name>The positions of the identifiers and the line breaks are used to identify the various subjects contained in each paragraph and save each subject as a different object, storing the identifiers and their substantive contents in each subject as variables under the object; in particular, for <spe> The content after the identifier, including the function name and parameter names, is identified and saved separately.< / spe> < / name> 7. The method for automatically compiling accounting entries based on a large language model according to claim 6 is characterized in that: The intermediate entry decoder includes a calculation module, in which the calculation logic corresponding to all function names is stored; the calculation subject values ​​include: For markers <spe> The corresponding account value needs to be calculated, so the intermediate entry decoder processes each paragraph as follows:< / spe> Sequentially traverse all the subjects in the paragraph; If the value of the current subject is known, the identifier is <num>, or <spe> But if it has been calculated, continue traversing;< / spe> < / num> If the value of the current account is unknown, the identifier is <spe>If the value of each subject corresponding to each parameter name is known and has not been calculated, then determine whether all the values ​​of each subject corresponding to the saved parameter name are known; if so, calculate the value of each subject according to the <spe> The function name, parameter name and its corresponding value recorded in the calculation module are called to calculate the value corresponding to the function name and save it in the subject object; in this process, the calculation module saves the calculation process in text form according to a preset format to form an explanatory text;< / spe> < / spe> At this point, the value of an item is calculated, and then the items in the paragraph are traversed downward until the values ​​of all items in the paragraph are known; After the calculation of one paragraph is completed, the above process is repeated for the next paragraph until all paragraphs have been executed.

8. The method for automatically compiling accounting entries based on a large language model according to claim 7, characterized in that: After all the account values ​​of all the paragraphs are calculated, the intermediate entry decoder integrates all the paragraphs according to the identifier <pos> It identifies the substantive content of the accounting entries in each paragraph and their credit and debit directions, and combines them into a standardized accounting entry text based on the name, value, and credit and debit direction of the account; at the same time, the explanatory text previously saved in the calculation process will also be attached to the end of the accounting entry text, together as the output of the intermediate entry decoder.< / pos> 9. The method for automatically compiling accounting entries based on a large language model according to claim 1, characterized in that: The pre-training and fine-tuning are performed using the open source general large model Baichuan2-7B-Chat and the large model training framework LLaMa-Factory. The training data consists of the question-answer pairs and the general corpus collected from the Internet in a ratio of 2:

3.

10. An automatic accounting entry preparation system based on a large language model, characterized in that: For implementing the method according to any one of claims 1 to 9, the system comprises: The accounting model is used to receive accounting event input, encode it according to the preset three-level structure to form intermediate entries, and output it to the intermediate entry decoder; The intermediate entry decoder includes a calculation module, which performs structured recognition and storage on the received intermediate entries, calculates the subject values ​​based on the calculation module, and finally generates corresponding accounting entries in text form for output presentation.

Citation Information

Patent Citations

  • Automatic intelligent reimbursement and accreditation system and method thereof

    CN117876130A

  • Text structured extraction method and system, terminal and medium

    CN119202144A

  • Method and system for improving accuracy of large language model on financial query problem based on external retrieval

    CN119377261A

  • Certificate template generation method and device, equipment, storage medium and program product

    CN119416765A

  • Vertical domain information processing method and device based on large language model

    CN119760079A