Intelligent litigation case identification method and system based on RAG and knowledge graph

By optimizing the pre-trained text embedding model and contrastive learning method, and combining knowledge graphs and large language models, the accuracy problems of entity recognition and knowledge retrieval in litigation cases were solved, and efficient structured information extraction and output were achieved.

CN120542404BActive Publication Date: 2025-11-21STATE GRID GANSU ELECTRIC POWER CO LANZHOU POWER SUPPLY CO
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202511036802.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-28
Publication Date
2025-11-21
Estimated Expiration
2045-07-28

AI Technical Summary

Technical Problem

Existing technologies for legal text processing suffer from insufficient modeling of technical terms and logical reasoning, resulting in low accuracy in entity identification in litigation cases and a disconnect between the context and knowledge retrieval results, thus affecting the accuracy of the output.

Method used

By optimizing the parameters of the pre-trained text embedding model, combining contrastive learning methods for entity matching and semantic aggregation, constructing a multi-factor scoring mechanism, utilizing knowledge graphs for entity matching and contextual corpus construction, and introducing a large language model for structured recognition.

Benefits of technology

It improves the accuracy of entity identification in litigation cases and the contextual consistency of knowledge retrieval, enhancing the professional credibility and accuracy of the output.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120542404B_ABST
    Figure CN120542404B_ABST
Patent Text Reader

Abstract

The application discloses an intelligent litigation case identification method and system based on RAG and a knowledge graph, relates to the technical field of litigation case identification, and comprises the following steps: performing semantic vectorization processing on litigation case texts based on a pre-trained text embedding model, and outputting a semantic vector sequence; performing similarity matching on the semantic vector sequence and obtained knowledge graph entity vectors, obtaining related graph entities, and constructing context corpus blocks corresponding to the litigation case texts; inputting the context corpus blocks into a large language model, identifying elements of the litigation case through structured prompt words, and outputting structured case information. The application is used to solve the problems of low entity recognition accuracy and disconnection of knowledge retrieval results in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of litigation case identification technology, and more specifically, to an intelligent litigation case identification method based on RAG and knowledge graph. Background Technology

[0002] Currently, in fields such as intelligent justice and legal technology, the structured processing and element identification of litigation case texts are of significant practical importance. Especially in scenarios such as case prediction, compliance analysis, and precedent recommendation, accurately and systematically extracting structured information from original case materials has become a key technical challenge.

[0003] While Large Language Models (LLMs) perform exceptionally well in natural language processing, they still face challenges in handling legal texts, such as insufficient understanding of technical terminology and difficulties in modeling logical structures, which limits the credibility and interpretability of their outputs. In recent years, knowledge graph-based semantic augmentation and retrieval-enhanced generation (RAG) methods have emerged as areas for improvement, enhancing the recognition of structured information by introducing external knowledge.

[0004] For example, the invention patent announcement CN118885627A discloses a multi-turn dialogue processing method and system based on RAG and knowledge graph. This method can effectively align user intent with response text while reducing interaction. Specifically, the method includes: retrieving and identifying entities associated with the user question based on a proprietary knowledge graph to obtain associated entities, constructing inference links, and converting them into inference text sequences; retrieving text, image, and audio data related to the user question through a multimodal large model to obtain relevant multimodal data; integrating the relevant multimodal data, the current inference text sequence, the user question, and the generated response text as model input, inputting them into the multimodal large model to obtain the model's response; filtering out relevant multimodal data, using the filtered multimodal data as context, and the question to be processed together as model input to the multimodal large model to obtain the response text corresponding to the question to be processed.

[0005] The above-disclosed technical solutions have at least the following technical problems:

[0006] In practical application in the legal field, on the one hand, legal scenarios have extremely high requirements for accuracy and controllability, but current solutions still have shortcomings in areas such as professional terminology modeling and logical reasoning chain construction, resulting in low accuracy in identifying the subject matter of litigation cases; on the other hand, the strict logical connections of legal texts make the problem of contextual disconnect in knowledge retrieval results more significant, making it difficult to effectively integrate retrieval fragments and affecting the accuracy of the output.

[0007] To address the above problems, this invention proposes a solution. Summary of the Invention

[0008] To overcome the aforementioned deficiencies of the prior art, embodiments of the present invention provide an intelligent litigation case recognition method based on RAG and knowledge graph. By optimizing the parameters of the pre-trained text embedding model, constructing a multi-factor scoring mechanism for entity matching, and generating semantically aggregated contextual corpus blocks, the method solves the problems of low entity recognition accuracy and disconnect between knowledge retrieval results and context in existing methods.

