Contract information extraction method and equipment based on multi-modal large language model

Through the contract information extraction method based on the multi-modal large language model, the difficulty in information extraction caused by the limitation of rule templates in the existing technology is solved, the efficient extraction of diagrams and key information in the contract is achieved, and the convenience of information management is improved. sex and accuracy.

CN118734032AActive Publication Date: 2024-10-01INSPUR GENERSOFT CO LTD

Patent Information

Application Number
CN202410716594.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-10-01
Estimated Expiration
2044-06-04

AI Technical Summary

Technical Problem

The existing contract information extraction method is limited by rule templates, making it difficult to extract chart information and key named entity information in the contract. There are problems with omissions, and the extraction process is inflexible.

Method used

Using a contract information extraction method based on a multi-modal large language model, by acquiring contract data in different formats, building a model training data set, building a latent space mapping model, training a general text and picture data encoder, and building a large language model for contract extraction, Perform information extraction and verification.

Benefits of technology

It improves the efficiency and flexibility of contract information extraction, can more accurately extract text, images, tables and other information in the contract, and reduces the risk of information management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118734032A_ABST
    Figure CN118734032A_ABST
Patent Text Reader

Abstract

The invention discloses a contract information extraction method and equipment based on a multi-modal large language model, belongs to the technical field of smart contracts, and is used for solving the problems that an existing contract information extraction mode is limited by a rule template, chart information and key named entity information in a contract are difficult to extract, and omission exists. And the extraction process is not flexible. The method comprises the following steps: acquiring contract data in different formats and constructing a model training data set; constructing a hidden space mapping model of the contract picture data and the contract text data; training a hidden space mapping model through the model training data set, and obtaining a general text data encoder and a general picture data encoder according to a model verification result; constructing a contract extraction large language model based on a general text data encoder and a general picture data encoder; and training the contract extraction large language model through a model training data set, and verifying the accuracy of information extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of smart contract technology, and in particular to a contract information extraction method and device based on a multimodal large language model. Background Art

[0002] Contract information extraction is a key link in the wave of enterprise informatization and digitalization. By extracting key information from contracts, the efficiency and accuracy of contract information management can be improved, the pain points in traditional contract management can be solved, contract risks can be reduced, control over contracts can be strengthened, and contract information can be shared, providing enterprises with better contract management and operational support. Traditional contract information extraction methods are divided into manual extraction and rule extraction. Manual extraction of contract information is costly and inefficient. Rule extraction is limited by templates.

[0003] With the rapid development of deep learning, the combination of neural networks and rule extraction has become popular, which has improved the integrity of information extraction. However, this method is still limited by rule templates and it is difficult to extract chart information in contracts, as well as key named entity information in contracts such as companies, amounts, time, etc. There are omissions and the extraction process is inflexible. Summary of the invention

[0004] The embodiment of the present invention provides a contract information extraction method and device based on a multimodal large language model, which is used to solve the following technical problems: the existing contract information extraction method is limited by rule templates, it is difficult to extract chart information and key named entity information in the contract, there are omission problems, and the extraction process is inflexible.

[0005] The embodiment of the present invention adopts the following technical solution:

[0006] On the one hand, an embodiment of the present invention provides a method for extracting contract information based on a multimodal large language model, the method comprising: acquiring contract data in different formats and constructing a model training data set; wherein the contract data in different formats comprises contract image data and contract text data; the model training data set comprises a first data set, a second data set, a third data set, a fourth data set and a fifth data set;

[0007] Construct a latent space mapping model between contract image data and contract text data;

[0008] Training the latent space mapping model through the model training data set, and obtaining a universal text data encoder and a universal picture data encoder according to the model verification result;

[0009] Based on the universal text data encoder and the universal picture data encoder, construct a large language model for contract extraction;

[0010] The contract extraction large language model is trained using the model training data set, and the accuracy of information extraction is verified.

[0011] In a feasible implementation, contract data in different formats is obtained and a model training data set is constructed, specifically including:

[0012] Performing standardization processing on the contract image data and the contract text data;

[0013] The standardized contract image data is cropped according to a preset cropping rule to obtain contract image cropping data; the standardized contract text data is disassembled according to a preset disassembly rule to obtain contract text disassembly data;

[0014] Aligning the contract image cropping data and the contract text disassembly data to obtain a first data set;

