A judicial case class case intelligent retrieval method and system
Patent Information
- Application Number
- CN202610041575.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-13
- Publication Date
- 2026-10-20
AI Technical Summary
单纯基于向量相似性匹配的方法,虽然提升了语义匹配能力,却难以直接对这些至关重要的法律推理逻辑进行建模,将会导致检索出的案例在表面相似,但在核心法律争议或裁判逻辑上存在本质差异
本发明通过结合本地司法大模型与自动化构建的异构法律知识图谱,提升了系统对法律术语、案情逻辑及文本语义的理解能力,增强了类案匹配的准确性与可解释性。通过引入关系图卷积网络(RGCN)进行结构建模,能够有效捕捉案件图中多类型实体与多元关系的交互特征,提升案件结构语义的表示质量,实现具备法律逻辑约束的图结构相似度计算。同时,采用双编码器密集向量模型(DPR)构建语义通道,增强对复杂案情及高语义跨度类案的匹配鲁棒性。结合稀疏向量初筛与结构语义双通道融合重排序机制,有效提升检索效率并优化Top-K匹配精度。结构与语义信息在排序阶段的协同作用,强化了系统对检索结果的判别能力与可解释性,满足司法应用中对类案关联的高质量建模需求。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to intelligent judicial information processing technology, specifically to an intelligent retrieval method and system for similar judicial cases that integrates graph structure modeling and dense vector coding. Background Technology
[0002] Currently, case retrieval is a core component of intelligent judicial systems. Its main goal is to efficiently and accurately retrieve historical precedents highly similar to target cases from massive legal databases based on case facts or legal provisions. In judicial practice, accurate case retrieval is not only a crucial link in achieving "same judgment for similar cases" and ensuring judicial fairness and consistency of judgments, but it also provides strong decision support and interpretable basis for judges' reasoning and application of law.
[0003] Traditional retrieval methods primarily rely on keyword matching. However, when dealing with specialized and complex legal texts, this approach struggles to deeply understand and capture the implicit semantic connections between legal provisions and case facts. This often results in limited relevance and accuracy of search results, failing to meet the demands of modern judicial work. In recent years, next-generation information retrieval technologies, represented by dense vector retrieval, have made significant progress. Dense vector retrieval employs a dual-encoder architecture, using deep neural networks to learn and compress textual information into low-dimensional, dense vector representations. This enables efficient matching between queries and documents within a unified semantic space, better modeling semantic information at the sentence and even document level. This effectively overcomes the problems of keyword mismatch or semantically similar but differently expressed keywords. Introducing dense vector retrieval technology into legal case retrieval scenarios provides a new and promising technological path for improving retrieval performance.
[0004] However, directly applying standard dense vector retrieval models to the legal field still faces many challenges. On the one hand, legal documents are typically complex in structure, lengthy, and contain a large number of professional terms and normative expressions. General pre-trained language models struggle to fully capture their domain characteristics, leading to inaccurate semantic representations when applied directly. On the other hand, judicial decisions rely not only on the surface semantic similarity of texts but also on an understanding of deeper structural information such as the causal structure of the case, the chain of factual evidence, and the logic of legal application. While methods based solely on vector similarity matching improve semantic matching capabilities, they cannot directly model these crucial legal reasoning logics. This can result in retrieved cases that appear similar on the surface but differ fundamentally in their core legal disputes or adjudicative logic. Therefore, effectively integrating the deep semantics of texts with the inherent structural logic of cases is a key issue that urgently needs to be addressed to improve the quality of intelligent judicial case retrieval. Summary of the Invention
[0005] The main objective of this invention is to provide a method and system for intelligent retrieval of similar judicial cases, which can deeply understand legal texts, accurately match the internal logic of cases, and combine high efficiency and interpretability.
[0006] According to one aspect of the present invention, a method for intelligent retrieval of similar judicial cases is provided, comprising: Acquire legal text-related data and obtain multi-source judicial text data required for legal case retrieval; Fine-tuning and construction of a local judicial model; Case studies and the construction of a criminal law knowledge graph; Graph similarity modeling based on relational graph convolutional networks; Legal text retrieval modeling based on dense vector coding; Legal case retrieval based on hierarchical filtering and semantic matching; A reordering mechanism that integrates graph structure and semantic vector similarity.
[0007] Furthermore, the fine-tuning and construction of the local judicial big data model includes: The model definition and fine-tuning framework, the definition and implementation of subtasks, and the training and generation of the model; A general-purpose large language model is used as the base model, and the base model is fine-tuned using a domain-specific corpus containing multi-source legal texts. The fine-tuning process adopts a multi-task joint optimization framework, and the model is trained end-to-end through a unified total loss function. The total loss function is composed of a weighted sum of the loss functions of three sub-tasks: (1) in, , , Let represent the loss functions for the following tasks: legal entity identification, causal chain extraction, and legal citation matching, respectively. , , An adjustable weighting coefficient used to balance the contributions of each task; The legal entity identification task is modeled as a sequence labeling task. The BIO labeling system is used to locate and classify key legal entities in judicial texts, such as parties involved and charges, according to predefined categories. The loss function for this task is... The cross-entropy loss measures the difference between the model's predicted label sequence and the true label sequence. The causal chain extraction task aims to extract causal pairs that describe the facts of a case. To ensure that the extracted label sequence conforms to logical rules, a Conditional Random Field (CRF) layer is added to the top layer of the model's encoder. This CRF layer constrains the compliance of the output sequence by learning the effective transition probabilities between labels. The loss function for this task is... The negative log-likelihood loss for this CRF layer; the legal citation matching task adopts a contrastive learning paradigm, which constructs a positive sample and one or more negative samples for each case description, and uses a contrastive learning loss function. The model is optimized by a loss function that aims to drive the model to learn a vector representation such that, in this vector space, the representation of the case is brought closer to that of its positive sample legal provisions, while being pushed further away from that of its negative sample legal provisions. By analyzing the total loss function Gradient backpropagation is performed to uniformly update the parameters of the base model, ultimately obtaining a local large-scale judicial model that can collaboratively handle three core judicial analysis tasks—entity, causality, and legal provision matching—within a single model, providing high-quality structured information and semantic representation for downstream case retrieval.
[0008] Furthermore, the construction of the aforementioned cases and the criminal law knowledge graph includes: The system includes modules for semantic unit recognition and initial graph construction, structural regularization and consistency verification, graph completion and semantic enhancement, and graph semantic generation and heterogeneous structure modeling. The semantic unit recognition and initial graph construction module uses a local judicial big data model fine-tuned in the legal domain as its basic processing engine. It is responsible for receiving and parsing legal text; based on the parsing results, it automatically identifies key legal entities. e semantic relations r The output of the module is an initial knowledge graph with confidence levels. ,in It is a collection of entities. It is a set of relations, where each relation is represented as a quadruple: (2) in, It is a head entity. It is a tail entity. It is the relationship between the two. The confidence score of the relation triple generated by the large model is [the confidence score of the model]. Key legal entities Includes: perpetrator, victim, time frame, object of the act, legal consequences; semantic relationships. It should include at least: implementation, cause, violation, and basis; For the initial map To address potential low-quality or redundant information, the structure regularity and consistency verification module introduces a confidence threshold-based approach. The filtering mechanism only retains entities and relationships whose confidence scores are higher than a preset threshold. From entity set and relation set constitute: (3) (4) in, and These are the confidence thresholds for entities and relationships, respectively, and are preset adjustable hyperparameters. This operation aims to ensure the structural consistency of the graph and the accuracy of the knowledge. The graph completion and semantic enhancement module introduces a knowledge-based reasoning-based link prediction mechanism, which uses a scoring function. To evaluate any unconnected entity pairs There is a relationship r The probability, the scoring function f Integrating graph topological features, entity and relation vector representations, when the score of a candidate triple exceeds a preset completion threshold... δ At that time, the triple will be added to the graph as newly derived knowledge, completing the set of relations. Defined as: (5) The enhanced set of relations is ; The graph semantic generation and heterogeneous structure modeling module provides a structured representation of the final knowledge: it employs a multi-relation heterogeneous graph. Unified modeling is performed; among which, V It is the final set of entity nodes. E It is the final set of relation edges. and These are sets of entity types and relation types, and there are two mapping functions. and This maps each node and each edge to its corresponding type; this heterogeneous structure provides a structured data foundation for subsequent modeling using graph neural networks, graph structure similarity calculation, and cross-graph alignment tasks.
[0009] Furthermore, the graph similarity modeling based on relational graph convolutional networks includes: Graph representation learning and encoding, relation-aware node information aggregation, graph similarity quantification and Top-K case retrieval; A relational graph convolutional network (RGCN) model is introduced to perform graph representation learning on the query case graph and candidate case graph constructed in the previous steps. The RGCN model can handle heterogeneous legal knowledge graphs containing multiple types of nodes and relational edges, encoding the complex structure and semantic information of each case graph into a low-dimensional, dense graph embedding vector. ; The core idea of the RGCN model is to perform node information aggregation for each relationship type in the graph. r Introduce an independent learnable weight matrix This allows for the differentiation of the impact of different semantic relationships when updating node representations; for any node in the graph v Its network l +1 layer representation vector It is achieved by aggregating the information of its neighboring nodes and combining it with its information in the first stage. l Layer's own information Here's an update: (6) in, Represents nodes v Through relationships r A set of connected neighbors. The normalization coefficient is... It is a non-linear activation function. Control the self-loop update item; The embedding vector representing the entire query case graph is obtained through the RGCN model. and the embedding vector representing each candidate case graph Then, a cosine similarity function is used to quantify and compare the two cases to calculate the structural semantic similarity score between them. (7) The numerator is the dot product of the query graph and the candidate graph embedding vectors, and the denominator is the product of the Euclidean norms of the two vectors. The similarity score effectively reflects the degree of closeness between cases in terms of factual composition, logical relationship and legal application. After calculating the similarity score between the query case and all candidate cases, all candidate cases are sorted in descending order according to their scores, and the K cases with the highest rankings are selected as the final set of similar case recommendations to complete the Top-K retrieval task.
[0010] Furthermore, the legal text retrieval modeling based on dense vector coding includes: Encoder pre-training and long text optimization, task fine-tuning based on hard negative sample mining, and final retrieval and ranking; The basic encoder was optimized to enhance its ability to understand legal texts in a general way, including: A RoBERTa encoder optimized based on contrastive learning: A dedicated corpus is built based on multi-source legal data, and a dynamic masking strategy is used for domain pre-training of the RoBERTa model. A contrastive learning strategy is introduced into the pre-training process, using positive and negative sample pairs for training, and a contrastive loss function is employed for optimization. (8) in, For query vector, For positive sample vectors, sim The cosine similarity function is used. τ This is a temperature hyperparameter; this step aims to enhance the model's general semantic discriminative ability in legal contexts. A hierarchical encoding strategy based on Longformer: For long legal documents, a Longformer model with a sparse attention mechanism is introduced, combined with an optimized RoBERTa model for hierarchical encoding; that is, the global semantic vector of the long text is obtained separately. Local semantic vectors of key segments Finally, the vectors are concatenated and merged into a comprehensive representation vector. ; The following strategy was used to fine-tune the encoder: During the fine-tuning phase, LegalBERT was used as the base model for both the query encoder and the case encoder, transforming the query... q and documents d Encode them into vector representations respectively and The similarity between the two is calculated using the dot product operation: ; A difficult-to-bear sample mining mechanism is introduced. This mechanism first uses word frequency matching algorithms such as BM25 to initially retrieve a set of candidate cases that are highly similar to the query text in terms of vocabulary from the case library. From this candidate set, cases that differ significantly from the query text in terms of legal application and judgment conclusions are further selected and used as difficult-to-bear samples for model training. The fine-tuning training objective adopts the InfoNCE loss function, aiming to maximize the similarity between the query and positive samples while minimizing its similarity with all difficult-to-bear samples. (9) in, q For querying text, For the positive samples that match it, For the first i A difficult sample size; this fine-tuning process forces the model to learn deeper legal logic differences beyond superficial lexical similarity. After fine-tuning, the final encoder model is used to convert the query text and all documents in the candidate case library into their final vector representations. By calculating the dot product similarity between the query vector and each candidate vector, all candidate cases are sorted in descending order, and the top K results are returned.
[0011] Furthermore, the legal case retrieval based on hierarchical filtering and semantic matching includes: A hierarchical filtering mechanism based on sparse and dense vectors and a hybrid sorting strategy based on weighted fusion; A two-stage hierarchical retrieval mechanism is adopted: the first stage is preliminary screening, which uses a sparse vector-based term matching algorithm (such as BM25) to perform an efficient preliminary screening of the complete case library. This stage aims to quickly recall a candidate case set that is highly relevant to the query request at the lexical level from massive data based on keyword matching degree; the second stage is semantic reordering, which only uses the candidate case set selected in the previous stage to perform deep semantic similarity calculation using the optimized dense vector retrieval (DPR) model described in claim 5. The dense vector similarity search is implemented based on the FAISS (Facebook AI Similarity Search) retrieval engine to ensure the efficiency of reordering the candidate set. This two-stage mechanism effectively balances the retrieval recall efficiency and matching accuracy by significantly narrowing the scope of dense semantic matching. Design a fusion ranking mechanism that weights and fuses the term matching scores and semantic similarity scores of candidate cases to generate the final ranking criteria: Let the BM25 term matching score of the candidate document be... The DPR model calculates the dense vector semantic similarity score as follows: The final fusion sort score Calculated by linear weighting: (10) in, These are preset weight hyperparameters used to adjust the relative importance of dense semantic matching and sparse keyword matching in the final ranking results. The system calculates these weights based on the results. The fusion scores are used to sort the candidate case set in descending order, generating a final recommendation list that reflects the deep semantic connections between cases and maintains high sensitivity to key factual elements such as legal terminology.
[0012] Furthermore, the reordering mechanism for the similarity between the fused graph structure and semantic vectors includes: Dual-channel similarity calculation, similarity score fusion, and final ranking; For the candidate case set obtained after preliminary search or screening It employs a dual-channel parallel computing mode to evaluate its relevance to the queried case from both semantic and structural dimensions. Q Similarity: Using a dense vector retrieval model, the query case is encoded with each candidate case, and a semantic similarity score is calculated between them. Simultaneously, using a relational graph convolutional network (RGCN)-based method, the knowledge graph of the query case and the knowledge graph of each candidate case are encoded, and the graph structure similarity score between the two is calculated. ; A linear weighted combination method is used to fuse the two types of similarity scores to construct a final, more comprehensive ranking score. The calculation method is as follows: (11) The preset weight coefficients, whose values are determined through parameter tuning on the validation set, are used to balance the relative importance of textual semantics and graph structure features in the final ranking; based on the calculated... The scores are combined to perform a final descending sort on the candidate case set and return the top-ranked cases. This sorting result takes into account both the content similarity and structural logic consistency between the cases.
[0013] According to another aspect of the present invention, a judicial case similarity intelligent retrieval system is provided, comprising: The module for acquiring legal text-related data is used to acquire multi-source judicial text data required for legal case retrieval. The local judicial big data model fine-tuning and construction module is used for defining and fine-tuning the model framework, defining and implementing sub-tasks, and training and generating the model. The module for constructing the case and criminal law knowledge graph is used to build a semantic unit recognition and initial graph construction module, a structure regularization and consistency verification module, a graph completion and semantic enhancement module, and a graph semantic generation and heterogeneous structure modeling module; A graph similarity modeling module based on relational graph convolutional networks is used for graph representation learning and encoding, relation-aware node information aggregation, graph similarity quantification, and Top-K case retrieval. A legal text retrieval modeling module based on dense vector coding is used for encoder pre-training and long text optimization, task fine-tuning based on hard negative sample mining, and final retrieval and ranking. A legal case retrieval module based on hierarchical filtering and semantic matching is used for a hierarchical filtering mechanism based on sparse and dense vectors and a hybrid ranking strategy based on weighted fusion. A re-ranking mechanism module that integrates graph structure and semantic vector similarity is used for dual-channel similarity calculation, similarity score fusion, and final ranking.
[0014] Advantages of this invention: This invention enhances the system's understanding of legal terminology, case logic, and textual semantics by combining a local judicial big data model with an automatically constructed heterogeneous legal knowledge graph, thereby improving the accuracy and interpretability of case matching. By introducing a relational graph convolutional network (RGCN) for structural modeling, it effectively captures the interaction features of multiple types of entities and diverse relationships in the case graph, improving the representation quality of case structural semantics and enabling graph structure similarity calculation with legal logical constraints. Simultaneously, a dual-encoder dense vector model (DPR) is used to construct semantic channels, enhancing the robustness of matching complex cases and cases with high semantic spans. The combination of sparse vector initial screening and a structural semantic dual-channel fusion re-ranking mechanism effectively improves retrieval efficiency and optimizes Top-K matching accuracy. The synergistic effect of structural and semantic information in the ranking stage strengthens the system's ability to discriminate and interpret retrieval results, meeting the high-quality modeling requirements for case association in judicial applications.
[0015] While improving the accuracy, efficiency, and interpretability of the legal case retrieval system, it also provides high-quality structural semantic representation support for downstream tasks such as case recommendation and judgment prediction in the intelligent judicial system.
[0016] In addition to the objectives, features, and advantages described above, the present invention has other objectives, features, and advantages. The invention will now be described in further detail with reference to the figures. Attached Figure Description
[0017] The accompanying drawings, which form part of this application, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.
[0018] Figure 1 This is a flowchart of the intelligent retrieval method for judicial case similarities based on the fusion of graph structure modeling and dense vector encoding of the present invention; Figure 2 This is a flowchart illustrating the dense vector retrieval module of the present invention; Figure 3 This is a flowchart illustrating the graph retrieval enhancement generation module of the present invention; Figure 4 This is an example of the automatic construction of the case knowledge graph of the present invention. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0020] refer to Figures 1 to 4This invention provides an intelligent retrieval method for similar judicial cases that integrates graph structure modeling and dense vector coding.
[0021] refer to Figure 1 This method, based on several key technologies including a local judicial language model, legal knowledge graph modeling, graph neural network structure representation, and semantic vector encoding retrieval, constructs a complete judicial case retrieval framework. The overall system workflow encompasses data collection and preprocessing, local judicial language model training, legal knowledge graph construction, graph structure modeling, semantic matching modeling, multi-level retrieval strategies, and fusion ranking mechanisms, ensuring high performance across multiple dimensions such as legal language understanding, case structure modeling, and case filtering.
[0022] In the legal data collection and preprocessing module, multi-source judicial data, including case fact descriptions, court opinions, judgment summaries, cited legal provisions, and sentencing results, is collected from public legal document databases, typical case databases, and court judgment disclosure platforms. This data is processed separately as structured and unstructured text: unstructured data, such as full judgments and case descriptions, is used for language model training and graph construction; structured data, such as charge tags, applicable legal provisions, and sentencing triples, is used for monitoring model training and evaluation. The data preprocessing stage first involves cleaning and standardization, including OCR noise correction, encoding conversion, punctuation correction, and sentence regularization. Subsequently, word segmentation and named entity recognition are used for initial screening, converting information such as people, behaviors, objects, and times into candidate entities. Further, terminological differences are addressed through unified naming conventions (e.g., "theft" and "stealing" are merged), and structured syntactic tags are constructed to provide high-quality input for subsequent causal relationship extraction and graph modeling.
[0023] A method for intelligent retrieval of similar judicial cases includes: Acquire legal text-related data and obtain multi-source judicial text data required for legal case retrieval; Fine-tuning and construction of a local judicial model; Case studies and the construction of a criminal law knowledge graph; Graph similarity modeling based on relational graph convolutional networks; Legal text retrieval modeling based on dense vector coding; Legal case retrieval based on hierarchical filtering and semantic matching; A reordering mechanism that integrates graph structure and semantic vector similarity.
[0024] Acquire legal text-related data, including multi-source judicial text data required for legal case retrieval, such as publicly available legal documents, judicial precedent databases, criminal law provisions, summaries of judgments, and records of legal knowledge Q&A; among them, unstructured data (such as case fact descriptions and full texts of judgments) are stored and used for the extraction of legal entities and relationships, while structured data (such as labeled crime names, legal provisions, and sentence triples) are stored and used to train local judicial large-scale models and vector encoding models, providing a data foundation for subsequent graph construction and semantic modeling; The fine-tuning and construction of the local judicial large-scale model, in order to adapt to the language style and expression characteristics of professional corpora in the judicial field, adopts the general pre-trained language model DeepSeek R1-7B as the base model, and combines supervised and unsupervised corpora in the judicial field to carry out domain-specific targeted fine-tuning to construct the local judicial large-scale model DeepSeek-Law. The training data used includes texts such as typical case documents, interpretations of criminal law provisions, judgments, and case summaries. The fine-tuning objectives cover judicial tasks such as legal entity recognition, case causal chain construction, and legal provision citation understanding, which significantly improves the model's ability to understand the semantics of legal texts and generate expressions, providing high-quality language foundation model support for subsequent graph construction and semantic modeling. The construction of case and criminal law knowledge graphs aims to enhance the expressive power of structured semantic information in legal texts and improve the modeling effect of case retrieval systems on the logical relationships of cases. An automated knowledge graph construction framework based on a local judicial large-scale model is constructed. This framework achieves unified analysis and graph-based modeling of criminal law provisions and typical case texts through modules such as semantic unit identification, structural regularization, knowledge completion, and heterogeneous modeling. First, legal entities and relationships are identified based on a judicial language model to generate an initial semantic graph. Then, a structural consistency verification mechanism is introduced to regularize the graph structure and eliminate semantic redundancy. Further, the automatic completion module expands the semantic edges and reasoning paths of the graph, improving semantic connectivity. Finally, a multi-relationship heterogeneous legal knowledge graph is generated, providing basic support for graph neural network modeling and graph structure similarity calculation, possessing both interpretability and adaptability. Graph Similarity Modeling Based on Relational Graph Convolutional Networks: To accurately characterize the structural and semantic similarity between query cases and candidate cases, a relational graph convolutional network (RGCN) is introduced to learn the structured representation of the constructed legal knowledge graph. This model effectively captures the complex interactions between multiple types of nodes and diverse semantic relationships in heterogeneous graphs by introducing a relation type weight adjustment mechanism during node information aggregation. Both the query graph and candidate case graphs are encoded using RGCN to obtain full-graph-level structural and semantic embedding representations. Then, based on the similarity calculation between graph vectors, structural matching and Top-K retrieval of candidate cases are achieved, providing a high-quality structural alignment foundation for subsequent case recommendation and legal reasoning. Legal text retrieval modeling based on dense vector coding: To improve the semantic matching capability of the case retrieval system, a dense vector retrieval (DPR) method is adopted to efficiently encode legal text semantically and calculate similarity. This method is based on a dual encoder architecture, which independently encodes the query summary and candidate cases, and achieves fast matching through similarity measurement in the vector space. Considering the characteristics of legal texts, such as strong professionalism, complex structure, and large semantic span of matching tasks, the DPR model is pre-trained on a large-scale legal corpus to enhance its understanding of legal terms and discourse structure. In addition, the model is fine-tuned in combination with case matching tasks to optimize its representation effect and retrieval accuracy in legal retrieval scenarios, providing technical support for refined matching of semantic channels. Legal Case Retrieval Based on Hierarchical Screening and Semantic Matching: To improve retrieval efficiency and matching accuracy in large-scale legal case databases, a hierarchical retrieval mechanism combining sparse vector initial screening and dense vector fine ranking is proposed. First, the BM25 algorithm is used to initially screen the case database at the term level, selecting a set of candidate cases with high matching degree to the query summary keywords. Then, the high-performance vector retrieval engine FAISS, combined with the DPR model, performs dense semantic matching and vector similarity calculation on the candidate set to obtain more semantically relevant retrieval results. This hierarchical retrieval strategy effectively reduces the consumption of large-scale computational resources, balancing recall efficiency and matching accuracy, and provides a scalable technical path for high-quality retrieval of legal cases. A re-ranking mechanism integrating graph structure similarity and semantic vector similarity: To comprehensively improve the matching accuracy and interpretability of candidate cases, a re-ranking mechanism integrating graph structure similarity and semantic vector similarity is constructed. After completing the initial retrieval, this mechanism calculates the structural similarity between case graphs based on Relational Graph Convolutional Network (RGCN) and obtains the semantic similarity between semantic vectors based on the DPR model. The candidate cases are then jointly scored and ranked through a weighted fusion strategy. The graph structure channel effectively reveals the deep legal structure such as the causal chain of the case, the normative reference path, and the behavioral logic, while the vector channel captures the overall semantic information of the case. The two work together to achieve a comprehensive modeling of the complex relationships between legal texts, significantly improving the accuracy, robustness, and interpretability of the case retrieval system.
[0025] The fine-tuning and construction of the local judicial big data model includes: The model definition and fine-tuning framework, the definition and implementation of subtasks, and the training and generation of the model; A general-purpose large language model (such as DeepSeek R1-7B) is used as the base model, and the base model is fine-tuned using a domain-specific corpus containing multi-source legal texts. The fine-tuning process adopts a multi-task joint optimization framework, and the model is trained end-to-end through a unified total loss function. The total loss function is composed of a weighted sum of the loss functions of three sub-tasks: (1) in, , , Let represent the loss functions for the following tasks: legal entity identification, causal chain extraction, and legal citation matching, respectively. , , An adjustable weighting coefficient used to balance the contributions of each task; The legal entity identification task is modeled as a sequence labeling task. The BIO labeling system is used to locate and classify key legal entities in judicial texts, such as parties involved and charges, according to predefined categories. The loss function for this task is... The cross-entropy loss measures the difference between the model's predicted label sequence and the true label sequence. The causal chain extraction task aims to extract causal pairs that describe the facts of a case. To ensure that the extracted label sequences conform to logical rules, a Conditional Random Field (CRF) layer is added to the top layer of the model's encoder. This CRF layer constrains the compliance of the output sequence by learning the effective transition probabilities between labels. The loss function for this task is... The negative log-likelihood loss for this CRF layer is used. The legal citation matching task employs a contrastive learning paradigm, aiming to determine the semantic relevance between a case description and a specific legal provision. This is achieved by constructing a positive sample (i.e., the correctly cited legal provision) and one or more negative samples (i.e., irrelevant legal provisions) for each case description, and using a contrastive learning loss function. The model is optimized by a loss function that aims to drive the model to learn a vector representation such that, in this vector space, the representation of the case is brought closer to that of its positive sample legal provisions, while being pushed further away from that of its negative sample legal provisions. By analyzing the total loss function Gradient backpropagation is performed to uniformly update the parameters of the base model, ultimately obtaining a local large-scale judicial model that can collaboratively handle three core judicial analysis tasks—entity, causality, and legal provision matching—within a single model, providing high-quality structured information and semantic representation for downstream case retrieval.
[0026] The aforementioned cases and the construction of the criminal law knowledge graph include: The system includes modules for semantic unit recognition and initial graph construction, structural regularization and consistency verification, graph completion and semantic enhancement, and graph semantic generation and heterogeneous structure modeling. The semantic unit recognition and initial graph construction module uses a local judicial big data model fine-tuned in the legal domain as its basic processing engine. It is responsible for receiving and parsing legal text; based on the parsing results, it automatically identifies key legal entities. e semantic relations r The output of the module is an initial knowledge graph with confidence levels. ,in It is a collection of entities. It is a set of relations, where each relation is represented as a quadruple: (2) in, It is a head entity. It is a tail entity. It is the relationship between the two. The confidence score of the relation triple generated by the large model is [the confidence score of the model]. Key legal entities Includes: perpetrator, victim, time frame, object of the act, legal consequences; semantic relationships. It should include at least: implementation, cause, violation, and basis; For the initial map To address potential low-quality or redundant information, the structure regularity and consistency verification module introduces a confidence threshold-based approach. The filtering mechanism only retains entities and relationships whose confidence scores are higher than a preset threshold. From entity set and relation set constitute: (3) (4) in, and These are the confidence thresholds for entities and relationships, respectively, and are preset adjustable hyperparameters. This operation aims to ensure the structural consistency of the graph and the accuracy of the knowledge. To solve To address the semantic fragmentation issue, the graph completion and semantic enhancement module introduces a knowledge-reasoning-based link prediction mechanism. This mechanism utilizes a scoring function. To evaluate any unconnected entity pairs There is a relationship r The probability, the scoring function fIntegrating graph topological features, entity and relation vector representations, when the score of a candidate triple exceeds a preset completion threshold... δ At that time, the triple will be added to the graph as newly derived knowledge, completing the set of relations. Defined as: (5) The enhanced set of relations is ; To enhance the interpretability of the graph and its application in downstream tasks, the graph semantic generation and heterogeneous structure modeling module provides a structured representation of the final knowledge: employing a multi-relation heterogeneous graph. Unified modeling is performed; among which, V It is the final set of entity nodes. E It is the final set of relation edges. and These are sets of entity types and relation types, and there are two mapping functions. and This maps each node and each edge to its corresponding type; this heterogeneous structure provides a structured data foundation for subsequent modeling using graph neural networks, graph structure similarity calculation, and cross-graph alignment tasks.
[0027] The graph similarity modeling based on relational graph convolutional networks includes: Graph representation learning and encoding, relation-aware node information aggregation, graph similarity quantification and Top-K case retrieval; A Relational Graph Convolutional Network (RGCN) model is introduced to perform graph representation learning on the query case graph and candidate case graph constructed in the previous steps. The RGCN model can handle heterogeneous legal knowledge graphs containing multiple types of nodes and relational edges, encoding the complex structure and semantic information of each case graph into a low-dimensional, dense graph embedding vector. ; The core idea of the RGCN model is to perform node information aggregation for each relationship type in the graph. r Introduce an independent learnable weight matrix This allows for the differentiation of the impact of different semantic relationships when updating node representations; for any node in the graph v Its network l +1 layer representation vector It is achieved by aggregating the information of its neighboring nodes and combining it with its information in the first stage. l Layer's own information Here's an update: (6) in, Represents nodes v Through relationships r A set of connected neighbors. The normalization coefficient is... It is a non-linear activation function. Control the self-loop update item; The embedding vector representing the entire query case graph is obtained through the RGCN model. and the embedding vector representing each candidate case graph Then, a cosine similarity function is used to quantify and compare the two cases to calculate the structural semantic similarity score between them. (7) The numerator is the dot product of the query graph and the candidate graph embedding vectors, and the denominator is the product of the Euclidean norms of the two vectors. The similarity score effectively reflects the degree of closeness between cases in terms of factual composition, logical relationship and legal application. After calculating the similarity score between the query case and all candidate cases, all candidate cases are sorted in descending order according to their scores, and the K cases with the highest rankings are selected as the final set of similar case recommendations to complete the Top-K retrieval task.
[0028] The legal text retrieval modeling based on dense vector encoding includes: Encoder pre-training and long text optimization, task fine-tuning based on hard negative samples mining, and final retrieval and ranking; The basic encoder was optimized to enhance its ability to understand legal texts in a general way, including: A RoBERTa encoder optimized based on contrastive learning: A dedicated corpus is built based on multi-source legal data, and a dynamic masking strategy is used for domain pre-training of the RoBERTa model. A contrastive learning strategy is introduced into the pre-training process, using positive and negative sample pairs for training, and a contrastive loss function is employed for optimization. (8) in, For query vector, For positive sample vectors, sim The cosine similarity function is used. τ This is a temperature hyperparameter; this step aims to enhance the model's general semantic discriminative ability in legal contexts. A hierarchical encoding strategy based on Longformer: For long legal documents, a Longformer model with a sparse attention mechanism is introduced, combined with an optimized RoBERTa model for hierarchical encoding; that is, the global semantic vector of the long text is obtained separately. Local semantic vectors of key segments Finally, the vectors are concatenated and merged into a comprehensive representation vector. ; To ensure the model accurately adapts to the final case retrieval task, the following strategies are used to fine-tune the encoder: During the fine-tuning phase, LegalBERT was used as the base model for both the query encoder and the case encoder, transforming the query... q and documents d Encode them into vector representations respectively and The similarity between the two is calculated using the dot product operation: ; To improve the model's discrimination accuracy in fine-grained legal semantics, a difficult-to-bear sample mining mechanism is introduced. This mechanism first uses word frequency matching algorithms such as BM25 to initially retrieve a set of candidate cases that are highly similar to the query text in terms of vocabulary from the case library. From this candidate set, cases that differ significantly from the query text in terms of legal application and judgment conclusions are further selected and used as difficult-to-bear samples for model training. The fine-tuning training objective adopts the InfoNCE loss function, aiming to maximize the similarity between the query and positive samples while minimizing its similarity with all difficult-to-bear samples. (9) in, q For querying text, For the positive samples that match it, For the first i A difficult sample size; this fine-tuning process forces the model to learn deeper legal logic differences beyond superficial lexical similarity. After fine-tuning, the final encoder model is used to convert the query text and all documents in the candidate case library into their final vector representations. By calculating the dot product similarity between the query vector and each candidate vector, all candidate cases are sorted in descending order, and the top K results are returned.
[0029] The legal case retrieval based on hierarchical filtering and semantic matching includes: A hierarchical filtering mechanism based on sparse and dense vectors and a hybrid sorting strategy based on weighted fusion; To balance computational overhead and matching accuracy in large-scale case database retrieval, a two-stage hierarchical retrieval mechanism is adopted: The first stage is preliminary screening, which uses a sparse vector-based term matching algorithm (such as BM25) to perform an efficient preliminary screening of the complete case database. This stage aims to quickly recall a candidate case set that is highly relevant to the query request at the lexical level from massive amounts of data based on keyword matching degree; The second stage is semantic reordering, which only uses the candidate case set selected in the previous stage to perform deep semantic similarity calculation using the optimized dense vector retrieval (DPR) model described in claim 5. The dense vector similarity search is implemented based on the FAISS (Facebook AI Similarity Search) retrieval engine to ensure the efficiency of reordering the candidate set. This two-stage mechanism effectively balances retrieval recall efficiency and matching accuracy by significantly narrowing the scope of dense semantic matching. To leverage the advantages of both sparse and dense matching, a fusion ranking mechanism is designed. This mechanism weights and fuses the term matching scores and semantic similarity scores of candidate documents to generate the final ranking criteria. Let the BM25 term matching score of a candidate document be... The DPR model calculates the dense vector semantic similarity score as follows: The final fusion sort score Calculated by linear weighting: (10) in, These are preset weight hyperparameters used to adjust the relative importance of dense semantic matching and sparse keyword matching in the final ranking results. The system calculates these weights based on the results. The fusion scores are used to sort the candidate case set in descending order, generating a final recommendation list that reflects the deep semantic connections between cases and maintains high sensitivity to key factual elements such as legal terminology.
[0030] The reordering mechanism for the similarity between the fusion graph structure and semantic vectors includes: Dual-channel similarity calculation, similarity score fusion, and final ranking; For the candidate case set obtained after preliminary search or screening It employs a dual-channel parallel computing mode to evaluate its relevance to the queried case from both semantic and structural dimensions. Q Similarity: Using a dense vector retrieval model, the query case is encoded with each candidate case, and a semantic similarity score is calculated between them. Simultaneously, using a relational graph convolutional network (RGCN)-based method, the knowledge graph of the query case and the knowledge graph of each candidate case are encoded, and the graph structure similarity score between the two is calculated. ; To comprehensively consider both the global semantics of the text and the deep structural logic of the case, a linear weighted combination method is used to fuse the two types of similarity scores to construct a final, more comprehensive ranking score. The calculation method is as follows: (11) The preset weight coefficients, whose values are determined through parameter tuning on the validation set, are used to balance the relative importance of textual semantics and graph structure features in the final ranking; based on the calculated... The scores are combined to perform a final descending sort on the candidate case set and return the top-ranked cases. This sorting result takes into account both the content similarity and structural logic consistency between the cases.
[0031] A judicial case-type intelligent retrieval system includes: The module for acquiring legal text-related data is used to acquire multi-source judicial text data required for legal case retrieval. The local judicial big data model fine-tuning and construction module is used for defining and fine-tuning the model framework, defining and implementing sub-tasks, and training and generating the model. The module for constructing the case and criminal law knowledge graph is used to build a semantic unit recognition and initial graph construction module, a structure regularization and consistency verification module, a graph completion and semantic enhancement module, and a graph semantic generation and heterogeneous structure modeling module; A graph similarity modeling module based on relational graph convolutional networks is used for graph representation learning and encoding, relation-aware node information aggregation, graph similarity quantification, and Top-K case retrieval. A legal text retrieval modeling module based on dense vector coding is used for encoder pre-training and long text optimization, task fine-tuning based on hard negative sample mining, and final retrieval and ranking. A legal case retrieval module based on hierarchical filtering and semantic matching is used for a hierarchical filtering mechanism based on sparse and dense vectors and a hybrid ranking strategy based on weighted fusion. A re-ranking mechanism module that integrates graph structure and semantic vector similarity is used for dual-channel similarity calculation, similarity score fusion, and final ranking.
[0032] In the language modeling phase, the system uses the DeepSeek R1-7B pre-trained model as a foundation and constructs a large-scale judicial language model, DeepSeek-Law, through domain-oriented fine-tuning. Training corpora include typical cases, criminal law provisions, judgment document summaries, and similar case analysis reports. The model structure maintains the Transformer architecture, but its domain adaptability is enhanced by expanding the legal domain vocabulary and implementing multi-task supervised learning objectives. Fine-tuning tasks mainly include legal entity recognition, case causal chain modeling, and legal provision application generation. Taking the entity recognition task as an example, the input text is Sentence = {T1, T2, ..., T...}. n}, after being embedded, is converted to Embedding = {E1, E2, ... , E n Then, the context representation H = {H1, ..., H} is obtained through the Transformer layer. n Finally, the classification layer calculates the label probability of each word using the Softmax function: pᵢ = softmax(W·Hᵢ + b), where W is the weight matrix and b is the bias term. The model output, after being decoded using BIO label rules, yields a standardized entity sequence.
[0033] In the legal knowledge graph construction phase, the system automatically constructs the legal graph using entity and relation information output by the language model. Entity types include subjects (e.g., "defendant Chen"), behaviors (e.g., "drinking alcohol"), objects (e.g., "folding knife"), results (e.g., "arrested"), and legal provisions; relation types cover implementation, causation, citation, and composition. The knowledge graph is represented by triples <entity 1, relation, entity 2> as the basic unit. After constructing the initial graph, the system performs graph cleaning through structural regularization and semantic clustering, merging semantically similar nodes and removing redundant edges. Subsequently, multi-hop path causal reasoning and fuzzy connection strategies are introduced to enhance graph connectivity, ultimately forming a heterogeneous graph structure, where each node has multiple types of labels and initial features X ∈ ℝⁿˣᶠ, and the graph structure is represented by an adjacency matrix A.
[0034] To improve the performance of structural semantic similarity calculation between case graphs, a relational graph convolutional network RGCN is introduced for structural modeling.
[0035] The RGCN model preserves semantic features in heterogeneous structures when aggregating node information by assigning independent weight matrices to different types of relationships. Its node representation update calculation is as follows: (12) Where σ is the activation function. For the first l Layer r The weight matrix corresponding to the class relationship, For nodes vThrough relationships r The set of connected neighboring nodes.
[0036] The full-image representation vector is calculated using the attention pooling (Attention Readout) mechanism: ,in The structural similarity between case graphs is defined by the cosine similarity between graph embeddings: .
[0037] For dense vector encoding, the system employs a DPR (Dense Passage Retrieval) dual-encoder architecture to establish a dense semantic matching module. The Query Encoder and Passage Encoder are trained separately, enabling the query case summary and candidate case documents to be encoded in the vector space as follows: q and p Vectors. The matching score between the two is... The training employs a negative contrastive learning approach, with the optimization objective being: (13) in p ⁺ represents a positive sample. p ⱼ⁻ represents a negative sample. k The number of negative cases.
[0038] To improve the overall system efficiency and accuracy, a two-stage hierarchical retrieval mechanism is introduced. In the first stage, the BM25 algorithm is used to perform sparse recall on the case database, quickly filtering candidate sets with high keyword matching. Its scoring function is: (14) In the second stage, DPR and FAISS vector indexes are used for dense semantic matching to complete Top-K ranking. This mechanism effectively combines the efficiency of sparse recall with the accuracy of dense matching, and is suitable for large-scale judicial case database environments.
[0039] To further improve matching accuracy and model interpretability, the system introduces a graph structure and semantic vector fusion and re-ranking mechanism. For the initially recalled candidate cases, their structural relationship with the query case is calculated separately. With semantic layer The similarity is used to calculate the overall score using a weighted fusion formula: (15) Among them weighting factors α The ranking mechanism can be dynamically updated through offline parameter tuning or online reinforcement learning strategies, enhancing its adaptability to different scenarios. Ultimately, the system can output case recommendation results with strong structural and semantic consistency, high matching accuracy, and visualized explanatory paths.
[0040] 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 retrieval of similar judicial cases, characterized in that, include: Acquire legal text-related data and obtain multi-source judicial text data required for legal case retrieval; Fine-tuning and construction of a local judicial model; Case studies and the construction of a criminal law knowledge graph; Graph similarity modeling based on relational graph convolutional networks; Legal text retrieval modeling based on dense vector coding; Legal case retrieval based on hierarchical filtering and semantic matching; A reordering mechanism that integrates graph structure and semantic vector similarity.
2. The intelligent retrieval method for similar judicial cases according to claim 1, characterized in that, The fine-tuning and construction of the local judicial big data model includes: The model definition and fine-tuning framework, the definition and implementation of subtasks, and the training and generation of the model; A general-purpose large language model is used as the base model, and the base model is fine-tuned using a domain-specific corpus containing multi-source legal texts. The fine-tuning process adopts a multi-task joint optimization framework, and the model is trained end-to-end through a unified total loss function. The total loss function is composed of a weighted sum of the loss functions of three sub-tasks: (1) in, , , Let represent the loss functions for the following tasks: legal entity identification, causal chain extraction, and legal citation matching, respectively. , , An adjustable weighting coefficient used to balance the contributions of each task; The legal entity identification task is modeled as a sequence labeling task. The BIO labeling system is used to locate and classify key legal entities in judicial texts, such as parties involved and charges, according to predefined categories. The loss function for this task is... The cross-entropy loss measures the difference between the model's predicted label sequence and the true label sequence. The causal chain extraction task aims to extract causal pairs that describe the facts of a case. To ensure that the extracted label sequence conforms to logical rules, a Conditional Random Field (CRF) layer is added to the top layer of the model's encoder. This CRF layer constrains the compliance of the output sequence by learning the effective transition probabilities between labels. The loss function for this task is... The negative log-likelihood loss for this CRF layer; the legal citation matching task adopts a contrastive learning paradigm, which constructs a positive sample and one or more negative samples for each case description, and uses a contrastive learning loss function. The model is optimized by a loss function that aims to drive the model to learn a vector representation such that, in this vector space, the representation of the case is brought closer to that of its positive sample legal provisions, while being pushed further away from that of its negative sample legal provisions. By analyzing the total loss function Gradient backpropagation is performed to uniformly update the parameters of the base model, ultimately obtaining a local large-scale judicial model that can collaboratively handle three core judicial analysis tasks—entity, causality, and legal provision matching—within a single model, providing high-quality structured information and semantic representation for downstream case retrieval.
3. The intelligent retrieval method for similar judicial cases according to claim 1, characterized in that, The construction of the case studies and the criminal law knowledge graph includes: The system includes modules for semantic unit recognition and initial graph construction, structural regularization and consistency verification, graph completion and semantic enhancement, and graph semantic generation and heterogeneous structure modeling. The semantic unit recognition and initial graph construction module uses a local judicial big data model finely tuned for the legal domain as its basic processing engine. It is responsible for receiving and parsing legal text; based on the parsing results, it automatically identifies key legal entities. e semantic relations r The output of the module is an initial knowledge graph with confidence levels. ,in It is a collection of entities. It is a set of relations, where each relation is represented as a quadruple: (2) in, It is a head entity. It is a tail entity. It is the relationship between the two. The confidence score of the relation triple generated by the large model is [the confidence score of the model]. Key legal entities Includes: perpetrator, victim, time frame, object of action, legal consequences; semantic relationships. It should include at least: implementation, cause, violation, and basis; For the initial map To address potential low-quality or redundant information, the structure regularity and consistency verification module introduces a confidence threshold-based approach. The filtering mechanism only retains entities and relationships whose confidence scores are higher than a preset threshold. From entity set and relation set constitute: (3) (4) in, and These are the confidence thresholds for entities and relationships, respectively, and are preset adjustable hyperparameters. This operation aims to ensure the structural consistency of the graph and the accuracy of the knowledge. The graph completion and semantic enhancement module introduces a knowledge-based reasoning-based link prediction mechanism, which uses a scoring function. To evaluate any unconnected entity pairs There is a relationship r The probability, the scoring function f Integrating graph topological features, entity and relation vector representations, when the score of a candidate triple exceeds a preset completion threshold... δ At that time, the triple will be added to the graph as newly derived knowledge, completing the set of relations. Defined as: (5) The enhanced set of relations is ; The graph semantic generation and heterogeneous structure modeling module provides a structured representation of the final knowledge: it employs a multi-relation heterogeneous graph. Unified modeling is performed; among which, V It is the final set of entity nodes. E It is the final set of relation edges. and These are sets of entity types and relation types, and there are two mapping functions. and This maps each node and each edge to its corresponding type; this heterogeneous structure provides a structured data foundation for subsequent modeling using graph neural networks, graph structure similarity calculation, and cross-graph alignment tasks.
4. The intelligent retrieval method for similar judicial cases according to claim 1, characterized in that, The graph similarity modeling based on relational graph convolutional networks includes: Graph representation learning and encoding, relation-aware node information aggregation, graph similarity quantification and Top-K case retrieval; A relational graph convolutional network (RGCN) model is introduced to perform graph representation learning on the query case graph and candidate case graph constructed in the previous steps. The RGCN model can handle heterogeneous legal knowledge graphs containing multiple types of nodes and relational edges, encoding the complex structure and semantic information of each case graph into a low-dimensional, dense graph embedding vector. ; The core idea of the RGCN model is to perform node information aggregation for each relationship type in the graph. r Introduce an independent learnable weight matrix This allows for the differentiation of the impact of different semantic relationships when updating node representations; for any node in the graph v Its network l +1 layer representation vector It is achieved by aggregating the information of its neighboring nodes and combining it with its information in the first stage. l Layer's own information Here's an update: (6) in, Represents nodes v Through relationships r Connected neighbor set, The normalization coefficient is... It is a non-linear activation function. Control the self-loop update item; The embedding vector representing the entire query case graph is obtained through the RGCN model. and the embedding vector representing each candidate case graph Then, a cosine similarity function is used to quantify and compare the two cases to calculate the structural semantic similarity score between them. (7) The numerator is the dot product of the query graph and the candidate graph embedding vectors, and the denominator is the product of the Euclidean norms of the two vectors. The similarity score effectively reflects the degree of closeness between cases in terms of factual composition, logical relationship and legal application. After calculating the similarity score between the query case and all candidate cases, all candidate cases are sorted in descending order according to their scores, and the K cases with the highest rankings are selected as the final set of similar case recommendations to complete the Top-K retrieval task.
5. The intelligent retrieval method for similar judicial cases according to claim 1, Its characteristics are Therefore, the legal text retrieval modeling based on dense vector coding includes: Encoder pre-training and long text optimization, task fine-tuning based on hard negative sample mining, and final retrieval and ranking; The basic encoder was optimized to enhance its ability to understand legal texts in a general way, including: A RoBERTa encoder optimized based on contrastive learning: A dedicated corpus is built based on multi-source legal data, and a dynamic masking strategy is used for domain pre-training of the RoBERTa model. A contrastive learning strategy is introduced into the pre-training process, using positive and negative sample pairs for training, and a contrastive loss function is employed for optimization. (8) in, For query vector, For positive sample vectors, sim The cosine similarity function is used. τ This is a temperature hyperparameter; this step aims to enhance the model's general semantic discriminative ability in legal contexts. A hierarchical encoding strategy based on Longformer: For long legal documents, a Longformer model with a sparse attention mechanism is introduced, combined with an optimized RoBERTa model for hierarchical encoding; that is, the global semantic vector of the long text is obtained separately. Local semantic vectors of key segments Finally, the vectors are concatenated and merged into a comprehensive representation vector. ; The following strategy was used to fine-tune the encoder: During the fine-tuning phase, LegalBERT was used as the base model for both the query encoder and the case encoder, transforming the query... q and documents d Encode them into vector representations respectively and The similarity between the two is calculated using the dot product operation: ; A difficult-to-bear sample mining mechanism is introduced. This mechanism first uses word frequency matching algorithms such as BM25 to initially retrieve a set of candidate cases that are highly similar to the query text in terms of vocabulary from the case library. From this candidate set, cases that differ significantly from the query text in terms of legal application and judgment conclusions are further selected and used as difficult-to-bear samples for model training. The fine-tuning training objective adopts the InfoNCE loss function, aiming to maximize the similarity between the query and positive samples while minimizing its similarity with all difficult-to-bear samples. (9) in, q For querying text, For the positive samples that match it, For the first i A difficult sample size; this fine-tuning process forces the model to learn deeper legal logic differences beyond superficial lexical similarity. After fine-tuning, the final encoder model is used to convert the query text and all documents in the candidate case library into their final vector representations. By calculating the dot product similarity between the query vector and each candidate vector, all candidate cases are sorted in descending order, and the top K results are returned.
6. The intelligent retrieval method for similar judicial cases according to claim 1, characterized in that, The legal case retrieval based on hierarchical filtering and semantic matching includes: A hierarchical filtering mechanism based on sparse and dense vectors and a hybrid sorting strategy based on weighted fusion; A two-stage hierarchical retrieval mechanism is adopted: the first stage is preliminary screening, which uses a sparse vector-based term matching algorithm (such as BM25) to perform an efficient preliminary screening of the complete case library. This stage aims to quickly recall a candidate case set that is highly relevant to the query request at the lexical level from massive data based on keyword matching degree; the second stage is semantic reordering, which only uses the candidate case set selected in the previous stage to perform deep semantic similarity calculation using the optimized dense vector retrieval (DPR) model described in claim 5. The dense vector similarity search is implemented based on the FAISS (Facebook AI Similarity Search) retrieval engine to ensure the efficiency of reordering the candidate set. This two-stage mechanism effectively balances the retrieval recall efficiency and matching accuracy by significantly narrowing the scope of dense semantic matching. Design a fusion ranking mechanism that weights and fuses the term matching scores and semantic similarity scores of candidate cases to generate the final ranking criteria: Let the BM25 term matching score of the candidate document be... The DPR model calculates the dense vector semantic similarity score as follows: The final fusion sort score Calculated by linear weighting: (10) in, These are preset weight hyperparameters used to adjust the relative importance of dense semantic matching and sparse keyword matching in the final ranking results. The system calculates these weights based on the results. The fusion scores are used to sort the candidate case set in descending order, generating a final recommendation list that reflects the deep semantic connections between cases and maintains high sensitivity to key factual elements such as legal terminology.
7. The intelligent retrieval method for similar judicial cases according to claim 4 or claim 6, characterized in that, The reordering mechanism for the similarity between the fusion graph structure and semantic vectors includes: Dual-channel similarity calculation, similarity score fusion, and final ranking; For the candidate case set obtained after preliminary search or screening It employs a dual-channel parallel computing mode to evaluate its relevance to the queried case from both semantic and structural dimensions. Q Similarity: Using a dense vector retrieval model, the query case is encoded with each candidate case, and a semantic similarity score is calculated between them. Simultaneously, using a relational graph convolutional network (RGCN)-based method, the knowledge graph of the query case and the knowledge graph of each candidate case are encoded, and the graph structure similarity score between the two is calculated. ; A linear weighted combination method is used to fuse the two types of similarity scores to construct a final, more comprehensive ranking score. The calculation method is as follows: (11) The preset weight coefficients, whose values are determined through parameter tuning on the validation set, are used to balance the relative importance of textual semantics and graph structure features in the final ranking; based on the calculated... The scores are combined to perform a final descending sort on the candidate case set and return the top-ranked cases. This sorting result takes into account both the content similarity and structural logic consistency between the cases.
8. A judicial case similarity intelligent retrieval system, characterized in that, include: The module for acquiring legal text-related data is used to acquire multi-source judicial text data required for legal case retrieval. The local judicial big data model fine-tuning and construction module is used for defining and fine-tuning the model framework, defining and implementing sub-tasks, and training and generating the model. The module for constructing the case and criminal law knowledge graph is used to build a semantic unit recognition and initial graph construction module, a structure regularization and consistency verification module, a graph completion and semantic enhancement module, and a graph semantic generation and heterogeneous structure modeling module; A graph similarity modeling module based on relational graph convolutional networks is used for graph representation learning and encoding, relation-aware node information aggregation, graph similarity quantification, and Top-K case retrieval. A legal text retrieval modeling module based on dense vector coding is used for encoder pre-training and long text optimization, task fine-tuning based on hard negative sample mining, and final retrieval and ranking. A legal case retrieval module based on hierarchical filtering and semantic matching is used for a hierarchical filtering mechanism based on sparse and dense vectors and a hybrid ranking strategy based on weighted fusion. A re-ranking mechanism module that integrates graph structure and semantic vector similarity is used for dual-channel similarity calculation, similarity score fusion, and final ranking.