Real-time retrieval enhancement system for large model and external knowledge base

By using a real-time retrieval enhancement system that integrates a large model with an external knowledge base, the problems of knowledge timeliness, retrieval efficiency, and resource waste in large language models are solved. It achieves real-time dynamic updates and efficient semantic matching, improving retrieval accuracy and computational efficiency, and is suitable for intelligent applications in multiple scenarios.

CN121808034APending Publication Date: 2026-04-07SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-23
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing large language models have shortcomings in terms of knowledge timeliness, retrieval efficiency, context fusion ability, and computational resource waste. They are difficult to achieve real-time dynamic updates and efficient semantic matching, resulting in delayed responses, resource waste, and knowledge gaps.

Method used

The real-time retrieval enhancement system adopts a large model and an external knowledge base. Through a layered architecture of data layer, retrieval engine layer, knowledge fusion layer and operation and maintenance layer, combined with vector indexing, layered attention mechanism and dynamic update mechanism, it realizes real-time knowledge injection, semantic retrieval and lightweight deployment, and supports dynamic knowledge base updates.

Benefits of technology

It enables real-time knowledge updates, improves retrieval accuracy and speed, reduces computing resource consumption, enhances the timeliness and accuracy of responses, and supports in-depth applications in multiple scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121808034A_ABST
    Figure CN121808034A_ABST
Patent Text Reader

Abstract

The invention provides a real-time retrieval enhancement system for a large model and an external knowledge base, and belongs to the technical field of artificial intelligence. Efficient linkage of the large model and the external knowledge base is realized by constructing a hierarchical retrieval architecture and combining a dynamic vector index, a semantic enhancement retrieval strategy and a real-time knowledge fusion engine; the response accuracy and timeliness of a large model in scenes such as real-time question answering and professional field analysis are remarkably improved, and meanwhile the model parameter quantity and the calculation cost are reduced.
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 real-time retrieval enhancement system for large models and external knowledge bases. Background Technology

[0002] With the rapid development of Large Language Model (LLM) technology, these models have demonstrated powerful capabilities in tasks such as natural language understanding and generation. However, existing technologies suffer from the following significant drawbacks:

[0003] (1) Insufficient timeliness of knowledge: After the parameters of the large model are fixed, it is difficult to update dynamic knowledge (such as news events, policies and regulations, scientific research results, etc.) in real time, resulting in the response lagging behind the actual needs.

[0004] (2) Low retrieval efficiency: Traditional retrieval methods (such as BM25) are difficult to process massive amounts of unstructured data and cannot accurately match the semantic understanding needs of large models, resulting in low relevance of retrieval results.

[0005] (3) Weak context fusion capability: Existing systems lack a deep semantic fusion mechanism for retrieval results and user queries, making it difficult for large models to effectively utilize external knowledge to generate coherent answers.

[0006] (4) Waste of computing resources: Directly searching the entire knowledge base or fine-tuning the parameters of large models will consume a lot of computing power, especially in real-time scenarios where it is difficult to meet the low latency requirements.

[0007] (5) Difficulty in dynamic updates: Incremental updates of external knowledge bases (such as daily new documents) cannot be efficiently synchronized to the reasoning process of large models, resulting in knowledge gaps. Summary of the Invention

[0008] To address the above technical problems, this invention provides a real-time retrieval enhancement system for large models and external knowledge bases, achieving the following objectives.

[0009] Real-time knowledge injection: Enables dynamic interaction between external knowledge bases and large models, ensuring that answers contain the latest information;

[0010] High-efficiency semantic retrieval: Combining vector indexing with semantic understanding improves retrieval accuracy and speed;

[0011] Intelligent knowledge fusion: Through a hierarchical attention mechanism, the retrieval results are deeply fused with the context of the large model;

[0012] Lightweight deployment: Reduces the number of model parameters and computational costs, and supports low-latency response in real-time scenarios;

[0013] Dynamic update mechanism: Automatically handles incremental updates to the knowledge base to maintain knowledge consistency.

[0014] The technical solution of this invention is:

[0015] A real-time retrieval enhancement system for large models and external knowledge bases includes:

[0016] Data layer: responsible for capturing dialogue interaction data in real time; storing multi-source knowledge and performing preprocessing;

[0017] Search engine layer: Enables dynamic semantic retrieval and result reordering; vectorizes and annotates metadata for multi-source knowledge to construct searchable semantic units;