[0009] To achieve the above objectives, the present invention provides the following technical solution:

[0010] A method for intelligent litigation case recognition based on RAG and knowledge graph includes the following steps: S1, semantically vectorizing the litigation case text based on a pre-trained text embedding model to output a semantic vector sequence; S2, performing similarity matching between the semantic vector sequence and the obtained knowledge graph entity vectors to obtain relevant graph entities and constructing a contextual corpus block corresponding to the litigation case text; S3, inputting the contextual corpus block into a large language model, identifying the elements of the litigation case through structured prompt words, and outputting structured case information.

[0011] In a preferred embodiment, before performing semantic vectorization on the litigation case text, the process further includes text cleaning and semantic segmentation of the litigation case text.

[0012] In a preferred embodiment, the semantic vector sequence is obtained through the following steps: S11, entity recognition and subclass labeling are performed on the input case text using predefined hierarchical legal entity labels in the knowledge graph to obtain case labeled corpus; S12, semantic contrast triples containing positive and negative samples are constructed based on the labeled corpus to obtain a training dataset for contrastive learning; S13, the parameters of the pre-trained text embedding model are optimized using a contrastive learning method to make the semantic vectors of similar entity statements close together and the semantic vectors of dissimilar statements separate, thus obtaining the case semantic vector sequence.

[0013] In a preferred embodiment, the steps of optimizing the parameters of the pre-trained text embedding model using the contrastive learning method are as follows: using the pre-trained Chinese text embedding model to vectorize the semantic contrastive triples to obtain triple sentence vectors; constructing a loss function based on the triple sentence vectors; and using the AdamW optimizer to iteratively update the model parameters based on the loss function to obtain the optimized pre-trained text embedding model.

[0014] In a preferred embodiment, the step of matching the semantic vector sequence with the acquired knowledge graph entity vectors to obtain relevant graph entities specifically involves: calculating the similarity between the semantic vector sequence and the semantic vectors of entities in the knowledge graph to obtain candidate graph entities; scoring the candidate graph entities using a preset multi-factor scoring system, and sorting and filtering based on the scoring results to obtain semantically relevant graph entities; the multi-factor scoring system includes semantic similarity score, entity hierarchical path score, and entity connectivity.

[0015] In a preferred embodiment, the specific steps for obtaining the entity hierarchy path score are as follows: determine the path where the candidate entity is located based on the predefined entity hierarchy structure in the knowledge graph; calculate the entity hierarchy path score starting from the root node based on the number of hierarchy nodes contained in the path.

[0016] In a preferred embodiment, the specific steps for obtaining the entity connectivity degree are as follows: Based on the construction principles of the knowledge graph, define the connection relationship types between entities in the graph and assign a preset weight value to each relationship type; extract the core entity of the input case from the case annotation corpus as the target node for measuring the connection relationship; traverse the edge information of the candidate entity in the knowledge graph, determine whether the candidate entity has a defined connection relationship type with the target node, and if so, record the weight corresponding to the connection relationship type; for each candidate entity, sum the weights between it and all target nodes to obtain the entity connectivity degree of each candidate entity.

[0017] In a preferred embodiment, before constructing the contextual corpus block corresponding to the litigation case text, it is necessary to generate contextual corpus units. The specific steps are as follows: the original graph corpus text is vectorized using an optimized pre-trained text embedding model to obtain semantic representation vectors of entity corpora; the similarity between entities is calculated based on the semantic representation vectors, and an entity-related graph is constructed by combining the structural relationships in the knowledge graph; the entity-related graph is divided into communities using a graph clustering algorithm to obtain entity contextual corpus units; the original graph corpus text is obtained based on the knowledge graph entity mapping method.

[0018] In a preferred embodiment, before outputting the structured case information, the method further includes: constructing a multi-hop path index for the case target entity in a knowledge graph; verifying whether the identified field can be derived from the path structure; if the identified field is broken from the path, the identified field is marked as an unsupported item and removed.

[0019] An intelligent litigation case recognition system based on RAG and knowledge graph includes: a semantic representation generation module, a context corpus construction module, and a structured information recognition module; the semantic representation generation module performs semantic vectorization processing on the litigation case text based on a pre-trained text embedding model, and outputs a semantic vector sequence; the context corpus construction module performs similarity matching between the semantic vector sequence and the acquired knowledge graph entity vectors to obtain relevant graph entities, and constructs the context corpus block corresponding to the litigation case text; the structured information recognition module inputs the context corpus block into a large language model, identifies the elements of the litigation case through structured prompt words, and outputs structured case information.