[0015] Cut out the preset area image from the standardized contract image data, extract information, and construct the second data set and the third data set;

[0016] Extract prompt words from the standardized contract image data and contract text data to construct a fourth data set and a fifth data set;

[0017] The first data set, the second data set, the third data set, the fourth data set and the fifth data set are divided into training sets and test sets according to preset ratios to obtain the model training data set.

[0018] In a feasible implementation, a preset area image is intercepted from the standardized contract image data, and information is extracted to construct a second data set and a third data set, which specifically includes:

[0019] Extract the table area image and the official seal area image from the standardized contract image data;

[0020] By using the PPOCRLabel tool, the table area image is labeled as a first preset format text data using Latex as typeset; and the official seal area image is labeled as a second preset format text data containing company information;

[0021] Extracting a first Prompt word from the first preset format text data;

[0022] Extracting a second Prompt word from the second preset format text data;

[0023] Constructing the table area image, the first preset format text data and the first Prompt word into a second data set;

[0024] The official seal area image, the second preset format text data and the second Prompt word are constructed into a third data set.

[0025] In a feasible implementation, prompt words are extracted from the standardized contract image data and contract text data to construct a fourth data set and a fifth data set, which specifically include:

[0026] Extracting a third prompt word from the standardized contract image data and the contract text data;

[0027] The standardized contract image data, the third prompt word and the standardized contract text data are constructed into a fourth data set;

[0028] The standardized contract text data and the third Prompt word are constructed into a fifth data set.

[0029] In a feasible implementation, constructing a latent space mapping model between contract image data and contract text data specifically includes:

[0030] Patch segmentation is performed on the contract image data, and patch coding and position coding are performed;

[0031] The Transformer Encode with self-attention mechanism as the core and the feedforward neural network FFN are used to construct the image data encoder to obtain the latent space feature vector V of the contract image data. img ;

[0032] Tokenize the contract text data, and perform token encoding and position encoding;

[0033] A text encoder with pre-trained weights and a feed-forward neural network FFN are used to construct a text data encoder to obtain the latent space feature vector V of the contract text data. txt ;

[0034] According to the image data encoder and the text data encoder, a latent space mapping model of contract image data and contract text data is constructed.

[0035] In a feasible implementation manner, the method further includes:

[0036] The latent space feature vectors output by the image data encoder and the text data encoder are L2 regularized to obtain the cosine similarity formula:

[0037] The latent space feature vectors output by the image data encoder and the text data encoder are processed by 2-paradigm respectively to obtain the Tanimoto coefficient formula:

[0038] According to the cosine similarity formula and the Tanimoto coefficient formula, the loss function of the latent space mapping model is obtained: Loss = β·Cos(V txt ,V img )+(1-β)Tan(V txt ,V img ), where β is the fusion weight of cosine similarity and Tanimoto coefficient, β∈[0,1].

[0039] In a feasible implementation, the latent space mapping model is trained by the model training data set, and a universal text data encoder and a universal picture data encoder are obtained according to the model verification result, specifically including:

[0040] Inputting the training set in the first data set into the latent space mapping model, training the mapping relationship between the contract text data and the contract image data, and obtaining a trained latent space mapping model;

[0041] The test set in the first data set is input into the latent space mapping model to verify the accuracy of the mapping relationship between the contract text data and the contract image data, and the weights of the text data encoder and the image data encoder that meet the accuracy requirements are saved to obtain the universal text data encoder and the universal image data encoder.

[0042] In a feasible implementation, based on the universal text data encoder and the universal picture data encoder, a large language model for contract extraction is constructed, which specifically includes:

[0043] Constructing a data format distinguishing module for dividing the contract text data and the contract image data, and calling the universal text data encoder and the universal image data encoder;

[0044] Based on the output vector of the general text data encoder or the general image data encoder, construct a Prompt prompt word encoder;

[0045] Construct a base large language model, and fine-tune the base large language model through the low-rank fine-tuning strategy Lora module to transform the base large language model into a professional model suitable for contract information extraction;

[0046] Build a post-processing module to handle chart tasks;

[0047] The data format differentiation module, the universal text data encoder, the universal picture data encoder, the Prompt word encoder, the Lora module, the base large language model and the post-processing module are combined into the contract information extraction large language model.

[0048] In a feasible implementation, the contract extraction large language model is trained by using the model training data set, and the accuracy of information extraction is verified, specifically including:

[0049] Input the training sets in the second data set, the third data set, the fourth data set and the fifth data set into the large language model for contract information extraction, and only train the prompt word encoder, the Lora module and the post-processing module in the large language model for contract information extraction;

[0050] The test set among the second data set, the third data set, the fourth data set and the fifth data set is input into the large language model for contract information extraction to verify the accuracy of the large language model for contract information extraction in extracting the required information in the contract document.

[0051] On the other hand, an embodiment of the present invention also provides a contract information extraction device based on a multimodal large language model, the device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor so that the at least one processor can execute the contract information extraction method based on the multimodal large language model.

[0052] Compared with the prior art, the method and device for extracting contract information based on a multimodal large language model provided by the embodiment of the present invention have the following beneficial effects:

[0053] The present invention solves the problem that the existing contract information extraction method is limited by rule templates and is difficult to extract chart information in the contract. The contract information extraction method based on the multimodal large language model processes the text information, image information, table information, etc. in the contract in different categories, and classifies the contract information through the multimodal large language model. The efficiency of contract information extraction is greatly improved, the flexibility of information acquisition is improved, and contract management is more convenient and intelligent. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0055] Figure 1 A flow chart of a method for extracting contract information based on a multimodal large language model provided by an embodiment of the present invention;

[0056] Figure 2 A schematic diagram of a latent space mapping model architecture provided by an embodiment of the present invention;

[0057] Figure 3 A schematic diagram of the structure of a Prompt word encoder provided by an embodiment of the present invention;

[0058] Figure 4 A schematic diagram of a large language model structure of a Lora fine-tuning base provided in an embodiment of the present invention;

[0059] Figure 5 A schematic diagram of the structure of a large language model for contract extraction provided by an embodiment of the present invention;

[0060] Figure 6 A schematic diagram of the structure of a contract information extraction device based on a multimodal large language model provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0061] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings 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 this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0062] The embodiment of the present invention provides a method for extracting contract information based on a multimodal large language model, such as Figure 1 As shown, the contract information extraction method based on the multimodal large language model specifically includes steps S101-S105:

[0063] S101, acquiring contract data in different formats and constructing a model training data set, wherein the model training data set includes a first data set, a second data set, a third data set, a fourth data set and a fifth data set.

[0064] Specifically, firstly, contract data in different formats are obtained, including contract image data and contract text data, and then the contract image data and contract text data are standardized.

[0065] Furthermore, the standardized contract image data is cropped according to preset cropping rules to obtain contract image cropped data; and the standardized contract text data is disassembled according to preset disassembly rules to obtain contract text disassembly data.

[0066] Furthermore, the contract image cropping data and the contract text disassembly data are aligned to obtain a first data set; a preset area image is captured from the standardized contract image data, and information is extracted to construct a second data set and a third data set; prompt words are extracted from the standardized contract image data and the contract text data to construct a fourth data set and a fifth data set.

[0067] Among them, the preset area image is intercepted from the standardized contract image data, and information is extracted to construct the second data set and the third data set, which specifically includes:

[0068] The table area image and the official seal area image are intercepted from the standardized contract image data; the table area image is marked as the first preset format text data with Latex as the layout through the PPOCRLabel tool; and the official seal area image is marked as the second preset format text data containing company information; the first Prompt prompt word is extracted from the first preset format text data; the second Prompt prompt word is extracted from the second preset format text data; the table area image, the first preset format text data and the first Prompt prompt word are constructed as the second data set. The official seal area image, the second preset format text data and the second Prompt prompt word are constructed as the third data set.

[0069] The prompt words are extracted from the standardized contract image data and contract text data to construct the fourth data set and the fifth data set, which specifically include:

[0070] Extract the third Prompt word from the standardized contract image data and the contract text data; construct the standardized contract image data, the third Prompt word and the standardized contract text data into a fourth data set; construct the standardized contract text data and the third Prompt word into a fifth data set.

[0071] Finally, the first data set, the second data set, the third data set, the fourth data set and the fifth data set are divided into training sets and test sets according to preset ratios to obtain a model training data set.

[0072] As a feasible implementation method, the specific steps of constructing a model training data set are as follows:

[0073] (1-1): Construct a training dataset for the latent space mapping model TI (Text and Img) of text data and image data: First, obtain the contract image format data (such as PDF, JPG, PNG, etc.), convert the data formats such as PDF, PNG and other data formats into JPG format, and then cut the JPG format image data into sentences, paragraphs, and chapters; then obtain the contract text format data (such as TXT, Word, etc.), convert the data formats such as Word and other data formats into TXT format, and then disassemble the TXT format text data into sentences, paragraphs, and chapters.

[0074] (1-2): Align the acquired JPG format image data and TXT format text data, use PPOCRLabel as a data annotation tool, and obtain the first data set D1 = [JPG, TXT].

[0075] (1-3): Construct a large language model training dataset for contract extraction, extract the table area in the JPG format image data, and annotate it as TXT format text data with LaTeX as typeset through PPOCRLabel. The prompt word content is extracted around the table information, for example, "parse the information of Table 1 in the contract", and obtain the second dataset D2 = [Table, Prompt, LaTeX].

[0076] (1-4): The official seal area in the JPG format image data is intercepted and marked as TXT format text data containing the company information through PPOCRLabel. The prompt word content is extracted around the official seal information, such as "parse the official seal information of Party A in the contract", and the third data set is obtained.

[0077] D3 = [Seal, Prompt, TXT], if the contract contains pictures containing other information, the processing method is the same as that of this step.

[0078] (1-5): For the text part of the JPG format image data and TXT format text data obtained in the first step, the prompt word content revolves around tasks such as knowledge extraction and content summary, such as "purchase amount", "term summary", "completion time", etc., and the fourth data set D4 = [JPG, Prompt, TXT] and the fifth data set D5 = [TXT, Prompt, TXT] are obtained.

[0079] (1-6): Divide the data sets D1, D2, D3, D4, and D5 into training sets and test sets in a ratio of 8:2.

[0080] S102: Construct a latent space mapping model between contract image data and contract text data.

[0081] Specifically, the contract image data is segmented into patches, and patch encoding and position encoding are performed. Then, the Transformer Encode with self-attention mechanism as the core and the feedforward neural network FFN are used to construct the image data encoder to obtain the latent space feature vector V of the contract image data. img .

[0082] Through practice, the present invention adopts 4 layers of Transformer Encode with self-attention mechanism as the core and 1 layer of FFN to construct an image data editor to achieve the best effect of image data editing.

[0083] Furthermore, the contract text data is tokenized, and token encoding and position encoding are performed. A text encoder with pre-trained weights and a 1-layer FFN are used to construct a text data encoder to obtain the latent space feature vector V of the contract text data. txt .

[0084] Furthermore, based on the image data encoder and the text data encoder, a latent space mapping model of the contract image data and the contract text data is constructed.

[0085] Furthermore, the latent space feature vectors output by the image data encoder and the text data encoder are L2 regularized to obtain the cosine similarity formula:

[0086] The latent space feature vectors output by the image data encoder and the text data encoder are processed by 2-paradigm respectively to obtain the Tanimoto coefficient formula:

[0087] According to the cosine similarity formula and the Tanimoto coefficient formula, the loss function of the latent space mapping model is obtained: Loss = β·Cos(V txt ,V img )+(1-β)Tan(V txt ,V img ), where β is the fusion weight of cosine similarity and Tanimoto coefficient, β∈[0,1].

[0088] As a feasible implementation method, Figure 2 A schematic diagram of a latent space mapping model architecture provided by an embodiment of the present invention is shown in FIG. Figure 2 As shown in Figure 2, the specific steps for constructing the latent space mapping model are as follows:

[0089] (2-1): Drawing on the idea of ​​CLIP contrastive learning, the contract image data is segmented into patches, then patch encoded and position encoded. Then, a 4-layer Transformer Encode with a self-attention mechanism as the core and a 1-layer FFN are used to construct an image data encoder to obtain the latent space feature vector V of the image data. img .

[0090] (2-2): Tokenize the text data, then encode it with tokens and positions, use CLIP text encoder with pre-trained weights and 1-layer FFN to build a text data encoder, and obtain the latent space feature vector V of the text data txt .

[0091] (2-3): One layer of FFN in the image data encoder and the text data encoder is used to ensure that the latent space feature vector V img and V txt The dimensions are the same.

[0092] (2-4): The weighted fusion of cosine similarity and Tanimoto coefficient is used as the loss function of the TI model.

[0093] S103, training a latent space mapping model using a model training data set, and obtaining a general text data encoder and a general image data encoder based on a model verification result.

