Question and answer service method, and method and system for updating knowledge graph in preset model

By introducing an incremental update mechanism into the GraphRag model, the problems of service interruption and resource consumption caused by knowledge base updates are solved, enabling continuous question-answering service during the update period and improving the user experience.

CN121457574APending Publication Date: 2026-02-03ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511240573.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-01
Publication Date
2026-02-03

AI Technical Summary

Technical Problem

The existing GraphRag model requires a full reconstruction and retraining when updating the knowledge base, which leads to service interruptions and huge consumption of computing resources, affecting the user experience.

Method used

An incremental update mechanism is adopted. By monitoring the update status of the knowledge base, the knowledge graph is partially updated without interrupting the service. The updated knowledge items are used to generate a knowledge subgraph and switch the service data source.

Benefits of technology

This reduces training time for knowledge base updates, lowers computational resource consumption, and ensures continuous question-answering service during updates, thus improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121457574A_ABST
    Figure CN121457574A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a question and answer service method and a knowledge graph updating method and system. According to the scheme provided by the embodiment, the first graph data is determined according to the knowledge graph corresponding to the current knowledge base constructed in the preset model. In the process that a preset model provides question and answer service for a user based on the first graph data, if it is monitored that knowledge items in a knowledge base are updated, the updated knowledge items are input into the preset model, and the preset model generates knowledge sub-graphs corresponding to the updated knowledge items; and updating the knowledge graph based on the knowledge sub-graph corresponding to the updated knowledge item. During the period of updating the knowledge graph, the first graph data used by the question and answer service provided by the preset model is the snapshot of the knowledge graph. And further, determining second graph data according to the updated knowledge graph, and switching a service data source of the preset model from the first graph data to the second graph data, so that the preset model provides a question and answer service for the user based on the second graph data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of artificial intelligence technology, and in particular to a question-answering service method, a method and system for updating a knowledge graph in a preset model. Background Technology

[0002] With the rapid development of artificial intelligence technology, graph retrieval enhancement generation (GraphRag) based on knowledge graphs has been widely applied in scenarios such as intelligent question answering. In a typical practical application, users usually build a GraphRag model based on a domain knowledge base to support intelligent question answering queries for specific service needs. This GraphRag model is based on the knowledge base and uses an existing and general-purpose large model for training to build, update, and optimize the knowledge graph, enabling it to understand and effectively utilize the topological structure and semantic relationships in the knowledge graph to generate more accurate answers to user questions. However, as services continue to evolve and knowledge accumulates, the document content in the knowledge base is dynamically updated. Currently, when dealing with knowledge base updates, it is necessary to retrain the large model to reconstruct the entire knowledge graph. Retraining is time-consuming, consumes huge amounts of computing resources, and the GraphRag model is usually suspended during retraining, affecting the user experience.

[0003] Therefore, there is an urgent need to provide an optimization scheme to ensure that the GraphRag model can quickly adapt to knowledge base updates without affecting the service. Summary of the Invention

[0004] Several embodiments in this specification provide a question-answering service method, a method for updating a knowledge graph in a preset model, a system, an apparatus, an electronic device, a storage medium, and a program product, enabling the GraphRag model (i.e., the preset model described in this specification) to quickly adapt to knowledge base updates without affecting the service.

[0005] In a first embodiment, this specification provides a question-and-answer service method. The method includes:

[0006] In the process of providing question-and-answer services to users based on the first graph data in the preset model, the update status of knowledge items in the knowledge base is monitored; the first graph data is determined based on the knowledge graph corresponding to the current knowledge base constructed in the preset model;

[0007] When an update to a knowledge item is detected in the knowledge base, the following question-answering service optimization operations are performed:

[0008] The updated knowledge items are input into the preset model, which generates a knowledge subgraph corresponding to the updated knowledge items. The knowledge graph is then updated based on the knowledge subgraph corresponding to the updated knowledge items. During the knowledge graph update process, the preset model provides a snapshot of the knowledge graph as the first graph data used for the question-answering service.

[0009] Based on the updated knowledge graph, determine the data for the second graph;

[0010] Switch the service data source of the preset model from the first graph data to the second graph data.

[0011] The knowledge graph contains multiple nodes and relationships between nodes.

[0012] In a second embodiment, this specification provides a method for updating a knowledge graph in a preset model. The preset model includes a dual-mode model, which participates in knowledge graph construction and updating in a first working mode and generates responses based on user-input dialogue information in a second working mode. The preset model also includes a knowledge graph corresponding to the current knowledge base constructed using the dual-mode model. The dual-mode model currently uses first graph data as the service data source for response generation, and the first graph data is generated by performing a snapshot operation on the knowledge graph corresponding to the current knowledge base.

[0013] And, the method includes:

[0014] Monitor the document update status in the knowledge base;

[0015] When a document update is detected in the knowledge base, the updated document is input into a preset model, which then performs the following actions:

[0016] Delete the knowledge subgraph corresponding to the document in the knowledge graph before the update to obtain the knowledge graph after deletion;

[0017] The updated document is then segmented into multiple document blocks.

[0018] The multiple document blocks are input into the dual-mode model to obtain the triples corresponding to each of the multiple document blocks in the output;

[0019] Based on the triples corresponding to each of the multiple document blocks, an updated knowledge subgraph corresponding to the document is created in the knowledge graph, and the updated knowledge graph is generated.

[0020] The triple includes the updated document identifier, document chunks, and knowledge entities extracted from the document chunks. After the knowledge graph generation update is completed, the service data source of the dual-mode model will switch from the first graph data to the second graph data, which is generated by performing a snapshot operation on the updated knowledge graph.

[0021] In a third embodiment, this specification provides a question-and-answer service system. The system includes:

[0022] Client;

[0023] On the server side, a preset model, a knowledge base, and a graph storage engine are deployed. The graph storage engine stores first graph data, which is generated by performing a snapshot operation on the knowledge graph corresponding to the current knowledge base constructed in the preset model.

[0024] And, the server has the following features:

[0025] In the process of providing question-and-answer services to the client-side user based on the first graph data in the preset model, the document update status of the knowledge base is monitored;

[0026] When a document update is detected in the knowledge base, the following question-answering service optimization operations are performed: the updated document in the knowledge base is input into the preset model, the preset model generates a knowledge subgraph corresponding to the updated document, and the knowledge graph is updated based on the knowledge subgraph corresponding to the updated document; wherein, while processing the updated document, the preset model continues to use the first graph data to provide question-answering services to the user; the knowledge graph is updated using the knowledge subgraph corresponding to the updated document; a snapshot operation is performed on the updated knowledge graph to obtain the second graph data;

[0027] The knowledge graph contains multiple nodes and relationships between nodes. There are three types of nodes: document identifier nodes, document chunk nodes, and knowledge entity nodes. The relationships between nodes include a first association relationship and a second association relationship. The first association relationship reflects the document to which the document chunk belongs, and the second association relationship reflects the document chunk from which the knowledge entity originates.

[0028] Each document in the knowledge base corresponds to a knowledge subgraph in the knowledge graph; the knowledge subgraph is rooted at the document identifier node, and is associated with multiple document block nodes downwards, and each document block node is associated with at least one knowledge entity node downwards.

[0029] Fourth embodiment: This specification provides a question-and-answer service device. The device includes:

[0030] The monitoring module is used to monitor the update status of knowledge items in the knowledge base when the preset model provides question-and-answer services to users based on the first graph data; the first graph data is determined based on the knowledge graph corresponding to the current knowledge base constructed in the preset model.

[0031] The execution module is configured to perform the following question-answering service optimization operations when an update to a knowledge item is detected in the knowledge base: inputting the updated knowledge item from the knowledge base into the preset model, generating a knowledge subgraph corresponding to the updated knowledge item from the preset model, and updating the knowledge graph based on the knowledge subgraph corresponding to the updated knowledge item; wherein, during the update of the knowledge graph by the preset model, the first graph data used to provide the question-answering service is a snapshot of the knowledge graph; determining the second graph data based on the updated knowledge graph; and switching the service data source of the preset model from the first graph data to the second graph data.

[0032] The knowledge graph contains multiple nodes and relationships between nodes.

[0033] Fifth embodiment: This specification provides a device for updating a knowledge graph in a preset model. The preset model includes a dual-mode model, which participates in knowledge graph construction and updating in a first working mode and generates responses based on user-input dialogue information in a second working mode. The preset model also includes a knowledge graph corresponding to the current knowledge base constructed using the dual-mode model. The dual-mode model currently uses first graph data as the service data source for response generation, and the first graph data is generated by performing a snapshot operation on the knowledge graph corresponding to the current knowledge base.

[0034] And, the device includes:

[0035] The monitoring module is used to monitor the update status of documents in the knowledge base;

[0036] The input / execution module is used to input the updated document into a preset model when a document update is detected in the knowledge base. The preset model then performs the following actions: deleting the knowledge subgraph corresponding to the document before the update in the knowledge graph, resulting in the deleted knowledge graph; segmenting the updated document content to obtain multiple document blocks; inputting the multiple document blocks into the dual-mode model to obtain the output triples corresponding to each of the multiple document blocks; and creating a knowledge subgraph corresponding to the updated document in the knowledge graph based on the triples corresponding to each of the multiple document blocks, thereby generating the updated knowledge graph.

[0037] The triple includes the updated document identifier, document chunks, and knowledge entities extracted from the document chunks. After the knowledge graph generation update is completed, the service data source of the dual-mode model will switch from the first graph data to the second graph data, which is generated by performing a snapshot operation on the updated knowledge graph.