[0020] The technical effects and advantages of the intelligent litigation case identification method and system based on RAG and knowledge graph of this invention are as follows:

[0021] 1. This invention improves the accuracy of legal entity recognition and semantic modeling by combining a pre-trained embedding model with a contrastive learning optimization mechanism, enabling the model to distinguish between semantically similar but legally different expressions, thereby enhancing the accuracy of mapping case texts to structured knowledge.

[0022] 2. This invention introduces a knowledge graph-driven entity aggregation and context construction mechanism, which integrates hierarchical paths, connections, and semantic similarities in the graph during entity matching. This enables automatic combination and abstract extraction of contextual information, effectively reducing the illusion phenomenon in the results generated by large language models and improving the professional credibility of structured recognition results. Attached Figure Description

[0023] Figure 1 This is a flowchart illustrating the intelligent litigation case identification method based on RAG and knowledge graph of the present invention.

[0024] Figure 2 This is a schematic diagram of the intelligent litigation case identification system based on RAG and knowledge graph of the present invention;

[0025] Figure 3 This is a training and validation loss curve for the parameter optimization process of the pre-trained text embedding model of the present invention.

[0026] Figure 4 This is a distribution diagram of the cosine similarity between the semantic vectors of positive and negative samples in this invention.

[0027] Figure 5 This is a clustering graph of t-distributed random neighborhood embedded statement vectors in this invention. Detailed Implementation

[0028] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0029] Example 1, Figure 1 The present invention provides an intelligent litigation case identification method based on RAG and knowledge graph, which includes the following steps.

[0030] S1, based on a pre-trained text embedding model, performs semantic vectorization processing on the litigation case text and outputs a semantic vector sequence.

[0031] In this embodiment, before performing semantic vectorization on the litigation case text, the method further includes text cleaning and semantic segmentation of the litigation case text, specifically:

[0032] For the input original litigation case text, text cleaning rules based on regular expressions are used to automatically delete the following content:

[0033] (1) Newline character ( ), tabs (\t), and consecutive extra spaces, etc., are typesetting characters;

