Context-based question-solving methods, apparatus, equipment, and media

By constructing a context graph, the problems of difficult knowledge updates and inaccurate generation in specific domains of large language models are solved, realizing an efficient and accurate question-answering system, improving interpretability and engineering scalability, and making it suitable for complex query needs with multiple fact combinations.

CN121998058BActive Publication Date: 2026-08-04SHUCHUANG ARC LIGHT (SHENZHEN) TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHUCHUANG ARC LIGHT (SHENZHEN) TECHNOLOGY CO LTD
Filing Date
2026-01-27
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

Existing large language models suffer from problems such as difficulty in updating knowledge, inaccurate generation, lack of traceability, insufficient interpretability, high cost, and low efficiency when dealing with specific domain knowledge and complex factual information. In particular, they are unable to meet the engineering requirements of high-throughput database construction and continuous evolution in multi-hop problems that require cross-segment and multi-fact combination.

Method used

A question-answering system based on context graph is constructed. By segmenting unstructured text into multiple context fragments, a target structured mapping is built, and a mapping between the context graph and the target vector index is established. The target seed set is generated by using the similar entity edge-incremental update mechanism and the conflict resolution mechanism. Subgraph expansion and pruning are performed in the context graph. The system generates accurate answer data by combining the graph ranking and the fusion score of vector similarity score.

Benefits of technology

It enables efficient construction of context graphs, improves the accuracy, interpretability, and engineering scalability of question-answering systems, reduces construction costs, improves retrieval efficiency and accuracy, and meets the auditability requirements of high-reliability scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121998058B_ABST
    Figure CN121998058B_ABST
Patent Text Reader

Abstract

This invention relates to the field of artificial intelligence technology, providing a question-answering method, apparatus, device, and medium based on context graphs. On one hand, it solves the problems of untraceability and insufficient interpretability through context graphs. On the other hand, it establishes a mapping between the context graph and the vector index based on a similar entity edge-incremental update mechanism and a conflict resolution mechanism, effectively reducing construction costs. Furthermore, it generates a seed set based on the similarity retrieval results of the user query in the vector index and the joint index system. Starting from the seed set, it performs subgraph expansion and pruning on the context graph, and calculates the fusion score of the graph ranking score and vector similarity score for each context fragment node to extract the target context fragment node, improving retrieval efficiency and accuracy. Finally, it uses the context fragment corresponding to the target context fragment node as a constraining context, and combines it with the user query to obtain target prompt words. This enables the generation of accurate question answers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a question-solving method, apparatus, device, and medium based on context graph. Background Technology

[0002] In recent years, Large Language Models (LLMs) have demonstrated strong capabilities in tasks such as text generation, automatic summarization, and dialogue systems. However, they still have limitations when dealing with specific domain knowledge and complex factual information: on the one hand, the model's parameterized knowledge is difficult to update in a timely manner, making it difficult to cover the latest or proprietary domain knowledge; on the other hand, the model may experience "illusions" during the generation process, i.e., generating inaccurate or even fictitious content. In scenarios where accuracy and reliability are highly demanding, these problems can significantly affect the system's usability and credibility.

[0003] Existing technologies mainly employ knowledge graphs and retrieval-augmented generation (RAG) to address the aforementioned issues, but they still face the following challenges: First, traditional knowledge graphs often use triples as the core representation, which often lacks an explicit binding mechanism for the context of entities and relations (such as source paragraphs, sentences, fragments, etc.). This makes it difficult to accurately align structured knowledge with original contextual evidence during the question-and-answer stage, affecting the traceability and interpretability of the answers. Secondly, the extraction of entities and relationships, graph construction, and maintenance of large amounts of unstructured text are costly and difficult to meet the engineering requirements of high-throughput database construction and continuous evolution. Third, traditional RAGs typically rely on vector similarity for candidate recall. As the database grows, this can easily lead to situations where candidates are "similar but irrelevant" or "relevant but not recalled." For multi-hop problems requiring cross-segment and multi-fact combinations, similarity retrieval alone cannot explicitly capture the structured connections between texts, resulting in incomplete answers or a lack of key link evidence. Traditional RAGs output several similar segments as context, but lack structured connection paths, entity relationship evidence, and contextual location information, making it difficult to explain "why these segments were selected" or "how the segments support the conclusions." This is insufficient for industry applications that require auditability and interpretability. Fourth, the retrieval stage often requires a trade-off between "rapid recall" and "cross-fragment association reasoning". Relying solely on text similarity retrieval is prone to missing implicit association information, while relying solely on graph structure reasoning may lead to computational overhead and noise spread. There is a lack of a mechanism to uniformly model, jointly sort, and control the scale of graph structure signals and vector similarity signals, making it difficult to simultaneously meet the needs of rapid recall and complex problem reasoning in engineering.

[0004] Therefore, there is an urgent need for a context graph-driven solution that can efficiently construct solutions for unstructured content and simultaneously possess contextual evidence backtracking and structured association capabilities during the question-answering phase, in order to improve the accuracy, interpretability, and engineering scalability of retrieval and enhanced question-answering systems. Summary of the Invention

[0005] In view of the above, it is necessary to provide a question-solving method, apparatus, device and medium based on context graph, which aims to solve the problems of existing question-solving schemes being untraceable, lacking interpretability, costly, inefficient and inaccurate.

[0006] A context-based question-solving method, comprising: Obtain unstructured text, segment the unstructured text into multiple contextual fragments, and construct a target structured mapping based on the multiple contextual fragments; Construct a contextual graph based on the target structured mapping, and construct a target vector index based on the target structured mapping; A mapping between the context graph and the target vector index is established based on the similar entity edge-incremental update mechanism and the conflict resolution mechanism to obtain a joint index system; In response to a question-answering instruction triggered by a target user query, a similarity search is performed in the target vector index according to the target user query, and a target seed set is generated based on the search results and the joint index system; Starting with the target seed set, subgraph expansion and pruning are performed on the context graph to obtain candidate subgraphs; Calculate the fusion score of graph ranking score and vector similarity score for each context fragment node in the candidate subgraph, and extract the target context fragment node from the candidate subgraph based on the fusion score; The context fragment corresponding to the target context fragment node is used as a constraining context, and combined with the target user query to obtain the target prompt word; The large language model obtains feedback information based on the target prompt words to obtain the target answer data for the target user's query.