[0038] A sixth embodiment provides an electronic device including a memory and a processor, wherein the memory stores executable program instructions, and the processor executes the program instructions to implement the methods provided in the first and second embodiments described above.

[0039] In a seventh embodiment, this specification provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed in a computer, it causes the computer to perform the methods provided in the first and second embodiments described above.

[0040] In an eighth embodiment, this specification also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the methods provided in the first and second embodiments described above.

[0041] The solutions provided in the above embodiments of this specification determine the existence of first graph data based on the knowledge graph corresponding to the current knowledge base constructed in the preset model. When the preset model provides question-and-answer services to users based on the first graph data, if a knowledge item update is detected in the knowledge base, the updated knowledge item is input into the preset model, which generates a knowledge subgraph corresponding to the updated knowledge item and updates the knowledge graph based on the updated knowledge subgraph. Therefore, the preset model provided in this case supports incremental update optimization of the knowledge graph, that is, it uses updated documents in the knowledge base to achieve incremental update optimization of the knowledge graph. This incremental update method effectively shortens the knowledge update optimization time of the knowledge graph. In the above, during the incremental update of the knowledge graph by the preset model, a snapshot of the knowledge graph is used as the first graph data to provide question-and-answer services to users. This achieves version management of the knowledge graph, enabling the preset model to continuously provide question-and-answer services to users during the knowledge graph update process, which is beneficial to improving the user experience. Furthermore, the process will also involve: determining the data for the second graph based on the updated knowledge graph, and switching the service data source of the preset model from the data in the first graph to the data in the second graph. This allows the preset model to provide question-and-answer services to users based on the data in the second graph, ensuring that the service data source on which the preset model provides question-and-answer services is synchronized with the updated knowledge base, which helps improve the quality of question-and-answer services. Attached Figure Description

[0042] To more clearly illustrate the technical solutions of the various embodiments disclosed in this specification, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are merely examples of the various embodiments disclosed in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort. In the drawings:

[0043] Figure 1A A schematic diagram of the technical architecture on which the implementation of each method in this specification is based, provided for exemplary embodiments;

[0044] Figure 1B A schematic diagram of the knowledge graph corresponding to the knowledge base provided for an exemplary embodiment;

[0045] Figure 2 This specification provides schematic diagrams illustrating the technical principles underlying the implementation of each method in exemplary embodiments.

[0046] Figure 3 This is a schematic diagram of the structure of a question-and-answer service system provided in the exemplary embodiments of this specification;

[0047] Figure 4A and Figure 4B A schematic diagram of a core technology link of the graph retrieval enhancement model (GraphRag model) provided as an exemplary embodiment of this specification;

[0048] Figure 5A and Figure 5B A schematic diagram of another core technology link of the graph retrieval enhancement model (GraphRag model) provided as an exemplary embodiment of this specification;

[0049] Figure 6 A flowchart illustrating a question-and-answer service method provided as an exemplary embodiment of this specification;

[0050] Figure 7 A flowchart illustrating a knowledge graph updating method provided as an exemplary embodiment of this specification;

[0051] Figure 8 A schematic diagram of the structure of the question-and-answer service device provided in the exemplary embodiments of this specification;

[0052] Figure 9 A schematic diagram of the structure of a knowledge graph updating device provided as an exemplary embodiment of this specification;

[0053] Figure 10 This is a schematic diagram of the structure of an electronic device provided as an exemplary embodiment of this specification. Detailed Implementation

[0054] In one AI application scenario, users typically build a GraphRag model based on a domain knowledge base to support intelligent question-answering queries for specific service needs. Specifically, see [link to relevant documentation]. Figure 4A The technical chain of the GraphRag model shown is based on an existing and relatively general large model (such as a language model (LLM)). By introducing a knowledge base and using the large model for training, a knowledge graph is constructed. This enables the large model to generate more accurate answers to user questions by utilizing the topological structure and semantic associations in the knowledge graph.

[0055] In short, the GraphRag model is a retrieval enhancement and generation framework that combines knowledge graphs and general large models, enabling it to provide users with better question-answering services. Furthermore, the "training" of the GraphRag model is not entirely equivalent to traditional model training; rather, it focuses more on the construction, updating, and optimization of the knowledge graph.

[0056] However, as services develop and service-related knowledge accumulates, some documents in the original knowledge base are constantly updated. These updates include content revisions, new entries, and the deletion of old information. This dynamic change in document content poses a significant challenge to the iterative maintenance of the GraphRag model. Currently, when dealing with document updates in the knowledge base, a "full reconstruction + overall retraining" approach is used to maintain the GraphRag model. Specifically, whenever the knowledge base is updated, all documents are split and re-imported into a vector database (meaning the split documents are re-generated into vectors and stored in the vector database), and then the large model is retrained. Here, "retraining the large model" does not refer to retraining the parameters of the large model, but rather to rebuilding the index, i.e., rebuilding the knowledge graph, so that the rebuilt knowledge graph is synchronized with the updated knowledge base. The GraphRag model maintenance method described above can lead to problems such as long training time (e.g., a complete training session may take several days, or about a week) and huge computational resource consumption if the knowledge base contains a large number of documents. Moreover, in order to ensure the consistency between the model and the knowledge, the GraphRag model usually has to pause its external service during training, which leads to service interruption and affects the continuous availability of the model and user experience.

[0057] To address the aforementioned issues, the embodiments in this specification provide a solution, which proposes a GraphRag model optimization mechanism that supports incremental updates. This incremental update mechanism means that when the knowledge base is updated (e.g., the content of existing documents changes and / or new documents are added), the previously constructed knowledge graph can be partially updated based on the updated documents, without needing to rebuild the entire knowledge graph. This incremental update method reduces the retraining time caused by knowledge base updates and allows the GraphRag model to continuously provide services during training.

[0058] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments in this specification, and not all of them. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.

[0059] It should be noted that, for ease of description, the accompanying drawings only show the parts related to the relevant technical solutions. Unless otherwise specified, the embodiments and features described in this specification can be combined with each other. Furthermore, the terms "first," "second," and "third" used in the embodiments of this specification are for informational purposes only and do not constitute any limitation. Moreover, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, product, or apparatus 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, product, or apparatus. Without further limitations, the presence of other identical or equivalent elements in the process, method, product, or apparatus that includes the stated elements is not excluded. Furthermore, in this specification, unless explicitly stated otherwise, "receiving and transmitting data" does not necessarily mean direct receiving and transmitting; it can be indirect receiving and transmitting. For example, when A receives data sent by B, it can be understood as A directly receiving the data sent by B, or it can be understood as A indirectly receiving the data sent by B through other entities such as C. Similarly, when B sends data to A, it can be understood as B sending the data directly to A, or it can be understood as B indirectly sending the data to A through other entities such as C. Here, C can be one entity, or it can be two or more entities.

[0060] Furthermore, it should be noted that specific terms are used to describe embodiments of this specification. For example, "an embodiment," "one embodiment," and / or "some embodiments" refer to a particular feature, structure, or characteristic related to at least one embodiment of this specification. Therefore, it should be emphasized and noted that "an embodiment," "one embodiment," or "an alternative embodiment" mentioned twice or more in different locations in this specification do not necessarily refer to the same embodiment. Moreover, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples, without contradiction. Although one or more embodiments of this specification provide method steps as described in the embodiments or flowcharts, it is understood that the order of steps listed in the embodiments or flowcharts is merely one possible order of execution among many steps, and does not represent the only possible order. Therefore, when the claims involve method steps, adjustments to the order of such steps, or parallel execution between steps, are also within the scope of protection of the claims.

[0061] Furthermore, it should be noted that when this manual involves obtaining user data, the user data obtained is authorized by the user and does not involve user privacy.

[0062] The embodiments provided in this specification will be described below with reference to the accompanying drawings.

[0063] First, the terminology used in the embodiments of this specification will be explained. It should be understood that this explanation is for the purpose of providing a clearer understanding of the embodiments described herein and does not necessarily constitute a limitation on the embodiments of this specification.

[0064] Graph Cluster: A graph cluster is formed by starting graph engine services on multiple nodes. Multiple graph data can be stored on the graph cluster. In other words, a graph cluster refers to a distributed graph database system composed of multiple nodes working together. Each node runs a graph engine service, which includes a graph storage engine.

[0065] Graph storage engine: This is a low-level database component specifically designed for efficient storage and management of graph data. This specification primarily utilizes the graph storage engine to store graph data. Specifically, it uses the graph storage engine to create a database snapshot of the graph data corresponding to the knowledge base. This database snapshot is a copy of the graph data corresponding to the knowledge base created at a specific point in time.

[0066] Knowledge base: This refers to a collection of knowledge items organized by users according to their needs, used to expand the functionality of a larger model. Knowledge items can also be called knowledge units. In practice, knowledge items can be documents, web page content, or structured record information (such as order records, medical records, etc.).

[0067] Graph data refers to a knowledge graph constructed based on all knowledge items in a knowledge base. For example, taking documents as knowledge items, the knowledge graph contains document identifier nodes, document chunk nodes, knowledge entity nodes, and the relationships between these nodes. Knowledge entities are entity objects with specific meanings identified and extracted from document chunks, such as names of people, companies / organizations, places, products, times (e.g., 2025, first quarter), and numerical indicators (e.g., 450,000 vehicles). Document chunks are obtained by dividing the document content.

[0068] GraphRag is a retrieval enhancement and generation (Rag) technique that uses graph data as the retrieval source. By integrating graph data (such as knowledge graphs) and large models (such as language models (LLMs)), GraphRag can achieve efficient and accurate question answering functionality.

