Legal consultation system based on big model fusion knowledge graph
By combining large language models and knowledge graphs, the accuracy decline and templated answering of large-model legal consultation systems are solved, achieving more accurate and personalized legal services and improving user experience.
Patent Information
- Application Number
- CN202410756449.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-08-23
AI Technical Summary
The existing large-model legal consultation system suffers from the problem of reduced accuracy and 'illusion' in which the output is inconsistent with reality. It cannot meet the public's legal consultation needs, and the knowledge graph is too templated for user understanding and answers.
Combining large language models and knowledge graphs, through data acquisition, information extraction, knowledge graphs and user interaction modules, deep learning and natural language processing technologies are used for semantic understanding and question and answer matching, identifying legal features and related attributes, and providing more accurate and personalized legal services.
It improves the accuracy and personalization of legal consultation, reduces the time users spend searching and filtering information, provides professional answers and suggestions, and improves user experience.
Smart Images

Figure CN118535706A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence, and in particular to a legal consulting system based on a large model fused with a knowledge graph. Background Art
[0002] Due to the high time and financial costs for individuals to seek help from lawyers when encountering legal disputes in life, and the limited number of reception staff for simple legal consultations, the current legal consultation needs of the general public cannot be met.
[0003] The current big model has a lag, which will lead to a decrease in the accuracy of the big model's legal advice and cause the "illusion" problem where the output does not match reality. Summary of the invention
[0004] The embodiment of the present application provides a legal consulting system based on a large model integrated with a knowledge graph, thereby solving the problem in the prior art that the accuracy of legal consulting based on the large model decreases, resulting in the "hallucination" problem that the output does not match the reality. It realizes the combination of the knowledge graph and the large language model, and provides more accurate and personalized legal services.
[0005] The embodiment of the present application provides a legal consulting system based on a large model fused with a knowledge graph, a data acquisition module, an information extraction module, a knowledge graph module, a large model module and a user interaction module; S1: Data acquisition module: Establish a legal database based on question sets, answer sets, legal provisions and major Kaiyuan legal cases; S2: Information extraction module: Perform sentence analysis on the legal database to obtain sentence structure, perform dependency syntax analysis on the legal database to obtain core words, and then determine the syntactic structure based on dependency words and dependency relations; Furthermore, the core word is the core governing verb (HED), and the dependent words are connected with the core word through dependency relations. The dependency relations can be specifically divided into subject-predicate relationship (SBV), verb-object relationship (VOB), preposition-object relationship (POB), front-position relationship (FOB), directive-verb relationship (DBL), attributive-predicate relationship (ATT), adverbial-predicate relationship (ADV), verb-complement structure (CMP), etc. S3: Knowledge graph module: Use deep learning technology to perform semantic understanding, intent recognition, and question-answer matching on sentences after dependency syntax analysis; Furthermore, the sentences after dependency syntax analysis are annotated according to the entity annotation system "BIO" to obtain data triple information; Identify legal features of input questions, search for attributes associated with questions, and match answers; The method of identifying the legal features of the input question, searching for attributes associated with the question and matching the query of the answer includes but is not limited to a method combining BERT, a bidirectional LSTM network and CRF; S4: Large model module: Build a large language model, train the model based on the legal database, and learn to identify the mapping relationship between legal questions and answers; S5: User interaction module: Perform dependency syntax analysis on the user's question, link it to the knowledge graph module, and output the knowledge graph question answer after matching the optimal value; The answer to the knowledge graph question is input into the large language model module and fused with the answer to the original question in the large language model to obtain the final answer.
[0006] After the S2 information extraction module performs dependency syntactic analysis, multiple predicates in a sentence are identified, judged, and deleted, which specifically includes the following steps: S21: Establishing a syntactic analysis tree, specifically, performing syntactic analysis on the sentence through a syntactic analyzer to obtain a syntactic analysis tree; S22: Define the candidate argument set, loop through the syntactic analysis tree, and find all verb nodes that may become predicates; Further, whether the verb node is a verb is determined by an external natural language processing library, and the candidate argument of the verb is added to the candidate argument set; S23: predefine language rules, loop through the candidate argument set, delete candidate arguments that do not meet the requirements, and obtain the first candidate argument set; S24: identifying the truth or falsity of candidate arguments in the first candidate argument set, determining whether the candidate arguments in the first candidate argument set are true arguments or false arguments by training based on a machine learning binary classifier, and deleting false arguments; Loop through S24 to obtain a second candidate argument set containing all true arguments; S25: Regenerate new sentences from all true arguments in the second candidate argument according to dependency words and dependency relationships, and input the new sentences into the knowledge graph module for subsequent operations.
[0007] Calculating sentence similarity for long legal documents includes the following steps: S51: taking the long legal document as a first legal document, and selecting a plurality of sentences from the first legal document as initial sentences; S52: Using the word embedding technology in natural language processing technology, the text expressed in natural language is converted into a real number vector used by a computer, including but not limited to word vectorization methods such as Word2vec, and the sentence similarity is calculated, specifically: S521: Set the first sentence to w1, the second sentence to w2, and the word vector length to n, then , ; S522: Calculate the similarity between the first sentence and the second sentence using the cosine formula, specifically: ; Specifically, the similarity calculation method includes but is not limited to the cosine similarity calculation method; S523: setting a threshold of the cosine similarity results, summarizing and deleting the results whose similarity exceeds the threshold, and rearranging the content of the context; S53: The above steps are repeated until there is no result in the first legal document where the cosine similarity exceeds the threshold, and a second legal document after being rearranged is output.
[0008] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: By combining the big language model with the knowledge graph, we can avoid the "hallucination" problem of the big language model where the model output does not match the reality and the untimely knowledge update, and solve the problem that the knowledge graph cannot understand user questions well and the knowledge graph answers are too templated. And by combining the answers of the knowledge graph and the big language model, the system can provide more accurate and personalized legal services, thereby improving the user experience. Users no longer need to spend a lot of time searching and screening information, and can directly obtain professional answers and suggestions provided by the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 This is a schematic diagram of the structure of a legal consulting system based on a large model fused with a knowledge graph according to the present invention; Figure 2 It is a flow chart of S21-S25 of a legal consulting system based on a large model fusion knowledge graph of the present invention; Figure 3 It is a flow chart of S51-S53 of a legal consulting system based on a large model integrated with a knowledge graph according to the present invention. DETAILED DESCRIPTION
[0010] To facilitate the understanding of the present invention, the present application will be described more comprehensively below with reference to the relevant drawings; the drawings show preferred embodiments of the present invention, but the present invention can be implemented in many different forms and is not limited to the embodiments described herein; on the contrary, the purpose of providing these embodiments is to enable a more thorough and comprehensive understanding of the disclosed content of the present invention.
[0011] It should be noted that the terms “vertical”, “horizontal”, “up”, “down”, “left”, “right” and similar expressions used in this document are only for illustrative purposes and do not represent the only implementation method.
[0012] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by technicians in the technical field to which the present invention belongs; the terms used in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention; the term "and / or" used herein includes any and all combinations of one or more related listed items.
[0013] Embodiment 1: Figure 1 As shown, the present application provides a legal consulting system based on a big model integrated with a knowledge graph, including: a data acquisition module, an information extraction module, a knowledge graph module, a big model module and a user interaction module.
[0014] S1: Data acquisition module: Establish a legal database based on question sets, answer sets, legal provisions and major Kaiyuan legal cases; S2: Information extraction module: Perform sentence analysis on the legal database to obtain sentence structure, perform dependency syntax analysis on the legal database to obtain core words, and then determine the syntactic structure based on dependency words and dependency relations; Furthermore, the core word is the core governing verb (HED), and the dependent words are connected with the core word through dependency relations. The dependency relations can be specifically divided into subject-predicate relationship (SBV), verb-object relationship (VOB), preposition-object relationship (POB), front-position relationship (FOB), directive-verb relationship (DBL), attributive-predicate relationship (ATT), adverbial-predicate relationship (ADV), verb-complement structure (CMP), etc. For example, in “The Industry and Commerce Bureau is responsible for supervising the management of market competition behavior”, “responsible for” is the core dominant verb and plays a dominant role in the entire sentence. The entire sentence can be divided into “The Industry and Commerce Bureau (SBV) is responsible for (HED) supervising (VOB) the management (ATT) of market (ATT) competition (ATT) behavior (POB)”; S3: Knowledge graph module: Use deep learning technology to perform semantic understanding, intent recognition, and question-answer matching on sentences after dependency syntax analysis; Furthermore, the sentences after dependency syntax analysis are annotated according to the entity annotation system "BIO" to obtain data triple information; Identify legal features of input questions, search for attributes associated with questions, and match answers; The method of identifying the legal features of the input question, searching for attributes associated with the question and matching the query of the answer includes but is not limited to a method combining BERT, a bidirectional LSTM network and CRF; S4: Large model module: Build a large language model, train the model based on the legal database, and learn to identify the mapping relationship between legal questions and answers; S5: User interaction module: Perform dependency syntax analysis on the user's question, link it to the knowledge graph module, and output the knowledge graph question answer after matching the optimal value; The answer to the knowledge graph question is input into the large language model module and fused with the answer to the original question in the large language model to obtain the final answer.
[0015] The technical solutions in the above embodiments of the present application have at least the following technical effects or advantages: By combining the large language model with the knowledge graph, we can avoid the "hallucination" problem of model output that does not match reality and the untimely knowledge update that are prone to occur in the large language model, and solve the problem that the knowledge graph cannot understand user questions well and the knowledge graph's answers are too templated.
[0016] By combining the answers from the knowledge graph and large language model, the system can provide more accurate and personalized legal services, thereby improving the user experience. Users no longer need to spend a lot of time searching and screening information, but can directly obtain professional answers and suggestions provided by the system.
[0017] Embodiment 2: Figure 2 As shown, in Example 1, the result obtained by the S2 information extraction module through dependency syntax analysis may be too long and contain multiple predicates. When too many predicates appear in the sentence, it is difficult for the S3 knowledge graph module to perform "BIO" entity labeling.
[0018] Therefore, the embodiments of the present application are optimized to a certain extent based on the above embodiments.
[0019] In some embodiments, after the S2 information extraction module performs dependency syntax analysis, multiple predicates in a sentence are identified, judged, and deleted, specifically including the following steps: S21: Establishing a syntactic analysis tree, specifically, performing syntactic analysis on the sentence through a syntactic analyzer to obtain a syntactic analysis tree; S22: Define the candidate argument set, loop through the syntactic analysis tree, and find all verb nodes that may become predicates; Further, whether the verb node is a verb is determined by an external natural language processing library, and the candidate argument of the verb is added to the candidate argument set; S23: predefine language rules, loop through the candidate argument set, delete candidate arguments that do not meet the requirements, and obtain the first candidate argument set; S24: identifying the truth or falsity of candidate arguments in the first candidate argument set, determining whether the candidate arguments in the first candidate argument set are true arguments or false arguments by training based on a machine learning binary classifier, and deleting false arguments; Loop through S24 to obtain a second candidate argument set containing all true arguments; S25: Regenerate new sentences from all true arguments in the second candidate argument according to dependency words and dependency relationships, and input the new sentences into the knowledge graph module for subsequent operations.
[0020] The technical solutions in the above embodiments of the present application have at least the following technical effects or advantages: By identifying, judging and deleting multiple predicates in a sentence, we can ensure that only predicates closely related to the core words are retained, which helps to reduce redundant data, improve the accuracy of information extraction, adapt to subsequent knowledge graph construction and question-answer matching, and significantly improve the accuracy of information extraction, optimize the syntactic analysis effect, enhance the accuracy of true and false argument identification, and improve the processing efficiency of the knowledge graph module.
[0021] Embodiment 3: Figure 3 As shown, in Example 1 and Example 2, when asking questions, the user will quote a longer legal document or judgment document. When the legal document or judgment document exceeds a certain word limit (including but not limited to more than 500 words), the document will contain multiple core words and repeated sentences.
[0022] Therefore, the embodiments of the present application are optimized to a certain extent based on the above embodiments.
[0023] Calculating sentence similarity for long legal documents includes the following steps: S51: taking the long legal document as a first legal document, and selecting a plurality of sentences from the first legal document as initial sentences; S52: Using the word embedding technology in natural language processing technology, the text expressed in natural language is converted into a real number vector used by a computer, including but not limited to word vectorization methods such as Word2vec, and the sentence similarity is calculated, specifically: S521: Set the first sentence to w1, the second sentence to w2, and the word vector length to n, then , ; S522: Calculate the similarity between the first sentence and the second sentence using the cosine formula: ; Specifically, the similarity calculation method includes but is not limited to the cosine similarity calculation method; S523: setting a threshold of the cosine similarity results, summarizing and deleting the results whose similarity exceeds the threshold, and rearranging the content of the context; S53: The above steps are repeated until there is no result in the first legal document where the cosine similarity exceeds the threshold, and a second legal document after being rearranged is output.
[0024] The technical solutions in the above embodiments of the present application have at least the following technical effects or advantages: For long legal documents, by calculating sentence similarity and deleting repeated sentences with high similarity, the length of the document can be significantly reduced, allowing subsequent steps such as information extraction, syntactic analysis, and knowledge graph construction to be processed more quickly, thereby improving the processing efficiency of the entire legal consulting system.
[0025] By reducing the length of files and redundant information, the computing resources and storage space required by the system to process legal documents will also be reduced accordingly, which will help reduce the overall operating costs of the system.
[0026] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A legal consulting system based on a large model fused with knowledge graph, characterized in that: It includes data acquisition module, information extraction module, knowledge graph module, large model module and user interaction module; S1: Data acquisition module: Establish a legal database based on question sets, answer sets, legal provisions and major Kaiyuan legal cases; S2: Information extraction module: Perform sentence analysis on the legal database to obtain sentence structure, perform dependency syntax analysis on the legal database to obtain core words, and then determine the syntactic structure based on dependency words and dependency relations; S3: Knowledge graph module: Use deep learning technology to perform semantic understanding, intent recognition, and question-answer matching on sentences after dependency syntax analysis; S4: Large model module: Build a large language model, train the model based on the legal database, and learn to identify the mapping relationship between legal questions and answers; S5: User interaction module: Perform dependency syntax analysis on the user's question, link it to the knowledge graph module, and output the knowledge graph question answer after matching the optimal value; The answer to the knowledge graph question is input into the large language model module and fused with the answer to the original question in the large language model to obtain the final answer.
2. A legal consulting system based on a large model fused with a knowledge graph as claimed in claim 1, characterized in that: The core word is the core governing verb, and the dependent words are connected with the core word through dependency relationships. The dependency relationships can be specifically divided into subject-predicate relationship, verb-object relationship, preposition-object relationship, preposition relationship, auxiliary modifier, attributive-predicate relationship, adverbial-predicate relationship and verb-complement structure.
3. A legal consulting system based on a large model fusion knowledge graph as claimed in claim 1, characterized in that: The knowledge graph module annotates the sentences after dependency syntactic analysis according to the entity annotation system "BIO" to obtain data triple information, and then identifies the legal features of the input questions, searches for question-related attributes, and matches the answers.
4. A legal consulting system based on a large model fusion knowledge graph as claimed in claim 1, characterized in that: After the S2 information extraction module performs dependency syntactic analysis, it identifies, judges and deletes multiple predicates in a sentence, which specifically includes the following steps: S21: Establishing a syntactic analysis tree, specifically, performing syntactic analysis on the sentence through a syntactic analyzer to obtain a syntactic analysis tree; S22: Define the candidate argument set, loop through the syntactic analysis tree, and find all verb nodes that may become predicates; Determine whether a verb node is a verb through an external natural language processing library, and add the candidate argument of the verb to the candidate argument set; S23: predefine language rules, loop through the candidate argument set, delete candidate arguments that do not meet the requirements, and obtain the first candidate argument set; S24: identifying the truth or falsity of candidate arguments in the first candidate argument set, determining whether the candidate arguments in the first candidate argument set are true arguments or false arguments by training based on a machine learning binary classifier, and deleting false arguments; Loop through S24 to obtain a second candidate argument set containing all true arguments; S25: Regenerate new sentences from all true arguments in the second candidate argument according to dependency words and dependency relationships, and input the new sentences into the knowledge graph module for subsequent operations.
5. The legal consulting system based on large model fusion knowledge graph as claimed in claim 1 is characterized in that: When a user inquires and quotes a long legal document exceeding 500 words, the S5 user interaction module needs to calculate the sentence similarity, which specifically includes the following steps: S51: taking the long legal document as a first legal document, and selecting a plurality of sentences from the first legal document as initial sentences; S52: Calculate sentence similarity, specifically: S521: Set the first sentence to w1, the second sentence to w2, and the word vector length to n, then , ; S522: Calculate the similarity between the first sentence and the second sentence, specifically: ; S523: setting a threshold value of similarity results, summarizing and deleting the results whose similarity exceeds the threshold value, and rearranging the content of the context; S53: The above steps are repeated until there is no result in the first legal document whose similarity exceeds the threshold, and a second legal document after reformatting is output.
Citation Information
Cited By
Policy matching model construction method and system based on large language model, and medium
CN120145067A
Legal advice and simulation training system and method thereof
TWI946803B
Electronic proposal solicitation processes with artificial intelligence and / or blockchain integrations
US20260340744A1
