Knowledge graph dynamic updating method based on large language model multi-agent
By adopting a multi-agent collaborative architecture based on a large language model, the problems of data quality, extraction accuracy, and efficiency in the dynamic updating of knowledge graphs are solved, achieving efficient and automatic knowledge graph updates and ensuring the consistency and timeliness of knowledge.
Patent Information
- Application Number
- CN202511541380.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-27
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2045-10-27
AI Technical Summary
Existing methods for dynamic updating of knowledge graphs have shortcomings in terms of inconsistent data quality, low accuracy of knowledge extraction, difficulty in resolving knowledge conflicts, and low update efficiency, making it difficult to meet the needs for efficient and accurate updates.
A multi-agent collaborative architecture based on a large language model is adopted to achieve fully automated updates of the knowledge graph through agents for entity tracking, information retrieval, entity extraction, data monitoring, and conflict resolution. Combined with the BERT model and Neo4j database, entity recognition, relationship extraction, and conflict resolution are performed.
It enables fully automated, timely, and highly accurate dynamic updates of knowledge graphs, reducing labor costs, improving entity recognition accuracy and knowledge consistency, and adapting to the update needs of different fields.
Smart Images

Figure CN121390263B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method for dynamic updating of knowledge graphs based on a large language model and multiple agents. Background Technology
[0002] As the core carrier of structured knowledge representation, the dynamic updating of knowledge graphs is crucial for maintaining their timeliness and accuracy. However, the actual updating process is affected by many factors, leading to low efficiency and accuracy. Regarding data, inconsistent data quality, noise, errors, and inconsistencies in data sources can introduce erroneous knowledge into the update. In the knowledge extraction stage, the accuracy of entity recognition and relation extraction needs improvement when faced with complex and diverse text and data formats; some semantically ambiguous or polysemous words are prone to extraction errors. Automatic updates may also trigger knowledge conflicts, where newly added knowledge contradicts existing knowledge in the knowledge graph, which is difficult to resolve automatically and effectively. Furthermore, update efficiency is also a challenge. As the scale of the knowledge graph increases, full updates consume significant computational resources and have high time costs. While incremental updates offer some improvement, they still face challenges in handling complex relationships. Therefore, how to effectively and dynamically update knowledge graphs remains an important research problem in knowledge graph construction. Summary of the Invention
[0003] This invention provides a method for dynamic updating of knowledge graphs based on a large language model and multiple agents, in order to at least partially solve the above-mentioned problems.
[0004] The first aspect of this invention provides a method for dynamic updating of a knowledge graph based on a large language model and multiple agents, the method comprising: During the perception phase, dynamic entities are identified through entity tracking agents and information retrieval agents, and the latest information set of the dynamic entities is obtained. During the parsing phase, the latest information set is parsed by entity extraction agents and relation attribute extraction agents to extract entities, relations and attributes, resulting in relation triples and attribute triples. During the decision-making phase, the data monitoring agent and the conflict resolution agent perform incremental difference detection based on the relation triples, attribute triples and historical data in the preset database to identify new and old data, handle knowledge conflicts, and obtain new relation triples and new attribute triples. During the execution phase, the knowledge storage agent writes the new relation triples and the new attribute triples into the preset database to update the knowledge graph.
[0005] Optionally, dynamic entities are identified through entity tracking agents and information retrieval agents, and the latest information set of the dynamic entities is obtained, including: The entity tracking agent parses the relational and attribute features of entities from the initial knowledge graph entity set using a large language model, and generates a dynamic entity tracking list. The information retrieval agent constructs a time-constrained retrieval formula based on the dynamic entity tracking list, performs a retrieval, and filters the retrieval results through a relevance scoring model to form the latest information set of dynamic entities.
[0006] Optionally, the latest information set is parsed using entity extraction agents and relation attribute extraction agents to extract entities, relations, and attributes, resulting in relation triples and attribute triples, including: By using entity extraction agents and entity recognition prompts, combined with the sequence labeling function of the BERT pre-trained model, the start and end positions of candidate entities are identified, a candidate entity set is generated, entity disambiguation is performed by cosine similarity calculation, and the new entities after entity disambiguation are mapped to the preset database. By using relation attribute extraction agents and relation attribute extraction prompts, the large language model is guided to infer the relationships between entities in the pre-set database and perform directional verification to generate relation triples. For structured text, attribute data is extracted using regular expressions. For unstructured text, attribute data is extracted using relation attribute extraction agents and relation attribute extraction prompts to generate attribute triples.
[0007] Optionally, by using entity extraction agents and entity recognition prompts, combined with the sequence labeling function of the BERT pre-trained model, the start and end positions of candidate entities are identified, including: Candidate entities are identified from the latest information set by an entity extraction agent and entity recognition prompts. The start and end positions of entities are identified from the latest information set based on the sequence labeling function of the BERT pre-trained model, thus correcting the error of the entity extraction agent in entity boundary recognition.
[0008] Optionally, entity disambiguation is performed using cosine similarity calculation, including: Calculate the cosine similarity of the context vectors of candidate entities with existing entities in the preset database; If the cosine similarity is higher than a preset threshold, the corresponding candidate entity and the existing entity are determined to be entities with the same name. When multiple entities with the same name exist for a candidate entity, the entity with the highest cosine similarity to the candidate entity is selected for matching.
[0009] Optionally, through a data monitoring agent and a conflict resolution agent, incremental difference detection is performed based on the relation triples, attribute triples, and historical data in a preset database to identify new and old data, handle knowledge conflicts, and obtain new relation triples and new attribute triples, including: The data monitoring agent queries the corresponding historical data in the preset database based on the relation triples and attribute triples, identifies relation changes and attribute changes through value comparison, and generates a list of relations to be updated and a list of attributes to be updated. The conflict resolution agent employs a confidence-based coverage strategy. Based on the list of relations to be updated and the list of attributes to be updated, it compares the confidence levels of the old and new relations and attributes to determine the relation data and attribute data with high confidence, thereby obtaining new relation triples and new attribute triples.
[0010] Optionally, the conflict resolution agent employs a confidence-based coverage strategy, comparing the confidence levels of the old and new relationships and attributes based on the list of relationships to be updated and the list of attributes to be updated, to determine the relationship data and attribute data with high confidence, including: For relational data, based on entity-relationship type, determine the relationship conflict between the same head entity and tail entity. If the confidence of the new relationship is higher than that of the old relationship, replace the old relationship with the new relationship; otherwise, keep the old relationship unchanged. For attribute data, based on entity-attribute-value, attribute conflicts for the same entity are identified. If the confidence of the new attribute value is higher than that of the old attribute value, the new attribute value replaces the old attribute value; otherwise, the old attribute value remains unchanged.
[0011] A second aspect of this invention provides a knowledge graph dynamic update device based on a large language model multi-agent system, the device comprising: The perception module is used to identify dynamic entities through entity tracking agents and information retrieval agents during the perception phase, and to obtain the latest information set of the dynamic entities. The parsing module is used to parse the latest information set during the parsing phase by using entity extraction agents and relation attribute extraction agents to extract entities, relations and attributes, and obtain relation triples and attribute triples. The decision-making module is used in the decision-making stage to perform incremental difference detection based on the relation triples, attribute triples and historical data in the preset database through the data monitoring agent and the conflict resolution agent, identify new and old data, handle knowledge conflicts, and obtain new relation triples and new attribute triples.
[0012] The execution module is used to write the new relation triples and the new attribute triples into the preset database through the knowledge storage agent during the execution phase, thereby updating the knowledge graph.
[0013] A third aspect of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes a knowledge graph dynamic update method based on a large language model multi-agent as described in the first aspect of the present invention.
[0014] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the knowledge graph dynamic update method based on a large language model multi-agent as described in the first aspect of the present invention.
[0015] A fifth aspect of the present invention provides a computer program product, including a computer program / instructions, which are implemented by a processor as the steps in the knowledge graph dynamic update method based on a large language model multi-agent as described in the first aspect of the present invention.
[0016] This invention innovatively proposes an automatic knowledge graph update method based on a large language model and multiple agents. Its core architecture cleverly adopts a three-layer progressive design of "agent-LLM-storage layer". With the help of the tight circular collaboration mechanism among the seven agents, the powerful semantic understanding and processing support of the large language model, and the efficient graph storage capability of the pre-set database (Neo4j), a closed-loop system that can achieve fully automatic and high-precision knowledge update is successfully constructed.
[0017] Therefore, the technical solution provided by the embodiments of the present invention can break through the bottleneck of traditional manual maintenance. The embodiments of the present invention replace the traditional knowledge graph update mode that relies on manual annotation and review through the circular collaboration of 7 intelligent agents and the semantic processing capability of a large language model, realizing full-process automation from dynamic entity recognition, information retrieval to knowledge writing, and greatly reducing labor costs.
[0018] In this embodiment of the invention, by leveraging the multi-agent processing mode, the update cycle (such as hourly or daily) can be customized according to business needs, solving the problem of update lag caused by the cumbersome process of traditional methods and ensuring the timeliness of the knowledge graph.
[0019] In this embodiment of the invention, dynamic entities and change information can be accurately identified: based on the dual judgment criteria of "attribute dimension + relationship dimension", the entity tracking agent can accurately locate the dynamic entities to be monitored; through BERT model sequence labeling and cosine similarity disambiguation technology, the entity extraction accuracy is significantly improved.
[0020] In this embodiment of the invention, the conflict resolution agent adopts a confidence comparison strategy to verify the rationality of new and old relationship / attribute data, avoid erroneous information overlay, and ensure the consistency and reliability of the knowledge graph.
[0021] The loosely coupled three-layer architecture of "agent-LLM-storage layer" proposed in this invention supports independent iteration of the functions of each agent (such as replacing a better retrieval model or conflict handling strategy), and can be adapted to the knowledge graph update needs of different fields such as finance, healthcare, and education.
[0022] The dynamic update process of this invention is rigorously divided into four main stages: "perception, analysis, decision-making, and execution". Through the orderly connection and coordinated operation of each stage, it ensures that the knowledge graph can be updated automatically, efficiently, and accurately. Attached Figure Description
[0023] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a flowchart of the steps of the knowledge graph dynamic update method based on a large language model and multiple agents provided in the embodiments of the present invention; Figure 2 This is a schematic diagram of the overall architecture of the knowledge graph dynamic update method based on a large language model and multiple agents provided in this embodiment of the invention.
[0025] Figure 3 This is a dynamic update sequence diagram of the knowledge graph dynamic update method based on a large language model and multiple agents provided in this embodiment of the invention; Figure 4 This is a hardware structure diagram of any device with data processing capabilities, which is the knowledge graph dynamic update device based on a large language model and multi-agent provided in the embodiments of the present invention. Detailed Implementation
[0026] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0027] In related technologies, methods for dynamic updating of knowledge graphs mainly include: The rule-based and reasoning-based update method uses rule-based reasoning to perform probabilistic inference on entities and relationships in a knowledge graph, thereby enabling the updating of the knowledge graph.
[0028] An automated update method based on natural language processing (NLP) uses techniques such as semantic parsing and entity linking to extract new knowledge from text and integrate it into the graph.
[0029] The update method based on topology and similarity acquires data from the knowledge graph topology, calculates similarity to update nodes, and optimizes the graph using the least squares method.
[0030] Among them, the rule-based and reasoning-based update method requires defining a series of rules to check the consistency and integrity of the graph. Through rule-based reasoning, probabilistic inferences can be made about entities and relationships in the knowledge graph, and candidate facts with high confidence can be generated, thereby realizing the update of the knowledge graph.
[0031] However, manually defined rules are mostly for known scenarios, while entity relationships in knowledge graphs constantly evolve into new forms as the domain develops, making it difficult for rules to fully cover them. When faced with emerging or complex relationships, rule gaps are likely to appear, resulting in some update requirements being overlooked and affecting the integrity of the graph.
[0032] Furthermore, the expansion of knowledge graphs leads to a surge in the number of rules, which can easily cause conflicts or redundancy due to semantic overlap. These rules require manual review and adjustment, and the rule base needs to be continuously updated as knowledge iterates, resulting in significant manpower and time costs for long-term maintenance.
[0033] The automated update method based on natural language processing (NLP) needs to understand the semantics of the update request by building a semantic parsing model, map it to the corresponding entities and relations using knowledge graph representation technology, adjust the update order and method according to the graph structure and semantic information, verify it through automated testing, and improve efficiency and accuracy by using machine learning optimization strategies.
[0034] However, entities in text often appear in variant forms such as aliases, abbreviations, and homophones, which differ from the standard naming in the graph. NLP technology has limited ability to identify and match these variants, resulting in entity linking problems. This can easily lead to incorrect entity links, causing new knowledge to be associated with the wrong nodes and causing update deviations.
[0035] Furthermore, new knowledge extracted from text may contradict existing knowledge in the graph, but NLP methods lack a systematic conflict detection mechanism and are difficult to effectively resolve conflicts by combining domain logic, which can easily lead to the retention of erroneous information and affect the consistency of the graph.
[0036] The update method based on topology and similarity requires first extracting the set of edges, nodes and relations from the topological graph and obtaining the embedding matrix, then calculating the similarity, updating the nodes if the similarity is below a threshold, and finally using the least squares method to fit and optimize the model to improve the quality of the graph.
[0037] However, topology analysis requires parsing the complex structure of the graph, embedding matrix calculation involves high-dimensional vector operations, and least squares optimization requires iterative fitting. The combination of these three factors places a huge demand on computing power, which can easily lead to update delays in large-scale knowledge graph scenarios and make it difficult to meet real-time requirements.
[0038] Furthermore, the least squares method, which optimizes based on the existing data distribution, may over-fit known patterns and fail to capture potential dynamic knowledge such as emerging entity relationships, thus limiting the map's ability to accommodate and adapt to new information.
[0039] Based on this, this invention proposes an automatic knowledge graph update method based on a large language model and multiple agents. By constructing a multi-agent collaborative architecture and combining the semantic understanding and reasoning capabilities of the large language model, the method achieves fully automated knowledge graph updates. This invention aims to improve the accuracy of entity recognition and linking, enhance the detection and resolution of knowledge conflicts, avoid the limitations of traditional NLP techniques in entity variant handling and conflict resolution, and ensure the accuracy and consistency of knowledge graph updates.
[0040] Unlike rule-based and reasoning-based update methods, this invention utilizes the autonomous learning and generalization capabilities of a large language model, combined with multi-agent collaboration, to construct an adaptive and evolving knowledge update logic. This invention uses a large language model to perform semantic understanding and reasoning on complex entity relationships without pre-defined rules, and combines this with dynamic optimization of update rules by multiple agents, thus overcoming the shortcomings of traditional methods such as limited rule coverage, difficulty in handling emerging entity relationships, and high maintenance costs.
[0041] Compared to topology- and similarity-based update methods, the multi-agent collaborative architecture provided in this invention significantly reduces computational costs and system complexity by decomposing tasks and processing them in parallel, eliminating the need for large-scale topology analysis and high-dimensional embedding matrix operations. Secondly, the multi-agent system, combined with machine learning optimization strategies, can continuously learn new knowledge patterns during the update process, exhibiting a stronger ability to capture dynamic information such as emerging entity relationships, thus avoiding the limitation of least squares methods overfitting known patterns. Compared to traditional methods, it can more efficiently handle the update needs of large-scale knowledge graphs, especially in scenarios with rapid knowledge iteration, enabling more timely and comprehensive graph updates.
[0042] Specifically, such as Figure 1 The diagram illustrates a flowchart of the steps in the knowledge graph dynamic update method based on a large language model multi-agent provided by an embodiment of the present invention. The method includes the following steps: S101, In the perception phase, dynamic entities are identified by entity tracking agents and information retrieval agents, and the latest information set of the dynamic entities is obtained.
[0043] S102, In the parsing phase, the latest information set is parsed by entity extraction agent and relation attribute extraction agent to extract entities, relations and attributes, and obtain relation triples and attribute triples.
[0044] S103, In the decision-making stage, the data monitoring agent and the conflict resolution agent perform incremental difference detection based on the relation triples, attribute triples and historical data in the preset database to identify new and old data, handle knowledge conflicts, and obtain new relation triples and new attribute triples.
[0045] S104, During the execution phase, the knowledge storage agent writes the new relation triples and the new attribute triples into the preset database to update the knowledge graph.
[0046] In this embodiment of the invention, the proposed automatic knowledge graph update method based on a large language model and multiple agents adopts a three-layer progressive architecture design of "agent-LLM-storage layer". This architecture specifically includes: a multi-agent collaborative system for building the basic framework of the knowledge graph; an entity tracking agent responsible for dynamic entity tracking; an information retrieval agent focused on acquiring the latest information; and a data monitoring agent specifically for monitoring data changes. Its overall architecture is as follows: Figure 2 As shown. Specifically, in the perception phase, with the help of the LLM large language model, the entity tracking agent dynamically tracks the entity, while the information retrieval agent periodically retrieves and extracts high-confidence content to obtain entity-related information.
[0047] During the parsing phase, entity extraction agents and relation / attribute extraction agents, based on the LLM large language model, perform entity extraction and relation / attribute extraction respectively, extracting knowledge elements such as entities, relationships between entities, and attributes from the acquired information.
[0048] During the decision-making phase, a data monitoring agent compares and identifies changes in the data. Then, a conflict resolution agent, based on the confidence coverage principle, handles potential knowledge conflicts to ensure the accuracy of the knowledge.
[0049] Finally, during the decision-making stage, the knowledge storage agent stores the processed knowledge in a pre-defined database (neo4j). Furthermore, this embodiment of the invention can also provide a visualization system that supports Cypher queries, text queries, and other operations to display knowledge and related functions.
[0050] In this embodiment of the invention, at the top-level intelligent agent layer, seven intelligent agents work in a circular collaborative manner to form a complete data processing chain: the entity tracking intelligent agent and the information retrieval intelligent agent constitute the data input end, responsible for acquiring the entities to be updated and the latest information; the knowledge storage intelligent agent is the output end, responsible for writing the processed knowledge into the database; the entity extraction intelligent agent, the relation attribute extraction intelligent agent, the data monitoring intelligent agent, and the conflict resolution intelligent agent serve as intermediate processing nodes, sequentially completing information parsing, difference detection, and conflict resolution. Each intelligent agent interacts with data through a preset interface. For example, the entity tracking intelligent agent outputs a dynamic entity list to the information retrieval intelligent agent in JSON format, and the information retrieval intelligent agent returns the latest information set in the form of a structured dictionary.
[0051] In the middle-layer LLM support layer, the core agent calls the LLM via API to perform core tasks such as semantic understanding and entity recognition. A parameter optimization strategy is employed during the call: temperature is set to 0.3 to ensure output stability, and max_tokens is dynamically adjusted according to the task type, set to 500 for entity recognition tasks and 1000 for relation inference tasks. For batch processing scenarios, an asynchronous call mechanism is used, processing 20 tasks per batch to avoid interface timeouts.
[0052] At the underlying storage layer, the knowledge graph is stored using the Neo4j graph database, supporting CRUD operations on triples using the Cypher query language. The database design includes entity tables, relation tables, and attribute tables, and query efficiency is improved through index optimization.
[0053] In this embodiment of the invention, the dynamic update process of the three-layer progressive architecture is rigorously divided into four main stages: "perception-analysis-decision-execution". Through the orderly connection and collaborative operation of each stage, it is ensured that the knowledge graph can be updated automatically, efficiently, and accurately. Figure 3 The dynamic update sequence diagram clearly shows the execution order of the seven agents under the main program's scheduling, such as... Figure 3The diagram illustrates the interaction logic between the main program and multiple agents. Specifically, the main program first loads an initial entity list and triggers the entity tracking agent to begin operation. The entity tracking agent then outputs a dynamic entity list to the main program. The main program passes this dynamic entity list to the information retrieval agent and retrieves the latest information about the dynamic entities from the information retrieval agent. The main program sends this latest information to the entity extraction agent, which extracts the entities, obtaining an entity list. It then sends this latest information to the relation and attribute extraction agent, which extracts the relations and attributes, obtaining a relation list and an attribute list. After obtaining the entity list, relation list, and attribute list, the data monitoring agent detects the differences between the old and new data, identifies the changed relations and attributes, and sends this information to the main program. The main program further resolves conflicts between the old and new data through a conflict resolution agent. After conflict resolution, the knowledge storage agent stores the new triples.
[0054] Specifically, in this embodiment of the invention, the execution order of the seven agents under the scheduling of the main program presents a highly efficient collaborative mode combining "serial + parallel". In the startup phase, the main program first loads the initial entity list and triggers the entity tracking agent to start working. The perception phase adopts a parallel mode; after the entity tracking agent outputs a dynamic entity list, the information retrieval agent immediately starts. No other agents participate in this phase to ensure the uniqueness and accuracy of the retrieved data. The parsing phase also uses a parallel mode; after information retrieval is completed, the entity extraction agent and the relation attribute extraction agent work synchronously, outputting the entity list and triplet set respectively, significantly shortening the parsing time. The decision-making phase uses a serial mode; first, the data monitoring agent compares the differences between the old and new data, and then the conflict handling agent resolves the conflicts, strictly ensuring the processing order to avoid logical confusion. In the execution phase, the knowledge storage agent writes the processed knowledge into the database and returns an "update successful" signal to the main program upon completion. The main program then enters a waiting state until the next timed trigger.
[0055] The perception phase is the starting point for knowledge updating. It is mainly completed by the entity tracking agent and the information retrieval agent working together. Its core objective is to accurately identify dynamic entities and obtain their latest information.
[0056] Specifically, step S101 includes the following sub-steps: S1011 generates a dynamic entity tracking list by analyzing the relational and attribute features of entities from the initial knowledge graph entity set through a large language model using an entity tracking agent.
[0057] S1012, the information retrieval agent constructs a time-constrained retrieval formula based on the dynamic entity tracking list, performs a retrieval, and filters the retrieval results through a relevance scoring model to form the latest information set of dynamic entities.
[0058] In this embodiment of the invention, the core function of the entity tracking agent lies in accurately identifying dynamic entities from the initial knowledge graph and generating a tracking list. Its operating mechanism is as follows: taking the entity set in the initial knowledge graph as input, a large language model is used to perform deep semantic analysis on the relational and attribute features of each entity, with a focus on determining whether the entity possesses timeliness characteristics.
[0059] The logic for determining timeliness features is to use LLM to perform semantic reasoning on entity attributes and relationships, and set dual judgment criteria: Attribute dimension: If the attribute value meets the criteria of "time-sensitive" or "high-frequency change", it is marked as a dynamic attribute; Relationship dimension: If the relationship has "time constraints" or "state dependencies", it is marked as a dynamic relationship.
[0060] After model inference, a structured dynamic entity tracking list is output. This list includes dynamic entities, dynamic relationship types or attribute items that need to be continuously monitored, and keyword combinations customized for subsequent information retrieval, thus providing accurate tracking targets for the dynamic updating of the knowledge graph.
[0061] For the dynamic entity list generated by the entity tracking agent, the information retrieval agent adopts a multi-strategy collaborative approach to acquire the latest data. First, based on the entity keywords and tracking dimensions in the list, a time-constrained search query is automatically constructed. By embedding time prefixes such as "latest" and "current" into the keyword set, the timeliness of the search results is improved.
[0062] To overcome access restrictions from multiple information sources, a two-pronged approach can be adopted: dynamic User-Agent generation and proxy IP pool management. The former randomly simulates different browser versions (such as Chrome and Safari) and their corresponding operating systems and device types, avoiding detection as a web crawler by the server. The latter requires maintaining a large number of highly anonymous proxy IPs, dynamically adjusting them according to a strategy of "switching one IP every 5 requests," while also incorporating a random request interval of 3-5 seconds. This reduces the risk of IP blocking and effectively avoids interference from anti-crawling mechanisms in data acquisition. In the data filtering stage, a pre-set relevance scoring model sorts the search results, prioritizing the extraction of high-confidence content, ultimately forming a structured, dynamic, and up-to-date information set of entities, providing high-quality data input for subsequent knowledge extraction and graph updates.
[0063] In this embodiment of the invention, the information retrieval intelligent agent can overcome the limitation of a single data source by dynamically generating User-Agent, managing proxy IP pools, and using a relevance scoring model. It can obtain high-quality information from multiple channels, effectively circumvent anti-scraping mechanisms, and improve the success rate of information retrieval.
[0064] In this embodiment of the invention, the core task of the parsing stage is to perform deep analysis on the latest information obtained in the perception stage, extracting entities, relationships, and attributes to provide structured triple data for knowledge graph updates. Specifically, step S102 includes the following sub-steps: S1021 uses entity extraction agents and entity recognition prompts, combined with the sequence labeling function of the BERT pre-trained model, to identify the start and end positions of candidate entities, generate a candidate entity set, perform entity disambiguation through cosine similarity calculation, and map the new entities after entity disambiguation to the preset database.
[0065] In the entity extraction stage, a precise entity recognition prompt is first constructed based on the large language model, employing a dual-task guidance mode of "entity type + boundary localization." After the entity boundary verification stage, the prompt is designed as "Please extract entities from the following text, in the format [entity text, type], where entity types include people, organizations, locations, events, etc." This clear task instruction guides the model to focus on entity extraction. Simultaneously, to further improve the accuracy of entity boundary recognition, the intelligent system integrates the sequence labeling function of the BERT pre-trained model for boundary localization—the BERT model can accurately identify the start and end positions of entities through deep learning of text sequences, thereby correcting potential errors in entity boundary recognition by the large language model. Ultimately, this generates a candidate entity set containing entity text and corresponding types.
[0066] Specifically, candidate entities can be identified from the latest information set using an entity extraction agent and entity recognition prompts. The start and end positions of entities can be identified from the latest information set based on the sequence labeling function of the BERT pre-trained model, thus correcting the error in entity boundary recognition by the entity extraction agent. Specifically, in this embodiment of the invention, entity disambiguation can be achieved through the following steps: S1, calculate the cosine similarity of the context vectors of the candidate entity and the existing entities in the preset database.
[0067] S2, if the cosine similarity is higher than a preset threshold, determine that the corresponding candidate entity and the existing entity are entities with the same name.
[0068] S3: When there are multiple entities with the same name for a candidate entity, select the entity with the highest cosine similarity to the candidate entity for matching.
[0069] In this embodiment of the invention, after generating the candidate entity set, to resolve the ambiguity caused by entities with the same name, the intelligent system employs entity disambiguation technology on the candidate entities: by calculating the semantic similarity between the candidate entity and existing entities in the knowledge graph (e.g., comparing their context vector representations using a cosine similarity algorithm), if the similarity is higher than a preset threshold, they are determined to be the same entity; if multiple entities with the same name exist and have different semantic similarities, the one with the highest similarity is selected as the matching item, thereby clarifying the true target of the candidate entity. Next, using entity linking technology, the disambiguated new entities are accurately mapped to their corresponding unique IDs in the Neo4j database: if the entity already exists in the database, its ID is directly associated; if it is a completely new entity, a new unique ID is automatically generated, and a corresponding type label is assigned to it according to the entity type, ultimately achieving entity normalization and ensuring the uniqueness and consistency of entities in the knowledge graph.
[0070] S1022, by using the relation attribute extraction agent and relation attribute extraction prompt words, the large language model is guided to infer the relationships between entities in the preset database and perform directional verification to generate relation triples; for structured text, attribute data is extracted through regular expressions; for unstructured text, attribute data is extracted through the relation attribute extraction agent and relation attribute extraction prompt words to generate attribute triples.
[0071] In the relation and attribute extraction stage, the agent employs a targeted processing strategy: for relation extraction, it uses an "entity pair + context" input mode, that is, simultaneously inputting the entity pairs to be analyzed and their respective textual contexts into the large language model, and guiding the model to infer the relationships between entities through carefully designed Prompt Engineering. After the relations are extracted, they are also subjected to directionality verification to ensure that the starting entity and the target entity of the relation are correct, and finally generating structured relation triples.
[0072] For entity attribute feature extraction, a hybrid approach combining rule-based and deep learning can be adopted: when processing structured text, attribute names and their corresponding attribute values can be accurately matched using predefined regular expressions—for example, for text like “height: 180cm”, the regular expression “height: (.*?) cm” can be used to extract the attribute name “height” and the attribute value “180”; when processing unstructured text, extraction is guided by a large language model prompt, thereby ensuring the effective extraction of attribute information from different types of text.
[0073] In this embodiment of the invention, the relation attribute extraction agent adopts a hybrid approach of "rules + deep learning," which can quickly parse structured text through regular expressions and mine implicit knowledge from unstructured text with the help of a large language model, covering a wider range of information sources.
[0074] In this embodiment of the invention, the perception stage and the parsing stage adopt a parallel processing mode (such as entity extraction and relation attribute extraction are performed simultaneously), which can significantly shorten the single-round update cycle; the batch tasks adopt an asynchronous call mechanism, and each batch can process 20 tasks, thereby improving the system throughput.
[0075] In this embodiment of the invention, during the decision-making stage, the data monitoring agent identifies the differences between new and old data through an incremental difference detection mechanism. The process is as follows: First, it receives structured data (i.e., attribute triples) containing newly extracted entity relations (i.e., relation triples) and attributes. Based on the two-level identification system of "entity pair-relationship type" (corresponding to relation triples) and "entity-attribute-value" (corresponding to attribute triples), it calls the knowledge storage agent interface to query the existing relations of the corresponding entity pairs and the historical attribute values of entity-attribute doubles in the Neo4j graph database. Then, through the value-based difference detection method, it directly compares the new relation type with the old relation type and the new attribute value with the old attribute value to identify relation changes and attribute changes. These changes are then classified into the list of relations to be updated and the list of attributes to be updated, respectively. Finally, it outputs structured updated data as the basis for subsequent processing. The entire process focuses only on the changes in the new and old data, achieving accurate capture of dynamic changes in the knowledge graph.
[0076] Specifically, step S103 includes the following sub-steps: S1031, the data monitoring agent queries the corresponding historical data in the preset database based on the relationship triples and attribute triples, identifies relationship changes and attribute changes through value comparison, and generates a list of relationships to be updated and a list of attributes to be updated.
[0077] S1032, the conflict handling agent adopts a confidence-based coverage strategy, and compares the confidence of the old and new relations and attributes based on the list of relations to be updated and the list of attributes to be updated, to determine the relation data and attribute data with high confidence, and obtain new relation triples and new attribute triples.
[0078] After obtaining the list of relationships to be updated and the list of attributes to be updated returned by the data monitoring agent, the conflict resolution agent uses a confidence-based coverage strategy to handle knowledge conflicts. Specifically, for relationship conflicts, a strategy of replacing old relationships with new ones based on confidence levels is adopted. For example, if an existing relationship is detected between the same head entity and tail entity, the confidence levels of the new and old relationships are compared. If the new relationship has a higher confidence level, the old relationship is replaced with the new one; otherwise, it remains unchanged. The method for handling attribute conflicts is similar.
[0079] Specifically, step S1032 includes the following sub-steps: S10321, For relational data, based on entity-relationship type, determine the relational conflict between the same head entity and tail entity. If the confidence of the new relation is higher than that of the old relation, replace the old relation with the new relation; otherwise, keep the old relation unchanged.
[0080] S10322, For attribute data, based on entity-attribute-value, determine the attribute conflict of the same entity. If the confidence of the new attribute value is higher than the confidence of the old attribute value, replace the old attribute value with the new attribute value; otherwise, keep the old attribute value unchanged.
[0081] In this embodiment of the invention, during the execution phase, based on the conflict-resolved list of relation triples and the list of attribute triples returned by the conflict resolution agent, the knowledge storage agent is invoked to store the processed knowledge in the neo4j database. Simultaneously, a schedule library is used to periodically trigger tasks to ensure automatic and continuous updates of the knowledge graph.
[0082] In this embodiment of the invention, complex technical details such as entity linking and relational reasoning are encapsulated within the intelligent agent, allowing users to dynamically maintain the knowledge graph without needing to master the underlying algorithms, thus lowering the technical application threshold.
[0083] In this embodiment of the invention, the knowledge update process is traceable through the structured storage of the Neo4j database and Cypher query support, making it easy for users to verify the update results and troubleshoot problems.
[0084] Based on the same inventive concept, embodiments of the present invention also provide a knowledge graph dynamic update device based on a large language model multi-agent system, the device comprising: The perception module is used to identify dynamic entities through entity tracking agents and information retrieval agents during the perception phase, and to obtain the latest information set of the dynamic entities. The parsing module is used to parse the latest information set during the parsing phase by using entity extraction agents and relation attribute extraction agents to extract entities, relations and attributes, and obtain relation triples and attribute triples. The decision-making module is used in the decision-making stage to perform incremental difference detection based on the relation triples, attribute triples and historical data in the preset database through the data monitoring agent and the conflict resolution agent, identify new and old data, handle knowledge conflicts, and obtain new relation triples and new attribute triples.
[0085] The execution module is used to write the new relation triples and the new attribute triples into the preset database through the knowledge storage agent during the execution phase, thereby updating the knowledge graph.
[0086] Optionally, the sensing module is used for: The entity tracking agent parses the relational and attribute features of entities from the initial knowledge graph entity set using a large language model, and generates a dynamic entity tracking list. The information retrieval agent constructs a time-constrained retrieval formula based on the dynamic entity tracking list, performs a retrieval, and filters the retrieval results through a relevance scoring model to form the latest information set of dynamic entities.
[0087] Optionally, the parsing module is used for: By using entity extraction agents and entity recognition prompts, combined with the sequence labeling function of the BERT pre-trained model, the start and end positions of candidate entities are identified, a candidate entity set is generated, entity disambiguation is performed by cosine similarity calculation, and the new entities after entity disambiguation are mapped to the preset database. By using relation attribute extraction agents and relation attribute extraction prompts, the large language model is guided to infer the relationships between entities in the pre-set database and perform directional verification to generate relation triples. For structured text, attribute data is extracted using regular expressions. For unstructured text, attribute data is extracted using relation attribute extraction agents and relation attribute extraction prompts to generate attribute triples.
[0088] Optionally, the parsing module is used for: Candidate entities are identified from the latest information set by an entity extraction agent and entity recognition prompts. The start and end positions of entities are identified from the latest information set based on the sequence labeling function of the BERT pre-trained model, thus correcting the error of the entity extraction agent in entity boundary recognition.
[0089] Optionally, the parsing module is used for: Calculate the cosine similarity of the context vectors of candidate entities with existing entities in the preset database; If the cosine similarity is higher than a preset threshold, the corresponding candidate entity and the existing entity are determined to be entities with the same name; When multiple entities with the same name exist for a candidate entity, the entity with the highest cosine similarity to the candidate entity is selected for matching.
[0090] Optionally, the decision module is used for: The data monitoring agent queries the corresponding historical data in the preset database based on the relation triples and attribute triples, identifies relation changes and attribute changes through value comparison, and generates a list of relations to be updated and a list of attributes to be updated. The conflict resolution agent employs a confidence-based coverage strategy. Based on the list of relations to be updated and the list of attributes to be updated, it compares the confidence levels of the old and new relations and attributes to determine the relation data and attribute data with high confidence, thereby obtaining new relation triples and new attribute triples.
[0091] Optionally, the decision module is used for: For relational data, based on entity-relationship type, determine the relationship conflict between the same head entity and tail entity. If the confidence of the new relationship is higher than that of the old relationship, replace the old relationship with the new relationship; otherwise, keep the old relationship unchanged. For attribute data, based on entity-attribute-value, attribute conflicts for the same entity are identified. If the confidence of the new attribute value is higher than that of the old attribute value, the new attribute value replaces the old attribute value; otherwise, the old attribute value remains unchanged.
[0092] The embodiment of the knowledge graph dynamic update device based on a large language model and multiple agents provided by this invention can be applied to any device with data processing capabilities, such as a computer. The device embodiment can be implemented in software, hardware, or a combination of both. Taking software implementation as an example, as a logical device, it is formed by the processor of any data processing device loading the corresponding computer program instructions from non-volatile memory into memory for execution. From a hardware perspective, such as... Figure 4 The diagram shown is a hardware structure diagram of any device with data processing capabilities, which is the knowledge graph dynamic update device based on a large language model and multi-agent system provided by the present invention. (Except for...) Figure 4 In addition to the processor, memory, network interface, and non-volatile memory shown, any data processing device in the embodiment may also include other hardware depending on the actual function of the data processing device, which will not be described in detail here.
[0093] Based on the same inventive concept, embodiments of the present invention also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the steps of the knowledge graph dynamic update method based on a large language model multi-agent as described in any of the above embodiments.
[0094] Based on the same inventive concept, embodiments of the present invention also provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps in the knowledge graph dynamic update method based on a large language model multi-agent described in any of the above embodiments.
[0095] Based on the same inventive concept, embodiments of the present invention provide a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps in the knowledge graph dynamic update method based on a large language model multi-agent described in any of the above embodiments.
[0096] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0097] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0098] Embodiments of the present invention are described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (apparatus), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0099] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable terminal device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0100] These computer program instructions can also be loaded onto a computer or other programmable terminal device to cause a series of operational steps to be performed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal device for implementing the process. Figure 1 One or more processes and / or boxes Figure 1The steps of the function specified in one or more boxes.
[0101] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.
[0102] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0103] The present invention provides a detailed description of a method for dynamic updating of knowledge graphs based on a large language model and multiple agents. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for dynamic updating of knowledge graphs based on a large language model and multiple agents, characterized in that, The method includes: During the perception phase, dynamic entities are identified through entity tracking agents and information retrieval agents, and the latest information set of the dynamic entities is obtained. During the parsing phase, the latest information set is parsed by entity extraction agents and relation attribute extraction agents to extract entities, relations and attributes, resulting in relation triples and attribute triples. During the decision-making phase, the data monitoring agent and the conflict resolution agent perform incremental difference detection based on the relation triples, attribute triples and historical data in the preset database to identify new and old data, handle knowledge conflicts, and obtain new relation triples and new attribute triples. During the execution phase, the new relation triples and new attribute triples are written into the preset database by the knowledge storage agent to update the knowledge graph. Identifying dynamic entities through entity tracking agents and information retrieval agents, and obtaining the latest information set of the dynamic entities, including: The entity tracking agent parses the relational and attribute features of entities from the initial knowledge graph entity set using a large language model, and generates a dynamic entity tracking list. The information retrieval agent constructs a time-constrained retrieval formula based on the dynamic entity tracking list, performs retrieval, and filters the retrieval results through a relevance scoring model to form the latest information set of dynamic entities. The latest information set is parsed using entity extraction agents and relation attribute extraction agents to extract entities, relations, and attributes, resulting in relation triples and attribute triples, including: By using entity extraction agents and entity recognition prompts, combined with the sequence labeling function of the BERT pre-trained model, the start and end positions of candidate entities are identified, a candidate entity set is generated, entity disambiguation is performed by cosine similarity calculation, and the new entities after entity disambiguation are mapped to the preset database. By using relation attribute extraction agents and relation attribute extraction prompts, the large language model is guided to infer the relationships between entities in the pre-set database and perform directional verification to generate relation triples. For structured text, attribute data is extracted using regular expressions. For unstructured text, attribute data is extracted using relation attribute extraction agents and relation attribute extraction prompts to generate attribute triples. Through data monitoring agents and conflict resolution agents, incremental difference detection is performed based on the relation triples, attribute triples, and historical data in a preset database to identify old and new data, handle knowledge conflicts, and obtain new relation triples and new attribute triples, including: The data monitoring agent queries the corresponding historical data in the preset database based on the relation triples and attribute triples, identifies relation changes and attribute changes through value comparison, and generates a list of relations to be updated and a list of attributes to be updated. The conflict resolution agent employs a confidence-based coverage strategy. Based on the list of relations to be updated and the list of attributes to be updated, it compares the confidence levels of the old and new relations and attributes to determine the relation data and attribute data with high confidence, thereby obtaining new relation triples and new attribute triples.
2. The method for dynamic updating of knowledge graphs based on large language models and multi-agent systems according to claim 1, characterized in that, By leveraging entity extraction agents and entity recognition prompts, and combining the sequence labeling capabilities of the BERT pre-trained model, the start and end positions of candidate entities are identified, including: Candidate entities are identified from the latest information set by an entity extraction agent and entity recognition prompts. The start and end positions of entities are identified from the latest information set based on the sequence labeling function of the BERT pre-trained model, thus correcting the error of the entity extraction agent in entity boundary recognition.
3. The method for dynamic updating of knowledge graphs based on a large language model and multiple agents according to claim 1, characterized in that, Entity disambiguation is performed using cosine similarity calculation, including: Calculate the cosine similarity of the context vectors of candidate entities with existing entities in the preset database; If the cosine similarity is higher than a preset threshold, the corresponding candidate entity and the existing entity are determined to be entities with the same name. When multiple entities with the same name exist for a candidate entity, the entity with the highest cosine similarity to the candidate entity is selected for matching.
4. The method for dynamic updating of knowledge graphs based on large language models and multi-agent systems according to claim 1, characterized in that, The conflict resolution agent employs a confidence-based coverage strategy. Based on the list of relationships to be updated and the list of attributes to be updated, it compares the confidence levels of the old and new relationships and attributes to determine the relationship and attribute data with high confidence, including: For relational data, based on entity-relationship type, determine the relationship conflict between the same head entity and tail entity. If the confidence of the new relationship is higher than that of the old relationship, replace the old relationship with the new relationship; otherwise, keep the old relationship unchanged. For attribute data, based on entity-attribute-value, attribute conflicts for the same entity are identified. If the confidence of the new attribute value is higher than that of the old attribute value, the new attribute value replaces the old attribute value; otherwise, the old attribute value remains unchanged.
5. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the knowledge graph dynamic update method based on a large language model multi-agent as described in any one of claims 1-4.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the knowledge graph dynamic update method based on a large language model multi-agent as described in any one of claims 1-4.
7. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the steps in the knowledge graph dynamic update method based on a large language model multi-agent as described in any one of claims 1-4.
Citation Information
Patent Citations
Intelligent question and answer method based on knowledge graph
CN120297415A
Method and system for constructing Neo4j knowledge graph based on LLM natural language
CN120744136A