[0034] (2) Fixed format information unrelated to the semantics of the case, such as page number identifiers (e.g., 'Page X of Y'), full name of the court (e.g., '×× People's Court'), and date stamps (e.g., 'January 1, 2024');

[0035] (3) Character encoding errors or unrecognizable garbled characters (such as non-printable characters with ASCII values ​​less than 32 or greater than 126);

[0036] During the cleaning process, the factual descriptions of the litigants, the judgments, and the relevant evidence texts are preserved to ensure the integrity of the core semantic content;

[0037] The cleaned text was segmented into sentences using a Chinese sentence segmentation tool, and divided into multiple semantic units according to semantic boundaries. For long and complex sentence structures common in the legal field, a dependency parser was further used to identify subject-predicate structure and subordinate relationships to achieve clause segmentation.

[0038] The system uses a Chinese word segmentation tool and loads a pre-built legal terminology dictionary to segment the text and annotate its parts of speech. The dictionary includes high-frequency terms in power grid company litigation, such as "power supply agreement," "property rights dispute," and "line relocation," thus improving the accuracy of word segmentation.

[0039] By combining rule templates with dictionary-based entity mapping methods, entities such as organization names, personal names, and place names appearing in the text are standardized and uniformly processed. For example, "XX Power Company" and "XX Power Supply Bureau" are uniformly mapped to "a certain power enterprise", reducing ambiguity.

[0040] In this embodiment, HanLP is used for Chinese sentence segmentation, and jieba is used for Chinese word segmentation to achieve semantic unit division and annotation of the input litigation case text. Through the above steps, structured preprocessing and semantic hierarchical expression of the input case text can be achieved, providing high-quality and dense semantic input units for subsequent accurate association with knowledge graphs and context construction.

[0041] Furthermore, the specific steps for obtaining the semantic vector sequence described in S1 are as follows:

[0042] S11. Using predefined hierarchical legal entity tags in the knowledge graph, entity recognition and subclass labeling are performed on the input case text to obtain the case-annotated corpus. First, a hierarchical entity tag system with legal semantic layers is extracted from the knowledge graph, including top-level tags such as "contract disputes," "tort liability," and "ownership," as well as subordinate second-level tags such as "equipment purchase and sale contract" and "line relocation liability." An entity recognition dictionary is constructed based on this tag system, and a BiLSTM-CRF model is used to perform named entity recognition on the input case text by combining word features and positional features. Subsequently, the identified entities are subclassified using rule templates and hierarchical logical relationships of tags, finally obtaining a fully annotated case corpus. For example, for "relocation disputes arising from equipment ownership issues," the tag "ownership" can be identified as "ownership disputes," and further refined into "line relocation liability."

[0043] S12, based on the labeled corpus, construct semantic contrastive triples containing positive and negative samples to obtain the training dataset for contrastive learning. The specific method is as follows:

[0044] Each labeled sentence serves as an anchor. From the corpus with the same label, a semantically similar positive sample is selected, and from the corpus with different labels, a semantically unrelated negative sample is selected, forming a (anchor, positive, negative) triple. For example, sentences A and B labeled "property disputes" are used as (anchor, positive sample), and sentence C labeled "construction disturbance disputes" which is semantically unrelated to it is selected as a negative sample, forming a training triple (A, B, C).

[0045] S13 employs a contrastive learning approach to optimize the parameters of the pre-trained text embedding model, bringing semantic vectors of similar entities closer together and separating semantic vectors of dissimilar entities, thus obtaining a sequence of semantic vectors for each case. Using the SimCSE architecture, the contrastive learning method selects the pre-trained Chinese language model RoBERTa-wwm-ext as the base embedding network. After inputting the aforementioned triples, vector calculation is performed, and the contrastive loss function is used to optimize the model parameters, resulting in convergence of semantic vector distances between similar statements and greater distances between vectors of dissimilar statements. After training, inputting any case text related to a power grid company will output a structured sequence of semantic vectors, serving as the basis for subsequent knowledge graph matching and contextual reasoning.

[0046] The contrastive learning method is used to optimize the parameters of the pre-trained text embedding model. The specific optimization steps are as follows:

[0047] S131, the pre-trained Chinese text embedding model RoBERTa-wwm-ext is used to encode semantic contrastive triples into vectors, resulting in triple sentence vectors. For anchor sentences within the contrastive triples... Positive Sample Sentences and negative sample sentences Obtain their sentence vector representations respectively:

[0048]

[0049] in, For anchor sentence vectors, For positive sample sentence vectors, For negative sample sentence vectors, This represents the [CLS] bit vector output by the pre-trained model.

[0050] S132, constructing the InfoNCE loss function based on triple sentence vectors. Positive samples are used as augmented replicas of anchor points, and negative samples are other instances in the training batch. The softmax similarity distribution is calculated using the following formula:

[0051]

[0052] in, For InfoNCE, compare the loss values. Represents cosine similarity. For any comparison sample sentence vector in the batch, that is, the sentence vectors of all samples in the current training batch, including positive samples and multiple negative samples. The temperature coefficient is set to 0.05.

[0053] S133 uses the AdamW optimizer to iteratively update the model parameters based on the loss function.

[0054] In this embodiment, the training cycle is set to 10 rounds, with 1000 triplet samples drawn in each round. The training batch size is set to 64, and the learning rate is 2e-5. Figure 3 As shown in the training and validation loss curves, the vertical axis represents the InfoNCE contrastive loss value, and the loss values ​​of the training and validation sets show a gradual decreasing trend; for example... Figure 4 As shown in the semantic vector cosine similarity distribution, after training, the cosine similarity of positive samples is concentrated above 0.8, while that of negative samples is concentrated below 0.3; for example... Figure 5 The results of t-distributed random neighborhood embedding (t-SNE) sentence vector clustering show that sample sentences with different legal tags cluster on a two-dimensional plane, indicating that the pre-trained Chinese text embedding model RoBERTa-wwm-ext has enhanced semantic extraction capabilities for legal texts after the above optimization.

[0055] Optimizing the pre-trained text embedding model using a contrastive learning approach can significantly improve the model's ability to distinguish fine-grained semantic differences in litigation cases, making the statement vectors of cases within the same legal entity category more aggregated and the statement vectors of different categories more separated.

[0056] The above steps, by introducing a training mechanism that compares positive and negative samples, enable the model to not only rely on contextual learning for embedding but also actively identify and determine semantic boundaries. This effectively solves the problems of semantic confusion and vector overlap in legally segmented entities in traditional embedding models. This makes the matching between semantic vectors and knowledge graph entities more accurate and the contextual recall results more targeted in subsequent steps, thereby significantly improving the accuracy and stability of overall case element identification and demonstrating good scalability and transferability.

[0057] S2, perform similarity matching between the semantic vector sequence and the obtained knowledge graph entity vector to obtain relevant graph entities, and construct the contextual corpus block corresponding to the litigation case text.

[0058] In this embodiment, the step of performing similarity matching between the semantic vector sequence and the acquired knowledge graph entity vectors to obtain relevant graph entities specifically involves:

[0059] Candidate graph entities are obtained by calculating the similarity between the semantic vector sequence and the semantic vector of the entity in the knowledge graph;

[0060] The candidate graph entities are scored using a pre-set multi-factor scoring system, and then sorted and filtered based on the scoring results to obtain semantically related graph entities.

[0061] The multi-factor scoring system includes semantic similarity score, entity hierarchical path score, and entity connectivity.

[0062] The specific steps for obtaining the semantic similarity score are as follows:

[0063] Based on the case semantic vector obtained in S1 Calculate its semantic vector with that of each entity in the knowledge graph. The cosine similarity score is calculated using the following formula:

[0064]

[0065] in, This represents the magnitude of the vector. A higher score indicates that the semantics of the case are closer to the semantics of the entity. Using this metric and a Top 10 strategy, the 10 entities in the knowledge graph with the highest similarity to the semantic vector of the case are selected as candidate graph entities.

[0066] The specific steps for obtaining the entity hierarchical path score are as follows:

[0067] Based on the predefined entity hierarchy structure in the knowledge graph, determine the path where the candidate entity is located;

[0068] Based on the number of hierarchical nodes d contained in the path, starting from the root node (level 0), calculate the entity hierarchy path score. L The specific calculation formula is as follows:

[0069]

[0070] Hierarchical path scores reflect the proximity of candidate entities to the root node within the graph structure, thus prioritizing the retention of candidate entities with more reasonable structural positions. For example, in the legal compliance knowledge graph, as shown in Table 1, the corresponding path depths are:

[0071] Candidate Entity A (Construction Contract Dispute): The path is "Legal Dispute -> Civil Dispute -> Contract Dispute -> Construction Contract Dispute", with a level depth of d=3 and a path score of 0.25;

[0072] Candidate Entity B (Road Property Dispute): The path is "Legal Dispute -> Civil Dispute -> Property Dispute -> Route Property Dispute", with a level depth of d=3 and a path score of 0.25;

[0073] Candidate Entity C (Civil Dispute): The path is "Legal Dispute -> Civil Dispute", the level depth is d=1, and the path score is 0.5.

[0074] Table 1

[0075]

[0076] The specific steps for obtaining the entity connectivity are as follows:

[0077] Based on the construction principles of knowledge graphs, we define the types of connection relationships between entities in the graph and assign preset weight values ​​to each type of relationship, as shown in Table 2.

[0078] Table 2

[0079]

[0080] Extract the core entities of the input case from the case annotation corpus, and use them as target nodes for measuring connection relationships;

[0081] Traverse the edge information of candidate entities in the knowledge graph, determine whether the candidate entity has a defined connection relationship type with the target node, and if so, record the weight corresponding to the connection relationship type;

[0082] For each candidate entity, the weights between it and all target nodes are summed to obtain the entity connectivity score for each candidate entity. C The specific formula is as follows:

[0083]

[0084] in, For candidate entity e and target node c k The connection weights between nodes, where K is the number of target nodes.

[0085] The step of traversing the edge information of candidate entities in the knowledge graph and determining whether a candidate entity has a defined connection relationship type with the target node specifically involves:

[0086] For each candidate entity, find its outgoing and incoming edges in the graph, that is, all connected adjacent nodes and edge types;

[0087] Determine whether any of these adjacent nodes contain the target node;

[0088] If a connection exists, its weight is recorded according to the type of the edge.

[0089] By introducing an entity connectivity scoring mechanism based on knowledge graph relationship types, the structural relevance between candidate graph entities and the case context can be effectively enhanced, avoiding semantic drift caused by relying solely on semantic similarity. This scoring strategy utilizes pre-defined legal domain-specific connections within the graph, such as legal citations, precedent attribution, and business processes, ensuring that the selected graph entities have a significant legal connection to the core content of the case. This improves the accuracy and semantic completeness of the contextual corpus construction, significantly enhancing the targeting and accuracy of subsequent case element identification.

[0090] Finally, for each candidate map entity, its comprehensive score is calculated by combining the three scoring indicators mentioned above. The specific weighted calculation formula is as follows:

[0091]

[0092] Wherein, α, β, and γ are the weight coefficients of each scoring item, and in this embodiment, they are taken as 0.4, 0.2, and 0.2, respectively. Taking the "line ownership dispute" case as an example, the scores of some candidate entities are shown in Table 3:

[0093] Table 3

[0094]

[0095] Furthermore, the specific steps for constructing the contextual corpus blocks corresponding to the litigation case text described in S2 are as follows:

[0096] S21, the knowledge graph entity mapping method is used to obtain the attribute, definition, and instance information of relevant graph entities, resulting in the original graph corpus text, specifically:

[0097] Extract the "definition", "scope of application", "related legal provisions", and "practical cases" attributes of entities from the knowledge graph;

[0098] Use the entity uniform resource identifier mapping to match the semantic vector obtained in S13 to the corresponding entity node;

[0099] The descriptive texts of all entities and their adjacent entities are integrated into the original graph corpus text.

[0100] For example, the original corpus for the candidate entity "Relocation Liability of Power Lines" includes the definition: "Refers to the standards for the division of responsibilities arising from the relocation of property rights lines caused by engineering construction in power grid construction"; the example: "A 110kV power line in a certain area was relocated due to high-speed construction, resulting in multiple ownership disputes"; and the superior entity "Property Rights Disputes" and its linked regulations.

[0101] S22, based on the semantic relationships and structural connectivity between entities in the original graph corpus text, aggregates and generates contextual corpus units, specifically:

[0102] The optimized pre-trained text embedding model is used to vectorize the original graph corpus text to obtain the semantic representation vector of the entity corpus;

[0103] The similarity between entities is calculated based on semantic representation vectors, and an entity correlation graph is constructed by combining structural relationships in the knowledge graph. The similarity calculation formula is the same as the semantic similarity scoring formula mentioned above. For example, suppose the input entity set is: E1 is "line relocation responsibility", E2 is "equipment ownership dispute", E3 is "property preservation request", E4 is "property registration system", and E5 is "objection to enforcement recusal".

[0104] Construct the semantic similarity matrix S{s} of the entity set {E1, E2, E3, E4, E5}. ij}∈R 5×5 as follows:

