Law concept interpretation method based on multi-view clustering and mixed retrieval
By combining multi-perspective clustering and mixed search models for search in database and large language models, the hallucination problem in legal concept interpretation is solved, and the credibility and accuracy of explanation is improved.
Patent Information
- Application Number
- CN202411843859.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-14
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-14
AI Technical Summary
There are hallucinations in the interpretation of legal concepts, which leads to insufficient professionalism, lag in knowledge, unreliability and random content creation.
A legal concept interpretation model based on multi-perspective clustering and mixed retrieval is adopted. By combining search in database and large language model (LLM), a high-diversity case set is obtained, the probability of hallucination is reduced, and the output is optimized through reflective reasoning and dynamic prompt generation mechanisms.
It improves the credibility and accuracy of legal concept interpretation, reduces the possibility of hallucination, and improves the professionalism and timeliness of generated content.
Smart Images

Figure CN119760113A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a legal concept interpretation method based on multi-view clustering and hybrid retrieval, belonging to the technical field of natural language processing. Background Art
[0002] An important source of legal concept interpretation is the application of the term in past court cases. Therefore, in the traditional legal concept interpretation method, human legal workers are usually the core. Legal workers learn about the past interpretation methods of legal concepts by querying the corresponding legal cases, and then summarize the legal interpretation that conforms to the current situation. However, the huge number of legal concepts makes it impossible for human legal workers to take into account all aspects, and they may put forward one-sided interpretations, which affects their objectivity.
[0003] Large Language Model (LLM) refers to a Transformer language model containing hundreds of billions (or more) of parameters, which demonstrates strong natural language understanding capabilities and the ability to solve complex tasks through text generation methods. The difficulties faced by human legal workers mainly revolve around the huge number of cases and limited memory and deduction capabilities. Since LLM is not limited by the latter, it is used to solve the problem of legal concept interpretation. Humans will provide prompts to LLM as users. The current LLM legal concept interpretation model splits the information input by the user into one or more legal concepts, and then organizes the legal concepts, user input, and specially designed format information into prompts and inputs them into LLM. Finally, LLM provides format-determined legal interpretations.
[0004] As a legal concept interpretation model, LLM also faces many challenges. For example, the generated content is not professional enough, the knowledge is lagging behind, the generated content is unreliable or fabricated. A key cause of these problems is that the quality of the relevant cases automatically called by LLM to explain legal concepts is not guaranteed, and LLM itself has a tendency to produce hallucinations, that is, "unconsciously" using internal and external calls that lack accurate control. These problems are to a certain extent caused by the insufficient number of quality-assured cases, so previous researchers proposed the Retrieval-Augmented Generation (RAG) method. A common method is to obtain a large amount of data through the Information Retrieval (IR) system. These data come from a specially maintained database. These data have a certain quality assurance, thereby ensuring the quality of the generated legal interpretation.
[0005] However, there are still a series of problems in the RAG model, such as the user's vague expression of true intention seriously affects the output, LLM is severely limited by the database called by IR, there is no good mechanism to organize the generation of hallucinations, and so on.
[0006] In order to alleviate these problems, we cannot rely solely on the single database called by IR or use LLM alone. Therefore, the IR retrieval method based on multiple databases combined with LLM retrieval forms a hybrid retrieval strategy. In addition, highly diverse case information helps reduce the possibility of hallucinations, so the multi-perspective clustering method used to obtain a highly diverse case set from the retrieval results is also applied to the problem of legal concept interpretation. Summary of the invention
[0007] The present invention aims at the problem that legal concepts are prone to hallucinations, thereby reducing the credibility of concept interpretation. A legal concept interpretation model based on multi-perspective clustering and hybrid retrieval is proposed. A hybrid retrieval method combining retrieval on a database (IR system) and LLM retrieval is used to widely obtain legal content with guaranteed quality, and multi-perspective clustering is combined to ensure case diversity, thereby reducing the probability of hallucinations and improving the credibility of generation.
[0008] The technical solution of the present invention is as follows:
[0009] Step 1) query semantic separation based on semantic hierarchical deconstruction to distinguish legal and non-legal concepts;
[0010] Step 2) extracting semantic fragments based on dynamic unit parsing according to the semantic separation method of step 1) to capture legal concepts that describe the relationship between legal nouns;
[0011] Step 3) A case acquisition mechanism based on recursive information retrieval and depth-first aggregation is used to systematically collect relevant legal cases;
[0012] Step 4) a case enhancement mechanism based on multi-view clustering is performed according to the case acquisition mechanism in step 3) to integrate and optimize case information;
[0013] Step 5) Preliminary screening of legal provisions based on cross-source information fusion, used to screen relevant legal provisions from multiple data sources;
[0014] Step 6) extracting legal provisions based on the preliminary screening of legal provisions in step 5) based on semantic enhanced retrieval, to screen legal provisions that better match the query;
[0015] Step 7) construct a knowledge map based on multi-level division to systematically classify legal concepts;
[0016] Step 8) Dynamic concept matching and supplementation based on similarity analysis based on the knowledge mapping constructed in step 7) to match and supplement relevant legal concepts;
[0017] Step 9) A feedback mechanism based on dynamic prompt generation is used to optimize the presentation of search results in steps 4), 6) and 8);
[0018] Step 10) an output adjustment strategy based on reflective reasoning, used to dynamically adjust the output of step 9) to improve performance;
[0019] The query semantic separation based on semantic hierarchical deconstruction is as follows:
[0020] Suppose the user query (i.e. the text entered by the user) is Q. To effectively parse the query, we first deconstruct its semantic structure hierarchically and construct two query categories: 1 represents the set of indivisible legal concept queries, the second type of query S 2 Represents a set of indivisible non-legal concept queries. Among them:
[0021] S 1 ={c 1 ,c 2 ,…,c m}, refers to a set of m legal terms, where c i Represents the i-th legal term.
[0022] S 2 ={n 1 ,n 2 ,…,n k}, refers to a set of k non-legal nouns, where n j Represents the jth non-legal noun.
[0023] Among them, semantic fragment extraction based on dynamic unit parsing is as follows:
[0024] For user query Q, the legal terms involved are extracted and organized into the first type of query instances through the dynamic unit parsing method. For the query text Q = (x 1 ,x 2 ,…,x n ), introduce the tag sequence y=(y 1 ,y 2 ,…,y n ), where each y i is x i The label after classification represents whether the corresponding word is a legal noun. Then, maximize the probability
[0025]
[0026] Then, the text words corresponding to the labels judged as legal nouns in the obtained y are extracted to form the first type of query instance q 1 , extract all the first-class query instances to form the first-class query instance set Q 1 Then, based on the relationship between different legal terms in Q, the second type of query instances are organized through the relationship extraction method. Given a query Q and two entities e i and e j , find r ij The value of maximizing the probability
[0027] P(r ij |Q,e i ,e j )
[0028] where r ij Represents e i and e j Is there any relationship between them? If yes, then it is 1, otherwise it is 0, and then extract the ij = 1, extract the two text words corresponding to the ordered pair (i, j), and connect them with "and" to form the second type of query instance q 2 , extract all the second-category query instances to form the second-category query instance set Q 2 . Then, we use the first type of query instance set Q 1 And the second type of query instance set Q 2 Query the legal knowledge base to obtain the first type of query concept C 1 and the second type of query concept C 2 .
[0029] The union of all legal concept sets is the analytical concept set C p , that is, C p =C 1 ∪C 2 .
[0030] Among them, the case acquisition mechanism based on recursive information retrieval and depth-first aggregation is as follows:
[0031] 3-1 Concept retrieval and relevance assessment
[0032] Establish legal case database When obtaining legal cases related to user query Q, we first extract a subset of concepts in the parsed concept set. For each concept Search for relevant legal cases to obtain a collection of legal cases
[0033]
[0034] where rel(d,c) represents the correlation function between case d and concept c, and
[0035]
[0036] in, and Represents the embedding of case d and concept c obtained by Word2Vec, θ 1 Represents the correlation threshold, which is set to 0.5. This parameter varies according to the actual situation and can be obtained using the grid search method.
[0037] 3-2 Depth-first aggregation
[0038] The obtained legal case set is aggregated to obtain the relevant case set under the output depth limit
[0039]
[0040] Among them, dep(d i ) is case d i The depth evaluation function is
[0041]
[0042] Among them, level(d i ,d j ) means d i and d j In the Legal Case Database represents the hierarchical relationship with the user query, and k is the depth traversal limit.
[0043] Among them, the case enhancement mechanism based on multi-perspective clustering is as follows:
[0044] 4-1 Classification and Sampling
[0045] In order to obtain more representative legal cases, a classification entry set is established on this basis These entries indicate the basis for the classification of each legal case. For each classification entry t i , from the case Extract and t i The content of the corresponding entry Use Word2Vec to embed and get the feature v i (d)
[0046]
[0047] From all cases Randomly select one of the embedded feature vectors as the initial cluster center ce 1 Then, if there are currently j cluster centers, calculate each case The Euclidean distance D to the nearest cluster center i (d)
[0048]
[0049] Then, according to the selection probability P c To select the next cluster center ce j+1 , selection probability P c Defined as
[0050]
[0051] Assume there are K cluster centers
[0052] Ce={ce 1 ,ce 2 ,…,ce K}
[0053] Classification result function r i for:
[0054]
[0055] Among them, r i is the classification result, indicating that case d is in the classification entry t i Subsequently, multiple classification results are integrated into a single classification indicator cr:
[0056]
[0057] The brackets represent the rounding function. According to the classification index cr after clustering, the relevant case set Divide into classification result sets Right now
[0058]
[0059] 4-2 Output relevant legal case collection
[0060] from Randomly select a case For representative cases, the relevant legal case collection for:
[0061]
[0062] Among them, the preliminary screening of regulations based on cross-source information fusion is as follows:
[0063] 5-1 Construction of legal text database
[0064] First, from multiple legal data sources Extract legal text data and organize it into a database
[0065]
[0066] Each data source The set of clauses in is represented as Among them l ij Represents the jth clause.
[0067] 5-2 Article Extraction and Information Fusion
[0068] The proposed extraction method ε(l ij ,c), this method means that from clause l ij Extract and concept c∈C p Related content:
[0069]
[0070] Among them, rel(l ij ,c) represents the correlation measure between clauses and concepts, then
[0071]
[0072] Among them, Tokenizer(·) represents the use of LLM-based tokenizer to tokenize the text, and the result is a word set. 2 Represents the correlation threshold, which is set to 0.3. This parameter varies according to the actual situation and can be obtained by the grid search method. On this basis, the cross-source information fusion method is used to merge the relevant articles in each data source into a unified article set.
[0073]
[0074] Among them, the precise extraction of legal provisions based on semantic enhanced retrieval is as follows:
[0075] 6-1 Semantic Enhanced Retrieval and Article Acquisition
[0076] In the integrated set of articles After that, we further use semantic enhancement retrieval method To extract a subset of related concepts Relevant legal provisions. The goal of this method is to obtain the most relevant provisions from the fused set of provisions based on the degree of match between the provisions and the concepts:
[0077]
[0078] Among them, sim(l,c) represents the similarity measure between clause l and legal concept c, θ 3 is the similarity threshold, which is set to 0.5. This parameter varies according to the actual situation and can be obtained using the grid search method.
[0079] 6-2 Output of the Final Set of Articles
[0080] The set of legal provisions obtained through semantic enhanced retrieval is expressed as
[0081]
[0082] This set of articles will serve as the final output of legal article extraction to ensure that it covers the legal articles related to the user's query.
[0083] Among them, the concept classification based on multi-level knowledge mapping is as follows:
[0084] 7-1 Construction of Knowledge Mapping
[0085] First, using the legal casebook The set of relevant legal concepts extracted from and from the legal texts The set of related concepts extracted from Constructing a preliminary knowledge map
[0086]
[0087] in, Represents the set of all related concepts.
[0088] 7-2 Hierarchical Division Concept Extraction
[0089] For law concept set The concept c on the above is divided into two layers using the hierarchical partitioning method H(c), which is based on the existing legal knowledge graph G k , the level h of concept c c Defined as the longest path length from c to the root node
[0090]
[0091] Where PathToRoot(c) is the set of all possible paths from c to the root node in the graph. len(p) represents the length of path p. The hierarchical partitioning tree T is constructed as follows:
[0092] First, all concept nodes are divided into levels h c The categories are as follows:
[0093]
[0094] represents all concepts at level i, and Where V g It's G k For G k The edge set E in k , the edge set in the hierarchical partition tree is E T :
[0095]
[0096] Finally, construct a hierarchical partitioning tree
[0097] T=(V g ,E T )
[0098] For a specific concept c, its direct sub-concepts are
[0099] Child(c)={c j ∈V g |(c,c j )∈E T}
[0100] Then the final knowledge map is formed
[0101]
[0102] Among them, the dynamic concept matching and supplement based on similarity analysis are as follows:
[0103] 8-1 Similarity Analysis and Concept Association
[0104] For the constructed hierarchical knowledge mapping, the similarity between two legal concepts is evaluated, and the similarity threshold ∈ is set to 0.6. This parameter varies according to the actual situation and can be obtained by the grid search method.
[0105]
[0106] 8-2 Detailed explanation and output of concepts
[0107] Finally, we query the legal concept database to extract the detailed explanation of each concept. Its detailed explanation is d c . Summarize the detailed explanations of all concepts to form the final output related concept set
[0108]
[0109] Among them, the feedback mechanism based on dynamic prompt generation is as follows:
[0110] Assume user query Q and dynamic content generated during step execution: Step 6) Collection of relevant legal provisions Step 8) Collection of relevant legal concepts And step 4) Collection of relevant legal cases
[0111] Initial output O 0 for
[0112] O 0 =LLM(Q)
[0113] The feedback A of the model combined with dynamically generated content is:
[0114] concat(O 0 , "Related legal provisions: ", "Collection of related legal concepts:"
[0115] , "Collection of relevant legal cases:",
[0116] Among them, concat represents the string concatenation operation.
[0117] Among them, the output adjustment strategy based on reflective reasoning is as follows:
[0118] The user query is Q, and the output of step 9) is A. Organizational reflection prompt P r :
[0119] concat("Please check the query", Q, "and the answer", A', "Is the topic consistent? Please answer yes or no")
[0120] Among them, concat represents the string concatenation function. Reflection conclusion O satisfies
[0121] O=LLM(P r )
[0122] Among them, LLM(·) represents the use of large language models for content generation. If the reflection result is "yes", the reflection conclusion O at this time is used as the final output; if the reflection conclusion is "no", the reflection reasoning prompt P is organized i :
[0123] concat("Query",Q,"and answer",A′,"Topic is inconsistent, please modify the inconsistent part of the answer")
[0124] Then update A′:
[0125] A′=LLM(P i )
[0126] and repeat the organizational reflection prompt and its follow-up.
[0127] Compared with the prior art, the present invention has the following advantages:
[0128] 1) This application proposes for the first time to apply multi-perspective clustering to the mixed retrieval of relevant cases in the interpretation of legal concepts to ensure diversity.
[0129] 2) This application adopts a hybrid search strategy, that is, combining a large language model and an information retrieval system to interpret legal concepts. This solution uses the reliable information source of the information retrieval system to reduce the illusion problem caused by the large language model due to the quality of citations, and can also avoid the serious decline in the quality of answers caused by relying solely on an information retrieval system with quality issues.
[0130] 3) This application adopts a reflective strategy, that is, in the multiple stages of the execution process involving the large language model, the large language model is re-used.
[0131] Evaluating the quality and accuracy of the data generated by itself and making improvements can improve the quality of generated answers to a certain extent. In practical applications, legal practitioners or ordinary users often need to quickly find relevant cases, legal provisions and concept definitions within a limited time. This method integrates the retrieval of legal cases, provisions and concept definitions and the expansion of related concepts into an organic process. Through multi-perspective clustering and hybrid retrieval methods, it provides multiple information at one time, reduces the time and energy of users repeatedly switching query directions, and can significantly improve retrieval efficiency. In addition, for ordinary users without a legal background, simple legal provisions or professional dictionary explanations are often obscure and difficult to understand. This method organizes and presents the authoritative definition of the concept, related cases and related legal provisions together, and finally uses a large language model to generate easy-to-understand explanations and summaries. This helps users quickly obtain the ins and outs and contextual relationships behind legal concepts, allowing users to understand legal concepts more intuitively and in a more scenario-based way. BRIEF DESCRIPTION OF THE DRAWINGS
[0132] Figure 1 This is the implementation architecture diagram of the legal concept interpretation method based on multi-perspective clustering and hybrid retrieval;
[0133] Figure 2 This is a flow chart of the different steps in the implementation of this program. DETAILED DESCRIPTION
[0134] The implementation process of the present invention is described in detail below in conjunction with the embodiments and the accompanying drawings.
[0135] Embodiment 1: A legal concept interpretation method based on multi-perspective clustering and hybrid retrieval, the implementation architecture diagram is as follows Figure 1 As shown, it includes the following steps:
[0136] Step 1) Separation of query semantics based on semantic hierarchical deconstruction, as follows:
[0137] Suppose the user query (i.e. the text entered by the user) is Q. To effectively parse the query, we first deconstruct its semantic structure hierarchically and construct two query categories: 1 represents the set of indivisible legal concept queries, the second type of query S 2 Represents a set of indivisible non-legal concept queries. Among them:
[0138] S 1 ={c 1 ,c 2 ,…,c m}, refers to a set of m legal terms, where c i Represents the i-th legal term.
[0139] S 2 ={n 1 ,n 2 ,…,n k}, refers to a set of k non-legal nouns, where n j Represents the jth non-legal noun.
[0140] Step 2) Semantic fragment extraction based on dynamic unit parsing, such as Figure 1 As shown on the left, the details are as follows:
[0141] For user query Q, the legal terms involved are extracted and organized into the first type of query instances through the dynamic unit parsing method. For the query text Q = (x 1 ,x 2 ,…,x n ), introduce the tag sequence y=(y 1 ,y 2 ,…,y n ), where each y i is x i The label after classification represents whether the corresponding word is a legal noun. Then, maximize the probability
[0142]
[0143] Then, the text words corresponding to the labels judged as legal nouns in the obtained y are extracted to form the first type of query instance q 1 , extract all the first-class query instances to form the first-class query instance set Q1 Then, based on the relationship between different legal terms in Q, the second type of query instances are organized through the relationship extraction method. Given a query Q and two entities e i and e j , find r ij The value of maximizing the probability
[0144] P(r ij |Q,e i ,e j )
[0145] where r ij Represents e i and e j Is there any relationship between them? If yes, then it is 1, otherwise it is 0, and then extract the ij = 1, extract the two text words corresponding to the ordered pair (i, j), and connect them with "and" to form the second type of query instance q 2 , extract all the second-category query instances to form the second-category query instance set Q 2 . Then, we use the first type of query instance set Q 1 And the second type of query instance set Q 2 Query the legal knowledge base to obtain the first type of query concept C 1 and the second type of query concept C 2 .
[0146] The union of all legal concept sets is the analytical concept set C p , that is, C p =C 1 ∪C 2 .
[0147] Step 3) Case acquisition mechanism based on recursive information retrieval and depth-first aggregation, as follows:
[0148] 3-1) Concept retrieval and relevance assessment
[0149] Establish legal case database When obtaining legal cases related to user query Q, we first extract a subset of concepts in the parsed concept set. For each concept Search for relevant legal cases to obtain a collection of legal cases
[0150]
[0151] where rel(d,c) represents the correlation function between case d and concept c, and
[0152]
[0153] in, and Represents the embedding of case d and concept c obtained by Word2Vec, θ 1 Represents the correlation threshold, which is set to 0.5. This parameter varies according to the actual situation and can be obtained using the grid search method.
[0154] 3-2) Depth-first aggregation
[0155] The obtained legal case set is aggregated to obtain the relevant case set under the output depth limit
[0156]
[0157] Among them, dep(d i ) is case d i The depth evaluation function is
[0158]
[0159] Among them, level(d i ,d j ) means d i and d j In the Legal Case Database represents the hierarchical relationship with the user query, and k is the depth traversal limit.
[0160] Step 4) Case enhancement mechanism based on multi-view clustering, such as Figure 1 As shown in the middle, the details are as follows:
[0161] 4-1) Classification and sampling
[0162] In order to obtain more representative legal cases, a classification entry set is established on this basis These entries indicate the basis for the classification of each legal case. For each classification entry t i , from the case Extract and t i The content of the corresponding entry Use Word2Vec to embed and get the feature v i (d)
[0163]
[0164] From all cases Randomly select one of the embedded feature vectors as the initial cluster center ce 1 Then, if there are currently j cluster centers, calculate each case The Euclidean distance D to the nearest cluster center i (d)
[0165]
[0166] Then, according to the selection probability P c To select the next cluster center ce j+1 , selection probability P c Defined as
[0167]
[0168] Assume there are K cluster centers
[0169] Ce={ce 1 ,ce 2 ,…,ce K}
[0170] Classification result function r i for:
[0171]
[0172] Among them, r i is the classification result, indicating that case d is in the classification entry t i Subsequently, multiple classification results are integrated into a single classification indicator cr:
[0173]
[0174] The brackets represent the rounding function. According to the classification index cr after clustering, the relevant case set Divide into classification result sets Right now
[0175]
[0176] 4-2) Output relevant legal case collections
[0177] from Randomly select a case For representative cases, the relevant legal case collection for:
[0178]
[0179] Step 5) Preliminary screening of regulatory provisions based on cross-source information fusion, as follows:
[0180] 5-1) Construction of legal text database
[0181] First, from multiple legal data sources Extract legal text data and organize it into a database
[0182]
[0183] Each data source The set of clauses in is represented as Among them l ij Represents the jth clause.
[0184] 5-2) Article extraction and information fusion
[0185] The proposed extraction method ε(l ij ,c), this method means that from clause l ij Extract and concept c∈C p Related content:
[0186]
[0187] Among them, rel(l ij ,c) represents the correlation measure between clauses and concepts, then
[0188]
[0189] Among them, Tokenizer(·) represents the use of LLM-based tokenizer to tokenize the text, and the result is a word set. 2 Represents the correlation threshold, which is set to 0.3. This parameter varies according to the actual situation and can be obtained by the grid search method. On this basis, the cross-source information fusion method is used to merge the relevant articles in each data source into a unified article set.
[0190]
[0191] Step 6) Accurate legal text extraction based on semantic enhanced retrieval, such as Figure 1 As shown in the middle, the details are as follows:
[0192] 6-1) Semantic Enhanced Retrieval and Article Acquisition
[0193] In the integrated set of articles After that, we further use semantic enhancement retrieval method To extract a subset of related concepts Relevant legal provisions. The goal of this method is to obtain the most relevant provisions from the fused set of provisions based on the degree of match between the provisions and the concepts:
[0194]
[0195] Among them, sim(l,c) represents the similarity measure between clause l and legal concept c, θ 3 is the similarity threshold, which is set to 0.5. This parameter varies according to the actual situation and can be obtained using the grid search method.
[0196] 6-2) Output of the final set of clauses
[0197] The set of legal provisions obtained through semantic enhanced retrieval is expressed as
[0198]
[0199] This set of articles will be used as the final output of legal article extraction to ensure that it covers the legal articles related to the user's query. Step 7) Concept classification based on multi-level knowledge mapping, as follows:
[0200] 7-1) Construction of knowledge mapping
[0201] First, using the legal casebook The set of relevant legal concepts extracted from and from the legal texts The set of related concepts extracted from Constructing a preliminary knowledge map
[0202]
[0203] in, Represents the set of all related concepts.
[0204] 7-2) Concept hierarchy
[0205] For law concept set The concept c on the above is divided into two layers using the hierarchical partitioning method H(c), which is based on the existing legal knowledge graph G k , the level h of concept c c Defined as the longest path length from c to the root node
[0206]
[0207] Where PathToRoot(c) is the set of all possible paths from c to the root node in the graph. len(p) represents the length of path p. The hierarchical partitioning tree T is constructed as follows:
[0208] First, all concept nodes are divided into levels h c The categories are as follows:
[0209]
[0210] represents all concepts at level i, and Where V g It's G k For G k The edge set E in k , the edge set in the hierarchical partition tree is E T :
[0211]
[0212] Finally, construct a hierarchical partitioning tree
[0213] T=(V g ,E T )
[0214] For a specific concept c, its direct sub-concepts are
[0215] Child(c)={c j ∈V g |(c,c j )∈E T}
[0216] Then the final knowledge map is formed
[0217]
[0218] Step 8) Dynamic concept matching and supplementation based on similarity analysis, such as Figure 1 As shown in the middle, the details are as follows:
[0219] 8-1) Similarity analysis and concept association
[0220] For the constructed hierarchical knowledge mapping, the similarity between two legal concepts is evaluated, and the similarity threshold ∈ is set to 0.6. This parameter varies according to the actual situation and can be obtained by the grid search method.
[0221]
[0222] 8-2) Detailed explanation and output of concepts
[0223] Finally, we query the legal concept database to extract the detailed explanation of each concept. Its detailed explanation is d c . Summarize the detailed explanations of all concepts to form the final output related concept set
[0224]
[0225] Step 9) The feedback mechanism generated based on dynamic prompts is as follows:
[0226] Assume user query Q and dynamic content generated during step execution: Step 6) Collection of relevant legal provisions Step 8) Collection of relevant legal concepts And step 4) Collection of relevant legal cases
[0227] Initial output O 0 for
[0228] O 0 =LLM(Q)
[0229] The feedback A of the model combined with dynamically generated content is:
[0230] concat(O 0 , "Related legal provisions: ", "Collection of related legal concepts:"
[0231] , "Collection of relevant legal cases:",
[0232] Among them, concat represents the string concatenation operation.
[0233] Step 10) Adjust the strategy based on the output of reflective reasoning, such as Figure 1 As shown on the right, the details are as follows:
[0234] The user query is Q, and the output of step 9) is A. Organizational reflection prompt P r :
[0235] concat("Please check the query", Q, "and the answer", A', "Is the topic consistent? Please answer yes or no")
[0236] Among them, concat represents the string concatenation function. Reflection conclusion O satisfies
[0237] O=LLM(P r )
[0238] Among them, LLM(·) represents the use of large language models for content generation. If the reflection result is "yes", the reflection conclusion O at this time is used as the final output; if the reflection conclusion is "no", the reflection reasoning prompt P is organized i :
[0239] concat("Query",Q,"and answer",A′,"Topic is inconsistent, please modify the inconsistent part of the answer")
[0240] Then update A′:
[0241] A′=LLM(P i )
[0242] and repeat the organizational reflection prompt and its follow-up.
[0243] Evaluation Methodology:
[0244] The legal concepts and their corresponding interpretations are submitted to human experts for review, focusing on different indicators x i The score range is 1-5 points: 1 point means that the indicator is not met, 5 points means that the indicator is met, and the average score of each expert is calculated. To represent the explanation in the index x i The overall satisfaction level on a certain indicator is the score of all indicators. Then find the average.
[0245] The indicators of the evaluation model are mainly divided into five aspects: Accuracy of concept analysis: whether the system can accurately analyze the user input to obtain the appropriate legal concepts. Completeness of related concept discovery: whether the system can analyze all legal concepts related to the user input. Relevance of legal cases: whether the legal cases called by the system are relevant to the user input. Diversity of legal cases: whether the sources of legal cases called by the system are diverse. Depth of legal knowledge: whether the legal knowledge called by the system is sufficiently professional. Timeliness of concept explanation: whether the legal knowledge called by the system keeps pace with the times.
[0246] Explanation Method accuracy Completeness Relevance Diversity depth Timeliness GPT-4 3.8 3.7 3.6 3.4 3.5 4.2 Human 4.7 4.6 4.6 4.5 4.7 4.9 This method 4.4 4.5 4.5 4.3 4.2 4.6
[0247] From the above experimental results, we can see that this method has achieved the same performance as human legal experts in terms of interpretation method, accuracy, completeness, relevance, etc., and has surpassed human experts in terms of diversity and timeliness. This shows that with the help of this method, we can effectively explore massive external knowledge and case bases, achieve more accurate conceptual interpretations that meet the requirements of legal practice, and show significant advantages in improving response speed and multi-perspective analysis capabilities. This shows that this method can improve the comprehensive handling ability of complex legal issues while maintaining high efficiency.
[0248] Next, we will give an example of legal concept interpretation generated by this method.
[0249]
[0250]
[0251]
[0252] It should be noted that the above embodiments are not intended to limit the protection scope of the present invention, and equivalent changes or substitutions made on the basis of the above technical solutions all fall within the protection scope of the claims of the present invention.
Claims
1. A legal concept interpretation method based on multi-perspective clustering and hybrid retrieval, characterized in that: The method comprises the following steps: Step 1) query semantic separation based on semantic hierarchical deconstruction to distinguish legal and non-legal concepts; Step 2) extracting semantic fragments based on dynamic unit parsing according to the semantic separation method of step 1) to capture legal concepts that describe the relationship between legal nouns; Step 3) A case acquisition mechanism based on recursive information retrieval and depth-first aggregation is used to systematically collect relevant legal cases; Step 4) a case enhancement mechanism based on multi-view clustering is performed according to the case acquisition mechanism in step 3) to integrate and optimize case information; Step 5) Preliminary screening of legal provisions based on cross-source information fusion, used to screen relevant legal provisions from multiple data sources; Step 6) extracting legal provisions based on the preliminary screening of legal provisions in step 5) based on semantic enhanced retrieval, to screen legal provisions that better match the query; Step 7) construct a knowledge map based on multi-level division to systematically classify legal concepts; Step 8) Dynamic concept matching and supplementation based on similarity analysis based on the knowledge mapping constructed in step 7) to match and supplement relevant legal concepts; Step 9) A feedback mechanism based on dynamic prompt generation is used to optimize the presentation of search results in steps 4), 6) and 8); Step 10) An output adjustment strategy based on reflective reasoning is used to dynamically adjust the output of step 9) to improve performance.
2. The legal concept interpretation method based on multi-perspective clustering and hybrid retrieval according to claim 1 is characterized in that: Step 1) Separation of query semantics based on semantic hierarchical deconstruction, as follows: Suppose the user query (i.e. the text input by the user) is Q. To effectively parse the query, we first deconstruct its semantic structure hierarchically and construct two query categories: the first type of query S1 represents the set of indivisible legal concept queries, and the second type of query S2 represents the set of indivisible non-legal concept queries, where: S1={c1,c2,…,c m }, refers to a set of m legal terms, where c i represents the i-th legal term, S2={n1,n2,…,n k }, refers to a set of k non-legal nouns, where n j Represents the jth non-legal noun.
3. The legal concept interpretation method based on multi-perspective clustering and hybrid retrieval according to claim 1 is characterized in that: Step 2) Semantic fragment extraction based on dynamic unit parsing, as follows: For user query Q, the legal terms involved are extracted and organized into the first type of query instances through the dynamic unit parsing method. All first-category query instances constitute the first-category query instance set Q1. Then, based on the relationship between different legal terms in Q, they are organized into second-category query instances through relationship extraction methods. All second-category query instances constitute the second-category query instance set Q2. Subsequently, the first-category query instance set Q1 and the second-category query instance set Q2 are used to query the legal knowledge base to obtain the first-category query concept C1 and the second-category query concept C2. The union of all legal concept sets is the analytical concept set C p , that is, C p =C1∪C2.
4. The legal concept interpretation method based on multi-perspective clustering and hybrid retrieval according to claim 1 is characterized in that: Step 3) Case acquisition mechanism based on recursive information retrieval and depth-first aggregation, as follows: 3-1 Concept retrieval and relevance assessment, Establish legal case database When obtaining legal cases related to user query Q, we first extract a subset of concepts in the parsed concept set. For each concept Search for relevant legal cases to obtain a collection of legal cases Where rel(d,c) represents the correlation function between case d and concept c, θ1 represents the correlation threshold set to 0.5, This parameter varies according to the actual situation and can be obtained according to the grid search method; 3-2 Depth-first aggregation, The obtained legal case set is aggregated to obtain the relevant case set under the output depth limit Among them, dep(d i ) is case d i The depth evaluation function represents the hierarchical relationship with the user query, and k is the depth traversal limit.
5. The legal concept interpretation method based on multi-perspective clustering and hybrid retrieval according to claim 1 is characterized in that: Step 4) Case enhancement mechanism based on multi-view clustering, as follows: 4-1 Classification and Sampling, In order to obtain more representative legal cases, a classification entry set is established on this basis These entries indicate the basis for the classification of each legal case. For each classification entry t i , propose the classification result function for: Among them, r i is the classification result, indicating that case d is in the classification entry t i Then, multiple classification results are integrated into a single classification indicator cr: The brackets represent the rounding function. According to the classification index cr after clustering, the relevant case set Divide into classification result sets Right now 4-2 Output relevant legal case collections, from Randomly select a case For representative cases, the relevant legal case collection for:
6. The legal concept interpretation method based on multi-perspective clustering and hybrid retrieval according to claim 1 is characterized in that: Step 5) Preliminary screening of regulatory provisions based on cross-source information fusion, as follows: 5-1 Construction of legal text database First, from multiple legal data sources Extract legal text data and organize it into a database Each data source The set of clauses in is represented as Among them l ij represents the jth article, 5-2 Article extraction and information fusion The proposed extraction method ε(l ij ,c), this method means that from clause l ij Extract the concept c∈C p Related content: Among them, rel(l ij ,c) represents the correlation measure between the clause and the concept, θ2 represents the correlation threshold, which is set to 0.
3. This parameter varies according to the actual situation and can be obtained according to the grid search method. On this basis, the cross-source information fusion method is used to merge the relevant clauses in each data source into a unified clause set.
7. The legal concept interpretation method based on multi-perspective clustering and hybrid retrieval according to claim 1 is characterized in that: Step 6) Extract accurate legal provisions based on semantic enhanced retrieval, as follows: 6-1 Semantic Enhanced Retrieval and Article Acquisition In the integrated set of articles After that, we further use semantic enhancement retrieval method To extract a subset of related concepts Relevant legal provisions, the goal is to obtain the most relevant provisions from the fused set of provisions based on the matching degree between the provisions and the concepts: Among them, sim(l,c) represents the similarity measure between article l and legal concept c, θ3 is the similarity threshold, which is set to 0.
5. This parameter varies according to the actual situation and can be obtained by the grid search method. 6-2 Output of the Final Set of Articles The set of legal provisions obtained through semantic enhanced retrieval is expressed as This set of articles will serve as the final output of legal article extraction to ensure that it covers the legal articles related to the user's query.
8. The legal concept interpretation method based on multi-perspective clustering and hybrid retrieval according to claim 1 is characterized in that: Step 7) Construct a knowledge map based on multi-level division, as follows: 7-1 Construction of Knowledge Mapping First, using the legal casebook The set of relevant legal concepts extracted from and from the legal texts The set of related concepts extracted from Constructing a preliminary knowledge map in, represents the set of all related concepts, 7-2 Hierarchical Division Concept Extraction For law concept set The concept c on the graph is mapped to level h using the hierarchical partitioning method H(c). c On the top, a hierarchical partitioning tree T is constructed. For a specific concept c, it and its direct subconcept Child(c) are added to the knowledge mapping to form the final knowledge mapping Step 8) Dynamic concept matching and supplementation based on similarity analysis, as follows: 8-1 Similarity analysis and concept association, For the constructed hierarchical knowledge mapping, the similarity between two legal concepts is evaluated, and the similarity threshold ∈ is set to 0.
6. This parameter varies according to the actual situation and can be obtained by the grid search method to obtain the associated concept set 8-2 Detailed explanation and output of concepts, Finally, we query the legal concept database to extract the detailed explanation of each concept. Its detailed explanation is d c , summarize the detailed explanations of all concepts to form the final output related concept set 9. The legal concept interpretation method based on multi-perspective clustering and hybrid retrieval according to claim 1 is characterized in that: Step 9) The feedback mechanism generated based on dynamic prompts is as follows: Assume user query Q and dynamic content generated during step execution: Step 6) Collection of relevant legal provisions Step 8) Collection of relevant legal concepts And step 4) Collection of relevant legal cases The initial output O0 is O0=LLM(Q) The feedback A of the model combined with dynamically generated content is: concat(O0,"Related legal provisions:", "Collection of related legal concepts:", "Collection of relevant legal cases:", ) Among them, concat represents the string concatenation operation; Step 10) Output adjustment strategy based on reflective reasoning, as follows: The user query is Q, the output of step 10) is A, and the organizational reflection prompt is P r : concat("Please check the query", Q," and the answer", A′," whether the topic is consistent, please answer yes or no") Among them, concat represents the string concatenation function, and the reflection conclusion O satisfies O=LLM(P r ) Among them, LLM(·) represents the use of a large language model for content generation. If the reflection result is "yes", the reflection conclusion O at this time is used as the final output; if the reflection conclusion is "no", the reflection reasoning prompt P is organized i : concat("Query",Q,"and Answer",A′,"The topic is inconsistent, please modify the inconsistent part of the answer") Then update A′: A′=LLM(P i ) and repeat the organizational reflection prompt and its follow-up.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the legal concept interpretation method based on multi-perspective clustering and hybrid retrieval as described in any one of claims 1 to 9 above is implemented.
Citation Information
Patent Citations
Case query method and device, computer equipment and storage medium
CN110209828A
An incomplete multi-view data clustering method and electronic equipment
CN113705603A
Semantic intelligent retrieval method for constructing legal knowledge graph based on terms
CN117216187A
Information retrieval query method for legal data service platform
CN118981512A
Natural language search system
US20070106499A1
Cited By
Network response retrieval enhancement generation method fused with large language model, electronic equipment and computer readable storage medium
CN120705265A
Multi-view knowledge intensive retrieval enhancement generation system and method
CN121166851A
AI large model-based life insurance intelligent operation service system
CN121437168A