Self-adaptive retrieval enhancement generation method based on multi-dimensional semantic routing
By using an adaptive retrieval enhancement generation method based on multidimensional semantic routing, the problems of resource waste and insufficient complex reasoning in large language models are solved. On-demand computing and resource optimization are achieved, improving the system's response speed and ability to solve complex problems, while also enhancing the system's robustness and accuracy.
Patent Information
- Application Number
- CN202610013620.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-07
- Publication Date
- 2026-04-03
AI Technical Summary
Existing retrieval enhancement generation techniques for large language models suffer from low resource efficiency, insufficient complex reasoning capabilities, and a lack of closed-loop correction and fault tolerance mechanisms, leading to increased system latency, wasted computing resources, and poor availability of the final response.
A multidimensional semantic routing method is used for feature recognition to dynamically generate routing decision instructions. Combined with the intuitive generation, retrieval enhancement and algorithmic reasoning modules in the capability library, a quality assessment and automatic repair mechanism is introduced to achieve on-demand computing and resource optimization.
It improved the system's response speed, enhanced its ability to solve complex problems, improved the system's robustness and accuracy, and reduced the generation of invalid responses.
Smart Images

Figure CN121786173A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and natural language processing, specifically to a large language model application framework, and in particular to an adaptive retrieval enhancement generation (RAG) method based on multidimensional semantic routing. Background Technology
[0002] With the rapid development of Large Language Models (LLMs), Retrieval-Augmented Generation (RAG) technology has become a major means to solve problems such as model illusion, knowledge obsolescence, and missing private data. Traditional RAG architectures typically employ a static, linear execution flow, meaning that for all user queries, the system performs a fixed "retrieval-concatenation-generation" process.
[0003] However, existing technologies have the following significant drawbacks in practical applications:
[0004] Resource inefficiency. For simple tasks such as greetings, translation, or creative writing, forcing knowledge base retrieval not only increases system latency but also wastes computing resources.
[0005] Insufficient complex reasoning capabilities. Traditional RAG technology focuses on information retrieval and input, lacking a logical reasoning mechanism for complex problems (such as deep attribution analysis and multi-path solution planning). Faced with such problems, the model can often only perform shallow splicing based on the retrieved fragments, making it difficult to provide structured and in-depth solutions.
[0006] Third, there is a lack of closed-loop correction and fault tolerance mechanisms. Existing systems typically adopt a single-execution mode. If the retrieved documents are irrelevant to the question, or if the model generates a rejection response such as "I don't know," the system lacks mechanisms for automatic remediation, online search, or degradation processing, resulting in poor usability of the final response.
[0007] Therefore, there is an urgent need for an adaptive question answering method that can accurately identify user intent, dynamically load different processing capabilities (such as direct generation, online retrieval, and deep reasoning) accordingly, and has the ability to self-check quality. Summary of the Invention
[0008] The present invention aims to solve the technical problems of rigid processes, insufficient reasoning depth and lack of fault tolerance mechanism in the above-mentioned prior art, and provides an adaptive retrieval enhancement generation method based on multi-dimensional semantic routing.
[0009] This invention provides an adaptive retrieval enhancement generation method based on multidimensional semantic routing, comprising the following steps:
[0010] S1: Receive a natural language query input by the user, and perform multi-dimensional feature recognition on the query through a semantic routing model. The multi-dimensional feature recognition includes at least the discrimination of data dependency and the discrimination of cognitive complexity.
[0011] S2: Based on the identified data dependencies and cognitive complexity, generate dynamic routing decision instructions, which define the combination of capability modules and reasoning strategies required to process the query;
[0012] S3: According to the dynamic routing decision instruction, activate the corresponding capability module from the preset capability library to process the query and generate an initial answer; the capability library includes at least an intuition generation module, a retrieval enhancement module, and an algorithmic reasoning module;
[0013] S4: Use a quality assessment model to detect the validity of the initial response. If the detection result is unqualified, trigger an automatic repair mechanism to generate the final response; otherwise, output the initial response as the final response.
[0014] Furthermore, the determination of data dependency includes: guiding the large language model to analyze whether the query involves private data, real-time data, or specific document content; if so, it is marked as high data dependency. The determination of cognitive complexity includes: identifying the intent type of the query, which includes simple interaction, deep attribution, solution planning, and comparative analysis.
[0015] Furthermore, the multidimensional feature recognition also includes a fallback mechanism: when the semantic routing model fails to recognize the query, a keyword scan is performed using a preset regular expression, and if a preset feature word is matched, the recognition result is forcibly corrected.
[0016] Furthermore, the retrieval enhancement module includes a relevance self-check step during execution: the retrieved document fragments are compared with the query input large language model; if the document fragments are determined to be unable to answer the query, a no data signal is returned and an internet search engine is automatically triggered to obtain external information.
[0017] Furthermore, the algorithmic reasoning module adopts the Algorithm of Thoughts (AoT) strategy: by guiding the model to simulate the algorithmic process of depth-first search (DFS) or breadth-first search (BFS) in the context with few sample examples, multi-path exploration and pruning are completed in a single generation.
[0018] A second aspect of the present invention provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the adaptive retrieval enhancement generation method based on multidimensional semantic routing described in the first aspect above.
[0019] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the adaptive retrieval enhancement generation method based on multidimensional semantic routing described in the first aspect above.
[0020] This invention proposes an adaptive retrieval enhancement generation (RAG) method based on multidimensional semantic routing, achieving on-demand computation and resource optimization: Through multidimensional semantic routing, simple problems are directly generated, and retrieval or inference resources are invoked only when necessary, significantly improving system response speed. It also enhances the ability to solve complex problems: by attaching an algorithmic reasoning module, the system possesses the ability for deep thinking and multi-perspective analysis when handling planning and analytical problems, breaking through the logical limitations of traditional RAG. Furthermore, it enhances the robustness and accuracy of the system: by introducing a relevance self-checking mechanism for retrieval results and an internet search fallback mechanism, combined with quality assessment of the final output and automatic repair loop, it effectively reduces the generation of illusions and invalid answers. Attached Figure Description
[0021] Figure 1 This is a schematic diagram of the main flow of the method provided in the embodiments of the present invention; Figure 2 This is a flowchart of the semantic routing logic processing in an embodiment of the present invention; Figure 3 This is a flowchart of the Retrieval Enhancement (RAG) process in an embodiment of the present invention; Figure 4 This is a flowchart of the Algorithm-Oriented Reasoning (AoT) process in an embodiment of the present invention; Figure 5 This is a system architecture block diagram provided in an embodiment of the present invention. Detailed Implementation
[0022] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.
[0023] Example 1 Figure 1 As shown in the figure, this embodiment provides an adaptive retrieval enhancement generation method based on multidimensional semantic routing. The specific processing flow of this method is as follows:
[0024] Step S1: The multidimensional semantic feature recognition method first receives the natural language query input by the user. In this step, instead of directly generating an answer, it interprets the query. To achieve accurate traffic splitting, this embodiment uses orthogonal analysis based on two dimensions: "data dependency" and "cognitive complexity."
[0025] (1) Data dependency determination: Determine whether answering the query requires external non-public knowledge or real-time information. For example, queries involving general knowledge (such as "the definition of the Pareto principle") are determined to have low data dependency; queries involving specific business data or time-sensitive information (such as "querying Q3 quarterly inventory" or "the latest industry standards") are determined to have high data dependency.
[0026] (2) Cognitive Complexity Assessment: Determine the required depth of thought and output target for the query. This embodiment categorizes intents into four types:
[0027] 1) Simple interactive classes: including simple definition explanations, translations, daily greetings, and basic text creation (such as writing thank-you notes).
[0028] 2) Deep attribution: This involves in-depth analysis of the causes of an event (e.g., "reviewing the reasons for project failure").
[0029] 3) Solution planning: This involves the design of specific execution paths (such as "designing a marketing and promotion plan").
[0030] 4) Comparative analysis: This involves comparing the advantages and disadvantages of multiple options.
[0031] To improve the stability of the method, a fallback mechanism based on regular expressions is also configured. When the semantic classification result of the large language model has low confidence or fails, a keyword scan will be performed on the query. If the query contains preset feature words such as "latest", "data", "report", and "parameter", the method will forcibly mark the data dependency as "high" to ensure that no retrieval needs are missed.
[0032] Step S2: Dynamic Routing and Capability Mounting. Based on the identification results of Step S1, a dynamic routing decision instruction is generated, and one or more corresponding processing flows are activated:
[0033] Scenario A: Intuitive Generation Mode (for queries with low data dependency and low complexity). When a query is identified as requiring no external data and having simple logic, the intuitive generation process is activated. This process directly calls the large language model, configures the system prompts from the "Professional Direct Assistant," and quickly generates an answer using the model's internalized parameter knowledge. This process does not perform retrieval or complex reasoning, resulting in the fastest response time.
[0034] Scenario B: Adaptive retrieval enhancement mode (for queries with high data dependency). When a query is identified as requiring external data, the retrieval enhancement process is activated. Its execution steps are as follows: Figure 3 As shown:
[0035] (1) Query rewriting: If the input query is too long or the semantics are ambiguous, the large language model is called first to extract the core search terms.
[0036] (2) Hybrid retrieval: Perform a retrieval in the local vector knowledge base to obtain several candidate document fragments.
[0037] (3) Relevance self-check (key step): The method does not directly use the retrieved documents, but instead constructs relevance discrimination prompts and inputs the query and candidate documents into the large language model. The model determines whether these documents contain the valid information needed to answer the question.
[0038] (4) Internet search fallback: If the large language model determines that the local document cannot answer the question (returns no data signal), the method will automatically call the Internet search engine interface to obtain publicly available information on the Internet as supplementary context.
[0039] (5) Generate answers: Generate the final enhanced search answer based on local documents or network information.
[0040] Scenario C: Algorithmic Reasoning Mode (for queries with high cognitive complexity). When a query is identified as requiring deep reasoning (such as solution planning or attribution analysis), the Algorithmic Reasoning (AoT) process is activated. This embodiment employs an efficient contextual algorithm simulation mechanism, and its execution steps are as follows: Figure 4 As shown:
[0041] (1) Load Algorithm Example Template: Based on the identified intent type (e.g., "planning"), load the corresponding AoT prompt template. This template not only contains task instructions but also embeds algorithm search examples (In-context Examples). For example, for a planning task, the template demonstrates how to propose a sub-solution, similar to Depth-First Search (DFS), and after finding it infeasible, output "backtracking" in the text before trying another sub-solution.
[0042] (2) Generating Algorithm Thinking Path: User queries and algorithm example templates are input into the large language model. Inspired by the algorithm examples, the model explicitly outputs the complete thinking process in a single generated text stream. This process includes:
[0043] 1) Decomposition steps: Break down complex problems into sub-nodes;
[0044] 2) Evaluation and pruning: The model evaluates the current child node's approach. If the evaluation score is low, the model will output a backtracking flag and switch to other approaches.
[0045] 3) Path extension: Conduct in-depth analysis of the ideas that have passed the evaluation.
[0046] (3) Extracting the optimal solution: The system uses a parser to identify and extract the conclusion portion that is ultimately marked as the "optimal solution" by the model from the long text thought process generated by the model, and uses it as the final structured report. This approach significantly reduces token consumption and the number of API calls while maintaining the depth of reasoning.
[0047] Step S3: Quality Assessment and Closed-Loop Repair After generating the initial answer, the answer will be post-processed and scanned.
[0048] (1) Validity detection: Detect whether the answer contains rejection signals (such as "I can't answer" or "Insufficient information") or vague statements (such as only containing "Specific situation needs to be analyzed" and having too few words).
[0049] (2) Automatic Repair: If the initial answer is deemed unacceptable, an automatic repair mechanism is triggered. A repair suggestion is constructed, which includes instructions to "ignore the preceding context" and "downgrade to a plain explanation," and the intuition generation process is re-executed. This mechanism ensures that even if the retrieval fails or reasoning is blocked, a usable fallback response is still provided to the user.
[0050] Example 2 Figure 5 As shown, this embodiment also provides an adaptive retrieval enhancement generation system based on multidimensional semantic routing, including:
[0051] (1) Routing decision module: It is used to perform the multi-dimensional semantic feature recognition steps in the above embodiment 1, and is configured with a data dependency discrimination unit and a cognitive complexity discrimination unit.
[0052] (2) Capability Execution Module: Connected to the routing decision module, it is used to receive routing decision instructions. This module integrates an intuition generation unit, a retrieval enhancement unit (including a vector retrieval unit and a network search interface), and an algorithmic reasoning unit (including an algorithm example loader and a single-generation parser).
[0053] (3) Quality control module: used to detect the validity of the initial response generated by the capability execution module and send a repair instruction to the capability execution module when it is unqualified.
[0054] Example 3 This example provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the program is used to implement the steps of the adaptive retrieval enhancement generation method based on multidimensional semantic routing described in Example 1.
[0055] It should be noted that the above embodiments are only preferred embodiments of the present invention. For those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. An adaptive retrieval enhancement generation method based on multidimensional semantic routing, characterized in that, Includes the following steps: (1) Receive a natural language query input by the user, and perform multi-dimensional feature recognition on the query through a semantic routing model. The multi-dimensional feature recognition includes at least the discrimination of data dependency and the discrimination of cognitive complexity. (2) Based on the identified data dependencies and cognitive complexity, generate dynamic routing decision instructions, wherein the instructions define the combination of capability modules and reasoning strategies required to process the query; (3) According to the dynamic routing decision instruction, activate the corresponding capability module from the preset capability library to process the query and generate an initial answer; (4) The capability library includes at least an intuition generation module, a retrieval enhancement module, and a thought chain reasoning module; (5) Use a quality assessment model to detect the validity of the initial answer. If the detection result is unqualified, trigger an automatic repair mechanism to generate the final answer; otherwise, output the initial answer as the final answer.
2. The method according to claim 1, characterized in that, The step (1) of performing multi-dimensional feature recognition on the query through a semantic routing model specifically includes: constructing system prompt words containing classification definitions to guide the large language model to determine whether the query depends on private data or real-time information; if so, marking the data dependency as true; simultaneously guiding the large language model to determine the intent type of the query, the intent type including at least simple interaction, deep attribution, solution planning and comparative analysis, and marking the cognitive complexity accordingly; when the semantic recognition of the large language model fails, using preset regular expression matching rules to scan the query for keywords in order to correct the result of the multi-dimensional feature recognition.
3. The method according to claim 1, characterized in that, The step (2) of generating dynamic routing decision instructions based on the identified data dependencies and cognitive complexity specifically includes: when the identification result is high data dependency, adding a call instruction for the retrieval enhancement module to the dynamic routing decision instructions; when the identification result is high cognitive complexity, adding a call instruction for the algorithm thinking reasoning module to the dynamic routing decision instructions, and specifying an algorithm reasoning template that matches the intent type.
4. The method according to claim 1, characterized in that, The execution steps of the retrieval enhancement module in step (4) specifically include: using a retrieval tool to retrieve document fragments related to the query in the knowledge base; constructing relevance discrimination prompts and inputting the query and the document fragments into a large language model for self-checking; if the large language model determines that the document fragments cannot answer the query, it returns a no-data signal and automatically triggers an internet search engine to obtain network information as supplementary context; if the large language model determines that the document fragments contain valid information, it generates an answer based on the document fragments.
5. The method according to claim 1, characterized in that, The execution steps of the algorithm thinking reasoning module in step (4) specifically include: loading the algorithm reasoning template corresponding to the reasoning strategy, wherein the template contains a context example that guides the large language model to simulate the search algorithm; using the large language model to generate once or a few times based on the template, and explicitly outputting the algorithm thinking path containing intermediate exploration steps, backtracking markers and evaluation process in the generated text; parsing and extracting the final preferred solution from the algorithm thinking path as the initial answer.
6. The method according to claim 1, characterized in that, The step (5) of using a quality assessment model to detect the validity of the initial response specifically includes: detecting whether the initial response contains preset rejection keywords or vague expression keywords; if the number of rejection keywords or vague expression keywords exceeds a preset threshold, the detection result is determined to be unqualified.
7. The method according to claim 6, characterized in that, The steps that trigger the automatic repair mechanism specifically include: constructing repair prompts, which contain instructions to ignore the preceding context and instructions to downgrade the processing mode to an intuitive generation mode; and using the intuitive generation module to regenerate the answer based on the repair prompts.
8. An adaptive retrieval enhancement generation system based on multidimensional semantic routing, characterized in that, include: The routing decision module is used to receive user queries and perform multi-dimensional feature recognition, and generate routing decision instructions based on the recognition results. The capability execution module includes an intuition generation unit, a retrieval enhancement unit, and a thought chain reasoning unit, which are used to dynamically attach and execute the corresponding units according to the routing decision instructions to generate an initial answer; The quality control module is used to evaluate the validity of the initial response and trigger repair logic when the evaluation is unsatisfactory.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: The processor is used to execute the computer program to implement the adaptive retrieval enhancement method as described in any one of claims 1 to 8.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it implements the adaptive retrieval enhancement method as described in any one of claims 1 to 8.
