Complex information retrieval system and method
By combining knowledge graphs and multi-agent collaborative work, a complex information retrieval system solves the shortcomings of traditional systems in processing complex query tasks, achieves accurate retrieval and association of knowledge in the legal field, and improves retrieval quality and user experience.
Patent Information
- Application Number
- CN202411112889.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2024-10-15
AI Technical Summary
Traditional information retrieval systems perform poorly when handling complex query tasks, especially in the legal field. It is difficult to quickly respond to continuous updates of knowledge and provide deep semantic understanding, resulting in an impact on retrieval quality and user experience.
A complex information retrieval system that combines knowledge graph and retrieval enhancement generation is used to achieve cross-graph matching and multi-agent collaborative work through the knowledge graph module, subgraph expansion generation module, agent building module, distributed retrieval module and strategy optimization module. , combined with open source large language models for answer generation.
It achieves accurate retrieval and association of professional knowledge, improves the accuracy and practicality of retrieval, is suitable for scenarios such as intelligent question and answer, expert systems and assisted writing, and provides a new intelligent solution.
Smart Images

Figure CN118779364A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence technology, and in particular relates to a complex information retrieval system and method. Background Art
[0002] Traditional information retrieval systems, such as search engines based on keyword matching, often perform poorly when handling complex query tasks. Such queries usually require the comprehensive use of multiple heterogeneous information sources, cross-domain correlation analysis, and deep semantic understanding, rather than simple keyword matching. For example, in the legal field, legal texts are lengthy, lack structure, and widely use complex rhetoric such as citations and enumerations, which makes it difficult for machines to understand and extract. Legal retrieval needs are diverse and sophisticated, requiring the retrieval of similar cases from multiple dimensions and the tracking of the evolution of legal concepts. This requires the system to have deep semantic understanding and reasoning capabilities, while traditional retrieval systems are difficult to respond quickly to the continuous updating of legal knowledge, affecting retrieval quality and user experience. In recent years, advances in artificial intelligence technology have brought hope for solving the above problems. Among them, knowledge graphs use graph structures to represent the semantic associations between concepts, making cross-domain and cross-information source knowledge integration possible; and large language models can learn rich grammar, semantics, common sense, and domain knowledge by pre-training on massive text corpora, greatly improving the ability to understand user intent and query context. However, current RAG systems still face many challenges in handling complex query tasks in the real world. For example, users have diverse query needs, and the knowledge involved in their queries may be scattered in different local areas of the graph. Appropriate cross-subgraph matching and linking mechanisms are needed to achieve global information fusion. General language models often face risks such as insufficient corpus and overfitting when adapting to vertical fields. It is necessary to introduce domain graphs for incremental pre-training. Therefore, it is necessary to develop a flexible and efficient complex domain RAG system through a multi-agent collaboration mechanism and differentiated subgraph retrieval strategies. Summary of the invention
[0003] In response to the problems in the prior art, the present invention provides a complex information retrieval system and method, specifically a retrieval system that combines a knowledge graph with retrieval enhancement generation.
[0004] In order to achieve the above purpose, the technical solution adopted in this application is: In a first aspect, the present invention provides a complex information retrieval system, including: a knowledge graph module, a subgraph expansion generation module, an agent construction module, a distributed retrieval module, an answer generation module and a strategy optimization module; The knowledge graph module is constructed by data preprocessing, designing legal domain ontology, data conversion and importing, and knowledge graph verification and optimization; The subgraph expansion generation module divides the legal knowledge graph into semantic subgraphs based on the graph partitioning algorithm discovered by the community; The agent building module includes a query understanding agent, a coordination control agent, a subgraph updating agent, a retrieval strategy agent, and an expansion graph matching agent, which perform semantic parsing and structured representation conversion, as well as dynamic task allocation, parameter tuning, and resource optimization. The distributed retrieval module includes a case type retrieval agent, a case subject retrieval agent, a case time retrieval agent, and a legal document retrieval agent, which respectively apply corresponding retrieval strategies to perform local retrieval and obtain structured answers; The answer generation module introduces an open source large-scale language model for answer generation, outputs natural language answer text generated based on structured answers and prompt information, and designs an API interface for this system based on the large model; The strategy optimization module uses an evaluation module to regularly evaluate the performance of each retrieval agent to obtain an evaluation result; the evaluation module sends the evaluation result to the coordination control agent, and the coordination control agent comprehensively integrates various evaluation indicators to perform reinforcement learning on the agent's retrieval strategy.
[0005] Furthermore, the data preprocessing includes collecting relevant data about the court, which is divided into three categories: structured data, semi-structured data and unstructured data. Structured data is usually stored in the database in the form of tables, including fields such as case number, case type, court date, and judgment result. Semi-structured data contains recognizable patterns or tags, so that there is a certain logical relationship between data elements; unstructured data includes the judge's reasoning process, legal citations and free text descriptions interspersed in the judgment instructions.
[0006] Furthermore, the semantic subgraph includes a case type subgraph, a legal regulations subgraph, a court level subgraph, a case cause element subgraph and a guiding case subgraph.
[0007] Furthermore, the query understanding agent adopts a sequence-to-sequence model based on a neural network to implement an end-to-end semantic parsing agent, and the structure includes three parts: an encoder, a decoder, and an attention mechanism.
[0008] Furthermore, the coordinated control agent adopts a hierarchical multi-agent reinforcement learning framework to decompose complex decision-making problems into multiple sub-tasks, which are completed collaboratively by agents at different levels.
[0009] Furthermore, the input of the interface includes two parts: one is the structured answer produced by the upstream module, and the other is the prompt information generated according to the user portrait and query history; the output is the natural language answer text generated based on the structured answer and the prompt information.
[0010] Furthermore, the evaluation indicators include precision, recall, response time, and resource consumption.
[0011] In a second aspect, the present invention provides a working method of a complex information retrieval system, comprising: Construct the knowledge graph module through data preprocessing, designing legal domain ontology, data conversion and importing, and knowledge graph verification and optimization; The legal knowledge graph is divided into semantic subgraphs through the subgraph expansion generation module based on the community discovery graph partitioning algorithm; The intelligent agent building module is used to perform semantic parsing and structured representation conversion, as well as dynamic task allocation, parameter tuning, and resource optimization; the intelligent agent building module includes query understanding agent, coordination control agent, subgraph update agent, retrieval strategy agent, and graph expansion matching agent; Perform local search and obtain structured answers through the distributed search module, which includes case type search agent, case subject search agent, case time search agent and legal document search agent, which respectively apply corresponding search strategies to perform local search and obtain structured answers; Through the answer generation module, an open source large-scale language model is introduced for answer generation, and the natural language answer text generated based on the structured answer and prompt information is output. Based on the large model, an API interface for this system is designed. The input of the interface includes two parts: one is the structured answer output by the upstream module, and the other is the prompt information generated based on the user portrait and query history; the output is the natural language answer text generated based on the structured answer and prompt information; The strategy optimization module uses an evaluation module to regularly evaluate the performance of each retrieval agent. The evaluation indicators include precision, recall, response time, and resource consumption. The evaluation module sends the evaluation results to the coordination and control agent, which integrates various evaluation indicators and conducts reinforcement learning on the agent's retrieval strategy.
[0012] Compared with the prior art, the advantages and positive effects of the present invention are: The present invention provides a complex information retrieval system and method. The system takes the knowledge graph as the core, and realizes the accurate retrieval and association of professional knowledge through the collaborative work of intelligent agents such as subgraph update, query understanding, retrieval strategy, and cross-graph matching. At the same time, the system introduces an open source large-scale language model for answer generation, and enhances its professionalism and interpretability through prompt engineering and domain adaptive fine-tuning. The present invention comprehensively utilizes cutting-edge technologies such as knowledge graphs, machine learning, and natural language processing to provide a new set of intelligent solutions for professional field knowledge services. By constructing knowledge graphs and multiple intelligent agents, the accuracy and practicality of retrieval are greatly improved by using distributed retrieval. Finally, the answer is generated using a large model. The system can be widely used in scenarios such as intelligent question and answer, expert systems, and assisted writing, and has good application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0014] Figure 1 It is a schematic diagram of the structure of the complex information retrieval system of the present invention. DETAILED DESCRIPTION
[0015] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described below in conjunction with the accompanying drawings and embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0016] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways than those described herein. Therefore, the present invention is not limited to the specific embodiments of the following disclosure.
[0017] Embodiment 1, as Figure 1 As shown, the present application provides a complex information retrieval system and method based on knowledge graph and multi-agents. The system takes the knowledge graph as the core and realizes accurate retrieval and association of professional knowledge through the collaborative work of agents such as subgraph update, query understanding, retrieval strategy, cross-graph matching, etc. At the same time, the system introduces an open source large-scale language model for answer generation, and enhances its professionalism and interpretability through prompt engineering and domain adaptive fine-tuning. The present invention includes: a knowledge graph module, a subgraph expansion generation module, an agent construction module, a distributed retrieval module, an answer generation module and a strategy optimization module; By comprehensively utilizing cutting-edge technologies such as knowledge graphs, machine learning, and natural language processing, it provides a new set of intelligent solutions for professional knowledge services.
[0018] S1. Construct a knowledge graph module for a specific field: The following steps take the construction of a court’s knowledge graph as an example.
[0019] S11. Data preprocessing: collect relevant data about the court, which can be roughly divided into three categories. Structured data (such as case management system), semi-structured data (such as legal documents) and unstructured data (such as regulations, judgment instructions, etc.). Data type description: Structured data is usually stored in the database in the form of tables. For example, in the case management system, it may contain fields such as case number, case type, court date, judgment result, etc. Each data corresponds to a cell in the table, which is easy to query and analyze. Although semi-structured data does not have a fixed table form, it contains recognizable patterns or tags, so that there is a certain logical relationship between data elements. Semi-structured data can parse information through specific tags or keywords. For example, in legal documents, key information such as party information, litigation requests, legal basis, etc. can be extracted through tags or specific keywords. Unstructured data is difficult to manage and process directly through traditional database management systems. For example, the judgment instructions may be interspersed with the judge's reasoning process, legal citations, and free text descriptions. This information requires complex text analysis technology to extract useful content. Data cleaning is performed on the collected data, and regular expressions are used to filter out irrelevant or erroneous information. Perform word segmentation, stem extraction, or lemmatization on the text to ensure the consistency of entity names, for example, unifying the representation of "Supreme People's Court" and "Supreme Court".
[0020] Using open source models such as the BERT model, we extract entity, relationship, and attribute information from the cleaned court data. Entities include case names, plaintiffs, defendants, and institution names. Relationships, such as verbs such as "hearing" and "involving", determine the connection between the case and the judge and the law. Attributes refer to the specific attribute values of entities, such as case numbers, court dates, and judgment results.
[0021] S12. Design a legal domain ontology and clarify core concepts such as cases, judges, plaintiffs, and defendants. Define relationship types (such as trial, involved laws, cited precedents), and clarify their directionality and domain and scope limitations. Classify and hierarchically construct laws and regulations, such as organizing them according to legal levels (laws, regulations, rules, etc.).
[0022] S13. Data conversion and import. Use RDFLib (python open source library) to create URI (Uniform Resource Identifier) for each entity, relationship and attribute to form a triple (Subject, Predicate, Object), where the subject represents an entity or resource, usually represented by URI or blank node; the predicate represents the relationship between entities or the attributes of entities, represented by URI; the object represents another entity, attribute value or data associated with the subject, which can be URI, blank node or literal. For example, (Case A, triedBy, Judge B) means that Case A is tried by Judge B.
[0023] Use Neo4j (Neo4j is a high-performance graph database management system, which is a type of NoSQL database that focuses on processing graph data. Unlike traditional tabular databases (such as relational databases), Neo4j stores data in the form of nodes, relationships, and properties. This data model is very suitable for expressing complex relationships between entities) Cypher statements or Python's Neo4j driver to batch import RDF triples into the graph database and create nodes and relationships.
[0024] S14. Knowledge graph verification and optimization: Ensure the conversion is correct by querying the integrity and consistency of the test data. Integrity check: S14a. Information link integrity: For entities with important associations, verify whether the correct relationship is established between them. For example, whether each case node is linked to the corresponding judge, plaintiff, defendant, etc.
[0025] S14b, Hierarchical integrity: For concepts with classification hierarchies, such as laws and regulations, check whether they are correctly organized according to the predefined hierarchical structure. Whether all sub-category regulations are included under the parent category regulations.
[0026] S14c, Information coverage completeness: Based on business needs, define some key information query patterns. Execute these queries and check whether the returned results meet expectations and cover the required information.
[0027] Consistency Check: S14d, Literal value consistency: For the attribute value of the same entity, check whether it is consistent in different data sources or different triples. For example, the case number of the same case should be exactly the same in different triples.
[0028] S14f, Relation Consistency: Verify that the domain and scope restrictions of the relationship are met. For example, the subject of the "trial" relationship should be the case node and the object should be the judge node. Check if there are any relationships that violate these restrictions.
[0029] S14g, Data type consistency: Check whether the data type of the attribute value is consistent with the ontology definition. For example, the case number should be a string type, and the court date should be a date type. ). Based on the feedback from actual retrieval needs, continuously iterate and optimize the knowledge graph structure and content to improve the accuracy and efficiency of information retrieval.
[0030] S2, subgraph expansion generation module. Considering the complexity of legal knowledge, this embodiment adopts a graph partitioning algorithm based on community discovery, such as the Louvain algorithm, to divide the legal knowledge graph into the following semantic subgraphs: The Louvain algorithm is a community discovery algorithm based on modularity optimization, which can be used to detect tightly connected community structures in complex networks. The following are the detailed steps of the Louvain algorithm: S21. Initialization: Treat each node in the graph as an independent community and calculate the initial modularity of the graph. Modularity is used to measure the quality of community division. The larger the value, the tighter the connection within the community and the sparser the connection between communities.
[0031] S22, first stage: node movement; For each node i, traverse all its neighboring nodes j: S22a, calculate the modularity gain ΔQ of moving node i to the community where node j is located.
[0032] S22b: Find the community that can provide the maximum modularity gain and move node i to the community.
[0033] S22c, if all nodes have been considered and no move operation has occurred, then enter the second stage.
[0034] S23, Phase 2: Community Aggregation; Treat the communities obtained in the first stage as new nodes and construct a new graph: S23a, In the new graph, each node represents a community.
[0035] S23b. In the new graph, the edge weight between two new nodes is equal to the sum of the edge weights between the two communities in the original graph.
[0036] S24, repeated iteration: Use the new graph obtained in the second stage as input, and repeat the first and second stages until the modularity is no longer significantly improved.
[0037] S25, community hierarchy tree: According to the algorithm's iterative process, a community hierarchy tree is generated. The bottom layer of the tree is the nodes in the original graph, and each upper layer node is aggregated from the communities in the lower layer. Different levels represent community divisions of different granularities.
[0038] S26. Select the best division: In the community hierarchy tree, select the layer with the largest modularity as the final community division result.
[0039] Case type sub-map: such as criminal cases, civil cases, administrative cases, etc.; Legal and regulatory sub-map: such as criminal law, civil law, administrative law, etc.; Sub-map of court hierarchy: Supreme People's Court, High People's Court, Intermediate People's Court, Basic People's Court; Case element sub-graph: the constituent elements of various cases and their relationships; Guiding Cases Sub-Chart: Influential guiding cases in various fields.
[0040] S3. Construct an agent module. This embodiment constructs the following agents for different tasks: Query understanding agent: Before the user query is submitted to the system, it performs semantic analysis and structural representation conversion. This step is to enable the subsequent retrieval agent to better understand the user's intention and improve the accuracy and efficiency of retrieval.
[0041] Coordination control agent: a global scheduler located above other agents. It does not directly participate in specific knowledge retrieval and matching tasks, but dynamically allocates tasks, optimizes parameters, and optimizes resources for tasks such as subgraph updates, retrieval strategy selection, and cross-graph matching based on the real-time status and feedback information of the system.
[0042] The subgraph update agent, retrieval strategy agent and cross-graph matching agent are responsible for the three core tasks of knowledge graph construction, retrieval and fusion respectively.
[0043] The following describes the construction and training process of each agent: S31, query understanding agent, query understanding agent is responsible for converting the user's natural language query into a structured representation on the knowledge graph for subsequent retrieval and matching. This embodiment uses a sequence-to-sequence (Seq2Seq) model based on a neural network to achieve end-to-end semantic parsing. Specifically, the structure of the agent includes three parts: encoder, decoder and attention mechanism. The encoder uses a bidirectional LSTM (BiLSTM) to encode the user query and obtain its context vector representation; the decoder uses a unidirectional LSTM to predict the next target token based on the output of the encoder and the currently generated token; the attention mechanism is used to dynamically adjust the weights of the encoder output at different positions, so that the decoder can selectively focus on different parts of the input sequence. The input of the model is the user's natural language query (such as "Zhang San 2018 A case judgment"), and the output is the corresponding logical expression (such as "((case: Zhang San case: case by A) AND (case: Zhang San case: year 2018))"). In order to train the model, it is necessary to build a large-scale <query, logical expression> paired corpus. This requires the assistance of legal experts to manually or semi-automatically map common query patterns into structured graph query statements. During the training process, the goal of the model is to minimize the prediction error of the logical expression. The cross entropy loss function is used here, which maximizes the probability of the correct logical expression. At the same time, in order to improve generalization and robustness, optimization techniques such as regularization terms of the attention mechanism and data enhancement of query rewriting can also be introduced. The cross entropy loss is defined as:
[0044] Where L represents the cross entropy loss, i represents a sample traversed, and yi represents the true label vector. represents the probability distribution vector predicted by the model. For example, suppose the query understanding model needs to parse the user query into three types of logical operations: AND, OR, and NOT. For a certain training sample, the output of the model is a probability distribution vector. , indicating that the model predicts that the probability of the query belonging to AND, OR, and NOT is 0.6, 0.3, and 0.1 respectively. The true label of the query is AND, so y = [1, 0, 0]. According to the cross entropy loss function formula,
[0045] S32, coordination and control agent, the coordination and control agent is responsible for unified management and scheduling of other agents, and adaptively optimizes the retrieval strategy based on feedback information. Here, a hierarchical multi-agent reinforcement learning (MARL) framework is adopted to decompose complex decision-making problems into multiple subtasks, which are completed collaboratively by agents at different levels. At the top level, the coordination and control agent determines the calling order, resource allocation, task segmentation, etc. of each sub-agent based on global information such as query type and knowledge base status. This can be modeled using the Deep Q-Network (DQN) equivalent function approximation method, that is, based on the current state, predict the long-term rewards of taking different coordinated actions. At the bottom level, each sub-agent (such as retrieval strategy agent, cross-graph matching agent, etc.) takes corresponding sub-task operations based on its own local perspective. Here, training algorithms based on policy gradient (Policy Gradient), evolutionary computation (Evolutionary Computation), etc. can be designed for different types of sub-agents, and collaborative learning between multiple sub-agents can be achieved through the communication mechanism with the coordination and control agent. During the training process, the core of the MARL system is to design a reasonable state representation, action space and reward function. Among them, state representation requires comprehensive graph data statistics (such as subgraph size, correlation, etc.), historical query records (such as common query patterns, feedback, etc.) and real-time system conditions (such as load balancing, cache hit rate, etc.); the action space covers various aspects such as agent scheduling, retrieval strategy selection, and knowledge base expansion; the reward function needs to weigh multiple factors such as precision, recall, response time, and computational cost to guide the agent to learn the global optimal collaborative strategy. In addition, in order to accelerate the training of the MARL system, the structural information of the knowledge graph can also be used to introduce prior knowledge, such as defining the abstraction of states and actions through metapaths, or using graph neural networks (GNNs) to achieve more efficient state representation learning. At the same time, the exploration and optimization process of the underlying agent can be assisted by designing a hierarchical reward shaping mechanism.
[0046] Evolutionary computation is a type of optimization algorithm based on the principle of biological evolution. Its core idea is to find the global optimal solution in a complex solution space through mechanisms such as group search and survival of the fittest. Compared with gradient-based methods such as policy gradient, evolutionary computation is usually simpler and more intuitive, does not require the objective function to be differentiable, and has a wider range of applications.
[0047] Specifically: In a multi-agent system, a population can be maintained for each type of sub-agent (such as retrieval strategy agent, cross-graph matching agent, etc.), and the individuals in each population correspond to a set of strategy network parameters of the agent of that type. In this way, different evolutionary algorithms and fitness functions can be designed for different types of sub-agents to better explore their local strategy space.
[0048] Specific algorithm steps: S321. Initialize multiple populations, each population corresponds to a type of sub-agent, and the individuals in the population represent the strategy network parameters of this type of agent.
[0049] S322. In each evolutionary iteration, for each type of sub-agent population, perform the following steps respectively: S322a, sampling the trajectory data of this type of intelligent agent in the environment, and calculating the fitness value of the individual according to its interaction with other intelligent agents. The fitness function here can be designed for the subtask objectives of this type of intelligent agent. S322b. Perform evolutionary operations such as selection, crossover, and mutation on the population according to the fitness value to generate a new generation of population.
[0050] S323. Evolve the populations of various sub-agents for multiple rounds, evaluate the global performance of the entire multi-agent system by coordinating the scheduling strategies of the control agents, and pass feedback signals to each sub-population to guide them to further optimize.
[0051] S324. Output the strategy network parameters corresponding to the individuals with the highest fitness in each type of sub-agent population.
[0052] In the above process, a population can be maintained for different types of sub-agents such as retrieval strategy agents and cross-graph matching agents, and each population can perform evolution operations independently. After each round of evolution, the global performance of the entire multi-agent system is evaluated by coordinating the scheduling strategy of the control agent, and the feedback signal is transmitted to each sub-population to guide them to further optimize. In this way, while exploring the local strategy of each sub-agent, the synergy of the entire system can be taken into account to achieve the global optimum.
[0053] S33, subgraph update agent, which mainly relies on text classification and named entity recognition (NER) technology. The text classification part uses convolutional neural network models such as TextCNN, which are supervised and trained on legal documents, case updates and other corpora to automatically classify new texts; the NER part uses sequence annotation models such as BiLSTM-CRF, which are trained on annotated legal text corpora to extract entities and relationships from texts. The training data of these two models needs to be manually annotated by domain experts.
[0054] S34, retrieval strategy agent, which uses deep reinforcement learning and is trained through the policy gradient algorithm. The state representation is obtained by learning the representation of the query and related subgraphs through graph embedding methods (such as TransE, GraphSAGE, etc.); the action space is discrete, including predefined retrieval operations such as selecting subgraphs, expanding keywords, and adjusting relevance thresholds; the reward is designed based on indicators such as the precision and recall of the returned results. The training of this agent needs to be simulated and evaluated on a real legal knowledge graph.
[0055] S35, cross-graph matching agent, the core of which is the Siamese Network, which is trained by contrastive learning. Specifically, the representation of different subgraphs is learned by using methods such as the Graph Attention Network (GAT), and then the node representations of the two subgraphs are input into the Siamese Network. The score function of cross-graph matching is learned by maximizing the similarity of positive sample pairs and minimizing the similarity of negative sample pairs. The training data can be obtained by randomly sampling subgraph pairs in the legal knowledge graph and annotating them by similarity by domain experts.
[0056] S4, distributed retrieval module, each retrieval agent applies the retrieval strategy it has mastered, performs local retrieval on one or more specified knowledge subgraphs, and obtains structured answers. The retrieval strategy can include keyword-based Boolean retrieval, TF-IDF ranking, entity linking, graph representation learning and other technologies to improve the precision and recall of retrieval from both semantic and structural dimensions. For example: the case type retrieval agent directly finds the case type that is most similar to "A" semantically by applying knowledge graph representation learning models such as TransE on the case cause element subgraph; the case subject retrieval agent first uses Elasticsearch to perform fuzzy matching on the name "Zhang San", and then uses the Cypher language of the graph database to query the case nodes associated with these subjects; the case time retrieval agent applies range query in the graph database to filter out case nodes with judgment time in 2018; the legal document retrieval agent first finds all legal document nodes containing "judgment" through regular matching, and then uses the text similarity model to sort their contents.
[0057] S5. Generate answer module. This embodiment introduces an open source large-scale language model (such as Qwen-72B-Chat) for answer generation. An API interface for this system is designed based on the large model. The input of this interface includes two parts: one is the structured answer produced by the upstream module, such as relevant cases and laws retrieved, etc.; the other is the prompt information (prompt) generated based on the user portrait and query history, such as "explain in plain language", "analyze from the perspective of the defense lawyer", "refer to the following similar cases", etc. The output is a natural language answer text generated based on the above information. In this way, the language generation ability of the Qwen model is seamlessly connected with the front-end knowledge retrieval and user understanding.
[0058] As a general language model, the Qwen model mainly draws its knowledge from a large amount of open domain network texts. In professional fields such as law, it is inevitable that there will be problems such as knowledge bias and factual errors. In order to improve the reliability and professionalism of the generated answers, two strategies can be adopted: First, the generation process of the Qwen model is constrained by using deterministic knowledge retrieved from the legal knowledge graph (such as the original text of the law, the summary of the judgment, etc.). These structured knowledge points are explicitly embedded in the prompt information to guide the model to generate subsequent text based on known facts, reducing the risk of making something out of nothing. At the same time, the reasoning path in the generation process is visualized to trace the source of each argument.
[0059] Second, fine-tune the Qwen model for domain adaptation. A large amount of high-quality legal corpus, such as legal textbooks, judgments, and court records, can be collected in advance, and fine-tuned on the Qwen model to better learn the characteristics and expressions of legal language.
[0060] S6, Strategy Optimization Module, the system uses an evaluation module to regularly evaluate the performance of each retrieval agent. The evaluation module is implemented using the following scheme: S61, Data Collection: Collect the query requests processed by each retrieval agent, the returned results, and related metadata, such as query time, query parameters, etc. S62, Evaluation Index Calculation, Precision Calculation: Calculate the accuracy of the results returned by each retrieval agent, such as accuracy, based on the user's feedback on the structured answer (retrieval result). Recall Calculation: Evaluate the coverage of the results returned by the retrieval agent, such as recall. Response Time Calculation: Count the average response time of each retrieval agent processing query requests; Resource Consumption Calculation: Calculate the average resource consumption level of each retrieval agent based on the collected resource consumption data; S63, Evaluation Report Generation: According to the set time interval (such as every hour, every day), summarize the evaluation index data of each retrieval agent and identify its performance improvement or decline. Finally, send the evaluation report and key indicator data to the coordination and control agent for it to formulate an optimization strategy. The evaluation indicators include precision, recall, response time, resource consumption, etc. The evaluation module sends the evaluation results to the coordinated control agent.
[0061] Taking precision rate as an example, different thresholds can be set to trigger corresponding optimization operations based on the precision rate performance of the retrieval agent.
[0062] Assume that the precision rate is divided into the following levels: precision rate>= 90%: excellent; 80%<= precision rate<90%: good; 70%<= precision rate<80%: average; precision rate<70%: poor; According to the precision level of the retrieval agent, the following optimization strategies can be formulated: S621. When the precision reaches the "excellent" level, it can be considered that the current search strategy is relatively mature and does not need to be adjusted significantly. At this time, the learning rate of the agent can be appropriately reduced to allow it to make fine adjustments based on the current strategy to maintain good performance. At the same time, the exploration rate of the agent can be increased to allow it to try some new search paths and find possible improvement directions.
[0063] S622. When the precision rate is at the "good" level, the learning rate of the agent can be appropriately increased to speed up its learning and optimization. At the same time, its exploration rate can be appropriately reduced to encourage it to search in the neighborhood of the current better strategy to avoid excessive divergence. In addition, the agent can also learn from agents with higher precision rates through knowledge distillation, transfer learning and other technologies to improve its retrieval strategy.
[0064] S623. When the precision rate is at the "average" level, the agent's search strategy needs to be significantly adjusted. At this time, its learning rate and exploration rate can be significantly improved to encourage it to try more different search paths and strategy combinations. At the same time, more training samples and feedback information can be provided to the agent through data enhancement, active learning and other technologies to help it quickly improve its performance.
[0065] S624: When the precision rate is at the "poor" level, the agent's retrieval strategy needs to be improved. At this point, you can consider resetting some of its learning parameters, or even reinitializing its strategy network, so that it can start learning from scratch. At the same time, you can also analyze its retrieval logs and error cases, manually summarize some optimization strategies and rules, introduce prior knowledge, and guide its learning and optimization direction.
[0066] Among them, exploration rate is an important concept in reinforcement learning, which determines whether the agent prefers to explore new possibilities or use existing experience when choosing actions.
[0067] The coordinated control agent combines various evaluation indicators to conduct reinforcement learning on the agent's retrieval strategy. The state is the size, structural characteristics and historical retrieval performance of the current subgraph, the action is to adjust the hyperparameters (such as the relevance threshold), change the retrieval algorithm (such as switching from TF-IDF to BM25), etc., and the reward is a weighted combination of evaluation indicators. This enables the agent to adaptively optimize the strategy according to the actual operation situation.
[0068] In addition, the coordination and control agent is also responsible for managing the life cycle of the agents. When the size of a subgraph grows significantly or the type of hot query changes, the coordination and control agent will create a new retrieval agent, pre-train it using the historical query logs of the relevant subgraph, and put it into service. For agents that are idle for a long time or have poor performance, the coordination and control agent will consider shutting them down and reclaiming computing resources.
[0069] Embodiment 2, the present invention provides a working method of a complex information retrieval system, comprising: Construct the knowledge graph module through data preprocessing, designing legal domain ontology, data conversion and importing, and knowledge graph verification and optimization; The legal knowledge graph is divided into semantic subgraphs through the subgraph expansion generation module based on the community discovery graph partitioning algorithm; The intelligent agent building module is used to perform semantic parsing and structured representation conversion, as well as dynamic task allocation, parameter tuning, and resource optimization; the intelligent agent building module includes query understanding agent, coordination control agent, subgraph update agent, retrieval strategy agent, and graph expansion matching agent; The distributed retrieval module uses keyword-based Boolean retrieval, TF-IDF ranking, entity linking, and graph representation learning technology to improve the precision and recall of retrieval from both semantic and structural dimensions; Through the answer generation module, an open source large-scale language model is introduced for answer generation. Based on the large model, an API interface for this system is designed. The input of the interface includes two parts: one is the structured answer produced by the upstream module, and the other is the prompt information generated based on the user portrait and query history; the output is the natural language answer text generated based on the structured answer and the prompt information; The strategy optimization module uses an evaluation module to regularly evaluate the performance of the case type retrieval agent, the case time retrieval agent, and the legal document retrieval agent. The evaluation indicators include precision, recall, response time, and resource consumption. The evaluation module sends the evaluation results to the coordination and control agent, which integrates various evaluation indicators and conducts reinforcement learning on the agent's retrieval strategy.
[0070] The above description is only a preferred embodiment of the present invention and does not limit the present invention in other forms. Any technician familiar with the profession may use the technical content disclosed above to change or modify it into an equivalent embodiment with equivalent changes and apply it to other fields. However, any simple modification, equivalent change and modification made to the above embodiment based on the technical essence of the present invention without departing from the content of the technical solution of the present invention still falls within the protection scope of the technical solution of the present invention.
Claims
1. A complex information retrieval system, characterized in that: include: Knowledge graph module, subgraph extension generation module, agent construction module, distributed retrieval module, answer generation module and strategy optimization module; The knowledge graph module is constructed by data preprocessing, designing legal domain ontology, data conversion and importing, and knowledge graph verification and optimization; The subgraph expansion generation module divides the legal knowledge graph into semantic subgraphs based on the graph partitioning algorithm discovered by the community; The agent building module includes a query understanding agent, a coordination control agent, a subgraph updating agent, a retrieval strategy agent, and an expansion graph matching agent, which perform semantic parsing and structured representation conversion, as well as dynamic task allocation, parameter tuning, and resource optimization. The distributed retrieval module includes a case type retrieval agent, a case subject retrieval agent, a case time retrieval agent and a legal document retrieval agent, which respectively apply corresponding retrieval strategies to perform local retrieval to obtain structured answers; The answer generation module introduces an open source large-scale language model for answer generation, outputs natural language answer text generated based on structured answers and prompt information, and designs an API interface for this system based on the large model; The strategy optimization module uses the evaluation module to regularly evaluate the performance of each retrieval agent of the distributed retrieval module to obtain evaluation results; the evaluation module sends the evaluation results to the coordination control agent, and the coordination control agent comprehensively integrates various evaluation indicators to perform reinforcement learning on the agent's retrieval strategy.
2. A complex information retrieval system according to claim 1, characterized in that: The data preprocessing includes collecting relevant data about the court, which is divided into three categories: structured data, semi-structured data and unstructured data. Structured data is stored in the database in the form of tables, including case number, case type, court date, and judgment result fields. Semi-structured data contains identifiable patterns or tags, so that there is a logical relationship between data elements; unstructured data includes the judge's reasoning process, legal citations and free text descriptions interspersed in the judgment instructions.
3. A complex information retrieval system according to claim 1, characterized in that: The semantic subgraphs include a case type subgraph, a legal regulations subgraph, a court level subgraph, a case cause element subgraph, and a guiding case subgraph.
4. A complex information retrieval system according to claim 1, characterized in that: The query understanding agent adopts a sequence-to-sequence model based on a neural network to implement an end-to-end semantic parsing agent. The structure of the agent includes three parts: an encoder, a decoder, and an attention mechanism.
5. A complex information retrieval system according to claim 1, characterized in that: The coordinated control agent adopts a hierarchical multi-agent reinforcement learning framework to decompose complex decision-making problems into multiple subtasks, which are completed collaboratively by agents at different levels.
6. A complex information retrieval system according to claim 1, characterized in that: The input of the interface includes two parts: one is the structured answer output by the upstream module, and the other is the prompt information generated according to the user portrait and query history; the output is the natural language answer text generated based on the structured answer and the prompt information.
7. A complex information retrieval system according to claim 1, characterized in that: The evaluation indicators include precision, recall, response time, and resource consumption.
8. A working method of a complex information retrieval system, characterized in that: include: Construct the knowledge graph module through data preprocessing, designing legal domain ontology, data conversion and importing, and knowledge graph verification and optimization; The legal knowledge graph is divided into semantic subgraphs through the subgraph expansion generation module based on the community discovery graph partitioning algorithm; The intelligent agent building module is used to perform semantic parsing and structured representation conversion, as well as dynamic task allocation, parameter tuning, and resource optimization; the intelligent agent building module includes query understanding agent, coordination control agent, subgraph update agent, retrieval strategy agent, and graph expansion matching agent; Perform local search and obtain structured answers through the distributed search module, which includes case type search agent, case subject search agent, case time search agent and legal document search agent, which respectively apply corresponding search strategies to perform local search and obtain structured answers; The answer generation module introduces an open-source large-scale language model for answer generation, outputs natural language answer text based on structured answers and prompt information, and designs an API interface for this system based on the large model. The input of the interface includes two parts: one is the structured answer output by the upstream module, and the other is the prompt information generated based on the user portrait and query history. The output is a natural language answer text generated based on the structured answer and prompt information; The strategy optimization module uses an evaluation module to regularly evaluate the performance of each retrieval agent in the distributed retrieval module; the evaluation module sends the evaluation results to the coordination control agent, which integrates various evaluation indicators and performs reinforcement learning on the agent's retrieval strategy.
Citation Information
Cited By
Model acceleration database retrieval optimization system and method based on knowledge graph
CN119046315A
Penetration test agent system driven by large language model and test method
CN119150912A
Multi-agent-based grid treatment knowledge graph construction method
CN119150978A
A method for constructing grid governance knowledge graph based on multi-agent
CN119150978B
Criminal investigation knowledge graph construction method, system and equipment based on multi-agent collaboration
CN119476442A