[0007] A context-based question-solving device, characterized in that the context-based question-solving device comprises: A construction unit is used to acquire unstructured text, segment the unstructured text into multiple contextual fragments, and construct a target structured mapping based on the multiple contextual fragments; The construction unit is further configured to construct a contextual graph based on the target structured mapping, and to construct a target vector index based on the target structured mapping; The mapping unit is used to establish a mapping between the context graph and the target vector index based on the similar entity edge-incremental update mechanism and the conflict resolution mechanism, so as to obtain a joint index system; The generation unit is used to respond to a question-answering instruction triggered by a target user query, perform a similarity retrieval in the target vector index according to the target user query, and generate a target seed set according to the retrieval results and the joint index system; The processing unit is used to perform subgraph expansion and pruning processing on the context graph, starting from the target seed set, to obtain candidate subgraphs; The extraction unit is used to calculate the fusion score of graph ranking score and vector similarity score of each context fragment node in the candidate subgraph, and extract the target context fragment node from the candidate subgraph based on the fusion score. The combination unit is used to combine the context fragment corresponding to the target context fragment node as a constraining context with the target user query to obtain the target prompt word; The acquisition unit is used to acquire feedback information from the large language model based on the target prompt words, and obtain target answer data for the target user's query.

[0008] A computer device, the computer device comprising: A memory for storing at least one instruction; and a processor for executing the instructions stored in the memory to implement the context-based question-solving method.

[0009] A computer-readable storage medium storing at least one instruction, which is executed by a processor in a computer device to implement the context-map-based question-solving method.

[0010] As can be seen from the above technical solutions, on the one hand, the constructed context graph solves the problems of untraceability and insufficient interpretability; on the other hand, the mapping between the context graph and the target vector index is established based on the similar entity edge-incremental update mechanism and conflict resolution mechanism, which effectively reduces the construction cost and helps improve subsequent retrieval efficiency; on the other hand, a seed set is generated based on the similarity retrieval results of the user query in the target vector index and the joint index system. Starting from the seed set, subgraph expansion and pruning are performed on the context graph, and the graph ranking score and vector similarity score of each context fragment node in the candidate subgraph are calculated to extract the target context fragment node from the candidate subgraph, improving retrieval efficiency and accuracy; and on the other hand, the context fragment corresponding to the target context fragment node is used as a constraining context and combined with the user query to obtain target prompt words. This enables the generation of accurate question answers. Attached Figure Description

[0011] Figure 1 This is a flowchart of a preferred embodiment of the problem-solving method based on context graphs of the present invention.

[0012] Figure 2 This is a functional block diagram of a preferred embodiment of the context graph-based question-answering device of the present invention.

[0013] Figure 3 This is a schematic diagram of the structure of a computer device that implements the context-based question-answering method of the present invention. Detailed Implementation

[0014] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0015] like Figure 1 The diagram shown is a flowchart of a preferred embodiment of the context-based question-answering method of the present invention. The order of the steps in this flowchart can be changed, and some steps can be omitted, depending on different requirements.

[0016] The context-based question-solving method is applied to one or more computer devices. The computer device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0017] The computer device can be any electronic product that can interact with the user, such as a personal computer, tablet computer, smartphone, personal digital assistant (PDA), game console, interactive network television (IPTV), smart wearable device, etc.

[0018] The computer equipment may also include network equipment and / or user equipment. The network equipment includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud based on cloud computing consisting of a large number of hosts or network servers.

[0019] The server can be a standalone server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.

[0020] Artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0021] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.

[0022] The network in which the computer device is located includes, but is not limited to, the Internet, wide area network, metropolitan area network, local area network, and virtual private network (VPN).

[0023] S10, obtain unstructured text, segment the unstructured text into multiple contextual fragments, and construct a target structured mapping based on the multiple contextual fragments.

[0024] In this embodiment, the unstructured text may include, but is not limited to, unstructured content such as text documents, PDF (Portable Document Format) parsed text, PPT (PowerPoint Presentation) parsed text, and webpage parsed text.

[0025] In this embodiment, before segmenting the unstructured text into multiple contextual segments, preprocessing operations such as unified encoding (e.g., UTF-8 (Universal Multi-octet Coded Character Set) standardization), noise reduction (e.g., removing redundant spaces, special symbols, and meaningless characters), and basic cleaning (e.g., filtering invalid text segments and format standardization) can be performed on the unstructured text.

[0026] For example, the unstructured text could be a PDF technical manual containing formatted errors and redundant blank lines, which, after parsing, contains some garbled characters. Through preprocessing, a continuous text sequence with uniform encoding, no garbled characters, and no redundant blank lines can be obtained.

[0027] The above embodiments can eliminate data format differences and noise interference, provide high-quality input for subsequent contextual segmentation and information extraction, and avoid subsequent processing errors caused by invalid data.

[0028] In this embodiment, the multiple contextual segments can be segmented into paragraph-level contextual segments, sentence-level contextual segments, and fixed-length contextual segments according to various segmentation granularities. The specific segmentation can be configured according to the business scenario to achieve the structured splitting of the original content.

[0029] In this embodiment, constructing a target structured mapping based on the plurality of context fragments includes: Generate context segment identifiers and location metadata for each context segment; Extract the set of entities included in each context fragment, and use a structured extraction component to extract the relationships between entities in the set of entities as triple facts; By binding the context fragment identifier of each context fragment with the corresponding entity set and triplet facts, an initial structured mapping is obtained; The entity names and fact texts in the initial structured mapping are standardized. The entity identifier is obtained by hashing the entity name obtained after standardization, and the fact identifier is obtained by hashing the fact text obtained after standardization. The same entities in the cross-context fragments of the initial structured mapping are merged according to the entity identifier, and the same facts in the cross-context fragments of the initial structured mapping are merged according to the fact identifier, to obtain the target structured mapping; The target structured mapping records the number of times each entity is mentioned and the number of times each fact appears.

[0030] The context fragment identifier is used to uniquely identify each context fragment.

[0031] The location metadata may include the context fragment identifier, paragraph number, page number, character offset (such as start-end position), timestamp, and user isolation identifier (for access control).

[0032] In this process, a pluggable named entity recognition component or a large language model can be used to extract the set of entities included in each contextual fragment.

[0033] Among them, the entity set includes multiple entities, and the triple facts include multiple fact relationships, and each fact relationship includes entity-relationship-entity.

[0034] Among them, the initial structured mapping includes mapping records of context fragment identifier-entity set-triple facts.

[0035] Among them, the normalization process may include case unification, symbol cleaning (such as removing redundant punctuation and spaces), and stop word processing (such as filtering Chinese words like "de" and "le").

[0036] Among them, merging the same entities across context fragments in the initial structured mapping according to the entity identifier, and merging the same facts across context fragments in the initial structured mapping according to the fact identifier can achieve entity deduplication and fact deduplication.