[0069] Large models refer to artificial intelligence models with a huge number of parameters and complex structures. These models typically consist of millions or even billions of parameters and can perform complex tasks such as language understanding and natural language processing. In this specification, a large model may be, for example, a language model (LLM).

[0070] The technical solutions provided in the embodiments described below are all based on Figure 1A The technical architecture implementation is shown. For example... Figure 1A As shown, the technical architecture includes a knowledge base 11, a graph storage engine 12, and a preset model 13.

[0071] In specific implementation, based on Figure 1A The technical architecture shown, taking the knowledge items stored in the knowledge base as documents as an example, includes the following steps in its implementation principle:

[0072] Step 1: Perform multi-level abstraction on each document in the current knowledge base to extract the metadata of each document. For example, taking document 1 as an example, the metadata of document 1 may include the following four levels of information:

[0073] 1) The document identifier of document 1, which can be the document name or document code, for example, the document identifier of document 1 is doc1.

[0074] 2) The checksum corresponding to the document content in Document 1 is used to detect whether the document content of Document 1 has been changed. This checksum can be, for example, a hash value obtained by hashing the document content in Document 1 using the MD5 hash algorithm, denoted as md5.

[0075] 3) Document Chunks. Document chunks are obtained by dividing the content of document 1 (also known as segmentation, splitting, etc.). Specifically, the content of document 1 can be divided into multiple semantically complete document chunks.

[0076] 4) Knowledge Entities. Entity identification and extraction are performed on each document block of Document 1 to extract semantically meaningful knowledge entities from each document block.

[0077] By integrating the information from the above four levels, we can obtain the metadata representation of document 1, for example: doc1:md5:chunk:entity.

[0078] Step 2: Based on the metadata of each document in the current knowledge base, construct the knowledge graph corresponding to the current knowledge base, such as... Figure 1B The knowledge graph shown within the dashed box is also referred to as the graph data corresponding to the knowledge base.

[0079] Step 3: Perform a snapshot operation on the knowledge graph corresponding to the current knowledge base on the graph storage engine 12 to generate the first graph data. This first graph data is the first version of the knowledge graph (V1 version knowledge graph, also known as V1 version graph data). In other words, the first graph data is a copy of the knowledge graph corresponding to the current knowledge base.

[0080] Furthermore, the current preset model 13 provides services externally (specifically, a question-and-answer service) based on the aforementioned first graph data. In this specification, the preset model 13 is the GraphRag model.

[0081] Step 4: When an update to a document in the knowledge base is initiated, such as updating an existing document 2 (doc2), the metadata of the updated document 2 is compared with the previously cached metadata of the original document 2. Specifically, the checksum of the updated document 2 is compared with the checksum of the original document 2. If the checksum of the updated document 2 is different from that of the original document 2 (i.e., the checksum, such as the MD5 hash, has changed), an incremental update is performed on the knowledge graph. During the incremental update of the knowledge graph, the preset model 13 continues to provide services based on the first graph data. After the knowledge graph update is complete, a snapshot operation is performed on the updated knowledge graph on the graph storage engine 12 to generate the second graph data. The second graph data is the second version knowledge graph (V2 version knowledge graph, also known as V2 version graph data). Then, the preset model 13 switches to providing services based on the second graph data.

[0082] The incremental update of the knowledge graph described above includes: deleting document identifier nodes, document chunk nodes, knowledge entity nodes (specifically, knowledge entity nodes that are related to document chunk nodes related to document 2), and relationship edges from the knowledge graph that are related to the document 2 before the update. Then, the document identifier (doc2), document chunk, knowledge entity, and the relationships between them corresponding to the updated document 2 are written into the knowledge graph to obtain the updated knowledge graph. For the specific implementation of the deletion in the knowledge graph for the document 2 before the update, please refer to [link to relevant documentation]. Figure 2 The content shown within the dashed box can also refer to the relevant content provided in the following method embodiments, which will not be elaborated here.

[0083] The construction and updating of the knowledge graph described above are completed within a pre-defined model. Figure 4B The diagram illustrates a core technology chain of a pre-defined model (the GraphRag model). See also... Figure 4B It can be seen that the preset model implements question-answering functionality by integrating a knowledge graph and a large model (such as a language model (LLM)). The large model integrated into the preset model supports two working modes: a first working mode and a second working mode. In the first working mode, the large model can identify and extract corresponding knowledge entities from document chunks of unstructured documents and output structured triples (containing document identifier, document chunk, and knowledge entity) for each document chunk. These triples are used to update or update the knowledge graph in the preset model. Therefore, the first working mode can also be called the knowledge extraction mode. In the second working mode, the large model can generate corresponding answers based on existing knowledge graph information (such as the aforementioned first or second graph data) and combined with the user's question. Therefore, the second working mode can also be called the question-answering generation mode.

[0084] Based on the working modes supported by the large model described above, in the method embodiments provided in the following text specification, the large model integrated in the preset model is referred to as the dual-mode model.

[0085] The technical architecture mentioned above is based on a server-side and client-side implementation. Referring to Figure 1, the knowledge base 11, storage engine 12, and preset model 13 in the technical architecture are deployed on the server-side. The server-side can be a server, server cluster, virtual server, or cloud application, etc. The server-side provides corresponding functional services to the client, such as intelligent question-and-answer services. Users can interact online with the preset model on the server-side through a browser, application (APP), web application H5 (HyperText Markup Language 5), lightweight application (also known as a mini-program), or cloud application on the client. The client can be, but is not limited to, smartphones, smart wearable devices, tablets, laptops, desktop computers, etc.

[0086] thus, Figure 3 This specification also illustrates a question-and-answer service system according to an embodiment, which includes a client 200 and a server 100.

[0087] A preset model 13, a knowledge base 11, and a graph storage engine 12 are deployed on server 100. The graph storage engine 12 stores first graph data, which is generated by performing a snapshot operation on the knowledge graph corresponding to the current knowledge base 11 constructed in the preset model on the graph storage engine. The knowledge graph contains multiple nodes and relationships between nodes. The nodes are of three types: document identifier nodes, document chunk nodes, and knowledge entity nodes. The relationships between nodes include a first association and a second association. The first association reflects the document to which the document chunk belongs. The second association reflects the document chunk from which the knowledge entity originates. Furthermore, each document in the knowledge base corresponds to a knowledge subgraph in the knowledge graph. The knowledge subgraph is rooted at a document identifier node, and is associated downwards with multiple document chunk nodes, and each document chunk node is associated downwards with at least one knowledge entity node.

[0088] Furthermore, server 100 is configured to: continuously monitor the document update status of the knowledge base while the preset model provides question-and-answer services to users based on the first graph data; when a document update is detected in the knowledge base, perform the following question-and-answer service optimization operations: input the updated document in the knowledge base into the preset model, and have the preset model generate a knowledge subgraph corresponding to the updated document, and update the knowledge graph based on the knowledge subgraph corresponding to the updated document; wherein, during the processing of the updated document, the preset model continues to use the first graph data to provide question-and-answer services to users; perform a snapshot operation on the updated knowledge graph to obtain second graph data; switch the service data source of the preset model from the first graph data to the second graph data, so that the preset model provides question-and-answer services to users based on the second graph data.

[0089] The specific implementation of the functions of server 100 and client 200 will be described in detail in the following method embodiments, and will not be elaborated here.

[0090] The technical solutions provided in this specification will be described below by way of method embodiments.

[0091] Figure 6 This diagram illustrates a flowchart of a question-and-answer service method according to an embodiment of this specification. The execution entity of this method is the server 100 in the aforementioned question-and-answer service system. See also... Figure 6 As shown, this question-and-answer service method includes the following steps:

[0092] 102. In providing question-and-answer services to users based on the first graph data in the preset model, the update status of knowledge items in the knowledge base is monitored; the first graph data is determined based on the knowledge graph corresponding to the current knowledge base constructed in the preset model;

[0093] 104. When an update to a knowledge item is detected in the knowledge base, the following question-answering service optimization operations are performed:

[0094] 1042. Input the updated knowledge items in the knowledge base into the preset model, generate a knowledge subgraph corresponding to the updated knowledge items from the preset model, and update the knowledge graph using the knowledge subgraph corresponding to the updated knowledge items; wherein, during the updating of the knowledge graph, the preset model provides a snapshot of the knowledge graph as the first graph data used for the question-answering service;

[0095] 1044. Perform a snapshot operation based on the updated knowledge graph to determine the data for the second graph;

[0096] 1046. Switch the service data source of the preset model from the first graph data to the second graph data.

[0097] The knowledge graph contains multiple nodes and relationships between them. The nodes fall into three categories: knowledge item identifier nodes, knowledge block nodes, and knowledge entity nodes. Relationships between nodes include first and second associations. The first association reflects the knowledge item to which the knowledge block belongs. The second association reflects the knowledge block from which the knowledge entity originates; the knowledge block is obtained by dividing the knowledge item. In addition to the first and second associations, relationships between nodes may also include a third association, which reflects the relationships between different knowledge entities. For example, see [link to relevant documentation]. Figure 1A or Figure 1B As shown, the knowledge entity node entity3 has a relationship with the knowledge entity nodes entity1 and entity3.

[0098] Furthermore, each knowledge item in the knowledge base corresponds to a knowledge subgraph in the knowledge graph. The knowledge subgraph is rooted at the knowledge item identifier node and is associated with multiple knowledge block nodes, while each knowledge block node is associated with at least one knowledge entity node.

[0099] In this embodiment, the preset model is a GraphRag model. A knowledge base is a collection of knowledge items in a corresponding domain. Knowledge items can be documents, or other types of knowledge data such as web page content, structured records (e.g., medical records). For example, a knowledge base can be a collection of internal documents from an enterprise (e.g., containing various technical documents). Furthermore, the document format can be, but is not limited to, PDF files, Word documents, web pages (HTML), TXT plain text, etc., and the document content can include one or more combinations of text, images, tables, etc.

