Judicial text relation extraction method based on prompt tuning
By using pre-trained models in judicial texts and designing prompt templates for the judicial field to perform relationship extraction, the problem of traditional technology in identifying implicit semantic relationships and lack of annotated data is solved, and efficient and accurate judicial text relationship extraction is achieved.
Patent Information
- Application Number
- CN202410704846.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-03
- Publication Date
- 2024-08-30
AI Technical Summary
Traditional relation extraction technology is difficult to identify and parse implicit semantic relations when processing judicial texts with dense professional terms and complex grammatical structures, and its performance drops sharply when it lacks the support of a large amount of annotated data, especially in the judicial field where high-quality annotated data is scarce and costly. high.
Adopt a prompt optimization method based on pre-training models to design prompt templates for the judicial field. By splitting sentences into conditional functions and designing unary and binary function prompt templates, combined with logical rules and learnable tokens, a complete task is formed Tip, put it into the pre-trained model for relationship extraction.
It improves the accuracy of judicial text relationship extraction, significantly reduces the reliance on a large amount of annotated data, and improves efficiency and accuracy.
Smart Images

Figure CN118568200A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of natural language processing, and in particular relates to a judicial text relationship extraction method based on prompt tuning. Background Art
[0002] Traditional relationship extraction techniques usually rely on rule-driven or feature-based machine learning methods. Although these methods can achieve high accuracy on specific data sets, they often encounter many challenges when dealing with judicial texts that are densely packed with professional terms and have complex grammatical structures. For example, existing technologies are often unable to effectively identify and parse implicit semantic relationships in texts, such as the connection between case relevance and legal facts. In addition, the performance of existing methods drops sharply without the support of a large amount of annotated data, especially in the judicial field, where high-quality annotated data is not only scarce but also costly. Summary of the invention
[0003] The present invention relates to a method for relation extraction based on judicial text. The technology uses a judicial text dataset and a method for prompt tuning using a pre-trained model to achieve relation extraction of judicial text. By utilizing the powerful language understanding ability of a large-scale pre-trained model, a prompt template for the judicial field is designed to guide the model to more effectively capture and understand key information in legal texts. This method not only improves the accuracy of relation extraction, but also significantly reduces the reliance on a large amount of annotated data.
[0004] The technical solution adopted by the present invention is:
[0005] A judicial text relation extraction method based on prompt tuning includes the following steps
[0006] S1. Split the sentence and convert it into a conditional function. Use logical rules to divide a simple sentence into several parts. According to semantics, for a relation extraction task, we convert the sentence into a series of conditional function calculations. Relation functions are divided into two categories: unary functions and binary functions. Specifically, in the relation extraction task, a sentence is represented as x = {…e s …e o …}, where e s and e o They are the subject entity and the object entity. First, we set a unary function for the subject entity and the object entity. and To determine the subject s and object e o For the relationship between the subject entity and the object entity, set the binary function To represent the relationship between two entities.
[0007] S2. Design corresponding prompt templates for conditional functions, design prompt templates for unary functions and binary functions respectively:
[0008]
[0009] [MASK] is a learnable token, whose parameters are randomly initialized. The prompt templates of the unary and binary functions of all the parts of the sentence after splitting are obtained according to the prompt templates;
[0010] S3. Combine the parts of the sentence into a complete task prompt. Connect the prompt templates of all conditional functions related to the sentence logic rules. The complete prompt template is as follows:
[0011]
[0012] Among them, [·;·;·] is the prompt aggregation function. The aggregated tag word set example is as follows:
[0013] V [MASK]1 ={"person","object",…}
[0014] V_["MASK"]2={"stole"┤|"wasassistedby"…}
[0015] V [MASK]3 ={"object","person",…}
[0016] To make the template more effective, some learnable tokens are added in the middle of the template, and its parameters are randomly initialized.
[0017] S4. Put the task prompt into the pre-trained model to complete the relationship extraction. The aggregated template has multiple [MASK] tokens that need to be predicted, so the final learning goal of the pre-trained model is to maximize:
[0018]
[0019] Where X is the instance set, n is the number of [MASK], φ j (y) is the label word set V that will be mapped to the jth blocked word [MASK]j .
[0020] The beneficial effect of the present invention is that, compared with traditional methods, the present invention reduces the reliance on a large amount of annotated data while improving the efficiency and accuracy of judicial text relationship extraction. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is a work flow chart of the present invention.
[0022] Figure 2 It is a schematic diagram of the overall prompt framework of the embodiment. DETAILED DESCRIPTION
[0023] The present invention is described in detail below in conjunction with the accompanying drawings:
[0024] The workflow of the present invention is as follows Figure 1 As shown. First, the simple sentence is divided into several parts through logical rules, and each part is converted into a corresponding relational function. Then, each part is converted into a prompt according to the designed relational function prompt template, and then they are connected together and a learnable token is added to form the final task prompt. Finally, the task prompt is put into the pre-trained model to obtain the relation extraction result.
[0025] Example:
[0026] The overall prompt framework of this example is as follows Figure 2 As shown, the specific steps include:
[0027] S1. Split the sentence and convert it into a relational function. Get the judicial text "Zhang illegally tookaway a laptop." and divide it into three parts: "Zhang", "illegally took away", and "laptop", and convert them into conditional functions:
[0028]
[0029] S2. Design a corresponding prompt template for the conditional function. and The prompt templates corresponding to the unary relational function are “the[MASK]Zhang”, “the[MASK]laptop”; The prompt template corresponding to the binary function is "Zhang[MASK]laptop".
[0030] S3. Combine the parts of the sentence into a complete task prompt. and Connect them to form "the[MASK]Zhang[MASK]the[MASK]laptop", and add a learnable token in the middle, and finally form a task prompt like Figure 2 shown.
[0031] S4. Put the task prompt into the pre-trained model to complete the relation extraction. Finally, the final relation extraction result of "Zhang illegally tookaway a laptop" is "steal".
Claims
1. A judicial text relation extraction method based on prompt tuning, characterized in that: The following steps are involved: S1. Split the judicial text sentences and convert them into conditional functions. Specifically, simple sentences are divided into several parts through logical rules, and a relationship extraction task is converted into the calculation of conditional functions according to semantics. The definition method of conditional functions is: Suppose the sentence is represented by x = {…e s …e o …}, where e s and e o They are subject entity and object entity respectively, and unary functions are set for subject entity and object entity and To determine the subject s and object e o Type, set the binary function To express the subject s and object e o the relationship between; S2. Design prompt templates for univariate functions and binary functions respectively: [MASK] is a learnable token, whose parameters are randomly initialized. The prompt templates of the unary and binary functions of all the parts of the sentence after splitting are obtained according to the prompt templates; S3. Combine the parts of the sentence and connect all the prompt templates of the conditional functions related to the sentence logic rules to get the complete task prompt, which is expressed as: Among them, [·;·;·] is the prompt aggregation function, which sets the corresponding label word according to the sentence content; S4. Put the task prompt into the pre-trained model to complete the relationship extraction, where the training of the pre-trained model is achieved by maximizing the objective function: Where X is the instance set, n is the number of [MASK], φ j (y) is the label word set V that will be mapped to the jth blocked word [MASK]j .
Citation Information
Patent Citations
Network space knowledge extraction method and device based on rule enhancement prompt learning
CN117391083A