[0037] Through the above embodiments, the problems of entity fragmentation and fact duplication across context fragments can be solved, ensuring the consistency of knowledge; the stable identifier also provides a basis for cross-document association and incremental update of the knowledge graph.

[0038] S11. Construct a context graph according to the target structured mapping, and construct a target vector index according to the target structured mapping.

[0039] In this embodiment, the constructing a context graph according to the target structured mapping and constructing a target vector index according to the target structured mapping include: Extract the context fragment identifier from the target structured mapping as the unique key, and extract the context original text and the positioning meta-information as attributes to construct the context fragment node; Extract the entity identifier from the target structured mapping as the unique key, and extract the entity name, entity type, and entity attributes as attributes to construct the entity node; Construct a mention relationship edge; wherein, the mention relationship edge is used to connect the context fragment node and the entity node, and the edge attribute weight of the mention relationship edge is configured according to the mention times or extraction confidence of the corresponding entity; Construct a fact relationship edge; wherein, the fact relationship edge is used to connect two entity nodes according to the triple facts, and the edge attributes of the fact relationship edge include the fact identifier, fact text, and weight configured according to the occurrence times or cumulative confidence of the fact; Generate the context graph according to the context fragment node, the entity node, the mention relationship edge, and the fact relationship edge; Generate a context fragment vector according to the context original text, generate an entity vector according to the entity name, and generate a fact vector according to the fact text; The vector retrieval library is invoked to create vector indexes for the context fragment vector, the entity vector, and the fact vector, respectively, to obtain the target vector index.

[0040] The contextual graph can be adapted to mainstream graph databases such as Neo4j (Neo4j Graph Database), supporting efficient storage and associated queries of nodes and edges.

[0041] Among them, pre-trained language models (such as BERT (Bidirectional Encoder Representations from Transformers) and Sentence-BERT (Sentence Embeddings using Siamese BERT-Networks)) can be used to calculate the embedding vectors of the original context text, the entity name, and the factual text, respectively.

[0042] The vector retrieval library may include vector retrieval libraries such as FAISS (Facebook AI Similarity Search). The vector retrieval library is used to establish vector indexes for the entity vector, the fact vector, and the context fragment vector, respectively.

[0043] The entity type may include entity category or domain label; the entity attributes may include additional entity attribute information.

[0044] In the data structure of the context graph, the contextual location or source of an entity is not stored as a fixed entity node field, but is represented by the association between the entity and one or more context fragment nodes, thereby enabling an entity to correspond to multiple contextual evidences and be traceable.

[0045] Through the above embodiments, a three-in-one contextual graph of "context fragments-entities-facts" can be constructed, realizing a structural-level binding between structured knowledge and original contextual evidence, providing graph structure support for subsequent evidence backtracking. Simultaneously, vector indexes are established for the entity vectors, fact vectors, and context fragment vectors respectively to support efficient similarity retrieval.

[0046] S12, Based on the similar entity edge-incremental update mechanism and conflict resolution mechanism, establish the mapping between the context graph and the target vector index to obtain the joint index system.

[0047] In this embodiment, the process of establishing the mapping between the context graph and the target vector index based on the similar entity edge-incremental update mechanism and conflict resolution mechanism to obtain the joint index system includes: A nearest neighbor search is performed based on the vector index of the entity vectors to calculate the vector similarity between the entity vectors; entity vectors with corresponding vector similarity higher than a similarity threshold are selected to form entity pairs, and similarity relationship edges are created between the entity pairs in the context graph to update the context graph; wherein, the attribute of the similarity relationship edge is the vector similarity between the corresponding entity vectors; and / or When an update instruction triggered based on a context fragment to be processed is detected, update data for the context fragment to be processed is obtained; the context map is incrementally updated based on the update data; and / or Identify whether there are entity attribute conflicts or factual conflicts in the context graph across contextual segments; eliminate the entity attribute conflicts and factual conflicts in the context graph based on conflict resolution strategies, so as to update the context graph; Establish the mapping relationship between the nodes and edges of the context graph and the target vector index to obtain the joint index system.

[0048] The similarity threshold can be configured to be 0.85.

[0049] If a pair of entities is detected to already have a corresponding factual relationship edge, then that pair of entities is excluded.

[0050] The updated data may include update type (such as adding, modifying or deleting contextual fragments), update content, etc.

[0051] Specifically, for newly added context fragments, nodes can be added to the context graph based on the previously constructed context graph; for modified or deleted context fragments, the corresponding nodes and edges in the context graph are deleted simultaneously to maintain data consistency.

[0052] Among these features, the use of similar entity edges can complete the implicit semantic relationships between entities, improving the association recall capability of complex queries; and the incremental update mechanism can reduce the maintenance cost of the knowledge base and support the continuous evolution of knowledge.

[0053] The conflict resolution mechanism identifies entity attribute conflicts (e.g., the same entity's "product price" is "1000 yuan" and "1500 yuan" in different contexts) and factual conflicts (e.g., the same entity's relationship is "launch" and "agent" in different contexts). Conflicts can be automatically resolved based on source credibility (e.g., authoritative documents have higher priority than ordinary documents), timestamps (latest documents have higher priority than older documents), and frequency of occurrence (information supported by most contexts has higher priority). Conflicts can also be marked for manual review, thereby improving the knowledge quality of the context graph and preventing conflicting information from causing errors in subsequent question answering.

[0054] Through the above embodiments, a joint indexing system of graph structure and vector index can be constructed, realizing the collaborative foundation for rapid vector retrieval and graph-related query, and improving subsequent retrieval efficiency.

[0055] S13, in response to the question answering instruction triggered by the target user query, perform a similarity retrieval in the target vector index according to the target user query, and generate a target seed set according to the retrieval results and the joint index system.

[0056] In this embodiment, the question-answering instruction can be automatically triggered when the target user's query is detected.