[0100] Since the knowledge graph is one of the core components of the GraphRag model, the training involved in implementing a GraphRag model using a knowledge base includes: knowledge graph construction (i.e., index building), and knowledge graph updating and optimization. Knowledge graph construction refers to using the knowledge items in the knowledge base and training with a pre-defined model, such as a dual-mode model, to form an initial knowledge graph when building the GraphRag model. Furthermore, in this embodiment, the knowledge graph is updated and optimized incrementally; that is, when an update to a knowledge item is detected in the knowledge base, the updated knowledge item is used to train with, for example, a dual-mode model, to update and optimize the knowledge graph.

[0101] The aforementioned bimodal model is another core component of the GraphRag model. In the GraphRag model, the bimodal model not only enables the construction and updating of the knowledge graph but also handles user questions, outputting corresponding answers. This bimodal model is a general-purpose model, which can be, but is not limited to, a language model (LLM). Furthermore, during the construction of the knowledge graph, metadata is abstracted from the knowledge items in the knowledge base. This metadata includes the knowledge item identifier, the corresponding checksum, the knowledge chunk, and the knowledge entity. The checksum, for example, can be a hash value (md5) calculated using the MD5 hash algorithm to detect whether the knowledge content of the knowledge item has changed. The knowledge entity is identified and extracted from the knowledge chunk. The metadata of the abstracted knowledge items can be stored in a cached manner, such as on the server side or, specifically, in the knowledge base. The knowledge graph can be constructed and updated using the knowledge item identifier, knowledge chunk, knowledge entity, and the relationships between these three elements contained in the metadata.

[0102] It should be noted here that: when the above knowledge item is a document, the knowledge item identifier in the metadata of the knowledge item is the document identifier, the check code corresponding to the knowledge item is the check code corresponding to the document, the knowledge block is the document block obtained by dividing the document, and the knowledge entity is identified and extracted from the document block.

[0103] Based on the above, in some instances, the knowledge graph corresponding to the current knowledge base mentioned in 102 above can refer to an initial knowledge graph constructed based on the initial knowledge base, such as using a dual-mode model for training.

[0104] For example, taking the knowledge items stored in the knowledge base as documents, the construction of the initial knowledge graph may include the following steps:

[0105] 1) Divide the document content of each document in the knowledge base into multiple document blocks. For example, documents can be divided according to natural boundaries (such as paragraph marks and periods) or fixed lengths to obtain multiple document blocks, which facilitates contextual association during subsequent knowledge entity recognition and relation extraction. This includes, for example, combining... Figure 4B As shown, the partitioning of documents here can be achieved using the splitter in the GraphRag model, which is often also called a splitter.

[0106] 2) Knowledge Entity Identification and Extraction. Using the dual-mode model in GraphRag, knowledge entities can be identified and extracted from multiple document blocks separately, serving as a type of node in the knowledge graph. For example, combining... Figure 4B As shown, after each document block is input into the dual-mode model (which is a large model), the dual-mode model will use its first extractor to identify and extract knowledge entities from the document blocks and output them in the form of triples. Specifically, the output triples can be in the form of "document identifier: document block: knowledge entity".

[0107] Here, the first extractor is often also referred to as the triplet extractor.

[0108] 3) Based on the triple extraction results of documents implemented using a dual-mode model, a knowledge graph is constructed, such as... Figure 1B The knowledge graph corresponding to the knowledge base is shown within the dashed box.

[0109] Furthermore, in point 102 above, the first graph data can be the knowledge graph corresponding to the current knowledge base. Alternatively, the first graph data can also be a snapshot of the knowledge graph corresponding to the current knowledge base, that is, the first graph data can be generated by performing a snapshot operation on the knowledge graph corresponding to the current knowledge base on the graph storage engine. In this case, it can be understood that the first graph data is a copy of the knowledge graph corresponding to the current knowledge base and is immutable.

[0110] Furthermore, when the preset model provides question-and-answer services to users, it may utilize its internal dual-mode model and currently use the data from the first graph as the service data source to provide question-and-answer services to users.

[0111] For example, see Figure 3 Users can input relevant dialogue information on the client interface 21 provided by client 200. This dialogue information is the question the user wants to ask (which can be simply referred to as the user question), such as "Which companies did Marx found?" Client 200 responds to the user's input by obtaining the dialogue information and sending it to server 100. Server 100 then processes the received dialogue information using a preset model. See [link to relevant documentation] Figure 4BAs shown, the preset model first uses its internal dual-mode model to extract keywords from the dialogue information. Specifically, after the dialogue information is input into the dual-mode model, the model uses its internal second extractor to extract keywords from the dialogue information and inputs the extracted keywords into the graph traversaler. The graph traversaler then traverses the first graph data based on the received keywords to query relevant subgraph information from the first graph data. Afterwards, the synthesizer in the preset model generates prompts based on the information output by the graph traversaler and the user's dialogue information. The dual-mode model then generates and outputs the answer information based on the prompts. The server 100 returns the answer information to the client 200. The client 200 displays the answer information on the client interface 21. Thus, the server 100 completes one round of question-and-answer service using the preset model.

[0112] As usage time increases, the knowledge items in the knowledge base will continuously accumulate and be updated. For example, the content of some existing knowledge items in the knowledge base may be modified or deleted, or new knowledge items may be added to the knowledge base. When changes are detected in the knowledge items and their corresponding metadata in the knowledge base, an incremental update mechanism will be triggered in this embodiment to update and optimize the knowledge graph of the preset model using the updated knowledge items, thereby improving the question-answering service quality of the preset model.

[0113] Therefore, in the above 104, the situation where knowledge item updates are detected in the knowledge base includes at least one of the following: changes in the content of existing knowledge items in the knowledge base (such as text modification, image replacement, editing, or deletion, table adjustment, etc.), or the addition of new knowledge items to the knowledge base. Correspondingly, the updated knowledge items in the knowledge base mentioned in the above 1042 include: existing knowledge items in the knowledge base whose content has changed, and / or knowledge items added to the knowledge base. The detection of whether knowledge item updates have occurred in the knowledge base can be achieved by using a verification code comparison method.

[0114] Based on this, in one feasible solution, the method provided in this embodiment may further include the following steps:

[0115] S12. When an update is detected in an existing knowledge item in the knowledge base, calculate the check code of the knowledge content in the updated knowledge item.

[0116] S14. Compare the check code corresponding to the updated knowledge item with the check code corresponding to the previously cached knowledge item before the update to obtain the comparison result;

[0117] S16. If the comparison result shows that the verification codes are different, it is determined that the document content of the knowledge item has changed, and the question-and-answer service optimization operation described in 104 above is triggered, that is, the above steps 1042, 1044, and 1046 are triggered.

[0118] Steps S12, S14, and S16 above provide a specific implementation for detecting updates to existing knowledge items in the knowledge base. For newly added knowledge items in the knowledge base, detection can be achieved by listening for newly added metadata events such as hash values ​​in the cache.

[0119] Furthermore, during the process of triggering the question-and-answer service optimization operation, the knowledge subgraph corresponding to the updated knowledge item will be obtained by first executing the above step 1042.

[0120] In practical implementation, if we continue to use the knowledge items stored in the knowledge base as documents as an example, then in the above 1042, after inputting the updated document into the preset model, in one instance, as shown in [reference 1042]... Figure 4B As shown, the updated document is first segmented by a chunker in the preset model. Then, the chunker outputs multiple document chunks for the updated document. These multiple document chunks are input into a dual-mode model (a large model) in the preset model for knowledge entity recognition and extraction. The dual-mode model outputs a corresponding triple for each document chunk. Based on the set of triples corresponding to the updated document, the knowledge subgraph corresponding to the updated document can be obtained.

[0121] Therefore, in a specific implementable technical solution, step 1042 above, "inputting the updated knowledge items in the knowledge base into the preset model, and generating a knowledge subgraph corresponding to the updated knowledge items by the preset model," may include:

[0122] 10421. Input the updated documents from the knowledge base into the preset model, and have the preset model execute:

[0123] 104212. Divide the updated knowledge items into multiple knowledge blocks;

[0124] 104214. Perform entity extraction processing on the multiple knowledge blocks respectively to obtain the triples corresponding to each of the multiple knowledge blocks;

[0125] The triple includes the updated knowledge item identifier, the knowledge block, and the knowledge entity extracted from the knowledge block; the knowledge subgraph is composed of the triples corresponding to each of the multiple knowledge blocks.

[0126] For example, continuing to use knowledge items stored in the knowledge base as documents, assuming a change in the content of document 2 already existing in the knowledge base is detected, the updated document 2 is input into the preset model. The dual-mode model in the preset model will output a set of triples for the updated document 2. Taking the updated document 2 being split into 3 document chunks as an example, the output set of triples for the updated document 2 is:

[0127] {doc2: chunk21: entity1; doc2: chunk22: (entity3, entity5); doc2: chunk23: entity4}

[0128] Wherein, “doc2” represents the document identifier of the updated document 2, chunk21, chunk22 and chunk23 represent the three document chunks obtained by splitting the updated document 2, entity1 represents the knowledge entity extracted from document chunk21, entity3 and entity5 represent the knowledge entities extracted from document chunk22, and entity4 represents the knowledge entity extracted from document chunk23.

[0129] The set of triples corresponding to the updated document 2 can be regarded as a knowledge subgraph that describes the updated document 2 by structuring the semantic content of the updated document 2.

