Contract text desensitization method, system and equipment based on large language model, medium and product

By combining named entity recognition technology with regular expressions and large language models, the problem of identifying privacy data in multiple formats in contract text is solved, efficient and accurate desensitization of privacy data is achieved, and processing speed and accuracy is improved.

CN118940314APending Publication Date: 2024-11-12SHANGHAI OUYE FINANCIAL INFORMATION SERVICE CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411050608.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-01
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

The prior art is inefficient and low accuracy when identifying and desensitizing sensitive privacy information in contract texts, especially when facing multiple formats and types of privacy data, traditional methods are difficult to effectively handle.

Method used

Using a method based on a large language model, combining regular expressions and named entity recognition model, training the large language model through training samples, identifying and replacing fixed format privacy data and named entities in the contract text, and using random data for anonymization .

Benefits of technology

Significantly improves the accuracy and efficiency of desensitization of privacy data, reduces manual review time, reduces costs, and can handle contract documents in a variety of formats, including text, scanned copies and image files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118940314A_ABST
    Figure CN118940314A_ABST
Patent Text Reader

Abstract

The invention discloses a contract text desensitization method, system and device based on a large language model, a medium and a product, and relates to the field of data processing.The method comprises the steps that a to-be-desensitized contract file is converted into a text form, and a to-be-desensitized contract text is obtained; using a first set regular expression to identify fixed format privacy data in the contract text to be desensitized, and using a named entity identification model to identify a named entity in the contract text to be desensitized; the named entity recognition model is obtained by training a large language model by using a training sample; the training sample comprises contract text sample data and a corresponding named entity sample; and replacing the identified fixed format privacy data and the identified named entity in the to-be-desensitized contract text by using the random data to obtain a desensitized contract text. According to the method, the desensitization efficiency and accuracy of the contract text can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a contract text desensitization method, system, device, medium and product based on a large language model. Background Art

[0002] Nowadays, some companies are faced with the challenge of processing a large amount of sensitive privacy information when using contract text data, such as personal privacy data (such as name, ID number, telephone number, home address, etc.) and company commercial confidential data (including contract amount, customer information, account number and subject matter involved, etc.). In order to ensure information security, it is usually necessary to desensitize the contract text. However, due to the existence of various formats and types of privacy data in the contract text, traditional desensitization methods often face the problem of difficult identification. Currently, common desensitization methods include manual recognition and pattern matching, but they all have certain limitations: manual recognition is costly, inefficient and difficult to combine with information systems; pattern matching can only recognize privacy data in a specific format (such as ID number, account number), the recognition type is single, and the accuracy is not high. Summary of the invention

[0003] The purpose of this application is to provide a contract text desensitization method, system, device, medium and product based on a large language model to solve the problems of low efficiency and low accuracy of contract text desensitization.

[0004] To achieve the above objectives, this application provides the following solutions:

[0005] In a first aspect, the present application provides a contract text desensitization method based on a large language model, and the contract text desensitization method based on a large language model includes:

[0006] Convert the contract file to be desensitized into text form to obtain the contract text to be desensitized;

[0007] Using a first set regular expression to identify fixed-format privacy data in the contract text to be desensitized;

[0008] A named entity recognition model is used to identify named entities in the contract text to be desensitized; the named entity recognition model is obtained by training a large language model using training samples; the training samples include contract text sample data and corresponding named entity samples;

[0009] The fixed-format privacy data and the identified named entities in the desensitized contract text are replaced with random data to obtain the desensitized contract text; the format of the random data is consistent with the format of the identified fixed-format privacy data and the identified named entities.

[0010] Optionally, the fixed-format privacy data in the contract text to be desensitized is identified by using the first set regular expression, specifically including:

[0011] Using the second set regular expression to identify blank characters and line breaks in the contract text to be desensitized, and removing the identified blank characters and line breaks to obtain a preprocessed contract text to be desensitized;