[0057] In this embodiment, the step of performing a similarity search in the target vector index based on the target user query, and generating a target seed set based on the search results and the joint index system includes: The target user query is vectorized to obtain the query vector; The similarity between the query vector and the context fragment vector, the entity vector, and the fact vector is calculated in the target vector index, and candidate objects are recalled from the target vector index based on the calculation results; A candidate seed set is constructed based on the candidate objects and the federated index system; wherein, when the candidate object is a candidate context fragment vector, candidate mention relations edges corresponding to the candidate context fragment vector are obtained according to the federated index system, entity nodes corresponding to the candidate context fragment vector are extracted according to the candidate mention relations edges, and the candidate seed set is constructed based on the extracted entity nodes; and / or, when the candidate object is a candidate entity vector, entity nodes corresponding to the candidate entity vector are obtained according to the federated index system, and the candidate seed set is constructed based on the candidate mention relations edges; and / or, when the candidate object is a candidate fact vector, candidate fact relations edges corresponding to the candidate fact vector are obtained according to the federated index system, head entity nodes and tail entity nodes corresponding to the candidate fact vector are extracted according to the fact relations edges, and the candidate seed set is constructed based on the extracted head entity nodes and tail entity nodes. A lightweight ranking model is introduced to rearrange the seeds in the candidate seed set, and low-confidence seeds are filtered out based on the rearrangement results to obtain the target seed set.

[0058] The target user query supports permission-isolated queries that include user identity identifiers (e.g., returning only the context fragments authorized by the user identity identifier).

[0059] Specifically, a pre-trained language model, consistent with the one used when constructing the target vector index, can be invoked to convert the query text queried by the target user into a query vector, with the vector dimension consistent with that of entity, fact, and context fragment vectors.

[0060] When recalling candidate objects from the target vector index based on the calculation results, the top 50 objects (such as entity vectors, fact vectors, or context fragment vectors) can be obtained.

[0061] The above embodiments can quickly narrow down the search scope, locate objects related to the core of the query, and provide a precise starting point for subsequent subgraph construction.

[0062] S14, Starting from the target seed set, perform subgraph expansion and pruning in the context graph to obtain candidate subgraphs.

[0063] In this embodiment, the process of expanding and pruning subgraphs in the context graph, starting from the target seed set, to obtain candidate subgraphs includes: Starting with each seed in the target seed set, a multi-hop expansion is performed along the mention relation edge, the fact relation edge, and the similarity relation edge according to a preset step size to obtain an expanded subgraph; wherein, the preset step size is dynamically adjusted according to the query complexity. The neighbor nodes of the edges with weights greater than the pruning parameters in the expanded subgraph are retained to obtain the intermediate subgraph; wherein, the pruning parameters are adaptively adjusted according to query relevance and retrieval confidence signals; Calculate the similarity between the query vector and each node in the intermediate subgraph; The candidate subgraph is obtained by filtering out nodes whose similarity to the intermediate subgraph is less than a preset threshold.

[0064] The preset step size can be 2-3 jumps.

[0065] For example, only the top 20 neighboring nodes by edge weight can be retained, and weakly related nodes with similarity below 0.5 can be filtered out, thereby constructing a subgraph that is highly relevant to the query, focusing on core evidence. The pruning mechanism can also control computational overhead and noise spread, ensuring retrieval efficiency.

[0066] S15, calculate the fusion score of graph ranking score and vector similarity score of each context fragment node in the candidate subgraph, and extract the target context fragment node from the candidate subgraph based on the fusion score.

[0067] In this embodiment, calculating the fusion score of the graph ranking score and vector similarity score for each context fragment node in the candidate subgraph includes: The importance score of each context fragment node in the candidate subgraph is calculated by multiple rounds of random walks and used as the graph ranking score for each context fragment node. The similarity score between the query vector and each context segment node is calculated as the vector similarity score corresponding to each context segment node; The graph ranking score and vector similarity score corresponding to each context fragment node are fused according to the preset fusion weights to obtain the fusion score corresponding to each context fragment node.

[0068] The graph ranking score can be calculated using Personalized PageRank (PPR) or equivalent random walk or propagation scoring methods. A higher graph ranking score indicates a stronger relevance to the query.

[0069] The graph ranking score can be determined by a combination of vector recall score and fact relevance score, tilting the ranking towards nodes more relevant to the query. By utilizing the relationships within the graph structure, deep relevance between contextual fragment nodes can be mined, overcoming the limitations of simple vector retrieval.

[0070] The preset fusion weight can be configured to 0.6, then the fusion score = 0.6 × graph sorting score + (1-0.6) × vector similarity score.

[0071] Furthermore, based on the fusion score corresponding to each context fragment node, the top 5 context fragment nodes with the highest scores can be selected as the target context fragment nodes.

[0072] If there is insufficient valid evidence in the candidate subgraph (e.g., the number of context segments with a fusion score higher than the threshold is <3) or the fusion scores are all lower than the preset threshold (e.g., 0.5), the context segment nodes corresponding to the context segment vectors contained in the candidate object are directly output based on the backoff mechanism. That is, the dense retrieval results obtained by calculating the similarity between the query vector and the context segment vector are output (e.g., if the candidate object contains 20 context segment vectors, the context segment nodes corresponding to the top 5 context segment vectors with the highest similarity among the 20 context segment vectors can be directly taken through the backoff mechanism).

[0073] Of course, in this embodiment, the similarity between the query vector and each node (including entity nodes and context fragment nodes) can be calculated first, and the calculated similarity can be normalized and used as the initial weight of the corresponding node. Subsequently, multiple rounds of random walks are performed based on the initial weights of each node to propagate the importance of the nodes, and finally the graph ranking score corresponding to each context fragment node is obtained. This graph ranking score can be used as the final fusion score corresponding to each context fragment node (suitable for tasks that pursue computational efficiency, have high requirements for the stability of output results, or are dominated by graph structure information), or the graph ranking score can be further fused with the vector similarity score corresponding to each context fragment node according to the preset fusion weight to obtain the fusion score corresponding to each context fragment node (suitable for tasks that require high precision and where both semantic information and graph structure are important).

[0074] The above embodiments achieve a balance between the speed of vector retrieval and the association depth of graph ranking, resulting in more accurate and comprehensive contextual evidence. Simultaneously, the fallback mechanism ensures system robustness and avoids outputting no results.

[0075] In this embodiment, dense retrieval (i.e., the process of recalling candidate objects from the target vector index), keyword retrieval (such as the process of calculation based on the BM25 algorithm (Best Matching 25, a ranking function for information retrieval)) and graph retrieval (i.e., the process of calculating graph ranking scores) can be performed in parallel. A ranking fusion strategy (such as RRF (Reciprocal Rank Fusion) or weighted fusion) is used to merge the candidate context fragment sets to improve the recall and stability of complex problems. At the same time, the subgraph information generated by graph retrieval can be retained as an explanation output.

[0076] S16, using the context fragment corresponding to the target context fragment node as a constraining context, and combining it with the target user query to obtain the target prompt word.

[0077] By constraining the generation process of large language models with restrictive context, the risk of illusion can be reduced and the accuracy and credibility of answers can be improved.