[0130] Furthermore, using the knowledge subgraphs corresponding to the updated knowledge items obtained above, the knowledge graph corresponding to the knowledge base can be partially updated to optimize the knowledge graph. The update strategy used for partially updating the knowledge graph will differ depending on the updated knowledge item. For example, if the updated knowledge item is an existing knowledge item document in the knowledge base whose content has changed, the knowledge subgraph corresponding to the previous knowledge item in the knowledge graph needs to be deleted first, and then the knowledge subgraph corresponding to the updated knowledge item needs to be written into the knowledge graph. However, if the updated knowledge item is a newly added knowledge item in the knowledge base, there is no need to perform a knowledge subgraph deletion operation on the knowledge graph; the knowledge subgraph corresponding to the updated knowledge item can be directly written into the knowledge graph.

[0131] Therefore, in a specific implementable solution, when the updated knowledge item is an existing knowledge item in the knowledge base whose content has changed, step 1042 above, "updating the knowledge graph based on the knowledge subgraph corresponding to the updated knowledge item," may include:

[0132] 10422. Based on the metadata of the knowledge item before the update, delete the knowledge subgraph corresponding to the knowledge item in the knowledge graph before the update;

[0133] 10424. Write the knowledge subgraph corresponding to the updated knowledge item into the deleted knowledge graph.

[0134] The metadata includes multiple knowledge blocks corresponding to the knowledge item before the update, and knowledge entities extracted from the knowledge blocks. The multiple knowledge blocks are obtained by dividing the knowledge item before the update into knowledge content segments. The segmentation method can be, for example, by natural boundaries (such as paragraphs, periods, or chapters) or fixed lengths. In addition, the metadata of the knowledge item before the update may also include a checksum of the knowledge item before the update. The checksum can be, for example, a hash value, which can be obtained by hashing the entire knowledge content of the knowledge item before the update using an algorithm such as MD5, and can be used to detect whether the knowledge content in the knowledge item has changed.

[0135] It should be noted that step 10422 above can be performed before executing "inputting the updated knowledge items into the preset model".

[0136] In another specific implementation scheme, when the updated knowledge item is a knowledge item added to the knowledge base, then step 1044 above, "updating the knowledge graph based on the knowledge subgraph corresponding to the updated knowledge item," may include:

[0137] 10424' Write the knowledge subgraph corresponding to the updated knowledge item into the knowledge graph.

[0138] For details on the implementation of step 10424, please refer to the following description of the specific implementation of step 10424.

[0139] To facilitate understanding, steps 10422 and 10424 above will be described in detail below.

[0140] In step 10422 above, deleting the knowledge subgraph corresponding to the knowledge item in the knowledge graph before the update means deleting the knowledge item identifier nodes, knowledge block nodes, knowledge entity nodes, and corresponding relationship edges associated with the knowledge item before the update. Specifically, one or more knowledge entity nodes in the knowledge graph may not only be associated with the knowledge block of the knowledge item before the update, but may also have relationships with knowledge blocks of other knowledge items. In this case, only the relationship edges between the knowledge entity and the knowledge block of the knowledge item before the update are deleted.

[0141] That is, in one instance, the implementation of step 10422 above, "deleting the knowledge subgraph corresponding to the knowledge item in the knowledge graph before the update based on the metadata of the knowledge item before the update," may include the following steps:

[0142] 104222. Based on the metadata, identify the target knowledge entity node in the knowledge graph that is associated with the knowledge item before the update;

[0143] 104224. Determine at least one knowledge block node in the knowledge graph that has an association with the target knowledge entity node, and the knowledge item identifier node associated with each of the at least one knowledge block nodes;

[0144] 104226. Based on the knowledge item identifier node associated with each of the at least one knowledge block node, execute an appropriate deletion strategy for the target knowledge entity node to delete the target knowledge entity node from the knowledge graph and / or delete the relationship edge between the target entity node and the knowledge block node belonging to the knowledge item before the update in the at least one knowledge block node.

[0145] 104228. Based on the metadata, delete from the knowledge graph the target knowledge block node associated with the knowledge item before the update, the relationship edge connected to the target knowledge block node, and the knowledge item identifier node used to indicate the knowledge item before the update.

[0146] The implementation of step 104226 above may include:

[0147] S22. If the knowledge item identifier nodes associated with each of the at least one knowledge block nodes indicate the knowledge item before the update, then the target knowledge entity node and the relationship edge between the target knowledge entity node and the at least one knowledge block node will be deleted from the knowledge graph.

[0148] S24. If a knowledge item identifier node associated with a partial knowledge block in the at least one knowledge block indicates the knowledge item before the update, then delete the relationship edge between the target knowledge entity node and the partial knowledge block from the knowledge graph.

[0149] The following example uses document 2, a knowledge item in the knowledge base, to illustrate the implementation of steps 104222, 104224, 104226, and 104228 above.

[0150] Combination Figure 1BAs shown, based on the knowledge entities contained in the metadata of document 2 before the update, the knowledge entity nodes entity4, entity5, and entity6 in the knowledge graph are identified as target knowledge entity nodes associated with document 2 before the update. Furthermore, in the knowledge graph, at least one document chunk node associated with knowledge entity node entity4 includes: document chunk node chunk2m and document chunk node chunk1m. Document chunk node chunk2m represents a document chunk belonging to document 2 before the update, and document chunk node chunk1m represents a document chunk belonging to document 1. In this case, only the relationship edge between knowledge entity node entity4 and document chunk node chunk2m is deleted; knowledge entity node entity4 is not deleted. At least one document chunk node associated with the knowledge entity node entity5 includes document chunk node chunk22, which represents a document chunk belonging to the original document 2. Therefore, in this case, in addition to deleting the relationship edge between the knowledge entity node entity5 and the document chunk node chunk22, the knowledge entity node entity5 is also deleted. Similarly, the knowledge entity node entity6 and the relationship edge between the knowledge entity node entity6 and the document chunk node chunk2m are deleted from the knowledge graph. Then, based on the document identifier and document chunk contained in the metadata of the original document 2, the target document chunk node (including document chunk nodes chunk21, chunk22...chunk2m) and the target document identifier node (document identifier node doc2) associated with the original document 2 are identified in the knowledge graph. The target document chunk node, the relationship edge between the target document chunk node and the target document identifier node, and the target document identifier node are then deleted. This completes the deletion of the knowledge subgraph corresponding to the original document 2 in the knowledge graph.

[0151] In step 10424 above, based on the knowledge subgraph corresponding to the updated knowledge item, corresponding knowledge item identifier nodes, knowledge block nodes, and knowledge entity nodes are established in the deleted knowledge graph, and corresponding relationship edges are established between these nodes. Specifically, when establishing knowledge entity nodes, it can be first determined whether the corresponding knowledge entity node exists in the deleted knowledge graph; if it does not exist, the establishment operation is then performed.

[0152] This embodiment employs an optimization mechanism that uses updated knowledge items from the knowledge base to incrementally update the knowledge graph, effectively shortening the update and optimization time of the knowledge graph.

[0153] In addition, in the solution provided in this embodiment, in order to ensure that the preset model can always provide question-and-answer services to users during the incremental update of the knowledge graph, if the first graph data used by the preset model to provide question-and-answer services to users is the knowledge graph before the incremental update, a snapshot operation on the knowledge graph will be performed to generate the first graph data before triggering the question-and-answer service optimization operation implemented through the above steps 1042, 1044 and 1046.

[0154] Based on this, when the first graph data mentioned in step 102 is the knowledge graph corresponding to the current knowledge base constructed in the preset model, step 104 may further include the following steps:

[0155] S32. When an update to a knowledge item is detected in the knowledge base, before performing the question-and-answer service optimization operation, the method may further include:

[0156] S322. Create a snapshot of the knowledge graph;

[0157] S324. Use the snapshot of the knowledge graph as the first graph data.

[0158] In the above, it can be in the case of, for example Figure 4A or Figure 4B The graph storage engine shown creates snapshots of the knowledge graph by performing snapshot operations on the knowledge graph. During incremental updates of the knowledge graph performed by the preset model, these snapshots are used as the first graph data to continue providing question-and-answer services to users.

[0159] In steps 1044 and 1046 above, after incrementally updating the knowledge graph using the updated knowledge items in the knowledge base, the second graph data can be determined based on the updated knowledge graph. For example, the updated knowledge graph can be directly used as the second graph data; alternatively, a snapshot of the updated knowledge graph can be created on the graph storage engine, and this snapshot can be used as the second graph data. In this case, the second graph data is a copy of the updated knowledge graph. Then, the service data source of the preset model will be switched from the first graph data to the second graph data, enabling the preset model to provide question-and-answer services to users based on the second graph data. This ensures that the service data source upon which the preset model provides question-and-answer services is synchronized with the updated knowledge base, which helps improve the quality of the question-and-answer service. Moreover, the preset model can remain online throughout the entire process to provide question-and-answer services to users, which helps improve the user experience.

[0160] In the aforementioned combination Figure 6 In the given example of the question-and-answer service method, combined with Figure 4A and Figure 4BThe given preset model includes a dual-mode model, which is a large model with two working modes. The preset model utilizes this dual-mode model to achieve the following two functions: knowledge graph construction and optimization, and providing question-and-answer services to users. In other embodiments, the preset model may also have two large models, one for knowledge graph construction and optimization, and the other for providing question-and-answer services to users. For example, Figure 5A or Figure 5B The first and second models shown are the two large models in the preset model.