[0018] Knowledge fusion layer: Deeply integrates retrieval results with the context of a large model through a hierarchical attention mechanism;

[0019] Operations and Maintenance Layer: Managing incremental updates to the knowledge base and optimizing system monitoring;

[0020] Application Interface Layer: Enables dynamic interaction between external knowledge bases and large models, ensuring that answers contain the latest information.

[0021] Furthermore,

[0022] The search engine layer includes

[0023] 1) Hybrid retrieval strategy:

[0024] Vector retrieval: Based on model-generated knowledge vectors, efficient nearest neighbor search is achieved through Annoy / FAISS;

[0025] Semantic retrieval: Combining BM25 with a semantic matching model, it supports mixed keyword and semantic queries;

[0026] Dynamic indexing: Employs an incremental vector indexing update algorithm to ensure that newly added knowledge can be retrieved within seconds;

[0027] 2) Retrieval reordering: The initial screening results are semantically reordered using a dual-tower model to improve relevance.

[0028] Furthermore,

[0029] The knowledge fusion layer employs a hierarchical attention network and gating mechanism to achieve intelligent knowledge filtering and fusion, including...

[0030] 1) Contextual understanding module: Analyzes the user's query intent, domain, and contextual history to generate a retrieval requirement vector;

[0031] 2) Layered attention fusion:

[0032] Primary fusion: The retrieval results are feature-aligned with the query using a Transformer encoder;

[0033] Advanced integration: Introducing a dynamic routing mechanism to allocate attention weights based on knowledge importance and filter out noisy information;

[0034] 3) Knowledge verification module: Verifies the timeliness and authority of retrieved knowledge, and marks outdated or low-confidence content.

[0035] Furthermore,

[0036] Application interface layer, specifically including

[0037] 1) Inference Engine: The fused knowledge is used as input to the large model, and the model is guided to generate answers through prompting engineering;

[0038] 2) Real-time monitoring: Records retrieval time, hit rate, and answer accuracy, and supports dynamic optimization;

[0039] 3) API Gateway: Provides standardized interfaces and supports integration across multiple scenarios.

[0040] Furthermore,

[0041] A multi-dimensional retrieval strategy is adopted, including:

[0042] Search triggering mechanism

[0043] 1) Active trigger: Force the search to start when the user's query contains specific keywords;

[0044] 2) Passive triggering: When the large model generates an answer, if the confidence level of its internal knowledge is lower than the threshold, the retrieval is automatically triggered;

[0045] Semantic Enhancement Retrieval Algorithm

[0046] It is used to retrieve relevant knowledge from the knowledge base based on user queries and to optimize the retrieval results.

[0047] The specific steps for using semantically enhanced retrieval algorithms are as follows:

[0048] Query semantic encoding: The encoder is used to encode the query content and context information input by the user, converting the text information into a vector form that the computer can process, resulting in the query_emb query vector;

[0049] Vector coarse screening: Using the generated query_emb as the retrieval basis, a search is performed in the vector_db vector database to obtain the k candidate knowledge that are most similar to the query vector;

[0050] Semantic re-ranking: The re_ranker is used to re-rank the candidate knowledge of the initially screened candidates;

[0051] Timeliness filtering: The re-ranked candidate knowledge (ranked_candidates) is filtered for timeliness, retaining only the content with the highest confidence within the last 30 days to obtain recent knowledge; finally, the top 10 results from these recent knowledge are selected and returned as the final retrieval results provided for subsequent processing.

[0052] Furthermore,

[0053] Integrating knowledge and optimizing reasoning, including

[0054] A hierarchical knowledge fusion model is used to deeply fuse retrieved knowledge with the context of a large model; it generates alignment vectors by calculating the semantic relevance between knowledge and queries through an alignment layer; it automatically filters irrelevant knowledge using a gating mechanism to reduce noise interference to the model; it supports the dynamic insertion of knowledge fragments, enabling incremental updates of external knowledge without retraining the large model, thereby improving the model's adaptability and processing ability to new knowledge.

[0055] Inference optimization strategy

[0056] Search result truncation: Set an upper limit on the length of knowledge input and compress redundant content through a key information extraction algorithm;

[0057] Caching mechanism: Cache the search results of frequently queried queries, and reuse them directly when the cache is hit, reducing redundant calculations;