[0078] S17, Obtain feedback information from the large language model based on the target prompt words to obtain target answer data for the target user's query.

[0079] The target answer data, in addition to the answer content, may also include location information (such as the unique document identifier, page number, and paragraph number to which the context fragment belongs), a list of evidence (such as the cited context fragment content fragments and their corresponding context fragment identifiers), and subgraph structure information (such as core entities, relation edges, associated paths, and node scores), etc., as supporting evidence information. This solves the problems of insufficient transparency in existing technology search results and difficulty in explaining "why these contents were recalled" and "how the evidence supports the conclusions." It enables the generated answer to be supported and traced back based on contextual evidence fragments, meeting the auditability and interpretability requirements of high reliability scenarios.

[0080] This embodiment can be interpreted to output audit requirements that meet those of high-reliability scenarios.

[0081] This embodiment, based on a context graph data structure and a dual-binding mechanism of context, models knowledge in a unified manner as "context fragment nodes - entity nodes - relation edges." Context fragment nodes carry the context of the source text (including but not limited to documents, chapters, paragraphs, sentences, context fragment blocks, etc.), entity nodes carry reusable conceptual objects, and relation edges express semantic relationships between entities and mention or attribution relationships between entities and context fragments. Unlike traditional knowledge graphs that only focus on triples, this invention introduces a context mechanism at both the identifier-level and structure-level binding levels at the graph level: on the one hand, it records the source identifier and location identifier (such as at least one of document ID, fragment ID, paragraph or sentence number, page number, character offset, timestamp, source type, etc.) for entities, relations, or mention relationships; on the other hand, it uses context fragments as basic context units in the graph model to participate in modeling, ensuring that entities, relations, and their evidentiary contexts maintain a connectable and traceable correspondence within the graph structure. Meanwhile, nodes and edges support additional attributes, confidence levels, and weight information (such as co-occurrence frequency, extraction confidence, similarity, timeliness, and source credibility) to enhance the expressive power of complex contextual relationships and multi-source evidence. In this invention, the contextual graph is not only used to store entity relationships but also provides "locatable, searchable, and constrainable" contextual evidence for the reasoning process of large language models: entities or relationships involved in a query can be mapped to graph nodes, and contextual fragments associated with the entity (such as the entity's definition, attributes, values, conditions, application scenarios, and upstream and downstream descriptions) can be retrieved as constraining contextual inputs for the generation stage. This transforms large model reasoning from "relying solely on parametric knowledge" to "reasoning based on traceable contextual evidence," improving the accuracy, coherence, and interpretability of the answers and reducing the risk of illusion.

[0082] Furthermore, the contextual graph generated by this invention can also be represented and serialized into common structured data formats such as JSON for storage, exchange, or import / export. It has good compatibility and can be adapted to various graph databases or graph storage backends, including Neo4j.

[0083] This embodiment employs a high-efficiency knowledge base construction and incremental indexing technology based on context graphs. High-throughput database construction is achieved through multi-granularity context fragmentation, parallelization, and pipelined processing: After segmenting the input content into contextual units, a pluggable information extraction component is used to structurally extract entities, attributes, relationships, or facts. The extraction results are then normalized and deduplicated (e.g., text normalization, stable ID generation, synonym unification, conflict resolution, weight accumulation) to achieve consistent knowledge modeling and continuous evolution across fragments and documents. Simultaneously, a knowledge base indexing system is constructed while building the context graph: While writing graph nodes or edges, embedding vectors are calculated for at least one object among entities, facts, and context fragments, and vector indexes are established. The mapping relationship between vector entries and nodes, edges, and context fragments in the graph is maintained, thus forming a joint index foundation for knowledge base retrieval and intelligent question answering. The building process supports batch writing, incremental updates, and deletion maintenance, and can be adapted to different backend storage and indexing components (such as graph databases, vector indexes or vector databases, document storage, etc.), thereby improving the scalability and deployment compatibility of the project while ensuring the efficiency of knowledge base building.

[0084] This embodiment employs context graph-driven retrieval enhancement question answering and fusion ranking techniques, coordinating vector similarity retrieval with graph structure reasoning: First, the user query is vectorized for retrieval, recalling at least one object from entities, facts, and context fragments related to the query to form a seed set; then, graph expansion and subgraph construction are performed around the seed set in the context graph, and the expansion process is pruned using edge weights, co-occurrence statistics, similarity, or query relevance to control its scale; graph ranking (such as personalized PageRank or equivalent random walk / propagation scoring methods) is performed on the subgraph, and fused with the vector retrieval score to obtain a comprehensive relevance ranking of context fragments, outputting the Top-K context fragments as context input for large model generation, thus balancing retrieval speed and cross-fragment association capabilities. This embodiment can also adaptively adjust pruning parameters based on query relevance and retrieval confidence signals, and fall back to dense retrieval when graph evidence is insufficient, and introduce a model to rearrange candidate facts to optimize seed selection and subgraph construction.

[0085] This embodiment employs a multi-granularity context segmentation and parallel, pipelined information extraction processing mechanism, combined with standardized deduplication and stable ID generation. This enables high-throughput context graph construction and batch storage in large-scale unstructured text scenarios. Compared to traditional solutions that rely on manual construction or single-threaded serial extraction, this improves construction efficiency and reduces maintenance costs. Furthermore, through incremental update and deletion maintenance mechanisms, the knowledge base can continuously evolve with updated data (i.e., only the changed parts are updated, which can be context fragments to be added, modified, or deleted), avoiding the resource waste caused by full reconstruction.

[0086] This embodiment simultaneously constructs vector indexes for facts, entities, and contextual fragments and establishes mapping relationships with graph objects. During the question-answering phase, candidate facts or entities are quickly located using vector similarity to narrow the search scope. Then, controlled expansion and subgraph construction are performed within the contextual graph, and a fusion of graph ranking and vector scores is used to output the Top-K contextual fragments. Compared to traditional RAG (Retrieval-Augmented Generation) which relies solely on semantic similarity for recall, this embodiment is better suited to handling complex query requirements involving cross-fragment and multi-fact combinations. It can explicitly characterize the association links using graph structures, reducing missed recalls and improving the organizational completeness of answer evidence.

[0087] This embodiment can prune and control the scale of subgraph construction based on edge weights, co-occurrence statistics, similarity, or query relevance, reducing noise propagation and computational overhead. When graph evidence is insufficient, it can fall back to dense retrieval to ensure stable system output. Compared to graph-only reasoning or vector-only retrieval schemes, it can better balance real-time response and reasoning depth in engineering, making it suitable for online question-answering scenarios with large-scale knowledge bases.

[0088] The context graph in this embodiment can be deployed in conjunction with the vector index component, thereby realizing an integrated implementation from database construction to question answer retrieval, which has high engineering scalability and application promotion value.

[0089] As can be seen from the above technical solutions, on the one hand, the constructed context graph solves the problems of untraceability and insufficient interpretability; on the other hand, the mapping between the context graph and the target vector index is established based on the similar entity edge-incremental update mechanism and conflict resolution mechanism, which effectively reduces the construction cost and helps improve subsequent retrieval efficiency; on the other hand, a seed set is generated based on the similarity retrieval results of the user query in the target vector index and the joint index system. Starting from the seed set, subgraph expansion and pruning are performed on the context graph, and the graph ranking score and vector similarity score of each context fragment node in the candidate subgraph are calculated to extract the target context fragment node from the candidate subgraph, improving retrieval efficiency and accuracy; and on the other hand, the context fragment corresponding to the target context fragment node is used as a constraining context and combined with the user query to obtain target prompt words. This enables the generation of accurate question answers.

[0090] like Figure 2 The diagram shown is a functional block diagram of a preferred embodiment of the context graph-based question-answering device of the present invention. The context graph-based question-answering device 11 includes a construction unit 110, a mapping unit 111, a generation unit 112, a processing unit 113, an extraction unit 114, a combination unit 115, and an acquisition unit 116. The module / unit referred to in this invention is a series of computer program segments that can be executed by a processor and perform a fixed function, stored in memory. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.

[0091] The construction unit 110 is used to acquire unstructured text, segment the unstructured text into multiple contextual fragments, and construct a target structured mapping based on the multiple contextual fragments. The construction unit 110 is further configured to construct a contextual graph based on the target structured mapping, and to construct a target vector index based on the target structured mapping; The mapping unit 111 is used to establish a mapping between the context graph and the target vector index based on the similar entity edge-incremental update mechanism and the conflict resolution mechanism, so as to obtain a joint index system. The generation unit 112 is used to respond to a question answering instruction triggered by a target user query, perform a similarity search in the target vector index according to the target user query, and generate a target seed set according to the search results and the joint index system. The processing unit 113 is used to perform subgraph expansion and pruning processing on the context graph, starting from the target seed set, to obtain candidate subgraphs. The extraction unit 114 is used to calculate the fusion score of graph ranking score and vector similarity score of each context fragment node in the candidate subgraph, and extract the target context fragment node from the candidate subgraph according to the fusion score. The combination unit 115 is used to combine the context fragment corresponding to the target context fragment node as a constraining context with the target user query to obtain the target prompt word; The acquisition unit 116 is used to acquire feedback information from the large language model based on the target prompt words, and obtain target answer data for the target user's query.

[0092] As can be seen from the above technical solutions, on the one hand, the constructed context graph solves the problems of untraceability and insufficient interpretability; on the other hand, the mapping between the context graph and the target vector index is established based on the similar entity edge-incremental update mechanism and conflict resolution mechanism, which effectively reduces the construction cost and helps improve subsequent retrieval efficiency; on the other hand, a seed set is generated based on the similarity retrieval results of the user query in the target vector index and the joint index system. Starting from the seed set, subgraph expansion and pruning are performed on the context graph, and the graph ranking score and vector similarity score of each context fragment node in the candidate subgraph are calculated to extract the target context fragment node from the candidate subgraph, improving retrieval efficiency and accuracy; and on the other hand, the context fragment corresponding to the target context fragment node is used as a constraining context and combined with the user query to obtain target prompt words. This enables the generation of accurate question answers.

[0093] like Figure 3 The diagram shown is a schematic representation of the structure of a computer device that implements the context-based question-answering method of the present invention.

[0094] The computer device 1 may include a memory 12, a processor 13, and a bus (the arrow in the figure represents the bus), and may also include a computer program stored in the memory 12 and executable on the processor 13, such as a context-map-based question-and-answer program.

[0095] Those skilled in the art will understand that the schematic diagram is merely an example of computer device 1 and does not constitute a limitation on computer device 1. Computer device 1 can be either a bus topology or a star topology. Computer device 1 may also include more or fewer other hardware or software than shown in the diagram, or different component arrangements. For example, computer device 1 may also include input / output devices, network access devices, etc.

[0096] It should be noted that the computer device 1 described is merely an example. Other existing or future electronic products that are adaptable to this invention should also be included within the scope of protection of this invention and are incorporated herein by reference.

[0097] The memory 12 includes at least one type of readable storage medium, such as flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 12 can be an internal storage unit of the computer device 1, such as a portable hard drive of the computer device 1. In other embodiments, the memory 12 can be an external storage device of the computer device 1, such as a plug-in portable hard drive, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the computer device 1. Furthermore, the memory 12 can include both internal and external storage units of the computer device 1. The memory 12 can be used not only to store application software and various types of data installed on the computer device 1, such as the code of a context-based question-and-answer program, but also to temporarily store data that has been output or will be output.

[0098] In some embodiments, the processor 13 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits packaged with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 13 is the control unit of the computer device 1, connecting various components of the computer device 1 via various interfaces and lines. It performs various functions of the computer device 1 and processes data by running or executing programs or modules stored in the memory 12 (e.g., executing a context-based question-and-answer program) and accessing data stored in the memory 12.

[0099] The processor 13 executes the operating system of the computer device 1 and various installed applications. The processor 13 executes the applications to implement the steps in the various context-based question-solving method embodiments described above, for example... Figure 1 The steps are shown.

[0100] For example, the computer program may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete the present invention. The one or more modules / units may be a series of computer-readable instruction segments capable of performing specific functions, which describe the execution process of the computer program in the computer device 1. For example, the computer program may be divided into a construction unit 110, a mapping unit 111, a generation unit 112, a processing unit 113, an extraction unit 114, a combination unit 115, and an acquisition unit 116.

[0101] The integrated unit implemented as a software functional module described above can be stored in a computer-readable storage medium. This software functional module, stored in a storage medium, includes several instructions to cause a computer device (which may be a personal computer, a computer device, or a network device, etc.) or processor to execute portions of the context-based graph-based question-solving method described in the various embodiments of this invention.

[0102] If the modules / units integrated in the computer device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware devices. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above.

[0103] The computer program includes computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory, etc.

[0104] Furthermore, the computer-readable storage medium may primarily include a stored program area and a stored data area, wherein the stored program area may store the operating system, an application program required for at least one function, etc.; and the stored data area may store data created based on the use of blockchain nodes, etc.

[0105] The blockchain referred to in this invention is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.

[0106] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, in... Figure 3 The bus is represented by only one straight line, but this does not mean that there is only one bus or one type of bus. The bus is configured to enable communication between the memory 12 and at least one processor 13, etc.

[0107] Although not shown, the computer device 1 may also include a power supply (such as a battery) to power various components. Preferably, the power supply can be logically connected to the at least one processor 13 through a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The computer device 1 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.

[0108] Furthermore, the computer device 1 may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, a Bluetooth interface, etc.), which is typically used to establish communication connections between the computer device 1 and other computer devices.