[0161] Preferably, the preset model has a dual-mode model. The main reasons include: it can save model resources; in addition, due to the current knowledge graph update frequency and question-answering service volume, when using a large model to update the knowledge graph and provide question-answering services to users at the same time, there has been no significant impact on the question-answering service capability (this is because the corresponding answers are usually provided asynchronously during the question-answering service process).

[0162] Based on the above, the model structure of the preset model (a GraphRag model) described in this specification is as follows:

[0163] The preset model includes a dual-mode model, which is used in the first working mode to participate in the construction and updating of the knowledge graph, and in the second working mode to provide question answering services.

[0164] Alternatively, the preset model may include a first model and a second model, where the first model is used to participate in the construction and updating of the knowledge graph, and the second model is used to provide question-answering services. The first model and the second model are the same large model (e.g., both are Language Models (LLMs)).

[0165] Accordingly, the steps 104212 and 104214 involved in "generating the knowledge subgraph corresponding to the updated knowledge item by the preset model" are implemented by the preset model using its dual-mode model or first model.

[0166] This specification also provides a method for updating the knowledge graph in a preset model, the execution entity of which is... Figure 3 The server shown is included. The preset model includes a dual-mode model (for...). Figure 4BThe large model shown in the image has a dual-mode architecture. In the first working mode, it is used to participate in the construction and updating of the knowledge graph. In the second working mode, it is used to generate responses based on the dialogue information input by the user. The preset model also includes a knowledge graph corresponding to the current knowledge base constructed using the dual-mode model. Currently, the dual-mode model uses the first graph data as the service data source for the response generation. The first graph data is generated by performing a snapshot operation on the knowledge graph corresponding to the current knowledge base.

[0167] See also Figure 7 As shown, the knowledge graph update method in this preset model includes the following steps:

[0168] 202. Monitor the document update status in the knowledge base;

[0169] 204. When a document update is detected in the knowledge base, the updated document is input into the preset model, which then executes the following:

[0170] 2042. Delete the knowledge subgraph corresponding to the document in the knowledge graph before the update, and obtain the knowledge graph after deletion;

[0171] 2044. Divide the updated document into multiple document blocks;

[0172] 2046. Input the multiple document blocks into the dual-mode model to obtain the triples corresponding to each of the multiple document blocks in the output;

[0173] 2048. Based on the triples corresponding to each of the multiple document blocks, create an updated knowledge subgraph corresponding to the document in the knowledge graph, and generate the updated knowledge graph;

[0174] The triple includes the updated document identifier, document chunks, and knowledge entities extracted from the document chunks. After the knowledge graph generation update is completed, the service data source of the dual-mode model will switch from the first graph data to the second graph data, which is generated by performing a snapshot operation on the updated knowledge graph.

[0175] For specific implementation details of the steps described above in this embodiment, please refer to the relevant content in other embodiments, which will not be repeated here. Furthermore, the method provided in this embodiment may also include some steps disclosed in other embodiments, which can also be referred to the relevant content in other embodiments, and will not be repeated here.

[0176] The above text combined Figures 6-7Specific embodiments of the embodiments described herein have been described. It should be noted that other embodiments fall within the scope of the appended claims; and, in some cases, the actions or steps recited in the claims may be performed in a different order than those shown in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0177] The apparatus embodiments corresponding to the various method embodiments provided in this specification are described below.

[0178] Figure 8 A schematic diagram of a question-and-answer service apparatus provided in an exemplary embodiment of this specification is shown. Figure 8 As shown, the device includes: a monitoring module 32 and an execution module 34. Among them,

[0179] Monitoring module 52 is used to monitor the update status of knowledge items in the knowledge base when the preset model provides question-and-answer services to users based on the first graph data; the first graph data is cut according to the knowledge graph corresponding to the current knowledge base constructed in the preset model;

[0180] The execution module 34 is configured to perform the following question-answering service optimization operation when it detects that a knowledge item has been updated in the knowledge base: inputting the updated knowledge item in the knowledge base into the preset model, generating a knowledge subgraph corresponding to the updated knowledge item from the preset model, and updating the knowledge graph based on the knowledge subgraph corresponding to the updated knowledge item; wherein, during the updating of the knowledge graph, the preset model provides a snapshot of the knowledge graph as the first graph data used for the question-answering service; determining the second graph data based on the updated knowledge graph; and switching the service data source of the preset model from the first graph data to the second graph data.

[0181] The knowledge graph contains multiple nodes and relationships between nodes.

[0182] In one possible implementation, the above-mentioned nodes include knowledge item identifier nodes, knowledge block nodes, and knowledge entity nodes. The relationships between the nodes include a first association relationship and a second association relationship. The first association relationship reflects the knowledge item to which the knowledge block belongs, and the second association relationship reflects the knowledge block from which the knowledge entity originates.

[0183] Each knowledge item in the knowledge base corresponds to a knowledge subgraph in the knowledge graph; the knowledge subgraph is rooted at the knowledge item identifier node, and is associated with multiple knowledge block nodes downwards, and each knowledge block node is associated with at least one knowledge entity node downwards.

[0184] In one possible implementation, when the updated knowledge item is an existing knowledge item in the knowledge base whose knowledge content has changed, then: the execution module 34, when updating the knowledge graph based on the knowledge subgraph corresponding to the updated knowledge item, is specifically used to: delete the knowledge subgraph corresponding to the knowledge item in the knowledge graph before the update according to the metadata of the knowledge item before the update; write the knowledge subgraph corresponding to the updated knowledge item into the deleted knowledge graph; wherein, the metadata includes multiple knowledge blocks corresponding to the knowledge item before the update and knowledge entities extracted from the knowledge blocks.

[0185] In one possible implementation, the execution module 34, when deleting the knowledge subgraph corresponding to the knowledge item in the knowledge graph based on the metadata of the knowledge item before the update, specifically performs the following steps: based on the metadata, identifies a target knowledge entity node in the knowledge graph associated with the knowledge item before the update; determines at least one knowledge block node in the knowledge graph that has an association with the target knowledge entity node, and a knowledge item identifier node associated with each of the at least one knowledge block node; performs an adapted deletion strategy for the target knowledge entity node based on the knowledge item identifier nodes associated with each of the at least one knowledge block node, to delete the target knowledge entity node from the knowledge graph, and / or the relationship edge between the target entity node and the knowledge block node belonging to the knowledge item before the update in the at least one knowledge block node; based on the metadata, deletes the target knowledge block node associated with the knowledge item before the update, the relationship edge connected to the target knowledge block node, and the knowledge item identifier node used to indicate the knowledge item before the update from the knowledge graph.

[0186] In one possible implementation, the execution module 34, when executing an adapted deletion strategy for the target knowledge entity node based on the knowledge item identifier nodes associated with each of the at least one knowledge block nodes, specifically performs the following: if the knowledge item identifier nodes associated with each of the at least one knowledge block nodes all indicate the knowledge item before the update, then the target knowledge entity node and the relationship edges between the target knowledge entity node and the at least one knowledge block node will be deleted from the knowledge graph; if some of the at least one knowledge block nodes have knowledge item identifier nodes associated with indicating the knowledge item before the update, then the relationship edges between the target knowledge entity node and the partial knowledge blocks will be deleted from the knowledge graph.

[0187] In one possible implementation, the metadata of the knowledge item before the update also includes a checksum, which is used to detect whether the knowledge content in the knowledge item has changed. The device further includes: a calculation module, a comparison module, and a determination triggering module. The calculation module is used to calculate the checksum of the knowledge content in the updated knowledge item when an update is detected in the knowledge base. The comparison module is used to compare the checksum corresponding to the updated knowledge item with the checksum corresponding to the knowledge item before the update. The determination triggering module is used to determine that the knowledge item has changed its knowledge content if the comparison result shows that the checksums are different, and to trigger the execution of the question-and-answer service optimization operation.

[0188] In one possible implementation, the preset model includes a dual-mode model, which is used in a first working mode to participate in knowledge graph construction and updating, and in a second working mode to provide question-answering services; or, the preset model includes a first model and a second model, where the first model is used to participate in knowledge graph construction and updating, and the second model is used to provide question-answering services.

[0189] In one possible implementation, the execution module 34, when inputting the updated knowledge item from the knowledge base into the preset model and generating a knowledge subgraph corresponding to the updated knowledge item from the preset model, is specifically configured to: input the updated knowledge item from the knowledge base into the preset model, triggering the dual-mode model or the first model within the preset model to execute: divide the updated knowledge item into multiple knowledge blocks; perform entity extraction processing on each of the multiple knowledge blocks to obtain triples corresponding to each of the multiple knowledge blocks; wherein, the triples include the knowledge item identifier of the updated knowledge item, the knowledge block, and the knowledge entity extracted from the knowledge block; the knowledge subgraph is composed of the triples corresponding to each of the multiple knowledge blocks.

[0190] In one possible implementation, the first graph data is the knowledge graph or a snapshot of the knowledge graph; and when the first graph data is the knowledge graph, the apparatus further includes: a creation module and an application module. The creation module is used to create a snapshot of the knowledge graph before performing the question-answering service optimization operation when a knowledge item update is detected in the knowledge base. The application module is used to use the snapshot of the knowledge graph as the first graph data.

[0191] Figure 9This specification illustrates a schematic diagram of a knowledge graph updating device in a preset model according to an exemplary embodiment. The preset model includes a dual-mode model, which participates in knowledge graph construction and updating in a first working mode and generates responses based on user-input dialogue information in a second working mode. The preset model also includes a knowledge graph corresponding to the current knowledge base constructed using the dual-mode model. The dual-mode model currently uses first graph data as the service data source for response generation, and the first graph data is generated by performing a snapshot operation on the knowledge graph corresponding to the current knowledge base.