[0012] The first set regular expression is used to identify the fixed-format privacy data in the pre-processed contract text to be desensitized.

[0013] Optionally, after obtaining the desensitized contract text, the method further includes: restoring the removed blank characters and line breaks to obtain the desensitized contract text that is consistent with the format of the contract text to be desensitized.

[0014] Optionally, the first regular expression is constructed based on format features of fixed-format privacy data; the format features include string length, character type, and character position relationship.

[0015] Optionally, the training process of the named entity recognition model specifically includes:

[0016] Acquire contract text sample data, preprocess the contract text sample data, and use the preprocessed contract text sample data as training samples;

[0017] Inputting the training sample into a large language model and outputting a predicted named entity;

[0018] A loss function is constructed according to the predicted named entity and the named entity sample, and the network parameters of the large language model are adjusted by the loss function to obtain the named entity recognition model.

[0019] Optionally, the large language model is InternLM2-Chat-20B or Qwen1.5-32B.

[0020] In a second aspect, the present application provides a contract text desensitization system based on a large language model, and the contract text desensitization system based on a large language model includes:

[0021] A text form conversion module is used to convert the contract file to be desensitized into a text form to obtain the contract text to be desensitized;

[0022] A fixed format privacy data identification module, used to identify the fixed format privacy data in the contract text to be desensitized by using a first set regular expression;

[0023] A named entity recognition module is used to identify named entities in the contract text to be desensitized using a named entity recognition model; the named entity recognition model is obtained by training a large language model using training samples; the training samples include contract text sample data and corresponding named entity samples;

[0024] The contract text desensitization module is used to replace the fixed-format privacy data and the identified named entities in the contract text to be desensitized with random data, so as to desensitize the contract text to be desensitized and obtain the desensitized contract text; the format of the random data is consistent with the format of the identified fixed-format privacy data and the identified named entities.

[0025] In a third aspect, the present application provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of any one of the above-mentioned contract text desensitization methods based on a large language model.

[0026] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above-mentioned contract text desensitization methods based on a large language model.

[0027] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of any of the above-mentioned contract text desensitization methods based on a large language model.

[0028] According to the specific embodiments provided in this application, this application discloses the following technical effects:

[0029] The present application provides a contract text desensitization method, system, device, medium and product based on a large language model, which combines regular expressions and a privacy data identification method based on a large model to improve the accuracy of privacy data desensitization; in addition, the automated privacy data identification and desensitization process greatly improves the speed of processing contract documents, reduces the time consumption of manual review, and improves identification efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0031] Figure 1This is an application environment diagram of a contract text desensitization method based on a large language model in one embodiment of the present application;

[0032] Figure 2 A flowchart of a method for desensitizing a contract text based on a large language model provided in one embodiment of the present application;

[0033] Figure 3 A schematic diagram of functional modules of a contract text desensitization system based on a large language model provided in one embodiment of the present application;

[0034] Figure 4 A schematic diagram of the structure of a computer device provided in one embodiment of the present application.

[0035] Reference numerals:

[0036] Terminal-102, server-104, text form conversion module-1, fixed format privacy data identification module-2, named entity recognition module-3, contract text desensitization module-4. DETAILED DESCRIPTION

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

[0038] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0039] In the field of natural language processing, there is a task called named entity recognition, but it mainly uses small models with poor recognition results. It can usually only recognize limited types of data with low accuracy. In contrast, large language models have stronger context understanding, better recognition ability and stronger generalization ability with more complex structures and more extensive training data. Therefore, this application applies large language models to the identification of privacy data in data desensitization, significantly improving the recognition accuracy.