[0094] Specifically, the training set in the first data set is input into the latent space mapping model, and the mapping relationship between the contract text data and the contract image data is trained to obtain a trained latent space mapping model.

[0095] Furthermore, the test set in the first data set is input into the latent space mapping model to verify the accuracy of the mapping relationship between the contract text data and the contract image data, and the weights of the text data encoder and the image data encoder that meet the accuracy requirements are saved to obtain a universal text data encoder and a universal image data encoder.

[0096] As a feasible implementation method, the training set in the first data set is sent to the latent space mapping model, and the training method learning rate change strategy adopts warmup. After 100 rounds of training, the mapping relationship between the contract text data and the contract image data is finally obtained, and a trained latent space mapping model is obtained. Then the test set in the first data set is sent to the model to verify the accuracy of the mapping relationship between the contract text data and the contract image data. The weights of the text data encoder and the image data encoder that meet the accuracy requirements are saved to obtain a universal text data encoder and image data encoder.

[0097] S104: construct a large language model for contract extraction based on a general text data encoder and a general image data encoder.

[0098] Specifically, a data format differentiation module is constructed to divide the contract text data and the contract image data, and to call a universal text data encoder and a universal image data encoder.

[0099] Furthermore, based on the output vector of the general text data encoder or the general picture data encoder, a Prompt word encoder is constructed.

[0100] As a feasible implementation method, Figure 3 A schematic diagram of a Prompt word encoder structure provided by an embodiment of the present invention, such as Figure 3 As shown in the figure, the Prompt word encoder is constructed using a 2-layer Transformer Encode with a cross-attention mechanism as the core, where Q (query) and K (key) in the cross-attention mechanism come from the output of the general text data encoder or the general image data encoder, and V (value) comes from the output of the Prompt word encoder.

[0101] Furthermore, a base large language model is constructed, and the base large language model is fine-tuned through the low-rank fine-tuning strategy Lora module to transform the base large language model into a professional model suitable for contract information extraction.

[0102] As a feasible implementation method, Figure 4 A schematic diagram of a Lora fine-tuning base large language model structure provided by an embodiment of the present invention is shown in FIG. Figure 4 As shown in the figure, the low-rank fine-tuning strategy Lora is used to fine-tune the base large language model. The dimension reduction matrix A is initialized with a random Gaussian distribution, and the dimension increase matrix B is initialized with a 0 matrix to ensure that the matrix of the additional branch is still a zero matrix at the beginning of training. Through light fine-tuning, the large model is transformed into a professional model suitable for contract information extraction.

[0103] Furthermore, a post-processing module is constructed to process chart tasks.

[0104] The post-processing module is used to process chart tasks, such as Latex, official seal extraction, etc. If it is ordinary text, it will be output directly, Latex will be output as a table or excel, and the official seal will be output as a picture.

[0105] Finally, the data format distinction module, general text data encoder, general image data encoder, Prompt word encoder, Lora module, base large language model and post-processing module are combined into a large language model for contract information extraction.

[0106] The loss function of the multimodal contract information extraction large language model uses weighted KL divergence and MSE to measure the difference between the generated sample distribution and the real data distribution. The loss function is defined as: In the formula, y i is the real sample data, To generate sample data, N is the total amount of sample data, i is the sample label, i∈[1,N], θ is the dynamic weight, β∈[0,1].

[0107] As a feasible implementation method, Figure 5 A schematic diagram of a large language model structure for contract extraction provided by an embodiment of the present invention is shown in FIG. Figure 5 As shown in the figure, the contract text data and contract image data are respectively input into the contract text data encoder and the contract image data encoder for encoding after the data format differentiation module, and the output vector is input into the Prompt encoder for further encoding, and then input into the base large language model, and the base large language model is fine-tuned through the Lora module, and the processing results are input into the post-processing module to complete the information extraction. The module containing the "snowflake" logo is a weight freezing module, that is, the module only performs forward calculations and does not perform back propagation.

[0108] S105. Training the contract extraction large language model through the model training data set and verifying the accuracy of information extraction.

[0109] Specifically, the training sets in the second data set, the third data set, the fourth data set and the fifth data set are input into the large language model for contract information extraction, and only the prompt word encoder, the Lora module and the post-processing module in the large language model for contract information extraction are trained.