[0192] And, such as Figure 9 As shown, the device includes: a monitoring module 42 and an input / execution module 44. Among them,

[0193] Monitoring module 42 is used to monitor the document update status in the knowledge base;

[0194] The input / execution module 44 is used to input the updated document into a preset model when a document update is detected in the knowledge base. The preset model then performs the following actions: deleting the knowledge subgraph corresponding to the document before the update in the knowledge graph to obtain the deleted knowledge graph; segmenting the updated document into multiple document blocks; inputting the multiple document blocks into the dual-mode model to obtain the output triples corresponding to each of the multiple document blocks; and creating a knowledge subgraph corresponding to the updated document in the knowledge graph based on the triples corresponding to each of the multiple document blocks to generate the updated knowledge graph.

[0195] The triple includes the updated document identifier, document chunks, and knowledge entities extracted from the document chunks. After the knowledge graph generation update is completed, the service data source of the dual-mode model will switch from the first graph data to the second graph data, which is generated by performing a snapshot operation on the updated knowledge graph.

[0196] It should be noted that the above-mentioned devices can implement the technical solutions described in the corresponding method embodiments. The specific implementation principles of each module or unit can be found in the relevant content of the corresponding method embodiments, and will not be elaborated further here. Furthermore, for ease of description, the above devices are described by function as various modules or units. Of course, when implementing one or more of this specification, the functions of each module or unit can be implemented in one or more software and / or hardware, or a module that implements the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0197] Furthermore, embodiments of this specification also provide an electronic device. For example... Figure 10 As shown, the electronic device 900 includes a memory 91 and a processor 92.

[0198] The aforementioned memory 91 can be implemented by at least one volatile or non-volatile storage device of any type, or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. Furthermore, the memory, wholly or partially, can be integrated with the processor. The memory can contain both removable and non-removable components.

[0199] The processor 92 described above may include one or more general-purpose processors and / or special-purpose processors.

[0200] Furthermore, memory 91 may contain a non-transitory computer-readable medium storing executable program instructions 912 (e.g., compiled or uncompiled program logic and / or machine code). Processor 92 is capable of executing the program instructions 912 stored in memory to implement any methods, processes, or functions disclosed in this specification and / or the accompanying drawings. Additionally, execution of program instructions 912 by processor 92 may result in processor using corresponding data 911.

[0201] For example, the program instructions 912 described above may include an operating system 9122 (e.g., an operating system kernel, device drivers, and / or other modules) and one or more applications 9121 (e.g., a browser, social media application, or game application) installed on the electronic device 900. Similarly, the data 911 described above may include operating system data 9112 and application data 9111. The operating system data 9112 is primarily accessible to the operating system 9122, while the application data 9111 is primarily accessible to one or more applications 9121. The application data 9111 may reside in a file system visible or hidden from the user of the electronic device 900.

[0202] Application 9121 can communicate with operating system 9122 through one or more application programming interfaces (APIs). These APIs facilitate application 9122 in reading and / or writing application data, transmitting or receiving information via communication components, and receiving or displaying information on the user interface. In some terms, application 9121 may be simply referred to as an "app". Furthermore, application 9121 can be downloaded to the electronic device through one or more online application stores or app markets. However, application 9121 can also be installed on electronic device 400 in other ways, such as through a web browser or a physical interface on electronic device 900 (e.g., a USB port).

[0203] Furthermore, such as Figure 10 As shown, the electronic device also includes: a communication component 93, a display 94, a power supply component 95, an audio component 96, a user interface 99, and other components. Figure 10 The diagram only shows some components and does not imply that the electronic device 900 includes only these components. Figure 10 The components shown. Additionally... Figure 10 The components within the dashed box are optional, not mandatory, and their specific requirements depend on the product form of the electronic device 900. The electronic device 900 in this embodiment can be a terminal device such as a desktop computer, laptop computer, smartphone, or IoT device; it can also be a server-side device such as a conventional server, cloud server, or server array; or it can be an integrated device combining terminal and server-side devices. If the electronic device 900 in this embodiment is implemented as a terminal device such as a desktop computer, laptop computer, or smartphone, it may include... Figure 10 The components within the dashed box; if the electronic device 900 in this embodiment is implemented as a conventional server, cloud server, or server array, etc., then it may not include... Figure 10 The component within the dashed box.

[0204] The aforementioned communication component 93 is configured to facilitate wired or wireless communication between the device housing the communication component and other devices. The device housing the communication component 93 can access wireless networks based on communication standards, such as 2G, 3G, 4G / LTE, 5G, or combinations thereof. In one exemplary embodiment, the communication component 93 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. Specifically, the communication component 93 includes a communication interface that enables the electronic device 900 to communicate with other devices, access networks, and transmission networks via analog or digital modulation. For example, the communication interface may include a chipset and antenna for wireless communication with a radio access network or access point. Furthermore, the communication interface can be a wired interface such as Ethernet, Token Ring, or a USB port, or a wireless interface such as Wi-Fi, Bluetooth, Global Positioning System (GPS), or a wide-area wireless interface (e.g., WiMAX or LTE). Of course, the communication interface can also support other forms of physical layer interfaces and standard or proprietary communication protocols. The communication interface may also include multiple physical communication interfaces, such as Wi-Fi, Bluetooth, and wide-area wireless interfaces.

[0205] The aforementioned display 94 includes a screen, which may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a Touch Panel, the screen can be implemented as a touchscreen to receive input signals from a user. The Touch Panel includes one or more touch sensors to sense touches, swipes, and gestures on the Touch Panel. The touch sensors can sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation.

[0206] The power supply component 95 provides power to various components of the device in which it resides. The power supply component 95 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device in which the power supply component resides.

[0207] The aforementioned audio component 96 can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC) configured to receive external audio signals when the device containing the audio component is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals can be further stored in memory or transmitted via a communication component. In some embodiments, the audio component also includes a speaker for outputting audio signals.

[0208] The user interface 97 described above includes receiving user input and providing output to the user. Therefore, the user interface 97 may include input components such as a keypad, keyboard, touch-sensitive or presence-sensitive panel, computer mouse, trackball, joystick, microphone, still camera, and video camera, and output components such as a display screen (which may be combined with a touch-sensitive panel), CRT, LCD, LED, display using DLP technology, printer, and other similar devices known or developed in the future. The user interface 97 may also generate auditory output via speakers, speaker jacks, audio output ports, audio output devices, headphones, and other similar devices known or developed in the future. In some embodiments, the user interface 97 may include software, circuitry, or other forms of logic capable of transmitting and receiving data from external user input / output devices. Additionally or alternatively, the electronic device 900 may support remote access from other devices via a communication interface or another physical interface (not shown). The user interface 97 may be configured to receive user input, the position and movement of which may be indicated by indicators or cursors described herein. The user interface 97 may also be configured as a display device for rendering or displaying text fragments.

[0209] Accordingly, embodiments of this specification also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to implement the steps in the above-described method embodiments. The computer-readable storage medium includes volatile or non-volatile or a combination thereof, and can be removable or non-removable. Examples of computer-readable storage media include, but are not limited to, phase-change random access memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random-access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), flash memory or other memory technologies, CD-ROM, Digital Video Disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium.

[0210] Furthermore, embodiments of this specification also provide a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed in a computer, it causes the computer to perform actions such as... Figure 3 The method described in Figure 5.

[0211] This specification also provides a computer program product, including a computer program / instructions, which, when executed by a processor, implements... Figure 3 The method described in Figure 5.

[0212] Those skilled in the art will recognize that the functions described in the various embodiments disclosed in this specification in one or more of the examples above can be implemented using hardware, software, firmware, or any combination thereof. When implemented in software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium.

[0213] The specific embodiments described above further illustrate the purpose, technical solutions, and beneficial effects of the multiple embodiments disclosed in this specification. It should be understood that the above descriptions are merely specific implementations of the multiple embodiments disclosed in this specification and are not intended to limit the protection scope of the multiple embodiments disclosed in this specification. Any modifications, equivalent substitutions, improvements, etc., made based on the technical solutions of the multiple embodiments disclosed in this specification should be included within the protection scope of the multiple embodiments disclosed in this specification.

Claims

1. A question-and-answer service method, characterized in that, include: In the process of providing question-and-answer services to users based on the first graph data in the preset model, the update status of knowledge items in the knowledge base is monitored; The first graph data is determined based on the knowledge graph corresponding to the current knowledge base constructed in the preset model; When an update to a knowledge item is detected in the knowledge base, the following question-answering service optimization operations are performed: The updated knowledge items are input into the preset model, which generates a knowledge subgraph corresponding to the updated knowledge items. The knowledge graph is then updated based on the knowledge subgraph corresponding to the updated knowledge items. During the knowledge graph update process, the preset model provides a snapshot of the knowledge graph as the first graph data used for the question-answering service. Based on the updated knowledge graph, determine the data for the second graph; Switch the service data source of the preset model from the first graph data to the second graph data; The knowledge graph contains multiple nodes and relationships between nodes.

2. The method according to claim 1, characterized in that, The nodes include knowledge item identifier nodes, knowledge block nodes, and knowledge entity nodes. The relationships between the nodes include a first association relationship and a second association relationship. The first association relationship reflects the knowledge item to which the knowledge block belongs, and the second association relationship reflects the knowledge block from which the knowledge entity originates. The knowledge block is obtained by dividing the knowledge item. Each knowledge item in the knowledge base corresponds to a knowledge subgraph in the knowledge graph; the knowledge subgraph is rooted at the knowledge item identifier node, and is associated with multiple knowledge block nodes downwards, and each knowledge block node is associated with at least one knowledge entity node downwards.