[0040] The contract text desensitization method based on a large language model provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be set up separately, integrated on the server 104, or placed on the cloud or other servers. The terminal 102 can send the contract file to be desensitized to the server 104. After the server 104 receives the contract file to be desensitized, for the contract file to be desensitized, the server 104 converts the contract file to be desensitized into a text form to obtain the contract text to be desensitized; the fixed format privacy data in the contract text to be desensitized is identified by using a first set regular expression; the named entity recognition model is used to identify the named entities in the contract text to be desensitized; the named entity recognition model is obtained by training a large language model using training samples; the training samples include contract text sample data and corresponding named entity samples; the fixed format privacy data and the identified named entities in the contract text to be desensitized are replaced by random data to obtain the desensitized contract text; the format of the random data is consistent with the format of the identified fixed format privacy data and the identified named entities. The server 104 can feed back the desensitized contract text to the terminal 102. In addition, in some embodiments, the contract text desensitization method based on the large language model can also be implemented by the server 104 or the terminal 102 alone, such as the terminal 102 can directly perform contract text desensitization based on the large language model on the contract file to be desensitized, or the server 104 can obtain the contract file to be desensitized from the data storage system and perform contract text desensitization based on the large language model on the contract file to be desensitized.

[0041] The terminal 102 may be, but is not limited to, various desktop computers, laptop computers, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart vehicle-mounted devices, etc. The portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers, or may be a cloud server.

[0042] In an exemplary embodiment, Figure 2 As shown, a contract text desensitization method based on a large language model is provided. The method is executed by a computer device, and can be executed by a computer device such as a terminal or a server alone, or by a terminal and a server together. In the embodiment of the present application, the method is applied to Figure 1 The server 104 in the example is used as an example to illustrate the method, which includes the following steps S1 to S4. Among them:

[0043] Step S1, converting the contract document to be desensitized into text form to obtain the contract text to be desensitized.

[0044] Specifically, the contract files to be desensitized in different formats (such as doc, pdf, and pictures) are loaded and converted into text form. Among them, through optical character recognition (OCR) technology, the scanned PDF and picture format contract files can be converted into directly readable text.

[0045] Step S2, using the first set regular expression to identify fixed-format privacy data in the contract text to be desensitized, wherein the fixed-format privacy data includes data with fixed formats such as ID card number, telephone number, business license, bank account number, tax number and email address.

[0046] As an optional implementation, in step S2, the fixed-format privacy data in the contract text to be desensitized is identified using the first set regular expression, specifically including:

[0047] Step S21, using the second set regular expression to identify the blank characters and line breaks in the contract text to be desensitized, and removing the identified blank characters and line breaks to obtain the pre-processed contract text to be desensitized.

[0048] Step S22: using the first set regular expression to identify the fixed-format privacy data in the pre-processed contract text to be desensitized.

[0049] Specifically, in step S21, in the contract text, invalid characters mainly include blank characters (such as spaces, tabs) and line breaks, and these invalid characters need to be identified by the second set regular expression.

[0050] Whitespace characters include space, tab, newline, carriage return, etc. These characters are usually matched using the second regular expression \s.

[0051] Newline characters include: \n for line feed and \r for carriage return. These characters can be processed separately to ensure that all formats of newline characters are recognized.

[0052] During the recognition process, it is necessary not only to find these invalid characters, but also to record their positions and types in the contract text. This is mainly to be able to accurately restore the positions and types of these characters in the subsequent text restoration process. The method of recording the positions can create a list to store the specific position and type of each invalid character.

[0053] In step S22, a first set regular expression is created for the fixed format privacy data, wherein the first regular expression is constructed based on the format features of the fixed format privacy data; the format features include string length, character type, and character position relationship. The creation of the first set regular expression includes the following steps:

[0054] (1) Analyze data format

[0055] Identify the types of privacy data that need to be matched and analyze the specific format of each data. For example, social security numbers usually have a fixed length and a specific number / character combination pattern, and email addresses contain @ symbols and domain names.

[0056] (2) Feature extraction

[0057] Extract key features of each data type, such as length, character type (number, letter or symbol), and specific positional relationships. For example: ID number: 18 digits, of which the first 6 digits are the area code, the middle 8 digits are the date of birth, and the last 4 digits are the sequence code and check code; mobile phone number: Chinese mobile phone numbers are usually 11 digits, and the first three digits are the operator code.