[0058] Asynchronous retrieval: For long text processing scenarios, an asynchronous retrieval + streaming output mode is adopted to improve the user experience.

[0059] The specific process for incremental updates to the knowledge base is as follows:

[0060] a) New data access: New knowledge and data from outside enter the system; this data may be structured or unstructured.

[0061] b) Data cleaning and vectorization: The newly received data is cleaned to remove noise, erroneous data and duplicate content to ensure data quality; then, natural language processing technology is used to convert the cleaned data into a vector form that computers can understand and process, in preparation for subsequent retrieval and storage.

[0062] c) Conflict Detection: The vectorized new data is compared with the existing knowledge in the knowledge base, and semantic similarity detection is used to determine whether there is a conflict. A semantic similarity threshold is set; if the semantic similarity between the new data and the existing knowledge exceeds the threshold, a conflict is considered to exist; otherwise, no conflict is considered to exist.

[0063] d) Conflict handling: When a conflict is detected, the version management and merging process is initiated; conflicting knowledge versions are managed, and new data is merged with existing knowledge through algorithms and logic to retain correct and comprehensive information and eliminate contradictions and duplicate content;

[0064] e) Index update, without conflict or after conflict resolution: Regardless of whether the new data conflicts with existing knowledge, the knowledge base index needs to be updated after confirming that the data is available; incremental vector index update technology is adopted to support the dynamic addition of vectors, so that the new knowledge can be retrieved by the system;

[0065] f) Validation: After the index is updated, the validity of the updated knowledge base is verified to check whether the new data is added correctly, whether the index is working properly, and whether the retrieval and retrieval of knowledge are accurate.

[0066] g) Update complete: Once the validity verification is passed, the entire incremental update process of the knowledge base ends. At this point, the knowledge base has been successfully incorporated with new data and can provide the system with the latest knowledge support at any time.

[0067] Furthermore,

[0068] System monitoring and optimization include

[0069] Real-time metrics:

[0070] Search latency and hit rate;

[0071] Knowledge freshness;

[0072] Automatic optimization: Dynamically adjust retrieval thresholds and fusion weights through reinforcement learning to optimize overall performance.

[0073] The beneficial effects of this invention are

[0074] This invention achieves significant breakthroughs in timeliness, accuracy, and cost control through innovative technologies such as real-time retrieval and intelligent fusion, effectively addressing the pain points of existing large-scale model applications and providing strong support for their in-depth application and continuous optimization in multiple scenarios.

[0075] Real-time performance improvement: The knowledge base is updated to searchable status with a delay of ≤10 seconds and the search response time is ≤500ms, meeting the needs of real-time scenarios;

[0076] Improved accuracy: In dynamic knowledge scenarios, the accuracy rate of answers is increased by 35% compared to traditional methods, and the knowledge obsolescence rate is reduced by 80%;

[0077] Cost optimization: By enhancing retrieval, the number of parameters in a large model can be reduced (compressed to 1 / 5 of the original model), and the computational power consumption for inference is reduced by 60%.

[0078] Enhanced flexibility: Supports hot updates of the knowledge base, allowing adaptation to new domain knowledge without retraining the model;

[0079] Explainability: Search results are traceable, facilitating auditing and compliance checks, and meeting the needs of highly regulated scenarios such as finance and healthcare. Attached Figure Description

[0080] Figure 1 This is a schematic diagram of the system architecture of the present invention;

[0081] Figure 2 This is a diagram illustrating the real-time retrieval process. Detailed Implementation

[0082] 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 some embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0083] This invention discloses a real-time retrieval enhancement system for large models and external knowledge bases. Its system architecture adopts a four-layer layered architecture, with each module having clearly defined responsibilities and being independently expandable, such as... Figure 1 As shown:

[0084] 1. System Architecture

[0085] Data layer

[0086] Responsible for capturing real-time dialogue interaction data, including:

[0087] a) Multi-source knowledge base: Stores structured data (such as knowledge base graphs) and unstructured data (documents, web pages, papers, etc.), and supports distributed storage (such as Elasticsearch + vector database Milvus);

[0088] b) Metadata management: Add timestamps, domain tags, confidence scores, and other metadata to each piece of knowledge to facilitate retrieval and filtering;

[0089] c) Data preprocessing: Unstructured data is segmented, vectorized, and entity recognized using NLP tools to generate searchable semantic units.