3. The method according to claim 1, characterized in that, When the updated knowledge item is an existing knowledge item in the knowledge base whose knowledge content has changed, then: Based on the knowledge subgraph corresponding to the updated knowledge item, the knowledge graph is updated, including: Based on the metadata of the knowledge item before the update, delete the knowledge subgraph corresponding to the knowledge item in the knowledge graph before the update; Write the knowledge subgraph corresponding to the updated knowledge item into the deleted knowledge graph; The metadata includes multiple knowledge blocks corresponding to the knowledge item before the update, and knowledge entities extracted from the knowledge blocks.

4. The method according to claim 3, characterized in that, Based on the metadata of the knowledge item before the update, delete the knowledge subgraph corresponding to the knowledge item in the knowledge graph before the update, including: Based on the metadata, identify the target knowledge entity nodes in the knowledge graph that are associated with the knowledge items before the update; Identify at least one knowledge block node in the knowledge graph that is associated with the target knowledge entity node, and the knowledge item identifier node associated with each of the at least one knowledge block nodes; Based on the knowledge item identifier node associated with each of the at least one knowledge block node, an adapted deletion strategy is executed for the target knowledge entity node to delete the target knowledge entity node from the knowledge graph, and / or the relationship edge between the target entity node and the knowledge block node belonging to the knowledge item before the update in the at least one knowledge block node. Based on the metadata, the target knowledge block node associated with the knowledge item before the update, the relation edges connected to the target knowledge block node, and the knowledge item identifier node used to indicate the knowledge item before the update are deleted from the knowledge graph.

5. The method according to claim 4, characterized in that, Based on the knowledge item identifier node associated with each of the at least one knowledge block node, an adapted deletion strategy is executed for the target knowledge entity node, including: If the knowledge item identifier nodes associated with each of the at least one knowledge block nodes all indicate the knowledge item before the update, then the target knowledge entity node and the relationship edge between the target knowledge entity node and the at least one knowledge block node will be deleted from the knowledge graph. If a knowledge item identifier node associated with one of the at least one knowledge block nodes indicates the knowledge item before the update, then the relationship edge between the target knowledge entity node and the partial knowledge block is deleted from the knowledge graph.

6. The method according to any one of claims 3 to 4, characterized in that, The metadata of the knowledge item before the update also includes a verification code, which is used to detect whether the knowledge content in the knowledge item has changed; Furthermore, the method further includes: When an update is detected in the knowledge base, the check code of the knowledge content in the updated knowledge item is calculated. Compare the checksums corresponding to the updated knowledge items with the checksums corresponding to the knowledge items before the update; If the comparison result shows that the verification codes are different, it is determined that the knowledge item has undergone a change in knowledge content, and the question-and-answer service optimization operation is triggered.

7. The method according to any one of claims 1 to 5, characterized in that, The preset model includes a dual-mode model, which is used in the first working mode to participate in the construction and updating of the knowledge graph, and in the second working mode to provide question answering services; Alternatively, the preset model may include a first model and a second model, wherein the first model is used to participate in the construction and updating of the knowledge graph, and the second model is used to provide question-answering services; And, the updated knowledge items in the knowledge base are input into the preset model, and the preset model generates a knowledge subgraph corresponding to the updated knowledge items, including: The updated knowledge items in the knowledge base are input into the preset model, triggering the execution of the dual-mode model or the first model within the preset model: The updated knowledge items are divided into multiple knowledge blocks; Entity extraction is performed on each of the multiple knowledge blocks to obtain the triples corresponding to each of the multiple knowledge blocks; The triple includes the updated knowledge item identifier, the knowledge block, and the knowledge entity extracted from the knowledge block; the knowledge subgraph is composed of the triples corresponding to each of the multiple knowledge blocks.

8. The method according to any one of claims 1 to 5, characterized in that, The first graph data is the knowledge graph, or a snapshot of the knowledge graph; And, when the first graph data is the knowledge graph, then: When an update to a knowledge item is detected in the knowledge base, before performing the question-answering service optimization operation, the method further includes: Create a snapshot of the knowledge graph; A snapshot of the knowledge graph is used as the first graph data.

9. A method for updating a knowledge graph in a pre-defined model, characterized in that, The preset model includes a dual-mode model, which is used in a first working mode to participate in knowledge graph construction and updating, and in a second working mode to generate responses based on user-input dialogue information; the preset model also includes a knowledge graph corresponding to the current knowledge base constructed using the dual-mode model; wherein, the dual-mode model currently uses the first graph data as the service data source for the response generation, and the first graph data is generated by performing a snapshot operation on the knowledge graph corresponding to the current knowledge base; And, the method includes: Monitor the document update status in the knowledge base; When a document update is detected in the knowledge base, the updated document is input into a preset model, which then performs the following actions: Delete the knowledge subgraph corresponding to the document in the knowledge graph before the update to obtain the knowledge graph after deletion; The updated document is divided into multiple document blocks. The multiple document blocks are input into the dual-mode model to obtain the triples corresponding to each of the multiple document blocks in the output; Based on the triples corresponding to each of the multiple document blocks, an updated knowledge subgraph corresponding to the document is created in the knowledge graph, and the updated knowledge graph is generated. The triple includes the updated document identifier, document chunks, and knowledge entities extracted from the document chunks. After the knowledge graph generation update is completed, the service data source of the dual-mode model will switch from the first graph data to the second graph data, which is generated by performing a snapshot operation on the updated knowledge graph.

10. A question-and-answer service system, characterized in that, include: Client; The server-side is equipped with pre-defined models, a knowledge base, and a graph storage engine. The graph storage engine stores first graph data, which is generated by taking a snapshot of the knowledge graph corresponding to the current knowledge base constructed in the preset model. And, the server has the following features: In the process of providing question-and-answer services to the client-side user based on the first graph data in the preset model, the document update status of the knowledge base is monitored; When a document update is detected in the knowledge base, the following question-answering service optimization operations are performed: the updated document in the knowledge base is input into the preset model, the preset model generates a knowledge subgraph corresponding to the updated document, and the knowledge graph is updated based on the knowledge subgraph corresponding to the updated document; wherein, while processing the updated document, the preset model continues to use the first graph data to provide question-answering services to the user; the knowledge graph is updated using the knowledge subgraph corresponding to the updated document; a snapshot operation is performed on the updated knowledge graph to obtain the second graph data; The knowledge graph contains multiple nodes and relationships between nodes; the nodes are of three types: document identifier nodes, document chunk nodes, and knowledge entity nodes; the relationships between nodes include a first association relationship and a second association relationship, where the first association relationship reflects the document to which the document chunk belongs, and the second association relationship reflects the document chunk from which the knowledge entity originates; Each document in the knowledge base corresponds to a knowledge subgraph in the knowledge graph; the knowledge subgraph is rooted at the document identifier node, and is associated with multiple document block nodes downwards, and each document block node is associated with at least one knowledge entity node downwards.

11. A question-and-answer service device, characterized in that, include: The monitoring module is used to monitor the update status of knowledge items in the knowledge base when the preset model provides question-and-answer services to users based on the data in the first graph. The first graph data is determined based on the knowledge graph corresponding to the current knowledge base constructed in the preset model; The execution module is configured to perform the following question-answering service optimization operations when an update to a knowledge item is detected in the knowledge base: inputting the updated knowledge item from the knowledge base into the preset model, generating a knowledge subgraph corresponding to the updated knowledge item from the preset model, and updating the knowledge graph based on the knowledge subgraph corresponding to the updated knowledge item; wherein, during the updating of the knowledge graph, the preset model provides a snapshot of the knowledge graph as the first graph data used for the question-answering service; determining the second graph data based on the updated knowledge graph; and switching the service data source of the preset model from the first graph data to the second graph data; The knowledge graph contains multiple nodes and relationships between nodes.

12. A device for updating a knowledge graph in a preset model, characterized in that, The preset model includes a dual-mode model, which is used in a first working mode to participate in knowledge graph construction and updating, and in a second working mode to generate responses based on user-input dialogue information; the preset model also includes a knowledge graph corresponding to the current knowledge base constructed using the dual-mode model; wherein, the dual-mode model currently uses the first graph data as the service data source for the response generation, and the first graph data is generated by performing a snapshot operation on the knowledge graph corresponding to the current knowledge base; And, the device includes: The monitoring module is used to monitor the update status of documents in the knowledge base; The input / execution module is used to input the updated document into a preset model when a document update is detected in the knowledge base. The preset model then performs the following actions: deleting the knowledge subgraph corresponding to the document before the update in the knowledge graph, resulting in the deleted knowledge graph; dividing the updated document into multiple document blocks; inputting the multiple document blocks into the dual-mode model to obtain the output triples corresponding to each of the multiple document blocks; and creating a knowledge subgraph corresponding to the updated document in the knowledge graph based on the triples corresponding to each of the multiple document blocks, thereby generating the updated knowledge graph. The triple includes the updated document identifier, document chunks, and knowledge entities extracted from the document chunks. After the knowledge graph generation update is completed, the service data source of the dual-mode model will switch from the first graph data to the second graph data, which is generated by performing a snapshot operation on the updated knowledge graph.

13. An electronic device, characterized in that, The method includes a memory and a processor, wherein the memory stores executable program instructions, and the processor executes the program instructions to implement the method of any one of claims 1 to 9.

14. A computer-readable storage medium, characterized in that, The storage medium stores a computer program that, when executed in a computer, causes the computer to perform the method described in any one of claims 1 to 9.

15. A computer program product, characterized in that, The computer program product includes a computer program or instructions that, when executed by a processor, implement the method of any one of claims 1 to 9.