[0058] (3) Constructing a regular expression pattern

[0059] A first set of regular expression patterns is constructed based on the extracted features. Common elements of the first set of regular expressions include:

[0060] \d: Matches any digit.

[0061] \w: Matches any letter or number.

[0062] [a-zA-Z0-9]: matches any letter or number.

[0063] {n}: Matches exactly n occurrences of the previous character.

[0064] *: Matches zero or more occurrences of the preceding character.

[0065] +: Matches one or more occurrences of the previous character.

[0066] \b: Matches a word boundary.

[0067] .: Matches any character (except newline).

[0068] For example, the first set regular expression corresponding to the business license is "\b[A-Z0-9]{15,18}\b", and the first set regular expression corresponding to the ID card number is "\b([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]\b". The first set regular expression is used to match the data in the contract text to be desensitized, and the corresponding type label is added to the matched fixed-format privacy data, and the position of the matched fixed-format privacy data in the original contract text is recorded; the privacy data that can be extracted includes ID card number, mobile phone number, bank account number, tax number and email address, etc.

[0069] Step S3, using a named entity recognition model to identify named entities in the contract text to be desensitized; the named entity recognition model is obtained by training a large language model using training samples; the training samples include contract text sample data and corresponding named entity samples. Named entities include names, company names, addresses, and contract subject matter, and can also be other named entity types, which are not limited here.

[0070] As an optional implementation, in step S3, the training process of the named entity recognition model specifically includes:

[0071] Step S31, acquiring contract text sample data, preprocessing the contract text sample data, and using the preprocessed contract text sample data as training samples.

[0072] Step S32: input the training sample into a large language model and output a predicted named entity.

[0073] Step S33, constructing a loss function according to the predicted named entity and the named entity sample, and adjusting the network parameters of the large language model by using the loss function to obtain the named entity recognition model.