[0090] Search engine layer

[0091] a) Hybrid retrieval strategy:

[0092] Vector retrieval: Knowledge vectors are generated based on models such as Sentence-BERT, and efficient nearest neighbor search is achieved through Annoy / FAISS;

[0093] Semantic retrieval: Combining BM25 with semantic matching models (such as Dense Passage Retrieval), it supports mixed keyword and semantic queries;

[0094] Dynamic indexing: An incremental vector indexing update algorithm is used to ensure that newly added knowledge can be retrieved within seconds.

[0095] b) Retrieval reordering: The initial screening results are semantically reordered using a dual-tower model (Query Encoder + Document Encoder) to improve relevance.

[0096] Knowledge Fusion Layer

[0097] a) Contextual understanding module: Analyzes the user's query intent, domain, and contextual history to generate a retrieval requirement vector;

[0098] b) Layered attention fusion:

[0099] Primary fusion: The retrieval results are feature-aligned with the query using a Transformer encoder;

[0100] Advanced integration: Introducing a dynamic routing mechanism to allocate attention weights based on knowledge importance and filter out noisy information;

[0101] c) Knowledge verification module: Verifies the timeliness and authority of retrieved knowledge, and marks outdated or low-confidence content.

[0102] Application Interface Layer

[0103] a) Inference Engine: The fused knowledge is input into the large model as a condition, and the model is guided to generate answers through prompt engineering;

[0104] b) Real-time monitoring: Records metrics such as retrieval time, hit rate, and answer accuracy, and supports dynamic optimization;

[0105] c) API Gateway: Provides standardized interfaces and supports integration across multiple scenarios (such as intelligent customer service and decision support systems).

[0106] 2. Dynamic retrieval strategy design

[0107] To achieve efficient real-time retrieval, the system adopts a multi-dimensional retrieval strategy:

[0108] Search triggering mechanism

[0109] a) Proactive trigger: Force a search to start when the user's query contains specific keywords (such as "latest" or "2025");

[0110] b) Passive triggering: When the large model generates an answer, if the confidence level of internal knowledge is lower than the threshold (e.g., 0.6), the retrieval is automatically triggered.

[0111] Semantic Enhancement Retrieval Algorithm

[0112] This algorithm is mainly used to retrieve relevant knowledge from the knowledge base based on user queries and optimize the retrieval results. The specific steps are as follows:

[0113] a) Query semantic encoding: The user-input query and context are encoded using an encoder, converting the text information into a vector form that the computer can process, resulting in the query_emb (query vector). This step is fundamental to subsequent retrieval and matching, enabling the query to be compared with knowledge in the knowledge base in the vector space.

[0114] b) Vector coarse screening: Using the generated query_emb as the retrieval basis, a search is performed in vector_db (vector database) to obtain the k candidate knowledge items most similar to the query vector. Here, k is set to 50. Vector retrieval allows for the rapid filtering of initially relevant content from massive amounts of knowledge, narrowing down the scope of subsequent processing.

[0115] c) Semantic Re-ranking: The initially selected candidates are re-ranked using re_ranker. The ranking process combines the BM25 algorithm and a semantic matching model, considering not only the degree of keyword matching but also deeply analyzing the semantic relationships between the query, candidate documents, and context, thereby obtaining ranked candidates that better meet the user's actual needs.

[0116] d) Timeliness Filtering: The re-ranked candidate knowledge (ranked_candidates) is filtered for timeliness, retaining only content with high confidence from the last 30 days to obtain recent knowledge. Finally, the top 10 results from this recent knowledge are selected and returned as the final retrieval results for subsequent processing.

[0117] The key technical points of this algorithm are: training the retrieval model through contrastive learning to improve the accuracy of semantic matching between the query and the document; and introducing a time decay factor decay=e^(-λ*(t_now-t_doc)), where λ is the decay coefficient, t_now represents the current time, and t_doc represents the creation time of the knowledge, to reduce the weight of outdated knowledge, so that the older the knowledge, the lower its weight in the retrieval, thus prioritizing the return of the latest and most relevant knowledge content.

[0118] 3. Knowledge integration and reasoning optimization

[0119] Layered knowledge fusion model

[0120] This model is used to deeply integrate the retrieved knowledge with the context of a larger model. The specific execution process is as follows:

[0121] a) Model Initialization: During model initialization, the model receives `llm_model` (large language model) and `fusion_layers` (number of fusion layers, set to 2 here) as parameters. During initialization, a layer list `fusion_layers` consisting of two `nn.TransformerEncoderLayer` layers is constructed for subsequent layered attention fusion operations. Simultaneously, an `nn.Linear` layer `gate` is defined as a knowledge selection gate, with an input dimension of 768*2 and an output dimension of 1, used to determine which knowledge is relevant to the query and worth retaining.

[0122] b) Knowledge and Query Feature Alignment: During the forward propagation of the model, the `align` method is first used to align the features of `knowledge_emb` (knowledge vector) and `query_emb` (query vector). This operation typically uses calculations such as cosine similarity to analyze the semantic relevance between knowledge and query, generating `aligned_knowledge` (aligned knowledge vector), making the knowledge and query more easily integrated in the feature space.

[0123] c) Layered Attention Fusion: The aligned knowledge vector `aligned_knowledge` and the query vector `query_emb` are sequentially passed to each `TransformerEncoderLayer` in the defined `fusion_layers`. At each layer, an attention mechanism is used to fuse the knowledge and query, assigning different attention weights based on the importance of the knowledge. After two layers of processing, the fused (fused feature vector) is obtained. Through layered fusion, the semantic relationship between knowledge and query can be captured more comprehensively and deeply, gradually filtering out noise information.

[0124] d) Gating mechanism to filter irrelevant knowledge: The fused feature vector is concatenated with the query vector `query_emb` and passed to the gate layer to obtain the `gate_score`. A sigmoid activation function is applied to the `gate_score`, mapping the score to between 0 and 1. This score represents the relevance of each knowledge fragment to the query. Based on this score, a weighted operation is performed on `fused` to obtain `selected_knowledge`, automatically filtering out irrelevant knowledge and retaining highly relevant content.

[0125] e) Fusion with the large model context: Finally, the selected knowledge vector selected_knowledge is fused with the large model context llm_context using the concat_context method of llm (large language model) to obtain final_context (final fusion context), which serves as the input condition for the large model to generate answers.

[0126] The core mechanisms of this model include: generating alignment vectors by calculating the semantic relevance between knowledge and queries through an alignment layer; automatically filtering irrelevant knowledge using a gating mechanism to effectively reduce noise interference to the model; and supporting the dynamic insertion of knowledge fragments to achieve incremental updates of external knowledge without retraining the large model, thereby improving the model's adaptability and processing capabilities for new knowledge.

[0127] Inference optimization strategy

[0128] a) Retrieval result truncation: Set an upper limit for the length of knowledge input (e.g., 1000 tokens), and compress redundant content using a key information extraction algorithm (e.g., TextRank);

[0129] b) Caching mechanism: Cache the search results of frequently queried queries, and reuse them directly when the cache is hit, reducing redundant calculations;

[0130] c) Asynchronous retrieval: For long text processing scenarios, an asynchronous retrieval + streaming output mode is adopted to improve the user experience.

[0131] 4. Real-time update and maintenance module

[0132] Knowledge base incremental update process:

[0133] like Figure 2 As shown, it is mainly used to handle new data access, ensuring the accuracy and timeliness of the knowledge base. The specific process is as follows:

[0134] 1) New data access: New knowledge and data from outside enter the system. This data can be structured or unstructured, such as documents and web page information.

[0135] 2) Data Cleaning and Vectorization: The newly received data is cleaned to remove noise, errors, and duplicates, ensuring data quality. Then, Natural Language Processing (NLP) techniques are used to convert the cleaned data into vector form that computers can understand and process, preparing it for subsequent retrieval and storage.

[0136] 3) Conflict Detection: The vectorized new data is compared with the existing knowledge in the knowledge base, and semantic similarity detection is used to determine whether there is a conflict. A semantic similarity threshold of 0.85 is set. When the semantic similarity between the new data and the existing knowledge exceeds this threshold, a conflict is considered to exist; otherwise, no conflict is considered to exist.

[0137] 4) Conflict Handling (if a conflict exists): When a conflict is detected, the version management and merging process is initiated. Conflicting knowledge versions are managed, and new data is merged with existing knowledge using specific algorithms and logic to retain accurate and comprehensive information and eliminate contradictions and duplicate content.