[0105]

[0106] Where each element s ij Represents entity E i With E j The semantic similarity between entities is calculated by taking the entities as nodes in the graph. If the similarity s ij If the threshold θ = 0.8 is exceeded, then in entity E... i With E j Establish an edge between them with weight s. ij This leads to the construction of an entity-related graph;

[0107] The Louvain community discovery graph clustering algorithm is used to divide the entity-related graph into communities. Each clustering result is a "corpus unit of entity context". The corpus in each cluster will be provided as a whole to the subsequent large language model for processing.

[0108] S23, using a text summarization algorithm to refine the contextual corpus units and perform format standardization processing, to obtain contextual corpus blocks, specifically:

[0109] The BERT-SUM model is used to perform semantic compression on contextual corpus units;

[0110] The semantically compressed context corpus units are standardized in paragraph structure, redundant punctuation and noisy characters are cleaned, and the order of entity descriptions, cited laws and regulations, and case fields is kept consistent to form the final context corpus block.

[0111] It should be noted that all knowledge graph entity vectors, entity semantic vectors, and related graph entity vectors used for computation in this embodiment are obtained through the pre-trained text embedding model optimized in S13.

[0112] S3 inputs the contextual corpus into the large language model, identifies the elements of the litigation case through structured prompts, and outputs structured case information.