[0074] Specifically, open source large language models such as InternLM2-Chat-20B and Qwen1.5-32B are used for private deployment and model training to obtain a named entity recognition model. Among them, the privately deployed large language model recognizes the complex format of private data (named entities) in the contract. When the privately deployed large language model reaches a certain scale, such as 20 billion parameters or more, its semantic understanding ability is sufficient to identify named entities in the contract text. The semantic input instructions accepted by the large language model are also called prompt words. The semantic named entity recognition prompt words are defined as follows: the large language model is required to process the given text and recognize: names of people, company names, addresses, contract subjects, etc. The format requirements are added to the prompt words (such as: "The output only contains json strings that can be directly parsed, with the following format: """{{"Named Entity Name":[value1,value2...valuen]}}""""), and the large language model is required to return these data in json format. Each type of data is returned in a separate array corresponding to its own type label; when requiring the large language model to return each recognized named entity, a fragment of the original text in the given contract text is strictly used.

[0075] The large language model uses prompts to understand tasks and generate results. In order to perform named entity recognition, specific prompts need to be designed to guide the model to recognize named entities in the contract text. Prompt design includes:

[0076] a) Clarify the task description: Tell the model that it needs to recognize names, company names, addresses, etc. in the contract text.

[0077] b) Example input and output: Provide some examples to help the model understand the task requirements.

[0078] Here is an example:

[0079] Input: Please identify the named entities in the following contract text:

[0080] Contract text: Party A (Zhang San) and Party B (Beijing XYZ Technology Co., Ltd.) signed a cooperation agreement, the address is Zhongguancun Street, Haidian District, Beijing.

[0081] Output: Name: Zhang San; Company name: Beijing XYZ Technology Co., Ltd.; Address: Zhongguancun Street, Haidian District, Beijing.

[0082] The pre-processed desensitized contract text and the designed prompt words are input into the big model. The model uses its internal language understanding and context processing mechanism to identify and classify named entities. The specific process is as follows:

[0083] 1) Semantic understanding: The model reads the input text and understands its semantics and context.

[0084] 2) Entity Recognition: The model recognizes named entities in the text, such as names of people, companies, addresses, etc.

[0085] 3) Entity classification: Classify the identified entities by category (person name, company name, address, etc.) and return the results organized in JSON format.

[0086] Step S4, using random data to replace the fixed-format privacy data and the identified named entities in the desensitized contract text to obtain the desensitized contract text; the format of the random data is consistent with the format of the identified fixed-format privacy data and the identified named entities.

[0087] Specifically, the identified fixed-format privacy data and named entities are replaced with anonymized data that conforms to the format and length of the original text. According to the fixed-format privacy data and named entities identified in step S2 and step S3 and their corresponding type labels, when generating random data, it is generated according to the format and length of the original text, such as: using an 18-digit randomly generated number to replace the ID number, a randomly generated address to replace the original address, and a random name to replace the original name. Since the fixed-format privacy data identified in step S2 contains its position information in the original text, the generated random data can be directly replaced with the corresponding position. In step S3, although the named entities identified by the large language model do not contain position information, the original text fragment is strictly intercepted. The position of the fragment in the original text can be found by string search and replaced with the generated random data, and finally the desensitized contract text is obtained, completing the desensitization of the original contract document.

[0088] As an optional implementation, after obtaining the desensitized contract text, it also includes: restoring the removed blank characters and line breaks to obtain the desensitized contract text that is consistent with the format of the contract text to be desensitized.

[0089] Specifically, since the random data replaced by anonymization in step S4 is of the same length as the original text, the blank characters and line breaks cleaned in step S21 can be restored to the desensitized contract text, and a contract text consistent with the format of the original contract document can be output.

[0090] Beneficial effects of this application:

[0091] 1) High efficiency: The automated identification and desensitization process greatly improves the speed of processing contract documents and reduces the time consumed by manual review.

[0092] 2) High precision: Combining the first set regular expression and the recognition method based on the language model improves the accuracy of privacy data detection.

[0093] 3) Low cost: The desensitization process is highly automated, which reduces dependence on professionals and reduces labor costs.

[0094] 4) Wide applicability: By privately deploying large models and using semantic prompts for named entity recognition, it can process contracts in various formats, including text, scanned documents, and image files, enhancing the ability to process complex formats and diverse privacy data, and improving versatility and applicability.

[0095] 5) During the desensitization process, ensure that the generated random data is consistent with the format and length of the original text, and restore the invalid characters that have been cleaned up to maintain the integrity and readability of the text.

[0096] 6) High confidentiality: The use of random data for anonymization ensures that the security of sensitive data is not violated.

[0097] Based on the same inventive concept, the embodiment of the present application also provides a contract text desensitization system based on a large language model for implementing the above-mentioned contract text desensitization method based on a large language model. The implementation scheme for solving the problem provided by the system is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in one or more embodiments of the contract text desensitization system based on a large language model provided below can refer to the limitations of the contract text desensitization method based on a large language model above, and will not be repeated here.

[0098] In an exemplary embodiment, Figure 3 As shown, a contract text desensitization system based on a large language model is provided, including:

[0099] The text form conversion module 1 is used to convert the contract file to be desensitized into a text form to obtain the contract text to be desensitized.

[0100] The fixed format privacy data identification module 2 is used to identify the fixed format privacy data in the contract text to be desensitized by using a first set regular expression.

[0101] The named entity recognition module 3 is used to identify named entities in the contract text to be desensitized using a named entity recognition model; the named entity recognition model is obtained by training a large language model using training samples; the training samples include contract text sample data and corresponding named entity samples.

[0102] The contract text desensitizing module 4 is used to replace the fixed-format privacy data and the identified named entities in the contract text to be desensitized with random data, so as to desensitize the contract text to be desensitized and obtain the desensitized contract text; the format of the random data is consistent with the format of the identified fixed-format privacy data and the identified named entities.

[0103] In an exemplary embodiment, a computer device is provided. The computer device may be a server or a terminal. The internal structure diagram thereof may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the contract files to be desensitized. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a contract text desensitization method based on a large language model is implemented.

[0104] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components. In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0105] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0106] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0107] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0108] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0109] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.

[0110] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0111] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application; at the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.

Claims

1. A contract text desensitization method based on a large language model, characterized in that: The contract text desensitization method based on the large language model includes: Convert the contract file to be desensitized into text form to obtain the contract text to be desensitized; Using a first set regular expression to identify fixed-format privacy data in the contract text to be desensitized; A named entity recognition model is used to identify named entities in the contract text to be desensitized; the named entity recognition model is obtained by training a large language model using training samples; the training samples include contract text sample data and corresponding named entity samples; The fixed-format privacy data and the identified named entities in the desensitized contract text are replaced with random data to obtain the desensitized contract text; the format of the random data is consistent with the format of the identified fixed-format privacy data and the identified named entities.

2. The contract text desensitization method based on a large language model according to claim 1 is characterized in that: The first set regular expression is used to identify the fixed-format privacy data in the contract text to be desensitized, specifically including: Using the second set regular expression to identify blank characters and line breaks in the contract text to be desensitized, and removing the identified blank characters and line breaks to obtain a preprocessed contract text to be desensitized; The first set regular expression is used to identify the fixed-format privacy data in the pre-processed contract text to be desensitized.

3. The contract text desensitization method based on a large language model according to claim 2 is characterized in that: After obtaining the desensitized contract text, the method further includes: restoring the removed blank characters and line breaks to obtain the desensitized contract text consistent with the format of the contract text to be desensitized.

4. The contract text desensitization method based on a large language model according to claim 1 is characterized in that: The first regular expression is constructed based on the format features of the fixed-format privacy data; the format features include string length, character type, and character position relationship.

5. The contract text desensitization method based on a large language model according to claim 1 is characterized in that: The training process of the named entity recognition model specifically includes: Acquire contract text sample data, preprocess the contract text sample data, and use the preprocessed contract text sample data as training samples; Inputting the training sample into a large language model and outputting a predicted named entity; A loss function is constructed according to the predicted named entity and the named entity sample, and the network parameters of the large language model are adjusted by the loss function to obtain the named entity recognition model.

6. The contract text desensitization method based on a large language model according to claim 1 is characterized in that: The large language model is InternLM2-Chat-20B or Qwen1.5-32B.

7. A contract text desensitization system based on a large language model, characterized in that: The contract text desensitization system based on the large language model includes: A text form conversion module is used to convert the contract file to be desensitized into a text form to obtain the contract text to be desensitized; A fixed format privacy data identification module, used to identify the fixed format privacy data in the contract text to be desensitized by using a first set regular expression; A named entity recognition module is used to identify named entities in the contract text to be desensitized using a named entity recognition model; the named entity recognition model is obtained by training a large language model using training samples; the training samples include contract text sample data and corresponding named entity samples; The contract text desensitization module is used to replace the fixed-format privacy data and the identified named entities in the contract text to be desensitized with random data, so as to desensitize the contract text to be desensitized and obtain the desensitized contract text; the format of the random data is consistent with the format of the identified fixed-format privacy data and the identified named entities.

8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the contract text desensitization method based on a large language model as described in any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the contract text desensitization method based on a large language model described in any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the contract text desensitization method based on a large language model described in any one of claims 1 to 6 is implemented.

Citation Information

Cited By

  • Method and device for processing electronic document containing sensitive data, equipment and medium

    CN119862859A

  • Writing auxiliary method and device fusing semantic retrieval and large model and electronic equipment

    CN120492477A

  • Fusion semantic retrieval and large model writing assistance method, device and electronic equipment

    CN120492477B

  • Learning corpus making method and system for text sensitive information protection and computer readable storage medium

    CN121503657A