[0110] Furthermore, the test sets in the second data set, the third data set, the fourth data set and the fifth data set are input into the large language model for contract information extraction to verify the accuracy of the large language model for contract information extraction in extracting the required information in the contract document.

[0111] As a feasible implementation method, the training sets in the datasets D2, D3, D4, and D5 are sent to the large language model for contract information extraction, and only the prompt encoder, Lora module, and post-processing module are trained. The training method adopts warmup as the learning rate change strategy, and the training is repeated for 200 rounds to finally obtain a multimodal large language model for contract information extraction. Then the test sets in the datasets D2, D3, D4, and D5 are sent to the large language model for contract information extraction to verify the accuracy of the large language model for multimodal contract information extraction in extracting the required information in the contract document.

[0112] In addition, the embodiment of the present invention also provides a contract information extraction device based on a multimodal large language model, such as Figure 6 As shown, the contract information extraction device based on the multimodal large language model specifically includes:

[0113] at least one processor; and a memory in communication with the at least one processor; wherein,

[0114] The memory stores instructions executable by at least one processor to enable the at least one processor to perform:

[0115] Acquire contract data in different formats and construct a model training data set; wherein the contract data in different formats includes contract image data and contract text data; the model training data set includes a first data set, a second data set, a third data set, a fourth data set and a fifth data set;

[0116] Construct a latent space mapping model between contract image data and contract text data;

[0117] Training the latent space mapping model through the model training data set, and obtaining a universal text data encoder and a universal picture data encoder according to the model verification result;

[0118] Based on the universal text data encoder and the universal picture data encoder, construct a large language model for contract extraction;

[0119] The contract extraction large language model is trained using the model training data set, and the accuracy of information extraction is verified.

[0120] Each embodiment of the present invention is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and non-volatile computer storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0121] The above describes specific embodiments of the present invention. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0122] The above description is only an embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiments of the present invention should be included in the protection scope of the present invention.

Claims

1. A contract information extraction method based on a multimodal large language model, characterized in that: The method comprises: Acquire contract data in different formats and construct a model training data set; wherein the contract data in different formats includes contract image data and contract text data; the model training data set includes a first data set, a second data set, a third data set, a fourth data set and a fifth data set; Construct a latent space mapping model between contract image data and contract text data; Training the latent space mapping model through the model training data set, and obtaining a universal text data encoder and a universal picture data encoder according to the model verification result; Based on the universal text data encoder and the universal picture data encoder, construct a large language model for contract extraction; The contract extraction large language model is trained using the model training data set, and the accuracy of information extraction is verified.

2. According to claim 1, a method for extracting contract information based on a multimodal large language model is characterized in that: Obtain contract data in different formats and build a model training dataset, including: Performing standardization processing on the contract image data and the contract text data; The standardized contract image data is cropped according to a preset cropping rule to obtain contract image cropping data; the standardized contract text data is disassembled according to a preset disassembly rule to obtain contract text disassembly data; Aligning the contract image cropping data and the contract text disassembly data to obtain a first data set; Cut out the preset area image from the standardized contract image data, extract information, and construct the second data set and the third data set; Extract prompt words from the standardized contract image data and contract text data to construct a fourth data set and a fifth data set; The first data set, the second data set, the third data set, the fourth data set and the fifth data set are divided into training sets and test sets according to preset ratios to obtain the model training data set.

3. The method for extracting contract information based on a multimodal large language model according to claim 2, characterized in that: The preset area images are intercepted from the standardized contract image data, and information is extracted to construct the second data set and the third data set, which specifically include: Extract the table area image and the official seal area image from the standardized contract image data; By using the PPOCRLabel tool, the table area image is labeled as a first preset format text data using Latex as typeset; and the official seal area image is labeled as a second preset format text data containing company information; Extracting a first Prompt word from the first preset format text data; Extracting a second Prompt word from the second preset format text data; Constructing the table area image, the first preset format text data and the first Prompt word into a second data set; The official seal area image, the second preset format text data and the second Prompt word are constructed into a third data set.

4. The method for extracting contract information based on a multimodal large language model according to claim 2, characterized in that: The prompt words are extracted from the standardized contract image data and contract text data to construct the fourth data set and the fifth data set, which specifically include: Extracting a third prompt word from the standardized contract image data and the contract text data; The standardized contract image data, the third prompt word and the standardized contract text data are constructed into a fourth data set; The standardized contract text data and the third Prompt word are constructed into a fifth data set.