[0113] In this embodiment, the specific steps of S3 are as follows:

[0114] A prompt word template with legal semantic prompting function is constructed to guide the language model in inductive reasoning based on contextual information. Example prompt words are as follows:

[0115] "Based on the following case text and background materials, please identify and fill in the legal elements of the case: plaintiff, defendant, points of contention, legal basis, claims, and conclusion."

[0116] The case text, contextual corpus blocks, and prompt word templates are concatenated to construct the model input, in the following format:

[0117] [Case Text]: ...

[0118] [Background Information]: ...

[0119] [Task]: Please retrieve...

[0120] The model outputs a structured result, represented as a JSON string, based on the above input. Example output is as follows:

[0121] {

[0122] Plaintiff: A power supply company

[0123] Defendant: "A Certain Equipment Company"

[0124] "Point of contention": "Equipment ownership issue"

[0125] Legal Basis: Article XX of the Contract Law

[0126] Request: "Compensation for equipment damage and reinstallation costs"

[0127] Conclusion: The defendant is ordered to bear the responsibility for relocation.

[0128] }

[0129] To ensure the legal validity of the identified elements, the S3 step, before outputting the structured case information, also includes:

[0130] By constructing a multi-hop path index for the target entities in the case within the knowledge graph;

[0131] Verify whether the identified field can be derived from the path structure. If the identified field is broken from the path, mark the identified field as an unsupported item and remove it.

