An information query method and device and a storage medium
By constructing a community summary index library for parallel reasoning and aggregation, the problem of information fragmentation in traditional RAG methods is solved, improving the global inductive ability and answer accuracy of large language models.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHENGDU BOSS INNOVATION TECH CO LTD
- Filing Date
- 2026-03-09
- Publication Date
- 2026-06-09
AI Technical Summary
Traditional RAG methods in information retrieval and question answering systems suffer from information fragmentation due to document segmentation into fixed-length text fragments, making it difficult to capture high-level semantic structures across paragraphs and resulting in poor accuracy in generating answers.
By constructing a community summary index library, dividing nodes based on the topological structure of the knowledge graph, generating high-level semantic summaries, and using a large language model for parallel reasoning and aggregation, answers covering global information are generated.
It enhances the global inductive ability of large language models, improves the accuracy and efficiency of generated answers, avoids the problem of information fragmentation, and reduces the risk of illusion.
Smart Images

Figure CN122173607A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of large model technology, and more specifically, to an information retrieval method, apparatus, and storage medium. Background Technology
[0002] In information retrieval and question answering systems based on Large Language Models (LLMs), Retrieval-Augmented Generation (RAG) has become the mainstream technology paradigm.
[0003] Traditional RAG methods segment documents into fixed-length text fragments for vectorized retrieval. This approach leads to information fragmentation, with entities and their relationships separated into different segments. This makes it difficult for the model to capture high-level semantic structures across paragraphs, and it is particularly ineffective in answering questions that require global summarization, resulting in poor accuracy of the generated answers. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide an information query method, apparatus and storage medium to enhance the global inductive ability of a large language model and improve the accuracy of the generated answers.
[0005] Firstly, an information retrieval method is provided, including: In response to user queries, a preset number of community summaries are retrieved from a pre-built community summary index. The community summaries are high-level semantic summaries corresponding to each community in a pre-built knowledge graph of the target domain. A community is a group of nodes obtained by semantic aggregation of nodes in the graph based on the topological structure of the knowledge graph of the target domain. Prompt words are constructed based on community summaries and user queries, and answers covering global information are generated using a large language model.
[0006] Optionally, the construction process of the community summary index includes: Based on the topology of the pre-built knowledge graph of the target domain, the nodes in the knowledge graph of the target domain are recursively divided to generate multi-level communities; and a unique identifier is assigned to each community. For each community, retrieve entities and their topological connections within that community from the graph database, and serialize the retrieved entities and their topological connections into a community context; Input the community context into a large language model to generate a community summary in natural language format; The community summary is converted into a dense vector through an embedding model, and together with the corresponding community identifier and community summary, they form a community summary index. A community summary index library is built based on all the community summary indexes.
[0007] Optionally, the pre-construction process of the knowledge graph for the target domain includes: Obtain raw text data related to the target domain; The original text data is sliced to obtain several text slices; For each text slice, based on the preset entity relationship extraction prompt template, the large language model is used to parse out structured data containing entities, entity types and relationships between entities; The structured data is preprocessed, and the redundant preprocessed structured data is written into a graph database to form a knowledge graph of the target domain; the redundant preprocessing includes at least entity disambiguation and relation merging.
[0008] Optionally, suggestions can be constructed based on community summaries and user queries, and answers covering global information can be generated using a large language model, including: The large language model is invoked in parallel to perform inference on each retrieved community summary once to obtain the corresponding intermediate results. The intermediate results include the relevance score between the community summary and the user query, as well as the key information extracted from it. Based on the intermediate results, the context of each community summary is aggregated to obtain the aggregated context. Based on the aggregated context and user query, prompt words are constructed and input into a large language model for secondary reasoning to generate an answer that covers global information.
[0009] Optionally, the large language model can be invoked in parallel to perform inference on each retrieved community summary once, including: Encapsulate user queries and each retrieved community summary as an independent reasoning task context; Parallel calls to the large language model interface are made, and the large language model is used to perform one inference on the context of each inference task. In each inference iteration, prompt words are constructed based on the context of the inference task. These prompt words instruct the large language model, acting as a scorer, to output a relevance score between the community summary and the user query, as well as a list of key fact strings extracted from the community summary to answer the user query.
[0010] Optionally, context aggregation can be performed on the summaries of each community based on the intermediate results to obtain the aggregated context, which includes: Wait for all parallel inferences to complete, and collect all intermediate results containing relevance scores and key information; Filter out intermediate results with relevance scores below a preset threshold, and sort the remaining intermediate results in descending order of relevance scores; Using a pre-defined context filling strategy, key information is selected from the sorted intermediate results to serve as the context for the aggregated results.
[0011] Optionally, using a preset context filling strategy, key information can be selected from the sorted intermediate results to serve as the aggregated context, including: Initialize an empty context buffer; The token length of the key information corresponding to each intermediate result is calculated sequentially according to the relevance score ranking. Key information is sequentially filled into the context buffer in the sorting order until the Token budget preset by the Big Prophecy model is reached, and the content of the context buffer is used as the aggregated context. If the sum of the current cumulative token length in the context buffer and the token length of the key information to be added does not exceed the preset token budget, then the key information is filled into the context buffer; if it exceeds the preset token budget, then filling stops.
[0012] Optionally, the method also includes: If the following exceptions occur during the execution of a single or double inference by calling a large language model, a retry will be performed based on an exponential backoff strategy. The abnormal situations include at least the following: response parsing failure, output format validation failure, API rate limiting, timeout, or score exceeding the preset valid range. The exponential backoff strategy involves waiting for a preset delay time after the first failure, and then the waiting time for each subsequent retry increases exponentially. After reaching the maximum number of retries, the retry is terminated, and the error status or downgraded result is returned.
[0013] Secondly, an information query device is provided, comprising: The retrieval unit is used to retrieve a preset number of community summaries from a pre-built community summary index in response to user queries. The community summaries are high-level semantic summaries corresponding to each community in a pre-built knowledge graph of the target domain. A community is a group of nodes obtained by semantic aggregation of nodes in the graph based on the topological structure of the knowledge graph of the target domain. The generation unit is used to construct prompt words based on community summaries and user queries, and to generate answers that cover global information using a large language model.
[0014] Thirdly, a computer-readable storage medium is provided, wherein a computer program is stored therein, and when the computer program is executed by a processor, it implements any of the methods of the first aspect.
[0015] This invention provides an information retrieval method, apparatus, and storage medium. Responding to a user query, it retrieves a predetermined number of community summaries from a pre-built community summary index; constructs prompt words based on the community summaries and the user query; and utilizes a large language model to generate answers covering global information. This invention eliminates the reliance on raw text slices, using semantically coherent and structurally clear community summaries as the basic unit for retrieval and reasoning. This effectively solves the information fragmentation problem in traditional RAGs, thereby enhancing the global inductive ability of the large language model and improving the accuracy of the generated global response.
[0016] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 A flowchart of an information query method provided by an embodiment of the present invention is shown; Figure 2 This diagram illustrates the construction process of the community text summary index library provided in an embodiment of the present invention. Figure 3 A flowchart of another information query method provided by an embodiment of the present invention is shown; Figure 4 A schematic diagram of the structure of an information query device provided in an embodiment of the present invention is shown. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0020] This invention provides an information query method, such as... Figure 1 As shown, it includes the following steps: Step S101: In response to a user query, retrieve a preset number of community summaries from a pre-built community summary index.
[0021] The community summary is a high-level semantic summary of each community in a pre-constructed knowledge graph of the target domain (e.g., the kitchen appliance domain). A community is a group of nodes obtained by semantically aggregating nodes in the knowledge graph based on its topological structure. Examples include smart refrigerator product lines and range hood noise reduction technology clusters. These groups naturally possess semantic cohesion and can serve as macroscopic information units.
[0022] Community summaries are natural language summaries of the core content of the group, such as Company A's smart refrigerator series launched in 2023, which focuses on AI food recognition and cross-device interaction.
[0023] When a user queries a question, relevant community summaries can be retrieved directly, avoiding the need to piece together answers from hundreds of fragmented text blocks and significantly improving overall comprehension.
[0024] Step S102: Construct prompt words based on community summaries and user queries, and use a large language model to generate answers that cover global information.
[0025] Continuing from the previous example, this embodiment no longer concatenates the original document fragments before feeding them into the large language model. Instead, it uses a structured, de-redundant community summary as input and dynamically constructs prompts based on user intent. This guides the large language model to perform comparative reasoning, thereby generating answers that are both accurate and in-depth. This approach effectively overcomes the problem of insufficient inductive ability in traditional RAGs due to information fragmentation.
[0026] This invention eliminates the reliance on original text slices and uses semantically coherent and structurally clear community summaries as the basic unit for retrieval and reasoning. This effectively solves the information fragmentation problem in traditional RAGs, thereby enhancing the global inductive ability of large language models and improving the accuracy of the generated global responses.
[0027] In one feasible implementation, the pre-construction process of the knowledge graph for the target domain includes: Step A: Obtain raw text data relevant to the target domain.
[0028] The target market is at least the kitchen appliance sector.
[0029] This step collects unstructured raw data from multiple sources, such as product manuals, official website news, patent documents, and review articles, through data ingestion interfaces (such as Kafka, HTTPAPI, or file systems). This raw data forms the corpus foundation of the knowledge graph, covering multi-dimensional information such as entities, attributes, and events.
[0030] Step B: Slice the original text data to obtain several text slices.
[0031] Considering the input length limitations of large language models, for example, the original text can be sliced into sliding segments using a fixed token window (e.g., 800 tokens), with appropriate overlap (e.g., 100 tokens) to avoid truncating key information. This slicing strategy balances information integrity and processing efficiency.
[0032] Step C: For each text slice, based on the preset entity relationship extraction prompt template, use a large language model to parse out structured data containing entities, entity types, and relationships between entities.
[0033] The backend service concurrently calls the inference interface of the large language model (such as Qwen-Max or GPT-4) via RPC protocol, with each slice processed independently. It extracts Prompt templates using pre-defined view relationships, such as: "Please extract all kitchen appliance-related entities and their relationships from the following text," and outputs the results in JSON format. The model returns structured results.
[0034] This approach is significantly superior to traditional rules or NER models, accurately identifying complex, long-tail kitchen appliance terms and implicit relationships.
[0035] Step D: Preprocess the structured data and write the redundant preprocessed structured data into the graph database to form a knowledge graph of the target domain; the redundant preprocessing includes at least entity disambiguation and relation merging.
[0036] This step performs entity disambiguation and relation merging on the extracted results, removing duplicates if multiple documents mention the same relation. The cleaned nodes and edges are then transactfully written to the graph database using graph database drivers or Cypher statements to ensure data consistency.
[0037] The resulting knowledge graph for the target domain contains tens of thousands of entities and relationships, forming a solid foundation for subsequent community detection and summary generation.
[0038] Through this implementation method, the original unstructured text is transformed into a knowledge network with a clear structure, coherent semantics, and computability, providing fundamental support for solving the problem of information fragmentation.
[0039] Based on the above embodiments, as shown in Figure 2, the construction process of the community summary index library includes: Step S101A: Based on the topological structure of the pre-built knowledge graph of the target domain, recursively divide the nodes in the knowledge graph of the target domain to generate multi-level communities; and assign a unique identifier to each community.
[0040] After the knowledge graph of the basic target domain is constructed, the topological structure of all nodes and edges of the knowledge graph of the target domain is first loaded from a graph database (such as Neo4j or NebulaGraph). Then, a graph computing engine (such as igraph or GraphScope) is instantiated, and the Leiden algorithm is called to perform hierarchical community detection.
[0041] The goal of the Leiden algorithm is to find a way to partition nodes that maximizes the global modularity. The Leiden algorithm is not limited to single-level clustering; instead, it iteratively optimizes the modularity value, continuously attempting to increase it, and recursively partitions graph nodes into multi-level interconnected community structures, generating a tree-like hierarchical structure from bottom-level micro-nodes to high-level macro-groups. When it can no longer improve the modularity value, it considers that the current optimal community structure has been found.
[0042] For example, in the kitchen appliance industry, the bottom-level community may correspond to a single product model (such as the XX model integrated stove), the middle-level community aggregates into the integrated stove product line, and the top-level community aggregates into the strategic theme of smart kitchen solutions.
[0043] It should be noted that, compared to Louvain, the Leiden algorithm can ensure community connectivity and avoid semantic fragmentation, laying a structural foundation for high-quality summary generation.
[0044] In addition, a globally unique community ID (such as COMM_L2_089) is assigned to each community at each level, and an inverted index table from node to community ID is established to facilitate quick location of the semantic group to which the entity belongs.
[0045] Step S101B: For each community, retrieve the entities and their topological connections within the community from the graph database, and serialize the retrieved entities and their topological connections into a community context.
[0046] Specifically, it iterates through all community IDs, initiates a query for each community ID, and pulls all nodes (such as variable frequency motor, range hood duct design, range hood model A-B-C) and edges (such as using, containing, belonging to) contained within it from the graph database. These triplet data are then serialized into a standardized text context.
[0047] For example, the community COMM_L1_112 contains range hood models A-B-C, which use DC inverter motors and integrate AI smoke detection cruise technology. This context accurately reflects the semantic topology within the community, serving as input for the large language model to generate summaries.
[0048] Continuing from the previous example, if a user is interested in the motor technology of Robam range hoods, this context can accurately provide the required structured information, avoiding the extraction of noise from irrelevant documents.
[0049] Step S101C: Input the community context into the large language model to generate a community summary in natural language format.
[0050] In this embodiment of the invention, an asynchronous task queue is first created to concurrently process summary generation tasks from all communities.
[0051] Each task dynamically constructs a Prompt template. For example: You are an expert in the field of kitchen appliances. Please use concise and coherent natural language to summarize the core themes, key components and macro trends of the following technology groups.
[0052] The large language model outputs a summary based on this instruction, such as: "This community represents XX Appliances' high-end range hood product line in 2026, focusing on DC inverter drive and AI environmental perception technology, emphasizing quiet operation and intelligent linkage capabilities." Such summaries are highly generalized, semantically complete, and domain-specific, and can be directly used for subsequent semantic retrieval.
[0053] For example, when a user queries which models of range hoods use variable frequency motors, multiple similar summaries can be retrieved, achieving macro-level summarization across products and brands.
[0054] Step S101D: Convert the community summary into a dense vector through an embedding model, and combine it with the corresponding community identifier and community summary to form a community summary index. Construct a community summary index library based on all community summary indexes.
[0055] Specifically, a high-dimensional embedding model (such as text-embedding-3-large) is invoked to map each community summary into a 1536-dimensional dense floating-point vector.
[0056] Then, the triples "community ID + original summary text + vector" are written in batches to a vector database (such as Milvus or Pinecone), and an HNSW (Hierarchical Navigable Small World) index is built.
[0057] The HNSW index strikes a good balance between recall precision and query latency, supporting millisecond-level Top-K semantic retrieval. The resulting community summary index library forms a structured, searchable, and aggregatable semantic knowledge repository, eliminating the dependence of traditional RAGs on raw text slices and fundamentally solving the problem of information fragmentation.
[0058] The above embodiments alleviate the information fragmentation problem through community summarization. However, in actual question-answering processes, the context window of a large language model is limited. If all search results are directly concatenated, it is very easy to exceed the token limit. Existing solutions often employ strategies such as crude truncation, sliding windows, or random sampling, which may not only discard high-value information but also introduce a large amount of low-relevance content, significantly increasing the risk of model illusion.
[0059] Meanwhile, in terms of computing power scheduling, traditional RAG architectures often use serial processing or full concatenation methods, resulting in low query efficiency.
[0060] Therefore, based on the above embodiments, as shown in Figure 3, constructing prompt words based on community summaries and user queries, and generating answers covering global information using a large language model includes the following steps: Step S102A: In parallel, call the large language model to perform inference on each retrieved community summary once to obtain the corresponding intermediate results.
[0061] Intermediate results include a relevance score between the community summary and the user query, as well as key information extracted from it.
[0062] Taking the cooking scenario as an example, when a user inputs which smart ovens support voice control, instead of traversing the original product document fragments, the system quickly locates high-level semantic units such as Robam IoT Kitchen from the community summary index library, and independently evaluates the relevance of each unit.
[0063] This strategy of first recalling macro-level semantic blocks and then scoring them at a finer level effectively avoids the risk of traditional RAG missing key information in fragmented text, while providing a structured, low-noise input source for subsequent aggregation.
[0064] While the intermediate result list output by this step contains high-value information, directly concatenating all the content may still exceed the context window limit of the large language model or introduce low-relevance noise. Therefore, the following steps perform a stateful aggregation operation to dynamically filter and assemble the most relevant fact fragments.
[0065] Step S102B: Perform context aggregation on the summaries of each community based on the intermediate results to obtain the aggregated context.
[0066] Taking a user query "What are the differences between model A and model B range hoods in terms of noise reduction technology?" as an example, the first inference stage may return the ratings and key facts of 5 community summaries, while the second inference stage needs to extract core comparison points such as DC inverter motor and multi-cavity noise reduction air duct from them to form a compact and focused context, providing high-quality input for the final generation.
[0067] Step S102C: Construct prompt words based on the aggregated context and user query, and input them into the large language model for secondary reasoning to generate an answer that covers global information.
[0068] This can be explained by the fact that these three steps constitute a typical Map-Reduce collaborative reasoning architecture. Step S102A is the Map phase, and steps S102B and S102C are the Reduce phases.
[0069] Continuing from the previous example, the aggregated key information is combined with the original user query to form the final prompt, for example: Please answer the question based on the following information: [Context] Model A range hood uses a DC inverter motor with an operating noise as low as 52dB; Model B range hood uses a multi-cavity noise reduction duct design with a measured noise level of 54dB.
[0070] [Question] What are the differences in noise reduction technology between Model A and Model B range hoods? The prompt word is sent to the large language model server via an HTTPS interface, triggering secondary inference. The model generates a coherent, accurate, and inductive natural language answer based on structured evidence.
[0071] It should be noted that, since the context has been rigorously filtered and compressed by the Map-Reduce process, the large language model no longer needs to process redundant or irrelevant information, which significantly reduces the risk of illusions and improves the depth and professionalism of the answers.
[0072] In this embodiment, during the Map phase, stateless concurrent tasks are used to independently perform relevance scoring and key fact extraction for each community summary. This avoids the latency bottleneck of serial processing and compresses the original summary into high signal-to-noise ratio structured evidence, reducing resource memory usage. In the Reduce phase, noise is dynamically filtered based on the scores, and answers covering global information are generated. This reduces the illusion risk of large language models and improves answer accuracy. At the same time, it significantly optimizes response latency and resource utilization under high concurrency, improving query efficiency.
[0073] Based on the above embodiments, the large language model is invoked in parallel to perform one inference on each retrieved community summary, including: Step S102A1: Encapsulate the user query and each retrieved community summary into an independent inference task context.
[0074] Specifically, after receiving the user_query string from the front end, the embedding model (such as text-embedding-3-large) is first called to convert it into a high-dimensional floating-point query vector.
[0075] Then, an approximate nearest neighbor search request is initiated to the vector database via the gRPC protocol, and the top-K semantically most relevant objects (e.g., K=10) are retrieved from the community summary index based on cosine similarity. Each object contains a community ID and a community summary text field with a natural language description.
[0076] In addition, to avoid interference from duplicate content, the recall results are deduplicated based on either the community ID or the summary text. Then, an asynchronous task scheduler is instantiated, and the user query combined with each community summary text field is encapsulated into an independent inference task context object, which serves as the input unit for subsequent LLM calls.
[0077] For example, an inference task might include: Query: "Oven with voice control"; Community summary text: "The TQ35 series smart oven integrates a voice assistant, which can start the baking program via voice commands."
[0078] This encapsulation ensures that each task has a complete inference context and is isolated from each other.
[0079] Step S102A2: Call the large language model interface in parallel and use the large language model to perform one inference on the context of each inference task.
[0080] In each inference iteration, prompt words are constructed based on the context of the inference task. These prompt words instruct the large language model, acting as a scorer, to output a relevance score between the community summary and the user query, as well as a list of key fact strings extracted from the community summary to answer the user query.
[0081] In this embodiment of the invention, the system maintains a concurrent coroutine pool controlled by semaphores (e.g., the maximum concurrency is set to 20) and distributes all inference tasks to the large language model inference interface (e.g., calling Qwen-Max or GPT-4 API via HTTPS).
[0082] Each inference task dynamically assembles a structured prompt, for example: You are an objective rater. Please complete two tasks: (1) Evaluate the relevance of the following summary to the query 'voice-controlled oven' and output a floating-point score of 0–10; (2) Extract all the key facts that can directly answer the query and output them as a list of strings.
[0083] Returns only in JSON format: {"relevance_rating":xx,"key_facts":["...","..."]}".
[0084] In another implementation, strict JSON parsing and schema validation are performed on the raw HTTP response returned by the large model. Once validation passes, the intermediate results are mapped to intermediate result objects and stored in a thread-safe temporary list.
[0085] In this embodiment of the invention, all inference tasks run in parallel in isolated memory spaces without blocking each other, and the failure of some tasks does not affect the overall process. This design significantly improves the system's throughput under high load while ensuring result quality, providing a standardized, high signal-to-noise ratio data stream for the Reduce phase.
[0086] Based on the above embodiments, context aggregation is performed on the community summaries based on intermediate results to obtain the aggregated context, which includes: Step S102B1: Wait for all parallel inferences to complete and collect all intermediate results containing relevance scores and key information.
[0087] Specifically, before the main thread enters the Reduce phase, a synchronization barrier is established to block the main thread until all inference tasks in the Map phase are completed or time out.
[0088] Deserialize all intermediate result objects from a thread-safe list of intermediate results. Each object is a valid JSON structure containing `relevance_rating` (a floating-point number) and `key_facts` (a list of strings).
[0089] This synchronization mechanism ensures that the Reduce phase processes a complete and consistent dataset, avoiding information loss due to incomplete tasks.
[0090] Step S102B2: Filter out intermediate results with relevance scores below a preset threshold, and sort the remaining intermediate results in descending order of relevance scores.
[0091] For example, the intermediate results list is iterated through, and objects with relevance scores below a preset threshold (e.g., Threshold=6.0) are discarded. This threshold can be dynamically configured to remove weakly relevant or noisy content.
[0092] For example, if a community summary only mentions the oven's appearance design and has a rating of 4.5, it will be filtered out. The remaining results are sorted from highest to lowest rating. If the valid results have ratings of 9.2, 7.5, and 6.8, the processing order would be 9.2 → 7.5 → 6.8. This ensures that high-value information is processed first.
[0093] This filtering and sorting mechanism is a key preliminary step in achieving a high signal-to-noise ratio context.
[0094] Step S102B3: Using a preset context filling strategy, select key information from the sorted intermediate results as the aggregated context.
[0095] Based on the above embodiments, a preset context filling strategy is used to select key information from the sorted intermediate results as the aggregated context, including: Step S102B31: Initialize an empty context buffer.
[0096] In this embodiment of the invention, an empty string is first created as a context buffer, and a fixed token space is reserved to accommodate user queries, system commands, and final prompt word templates.
[0097] Step S102B32: Calculate the token length of the key information corresponding to each intermediate result in the order of relevance scores.
[0098] For example, tokenizers such as tiktokenforGPT-4 or QwenTokenizer can be used to count tokens for each key piece of information.
[0099] For example, the word segmentation length of "A range hood supports Xiaomei voice assistant" is 18 tokens.
[0100] Step S102B33: Fill the context buffer with key information in the sorting order until the Token budget preset by the big oracle model is reached, and use the content of the context buffer as the aggregated context.
[0101] The preset token budget can be set according to the context window limit of the large language model. For example, if the total model window is 32,768 tokens, reserving 2,000 tokens will result in a preset token budget of 30,768 tokens. This reservation mechanism ensures the integrity of the final prompt word structure and avoids truncation due to excessively long context.
[0102] In this embodiment of the invention, the context filling strategy adopts a greedy filling strategy. If the sum of the cumulative token length of the current context buffer and the token length of the key information to be added does not exceed the preset token budget, the key information is filled into the context buffer; if it exceeds the preset token budget, filling stops.
[0103] Specifically, the intermediate result list is traversed in descending order of score, and the token count is accumulated for each result. Assuming the first two key pieces of information require a total of 29,000 tokens, the third requires 2,000 tokens, and the remaining budget is only 1,768 tokens, then the third result is skipped and the filling process is terminated immediately.
[0104] This greedy fill strategy ensures that, under token-constrained conditions, the most relevant information is prioritized into the context, maximizing information utility. Ultimately, the content of the context buffer is the aggregated context, used to construct the final prompt in S102C.
[0105] In this embodiment of the invention, the context filling strategy no longer involves simply piecing together all key facts. Instead, it sets an effective token budget based on the context window limit of the target large language model, and prioritizes including high-scoring key information within this budget. This strategy effectively solves the token waste problem caused by blind piecing together in traditional RAG, allowing the limited context space to focus on the most relevant evidence.
[0106] Based on the above embodiments, the method further includes: Step S102D: If the following abnormal situation occurs during the process of calling the large language model to perform a first or second inference, a retry will be performed based on the exponential backoff strategy.
[0107] The abnormal situations include at least the following: response parsing failure, output format validation failure, API rate limiting, timeout, or score exceeding the preset valid range.
[0108] The exponential backoff strategy involves waiting for a preset delay time after the first failure, and then the waiting time for each subsequent retry increases exponentially. After reaching the maximum number of retries, the retry is terminated, and the error status or downgraded result is returned.
[0109] Specifically, the HTTP response returned by the large language model is first attempted to be parsed as JSON. If this fails (e.g., the model returns plain text instead of JSON), or if a field is missing (no relevance score), or if the score is 12.0 (outside the range of 0–10), it is considered an exception.
[0110] At this point, a retry is triggered: the first time waits 1 second, the second time 2 seconds, and the third time 4 seconds (i.e., delay = preset delay time × 2). n- ¹), retrying a maximum of 3 times. If it still fails, log the process and skip the task (Map phase) or return a fallback answer (Reduce phase). This mechanism significantly improves the robustness and availability of the system in unstable LLM service environments.
[0111] Based on the same inventive concept, embodiments of the present invention provide an information query device, as shown in FIG4, comprising: The retrieval unit 401 is used to retrieve a preset number of community summaries from a pre-built community summary index library in response to a user query; wherein, the community summary is a high-level semantic summary corresponding to each community in a pre-built knowledge graph of the target domain; the community is a group of nodes obtained by semantic aggregation of nodes in the graph based on the topological structure of the knowledge graph of the target domain. The generation unit 402 is used to construct prompt words based on community summaries and user queries, and to generate answers that cover global information using a large language model.
[0112] Based on the same inventive concept, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, it implements the steps of the above-described method embodiments. Specific implementation details can be found in the method embodiments, and will not be repeated here.
[0113] The information query device provided in this embodiment of the invention can be specific hardware on the device or software or firmware installed on the device. The implementation principle and technical effects of the device provided in this embodiment of the invention are the same as those in the foregoing method embodiments. For the sake of brevity, any parts not mentioned in the device embodiments can be referred to the corresponding content in the foregoing method embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can all be referred to the corresponding processes in the above method embodiments, and will not be repeated here.
[0114] In the embodiments provided by this invention, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0115] The units described as separate components may or may not be physically separate. The components shown as units 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 units can be selected to achieve the purpose of this embodiment according to actual needs.
[0116] In addition, the functional units in the embodiments provided by 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.
[0117] If the aforementioned functions 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, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0118] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0119] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. All should be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. An information retrieval method, characterized in that, include: In response to a user query, a preset number of community summaries are retrieved from a pre-built community summary index library; wherein, the community summary is a high-level semantic summary corresponding to each community in a pre-built knowledge graph of the target domain; the community is a group of nodes obtained by semantic aggregation of nodes in the graph based on the topological structure of the knowledge graph of the target domain. Based on the community summary and the user query, prompt words are constructed, and a large language model is used to generate answers that cover global information.
2. The method according to claim 1, characterized in that, The construction process of the community summary index repository includes: Based on the topological structure of the pre-built knowledge graph of the target domain, the nodes in the knowledge graph of the target domain are recursively divided to generate multi-level communities; and a unique identifier is assigned to each community. For each community, entities and their topological connections within the community are retrieved from the graph database, and the retrieved entities and their topological connections are serialized into a community context. The community context is input into a large language model to generate a community summary in natural language format; The community summary is converted into a dense vector through an embedding model, and together with the corresponding community identifier and community summary, a community summary index is formed. A community summary index library is constructed based on all the community summary indexes.
3. The method according to claim 1 or 2, characterized in that, The pre-construction process of the knowledge graph in the target domain includes: Obtain raw text data related to the target domain; The original text data is sliced to obtain several text slices; For each of the text slices, based on the preset entity relationship extraction prompt template, the large language model is used to parse out the structured data containing entities, entity types and relationships between entities; The structured data is preprocessed, and the redundant preprocessed structured data is written into a graph database to form a knowledge graph of the target domain; wherein the redundant preprocessing includes at least entity disambiguation and relation merging.
4. The method according to claim 1, characterized in that, The process of constructing prompt words based on the community summary and the user query, and generating answers covering global information using a large language model, includes: The large language model is invoked in parallel to perform inference on each retrieved community summary once to obtain the corresponding intermediate results. The intermediate results include the relevance score between the community summary and the user query and the key information extracted from it. Based on the intermediate results, the context of each community summary is aggregated to obtain the aggregated context. Based on the aggregated context and the user query, prompt words are constructed and input into the large language model for secondary reasoning to generate an answer that covers global information.
5. The method according to claim 4, characterized in that, The parallel invocation of the large language model, performing one inference on each retrieved community summary, includes: The user query and each retrieved community summary are encapsulated into an independent reasoning task context; Parallel calls to the large language model interface are made, and the large language model is used to perform one inference on the context of each inference task. In each of the aforementioned inference processes, a cue word is constructed based on the context of the inference task. The cue word instructs the large language model, acting as a scorer, to output a relevance score between the community summary and the user query, as well as a list of key fact strings extracted from the community summary to answer the user query.
6. The method according to claim 4, characterized in that, The context aggregation of each community summary based on the intermediate results yields the aggregated context, which includes: Wait for all parallel inferences to complete, and collect all intermediate results containing relevance scores and key information; Filter out intermediate results with relevance scores below a preset threshold, and sort the remaining intermediate results in descending order of relevance scores; Using a pre-defined context filling strategy, key information is selected from the sorted intermediate results to serve as the context for the aggregated results.
7. The method according to claim 6, characterized in that, The step of using a preset context filling strategy to select key information from the sorted intermediate results as the aggregated context includes: Initialize an empty context buffer; The token length of the key information corresponding to each intermediate result is calculated sequentially according to the sorting order of the relevance scores. The key information is sequentially filled into the context buffer according to the sorting order until the Token budget preset by the big oracle model is reached, and the content of the context buffer is used as the aggregated context. If the sum of the current cumulative token length in the context buffer and the token length of the key information to be added does not exceed the preset token budget, then the key information is filled into the context buffer; if it exceeds the preset token budget, then filling stops.
8. The method according to claim 4, characterized in that, The method further includes: If the following exceptions occur during the execution of a single or double inference by calling a large language model, a retry will be performed based on an exponential backoff strategy. The abnormal situations include at least the following: response parsing failure, output format validation failure, API rate limiting, timeout, or score exceeding the preset valid range. The exponential backoff strategy involves waiting for a preset delay time after the first failure, and then the waiting time for each subsequent retry increases exponentially. After reaching the maximum number of retries, the retry is terminated, and the error status or downgraded processing result is returned.
9. An information query device, characterized in that, include: The retrieval unit is used to retrieve a preset number of community summaries from a pre-built community summary index library in response to a user query; wherein, the community summary is a high-level semantic summary corresponding to each community in a pre-built knowledge graph of the target domain; the community is a node group obtained by semantic aggregation of nodes in the graph based on the topological structure of the knowledge graph of the target domain. The generation unit is used to construct prompt words based on the community summary and the user query, and to generate answers that cover global information using a large language model.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1-8.