[0138] 5) Index Update (No Conflict or After Conflict Resolution): Regardless of whether new data conflicts with existing knowledge, the knowledge base index needs to be updated after confirming the data's usability. Incremental vector index update techniques are employed, such as using Faiss's IVF-PQ index, which supports dynamically adding vectors, enabling new knowledge to be quickly retrieved by the system. This process can be completed within seconds.

[0139] 6) Validation: After the index is updated, the validity of the updated knowledge base is verified to check whether the new data has been added correctly, whether the index is working properly, and whether the retrieval and retrieval of knowledge are accurate.

[0140] 7) Update complete: Once the validity verification is passed, the entire incremental update process of the knowledge base ends. At this point, the knowledge base has been successfully incorporated with new data and can provide the system with the latest knowledge support at any time.

[0141] Key technologies in this process include: using semantic similarity to detect conflicts (with a threshold set to 0.85) to avoid duplicate or contradictory knowledge; and incremental vector index updates (such as Faiss's IVF-PQ index, which supports dynamic vector addition).

[0142] System monitoring and optimization

[0143] a) Real-time indicators:

[0144] Retrieval latency (target ≤ 500ms), hit rate (target ≥ 90%);

[0145] Knowledge freshness (average searchable time for newly added knowledge ≤ 10 seconds);

[0146] b) Automatic tuning: Optimize overall performance by dynamically adjusting parameters such as retrieval thresholds and fusion weights through reinforcement learning (RL).

[0147] 5. Multi-scenario adaptation solution

[0148] Vertical applications (such as financial risk control)

[0149] a) Domain knowledge enhancement: Pre-build a financial entity graph (such as companies, products, indicators), and prioritize returning domain-related knowledge during retrieval;

[0150] b) Compliance filtering: Automatically filters sensitive information (such as undisclosed financial data) to ensure compliance in responses.

[0151] Real-time question-and-answer scenarios (such as news and information)

[0152] a) Event chain retrieval: Based on the event keywords in the query, retrieve relevant event timelines, impact analyses, and other contextual information;

[0153] b) Multi-source verification: Aggregate information from multiple sources for the same event to improve the credibility of the answer.

[0154] The above description is merely a preferred embodiment of the present invention and is used only to illustrate the technical solution of the present invention, and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.

Claims

1. A real-time retrieval enhancement system for large models and external knowledge bases, characterized in that, include: Data layer: responsible for capturing dialogue interaction data in real time; storing multi-source knowledge and performing preprocessing; Search engine layer: Enables dynamic semantic retrieval and result reordering; vectorizes and annotates metadata for multi-source knowledge to construct searchable semantic units; Knowledge fusion layer: Deeply integrates retrieval results with the context of a large model through a hierarchical attention mechanism; Operations and Maintenance Layer: Managing incremental updates to the knowledge base and optimizing system monitoring; Application Interface Layer: Enables dynamic interaction between external knowledge bases and large models, ensuring that answers contain the latest information.

2. The system according to claim 1, characterized in that, The search engine layer includes 1) Hybrid retrieval strategy: Vector retrieval: Based on model-generated knowledge vectors, efficient nearest neighbor search is achieved through Annoy / FAISS; Semantic retrieval: Combining BM25 with a semantic matching model, it supports mixed keyword and semantic queries; Dynamic indexing: Employs an incremental vector indexing update algorithm to ensure that newly added knowledge can be retrieved within seconds; 2) Retrieval reordering: The initial screening results are semantically reordered using a dual-tower model to improve relevance.

3. The system according to claim 1, characterized in that, The knowledge fusion layer employs a hierarchical attention network and gating mechanism to achieve intelligent knowledge filtering and fusion, including... 1) Contextual understanding module: Analyzes the user's query intent, domain, and contextual history to generate a retrieval requirement vector; 2) Layered attention fusion: Primary fusion: The retrieval results are feature-aligned with the query using a Transformer encoder; Advanced integration: Introducing a dynamic routing mechanism to allocate attention weights based on knowledge importance and filter out noisy information; 3) Knowledge verification module: Verifies the timeliness and authority of retrieved knowledge, and marks outdated or low-confidence content.