[0109] Optionally, the computer device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), and optionally, a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the computer device 1 and to display a visual user interface.

[0110] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.

[0111] It will be understood by those skilled in the art that Figure 3 The structure shown does not constitute a limitation on the computer device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.

[0112] Combination Figure 1 The memory 12 in the computer device 1 stores multiple instructions to implement a context-based question-solving method, and the processor 13 can execute the multiple instructions to achieve the following: Obtain unstructured text, segment the unstructured text into multiple contextual fragments, and construct a target structured mapping based on the multiple contextual fragments; Construct a contextual graph based on the target structured mapping, and construct a target vector index based on the target structured mapping; A mapping between the context graph and the target vector index is established based on the similar entity edge-incremental update mechanism and the conflict resolution mechanism to obtain a joint index system; In response to a question-answering instruction triggered by a target user query, a similarity search is performed in the target vector index according to the target user query, and a target seed set is generated based on the search results and the joint index system; Starting with the target seed set, subgraph expansion and pruning are performed on the context graph to obtain candidate subgraphs; Calculate the fusion score of graph ranking score and vector similarity score for each context fragment node in the candidate subgraph, and extract the target context fragment node from the candidate subgraph based on the fusion score; The context fragment corresponding to the target context fragment node is used as a constraining context, and combined with the target user query to obtain the target prompt word; The large language model obtains feedback information based on the target prompt words to obtain the target answer data for the target user's query.