[0132] It should be noted that "multi-hop path index" refers to a set of paths in a knowledge graph that start from the target entity of a case and connect to other related entities through multiple intermediate entity nodes. The path length is greater than 1 hop, and it is used to capture the semantic relationships of indirect associations.

[0133] For example, taking a certain electricity-related litigation case as an example, the original text recognition result is as follows:

[0134] {

[0135] Plaintiff: A power supply company

[0136] Defendant: A property management company

[0137] "Point of contention": "Responsibility for line relocation"

[0138] Legal Basis: Article XX of the Electricity Law

[0139] Request: Refund of relocation fees and compensation for lost wages.

[0140] }

[0141] In the knowledge graph path index, "Route Relocation Responsibility" -> "Route Ownership" -> "Relocation Obligation" -> "Fee Bearing Rules" supports the "Refund of Relocation Fees" field, but there is no direct path to the "Compensation for Lost Work" node. Therefore, the system marks the latter as "No Supported Item" and removes this item from the final output.

[0142] {

[0143] Plaintiff: A power supply company

[0144] Defendant: A property management company

[0145] "Point of contention": "Responsibility for line relocation"

[0146] Legal Basis: Article XX of the Electricity Law

[0147] Request: Refund of relocation fees

[0148] }

[0149] Example 2, Figure 2 The present invention provides an intelligent litigation case recognition system based on RAG and knowledge graph, comprising: a semantic representation generation module, a context corpus construction module, and a structured information recognition module;

[0150] The semantic representation generation module performs semantic vectorization processing on the litigation case text based on a pre-trained text embedding model, and outputs a sequence of semantic vectors.

[0151] The context corpus construction module performs similarity matching between the semantic vector sequence and the acquired knowledge graph entity vectors to obtain relevant graph entities and constructs context corpus blocks corresponding to the litigation case text.

[0152] The structured information recognition module inputs contextual corpus blocks into a large language model, identifies elements of litigation cases through structured prompt words, and outputs structured case information.

[0153] The above formulas are all dimensionless calculations. The formulas are derived from software simulations based on a large amount of collected data to obtain the most recent real-world results. The preset parameters in the formulas are set by those skilled in the art according to the actual situation.

[0154] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, in the form of a computer program product.

[0155] Those skilled in the art will recognize that the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0156] In addition, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.

[0157] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0158] In conclusion, the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for intelligent litigation case identification based on RAG and knowledge graph, characterized in that, Includes the following steps: Based on a pre-trained text embedding model, semantic vectorization is performed on the litigation case text to output a sequence of semantic vectors. The semantic vector sequence is matched with the obtained knowledge graph entity vectors to obtain relevant graph entities, and contextual corpus blocks corresponding to the litigation case text are constructed. Input the contextual corpus into the large language model, identify the elements of the litigation case through structured prompt words, and output structured case information; Before constructing the contextual corpus blocks corresponding to the litigation case text, it is also necessary to generate contextual corpus units. The specific steps are as follows: The optimized pre-trained text embedding model is used to vectorize the original graph corpus text to obtain the semantic representation vector of the entity corpus; The similarity between entities is calculated based on semantic representation vectors, and an entity relevance graph is constructed by combining structural relationships in the knowledge graph. The entity-related graph is divided into communities using a graph clustering algorithm to obtain entity context corpus units; The original graph corpus text was obtained based on the knowledge graph entity mapping method.

2. The intelligent litigation case identification method based on RAG and knowledge graph according to claim 1, characterized in that, Before performing semantic vectorization on the litigation case text, the process also includes text cleaning and semantic segmentation of the litigation case text.