4. The system according to claim 1, characterized in that, Application interface layer, specifically including 1) Inference Engine: The fused knowledge is used as input to the large model, and the model is guided to generate answers through prompting engineering; 2) Real-time monitoring: Records retrieval time, hit rate, and answer accuracy, and supports dynamic optimization; 3) API Gateway: Provides standardized interfaces and supports integration across multiple scenarios.

5. The system according to claim 1, characterized in that, A multi-dimensional retrieval strategy is adopted, including: Search triggering mechanism 1) Active trigger: Force the search to start when the user's query contains specific keywords; 2) Passive triggering: When the large model generates an answer, if the confidence level of its internal knowledge is lower than the threshold, the retrieval is automatically triggered; Semantic Enhancement Retrieval Algorithm It is used to retrieve relevant knowledge from the knowledge base based on user queries and to optimize the retrieval results.

6. The system according to claim 5, characterized in that, The specific steps for using semantically enhanced retrieval algorithms are as follows: Query semantic encoding: The encoder is used to encode the query content and context information input by the user, converting the text information into a vector form that the computer can process, resulting in the query_emb query vector; Vector coarse screening: Using the generated query_emb as the retrieval basis, a search is performed in the vector_db vector database to obtain the k candidate knowledge that are most similar to the query vector; Semantic re-ranking: The re_ranker is used to re-rank the candidate knowledge of the initially screened candidates; Timeliness filtering: The re-ranked candidate knowledge (ranked_candidates) is filtered for timeliness, retaining only the content with the highest confidence within the last 30 days to obtain recent knowledge; finally, the top 10 results from these recent knowledge are selected and returned as the final retrieval results provided for subsequent processing.

7. The system according to claim 1, characterized in that, Integrating knowledge and optimizing reasoning, including A hierarchical knowledge fusion model is used to deeply fuse retrieved knowledge with the context of a large model; an alignment layer is used to calculate the semantic relevance between knowledge and query to generate an alignment vector; and a gating mechanism is used to automatically filter irrelevant knowledge to reduce noise interference to the model. It supports the dynamic insertion of knowledge fragments, enabling incremental updates of external knowledge without retraining the large model, thereby improving the model's adaptability and processing ability to new knowledge. Inference optimization strategy Search result truncation: Set an upper limit on the length of knowledge input and compress redundant content through a key information extraction algorithm; Caching mechanism: Cache the search results of frequently queried queries, and reuse them directly when the cache is hit, reducing redundant calculations; Asynchronous retrieval: For long text processing scenarios, an asynchronous retrieval + streaming output mode is adopted to improve the user experience.

8. The system according to claim 1, characterized in that, The specific process for incremental updates to the knowledge base is as follows: a) New data access: New knowledge and data from outside enter the system; this data may be structured or unstructured. b) Data cleaning and vectorization: Clean the newly received data to remove noise, erroneous data and duplicate content to ensure data quality; Then, using natural language processing technology, the cleaned data is converted into a vector form that computers can understand and process, in preparation for subsequent retrieval and storage; c) Conflict Detection: The vectorized new data is compared with the existing knowledge in the knowledge base, and semantic similarity detection is used to determine whether there is a conflict. A semantic similarity threshold is set; when the semantic similarity between the new data and existing knowledge exceeds this threshold, a conflict is considered to exist. Conversely, if the opposite is true, then it is considered that there is no conflict; d) Conflict handling: When a conflict is detected, the version management and merging process is initiated; conflicting knowledge versions are managed, and new data is merged with existing knowledge through algorithms and logic to retain correct and comprehensive information and eliminate contradictions and duplicate content; e) Index update, without conflict or after conflict resolution: Regardless of whether the new data conflicts with existing knowledge, the knowledge base index needs to be updated after confirming that the data is available; incremental vector index update technology is adopted to support the dynamic addition of vectors, so that the new knowledge can be retrieved by the system; f) Validation: After the index is updated, the validity of the updated knowledge base is verified to check whether the new data is added correctly, whether the index is working properly, and whether the retrieval and retrieval of knowledge are accurate. g) Update complete: Once the validity verification is passed, the entire incremental update process of the knowledge base ends. At this point, the knowledge base has been successfully incorporated with new data and can provide the system with the latest knowledge support at any time.

9. The system according to claim 1, characterized in that, System monitoring and optimization include Real-time metrics: Search latency and hit rate; Knowledge freshness; Automatic optimization: Dynamically adjust retrieval thresholds and fusion weights through reinforcement learning to optimize overall performance.