[0113] Specifically, the processor 13's implementation method for the above instructions can be found in [reference needed]. Figure 1 The descriptions of the relevant steps in the corresponding embodiments are not repeated here.

[0114] It should be noted that all the data involved in this case was legally obtained.

[0115] If any AI models, software tools, or components not belonging to this company appear in the embodiments of this invention, they are merely illustrative examples and do not represent actual use. All user personal information involved in the embodiments of this invention has been obtained by an entity authorized (with the knowledge and consent) or fully authorized by all parties through various legal and compliant means. The collection, storage, use, processing, transmission, provision, and disclosure of the information, data, and signals involved all comply with relevant laws and regulations and do not violate public order and good morals.

[0116] In the several embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.

[0117] This invention can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This invention can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This invention can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0118] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0119] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.

[0120] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0121] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.

[0122] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices described in this invention can also be implemented by a single unit or device through software or hardware. Terms such as "first," "second," etc., are used to indicate names and do not indicate any specific order.

[0123] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. A question answering method based on a context map, characterized by, The context-based question-answering method includes: Unstructured text is acquired, segmented into multiple contextual fragments, and a target structured mapping is constructed based on these fragments. This includes: generating a contextual fragment identifier and location metadata for each fragment; extracting the entity set included in each fragment, and using a structured extraction component to extract the relationships between entities in the entity set as triple facts; binding the contextual fragment identifier of each fragment with the corresponding entity set and triple facts to obtain an initial structured mapping; standardizing the entity names and fact texts in the initial structured mapping; hashing the standardized entity names to obtain entity identifiers, and hashing the standardized fact texts to obtain fact identifiers; merging identical entities across contextual fragments in the initial structured mapping based on the entity identifiers, and merging identical facts across contextual fragments in the initial structured mapping based on the fact identifiers, to obtain the target structured mapping; wherein, the number of times each entity is mentioned and the number of times each fact appears are recorded in the target structured mapping. Constructing a context graph based on the target structured mapping and constructing a target vector index based on the target structured mapping includes: extracting the context fragment identifier as a unique key from the target structured mapping, and extracting the original context text and the location metadata as attributes to construct the context fragment node; extracting the entity identifier as a unique key from the target structured mapping, and extracting the entity name, entity type, and entity attributes as attributes to construct the entity node; constructing mention relationship edges; wherein the mention relationship edges are used to connect the context fragment node and the entity node, and the edge attribute weight of the mention relationship edge is determined based on the mention count or extraction confidence of the corresponding entity. Configure; construct fact relationship edges; wherein, the fact relationship edges are used to connect two entity nodes based on the triplet facts, and the edge attributes of the fact relationship edges include the fact identifier, the fact text, and the weight configured according to the occurrence frequency or cumulative confidence of the fact; generate the context graph based on the context fragment nodes, the entity nodes, the mention relationship edges, and the fact relationship edges; generate context fragment vectors based on the original context text, generate entity vectors based on the entity names, and generate fact vectors based on the fact text; call the vector retrieval library to establish vector indexes for the context fragment vectors, the entity vectors, and the fact vectors respectively, and obtain the target vector index; A mapping between the context graph and the target vector index is established based on the similar entity edge-incremental update mechanism and the conflict resolution mechanism to obtain a joint index system; In response to a question-answering instruction triggered by a target user query, a similarity search is performed in the target vector index according to the target user query, and a target seed set is generated based on the search results and the joint index system; Starting with the target seed set, subgraph expansion and pruning are performed on the context graph to obtain candidate subgraphs; Calculate the fusion score of graph ranking score and vector similarity score for each context fragment node in the candidate subgraph, and extract the target context fragment node from the candidate subgraph based on the fusion score; The context fragment corresponding to the target context fragment node is used as a constraining context, and combined with the target user query to obtain the target prompt word; The large language model obtains feedback information based on the target prompt words to obtain the target answer data for the target user's query.

2. The question answering method based on the context map of claim 1, wherein, The mapping between the context graph and the target vector index is established based on the similar entity edge-incremental update mechanism and the conflict resolution mechanism, resulting in a joint index system including: A nearest neighbor search is performed based on the vector index of the entity vectors to calculate the vector similarity between the entity vectors; entity vectors with corresponding vector similarity higher than a similarity threshold are selected to form entity pairs, and similarity relationship edges are created between the entity pairs in the context graph to update the context graph; wherein, the attribute of the similarity relationship edge is the vector similarity between the corresponding entity vectors; and / or When an update instruction triggered based on a context fragment to be processed is detected, update data for the context fragment to be processed is obtained; the context map is incrementally updated based on the update data; and / or Identify whether there are entity attribute conflicts or factual conflicts in the context graph across contextual segments; eliminate the entity attribute conflicts and factual conflicts in the context graph based on conflict resolution strategies, so as to update the context graph; Establish the mapping relationship between the nodes and edges of the context graph and the target vector index to obtain the joint index system.