5. The method for extracting contract information based on a multimodal large language model according to claim 1, characterized in that: Construct a latent space mapping model between contract image data and contract text data, including: Patch segmentation is performed on the contract image data, and patch coding and position coding are performed; The Transformer Encode with self-attention mechanism as the core and the feedforward neural network FFN are used to construct the image data encoder to obtain the latent space feature vector V of the contract image data. img ; Tokenize the contract text data, and perform token encoding and position encoding; A text encoder with pre-trained weights and a feed-forward neural network FFN are used to construct a text data encoder to obtain the latent space feature vector V of the contract text data. txt ; According to the image data encoder and the text data encoder, a latent space mapping model of contract image data and contract text data is constructed.

6. The method for extracting contract information based on a multimodal large language model according to claim 5, characterized in that: The method further comprises: The latent space feature vectors output by the image data encoder and the text data encoder are L2 regularized to obtain the cosine similarity formula: The latent space feature vectors output by the image data encoder and the text data encoder are processed by 2-paradigm respectively to obtain the Tanimoto coefficient formula: According to the cosine similarity formula and the Tanimoto coefficient formula, the loss function of the latent space mapping model is obtained: Loss = β·Cos(V txt ,V img )+(1-β)Tan(V txt ,V img ), where β is the fusion weight of cosine similarity and Tanimoto coefficient, β∈[0,1].

7. The method for extracting contract information based on a multimodal large language model according to claim 1, characterized in that: The latent space mapping model is trained by the model training data set, and a universal text data encoder and a universal picture data encoder are obtained according to the model verification result, specifically including: Inputting the training set in the first data set into the latent space mapping model, training the mapping relationship between the contract text data and the contract image data, and obtaining a trained latent space mapping model; The test set in the first data set is input into the latent space mapping model to verify the accuracy of the mapping relationship between the contract text data and the contract image data, and the weights of the text data encoder and the image data encoder that meet the accuracy requirements are saved to obtain the universal text data encoder and the universal image data encoder.

8. The method for extracting contract information based on a multimodal large language model according to claim 1, characterized in that: Based on the universal text data encoder and the universal image data encoder, a large language model for contract extraction is constructed, which specifically includes: Constructing a data format distinguishing module for distinguishing the contract text data and the contract image data, and calling the universal text data encoder and the universal image data encoder; Based on the output vector of the general text data encoder or the general image data encoder, construct a Prompt prompt word encoder; Construct a base large language model, and fine-tune the base large language model through the low-rank fine-tuning strategy Lora module to transform the base large language model into a professional model suitable for contract information extraction; Build a post-processing module to handle chart tasks; The data format differentiation module, the universal text data encoder, the universal picture data encoder, the Prompt word encoder, the Lora module, the base large language model and the post-processing module are combined into the contract information extraction large language model.

9. The method for extracting contract information based on a multimodal large language model according to claim 1, characterized in that: The contract extraction large language model is trained using the model training data set, and the accuracy of information extraction is verified, specifically including: Input the training sets in the second data set, the third data set, the fourth data set and the fifth data set into the large language model for contract information extraction, and only train the prompt word encoder, the Lora module and the post-processing module in the large language model for contract information extraction; The test set among the second data set, the third data set, the fourth data set and the fifth data set is input into the large language model for contract information extraction to verify the accuracy of the large language model for contract information extraction in extracting the required information in the contract document.

10. A contract information extraction device based on a multimodal large language model, characterized in that: The device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, so that the at least one processor can execute the contract information extraction method based on a multimodal large language model according to any one of claims 1-9.

Citation Information

Patent Citations

  • Contract text image key information extraction system and method based on joint pre-training

    CN112329767A

  • Two-stage image multi-task processing method based on function module

    CN117095231A

  • Multi-modal large model implementation method and system for organizational knowledge management

    CN117709356A

  • Systems and methods for vision-language model instruction tuning

    US20240160858A1

Cited By

  • Pre-training data set construction method, training method, equipment, medium and product

    CN119272059A

  • Receipt identification method, apparatus and device, and medium

    CN119418350A

  • Contract semantic comparison method and system based on multi-modal model

    CN120087373A

  • LoRA-based large model task optimization adjustment method and system

    CN120106165A

  • Intelligent contract auditing method and device based on multi-modal large model and medium

    CN120524239A