3. The intelligent litigation case identification method based on RAG and knowledge graph as described in claim 2, characterized in that, The specific steps for obtaining the semantic vector sequence are as follows: By using predefined hierarchical legal entity tags in the knowledge graph, entity recognition and subclass labeling are performed on the input case text to obtain the case-labeled corpus; Based on the labeled corpus, semantic contrast triples containing positive and negative samples are constructed to obtain a training dataset for contrastive learning. A contrastive learning method is used to optimize the parameters of the pre-trained text embedding model, making the semantic vectors of similar entity statements close together and the semantic vectors of dissimilar statements separate, thus obtaining a sequence of case semantic vectors.

4. The intelligent litigation case identification method based on RAG and knowledge graph according to claim 3, characterized in that, The specific steps for optimizing the parameters of the pre-trained text embedding model using a contrastive learning method are as follows: Using a pre-trained Chinese text embedding model, semantic contrast triples are vector-encoded to obtain triple sentence vectors; Constructing a loss function based on triple sentence vectors; Based on the loss function, the AdamW optimizer is used to iteratively update the model parameters to obtain the optimized pre-trained text embedding model.

5. The intelligent litigation case identification method based on RAG and knowledge graph according to claim 4, characterized in that, The step of performing similarity matching between the semantic vector sequence and the acquired knowledge graph entity vectors to obtain relevant graph entities specifically involves: Candidate graph entities are obtained by calculating the similarity between the semantic vector sequence and the semantic vector of the entity in the knowledge graph; Candidate graph entities are scored using a pre-defined multi-factor scoring system, and then sorted and filtered based on the scoring results to obtain semantically related graph entities. The multi-factor scoring system includes semantic similarity score, entity hierarchical path score, and entity connectivity.

6. The intelligent litigation case identification method based on RAG and knowledge graph according to claim 5, characterized in that, The specific steps for obtaining the entity hierarchical path score are as follows: Based on the predefined entity hierarchy structure in the knowledge graph, determine the path where the candidate entity is located; Based on the number of hierarchical nodes contained in the path, the entity hierarchical path score is calculated starting from the root node.

7. The intelligent litigation case identification method based on RAG and knowledge graph according to claim 6, characterized in that, The specific steps for obtaining the entity connectivity are as follows: Based on the construction principles of knowledge graphs, we define the types of connection relationships between entities in the graph and assign preset weight values ​​to each type of relationship. Extract the core entities of the input case from the case annotation corpus, and use them as target nodes for measuring connection relationships; Traverse the edge information of candidate entities in the knowledge graph, determine whether the candidate entity has a defined connection relationship type with the target node, and if so, record the weight corresponding to the connection relationship type; For each candidate entity, the weights between it and all target nodes are summed to obtain the entity connectivity of each candidate entity.

8. The intelligent litigation case identification method based on RAG and knowledge graph according to claim 7, characterized in that, The specific steps for constructing the contextual corpus blocks corresponding to the litigation case text are as follows: The knowledge graph entity mapping method is used to obtain the attribute, definition and instance information of relevant graph entities, and the original graph corpus text is obtained. Based on the semantic relationships and structural connectivity between entities in the original graph corpus text, contextual corpus units are aggregated and generated. The context corpus units are refined using a text summarization algorithm and then standardized in format to obtain context corpus blocks.

9. The intelligent litigation case identification method based on RAG and knowledge graph according to claim 8, characterized in that, The output of structured case information also includes: By constructing a multi-hop path index for the target entities in the case within the knowledge graph; Verify whether the identified field can be derived from the multi-hop path index. If the identified field is broken from the path, mark the identified field as an unsupported item and remove it.

10. A system for implementing the intelligent litigation case identification method based on RAG and knowledge graph as described in any one of claims 1-9, characterized in that, include: The module includes a semantic representation generation module, a context corpus construction module, and a structured information recognition module. The semantic representation generation module performs semantic vectorization processing on the litigation case text based on a pre-trained text embedding model, and outputs a sequence of semantic vectors. The context corpus construction module performs similarity matching between the semantic vector sequence and the acquired knowledge graph entity vectors to obtain relevant graph entities and constructs context corpus blocks corresponding to the litigation case text. The structured information recognition module inputs contextual corpus blocks into a large language model, identifies elements of litigation cases through structured prompt words, and outputs structured case information.

Citation Information

Patent Citations

  • Multi-round dialogue processing method and system based on RAG and knowledge graph

    CN118885627A

  • Information retrieval query method for legal data service platform

    CN118981512A

  • Method for constructing knowledge graph based on large language model and vector library

    CN119129722A