3. The question answering method based on the context map of claim 2, wherein, The step of performing a similarity search in the target vector index based on the target user query, and generating a target seed set based on the search results and the joint index system includes: The target user query is vectorized to obtain the query vector; The similarity between the query vector and the context fragment vector, the entity vector, and the fact vector is calculated in the target vector index, and candidate objects are recalled from the target vector index based on the calculation results; A candidate seed set is constructed based on the candidate objects and the federated index system; wherein, when the candidate object is a candidate context fragment vector, candidate mention relations edges corresponding to the candidate context fragment vector are obtained according to the federated index system, entity nodes corresponding to the candidate context fragment vector are extracted according to the candidate mention relations edges, and the candidate seed set is constructed based on the extracted entity nodes; and / or, when the candidate object is a candidate entity vector, entity nodes corresponding to the candidate entity vector are obtained according to the federated index system, and the candidate seed set is constructed based on the candidate mention relations edges; and / or, when the candidate object is a candidate fact vector, candidate fact relations edges corresponding to the candidate fact vector are obtained according to the federated index system, head entity nodes and tail entity nodes corresponding to the candidate fact vector are extracted according to the fact relations edges, and the candidate seed set is constructed based on the extracted head entity nodes and tail entity nodes. A lightweight ranking model is introduced to rearrange the seeds in the candidate seed set, and low-confidence seeds are filtered out based on the rearrangement results to obtain the target seed set.

4. The question answering method based on the context map of claim 3, wherein, Starting with the target seed set, the process of expanding and pruning subgraphs within the contextual graph yields candidate subgraphs, including: Starting with each seed in the target seed set, a multi-hop expansion is performed along the mention relation edge, the fact relation edge, and the similarity relation edge according to a preset step size to obtain an expanded subgraph; wherein, the preset step size is dynamically adjusted according to the query complexity. The neighbor nodes of the edges with weights greater than the pruning parameters in the expanded subgraph are retained to obtain the intermediate subgraph; wherein, the pruning parameters are adaptively adjusted according to query relevance and retrieval confidence signals; Calculate the similarity between the query vector and each node in the intermediate subgraph; The candidate subgraph is obtained by filtering out nodes whose similarity to the intermediate subgraph is less than a preset threshold.

5. The question-answering method based on context graph as described in claim 3, characterized in that, The calculation of the fusion score of graph ranking score and vector similarity score for each context fragment node in the candidate subgraph includes: The importance score of each context fragment node in the candidate subgraph is calculated by multiple rounds of random walks and used as the graph ranking score for each context fragment node. The similarity score between the query vector and each context segment node is calculated as the vector similarity score corresponding to each context segment node; The graph ranking score and vector similarity score corresponding to each context fragment node are fused according to the preset fusion weights to obtain the fusion score corresponding to each context fragment node.

6. A question-answering device based on context graph, characterized in that, The context-based question-answering device includes: A construction unit is used to acquire unstructured text, segment the unstructured text into multiple contextual fragments, and construct a target structured mapping based on the multiple contextual fragments. This includes: generating a contextual fragment identifier and location metadata for each contextual fragment; extracting the entity set included in each contextual fragment, and using a structured extraction component to extract the relationships between entities in the entity set as triple facts; binding the contextual fragment identifier of each contextual fragment with the corresponding entity set and triple facts to obtain an initial structured mapping; standardizing the entity names and fact texts in the initial structured mapping; hashing the standardized entity names to obtain entity identifiers, and hashing the standardized fact texts to obtain fact identifiers; merging identical entities across contextual fragments in the initial structured mapping based on the entity identifiers, and merging identical facts across contextual fragments in the initial structured mapping based on the fact identifiers, to obtain the target structured mapping; wherein, the target structured mapping records the number of times each entity is mentioned and the number of times each fact appears. The construction unit is further configured to construct a context graph based on the target structured mapping and to construct a target vector index based on the target structured mapping, including: extracting the context fragment identifier as a unique key from the target structured mapping, and extracting the original context text and the location metadata as attributes to construct the context fragment node; extracting the entity identifier as a unique key from the target structured mapping, and extracting the entity name, entity type, and entity attributes as attributes to construct the entity node; constructing mention relationship edges; wherein the mention relationship edges are used to connect the context fragment node and the entity node, and the edge attribute weight of the mention relationship edge is based on the mention count of the corresponding entity or extraction. Confidence is configured; fact relationship edges are constructed; wherein, the fact relationship edges are used to connect two entity nodes based on the triplet facts, and the edge attributes of the fact relationship edges include the fact identifier, the fact text, and the weight configured based on the occurrence frequency or cumulative confidence of the fact; the context graph is generated based on the context fragment nodes, the entity nodes, the mention relationship edges, and the fact relationship edges; context fragment vectors are generated based on the original context text, entity vectors are generated based on the entity names, and fact vectors are generated based on the fact text; a vector retrieval library is called to establish vector indexes for the context fragment vectors, entity vectors, and fact vectors respectively, to obtain the target vector index; The mapping unit is used to establish a mapping between the context graph and the target vector index based on the similar entity edge-incremental update mechanism and the conflict resolution mechanism, so as to obtain a joint index system; The generation unit is used to respond to a question-answering instruction triggered by a target user query, perform a similarity retrieval in the target vector index according to the target user query, and generate a target seed set according to the retrieval results and the joint index system; The processing unit is used to perform subgraph expansion and pruning processing on the context graph, starting from the target seed set, to obtain candidate subgraphs; The extraction unit is used to calculate the fusion score of graph ranking score and vector similarity score of each context fragment node in the candidate subgraph, and extract the target context fragment node from the candidate subgraph based on the fusion score. The combination unit is used to combine the context fragment corresponding to the target context fragment node as a constraining context with the target user query to obtain the target prompt word; The acquisition unit is used to acquire feedback information from the large language model based on the target prompt words, and obtain target answer data for the target user's query.

7. A computer device, characterized in that, The computer device includes: A memory for storing at least one instruction; and a processor for executing the instructions stored in the memory to implement the context-based question-solving method as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, which is executed by a processor in a computer device to implement the context-based question-solving method as described in any one of claims 1 to 5.