Search enhancement generation method, system, electronic device, medium, and program product
By decomposing the query task into computational complexity fractions and selecting appropriate agents to execute subtasks, the efficiency and accuracy issues of the existing RAG system in handling complex queries are resolved, achieving resource optimization and reliability improvement, and reducing system maintenance costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- INSPUR SUZHOU INTELLIGENT TECH CO LTD
- Filing Date
- 2026-06-18
- Publication Date
- 2026-07-21
AI Technical Summary
Existing search-enhanced generation (RAG) systems cannot meet diverse query needs when handling complex queries, have insufficient search efficiency and accuracy, lack effective task decomposition and processing mechanisms, cannot fully leverage the professional advantages of each agent, have high complexity in managing task dependencies, and have low resource utilization efficiency.
By calculating the complexity score of natural language query tasks, decomposing them into multiple subtasks and determining task dependencies, selecting appropriate target agents to execute subtasks, and adopting modular architecture design and Agent capability profiling management, resource optimization and result fusion are achieved.
It improves the processing quality and overall execution efficiency of task queries, reduces retrieval response time, enhances system reliability and user experience, and reduces system maintenance costs and iteration risks.
Smart Images

Figure CN122432322A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a retrieval enhancement generation method, system, electronic device, medium, and program product. Background Technology
[0002] Existing Retrieval-Augmented Generation (RAG) systems suffer from the following technical problems when handling complex queries: (1) It cannot meet diverse query needs, resulting in insufficient retrieval efficiency and accuracy; (2) The lack of an effective task decomposition and processing mechanism leads to low efficiency in handling complex tasks; (3) Lack of ability to flexibly select and schedule agents based on task characteristics, and inability to fully leverage the professional advantages of each agent; (4) The existing system lacks an intelligent scheduling mechanism for the dependencies between tasks, resulting in low quality of answers and low system reliability; (5) The existing system has low resource utilization efficiency, resulting in a large waste of computing resources. Summary of the Invention
[0003] This invention provides a search enhancement generation method, system, electronic device, medium, and program product to at least solve the problems that a single search strategy cannot meet diverse query needs, the efficiency of complex task processing is low, the advantages of each agent cannot be fully utilized, and the complexity of task dependency management is high.
[0004] This invention provides a retrieval enhancement generation method, comprising: responding to a natural language query task, calculating a complexity score of the natural language query task; decomposing the natural language query task into at least one subtask based on the complexity score and determining the dependencies between the at least one subtask; generating a task execution plan for the at least one subtask based on the task dependencies between the at least one subtask, determining a target agent corresponding to the at least one subtask, and executing the corresponding subtask through the target agent corresponding to the at least one subtask based on the task execution plan to obtain the retrieval result of the natural language query task.
[0005] The present invention also provides a retrieval enhancement generation system, comprising: a calculation module, configured to calculate a complexity score of a natural language query task in response to the natural language query task; a task decomposition module, configured to decompose the natural language query task into at least one subtask based on the complexity score and a predetermined decomposition condition, and determine the dependencies between the at least one subtask; and a retrieval generation module, configured to generate a task execution plan for the at least one subtask based on the task dependencies between the at least one subtask, determine the target agent corresponding to the at least one subtask, and execute the corresponding subtask through the target agent corresponding to the at least one subtask based on the task execution plan to obtain the retrieval result of the natural language query task.
[0006] The present invention also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of the above-described retrieval enhancement generation method when executing the computer program.
[0007] The present invention also provides a non-volatile computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the above-described retrieval enhancement generation method.
[0008] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described search enhancement generation method.
[0009] This invention addresses the challenges of a single retrieval strategy failing to meet diverse query requirements, low efficiency in handling complex tasks, inability to fully leverage the strengths of various agents, and high complexity in managing task dependencies. It improves the processing quality and overall execution efficiency of query tasks, reduces retrieval response time, enhances system reliability, and significantly improves user experience. Attached Figure Description
[0010] To more clearly illustrate the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 A flowchart of a retrieval enhancement generation method provided according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the system architecture involved in the retrieval enhancement generation method according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the task decomposition and dependency graph construction process according to an embodiment of the present invention; Figure 4 This is a flowchart illustrating Agent matching and parallel scheduling execution according to an embodiment of the present invention; Figure 5 This is a flowchart illustrating the result fusion and quality control according to an embodiment of the present invention; Figure 6 This is a schematic diagram of a retrieval enhancement generation system according to an embodiment of the present invention; Figure 7 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0012] 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. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the present invention.
[0013] It should be noted that, in the description of this invention, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., used in this invention are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0014] In recent years, intelligent agent technology has made significant progress in the field of artificial intelligence, and researchers have begun to explore the introduction of the agent's autonomous decision-making and tool invocation capabilities into the RAG system.
[0015] Related technologies include mainstream single-agent autonomous RAG systems, with a typical implementation like the ReAct (Reasoning and Acting) framework. When a user inputs a query, the agent first analyzes the query and generates an initial reasoning approach. Based on the reasoning results, it decides whether to provide a direct answer or invoke an external tool. If a tool is needed, the agent generates a tool invocation command, including the tool name and parameters. The system executes the tool invocation and returns the result to the agent. The agent continues reasoning based on the newly acquired information, potentially triggering another round of tool invocations. This process repeats until the agent believes it has obtained enough information to generate the final answer.
[0016] Related technologies, such as multi-agent collaborative systems, encapsulate different functional modules as independent agents that interact through predefined collaborative processes. A typical system architecture includes three core components: a planning agent, a retrieval agent, and a question-answering agent. The planning agent receives user queries and formulates an execution plan, determining the sequence of operations to be performed by analyzing the query content. The retrieval agent retrieves relevant information from a knowledge base, receiving retrieval requests from the planning agent, executing specific retrieval operations, and returning results. The question-answering agent generates the final answer based on the retrieved information, receiving the original query and retrieval results as input, and generating a natural language response using a large language model.
[0017] However, the retrieval generation methods mentioned above have a series of technical problems when dealing with complex queries.
[0018] Problem 1: A single retrieval strategy cannot meet the differentiated needs of heterogeneous subtasks. Existing systems use a uniform processing strategy for all types of subtasks, failing to employ optimal retrieval and processing methods for different types such as factual queries, computational queries, inferential queries, and summary queries, resulting in insufficient retrieval accuracy and processing quality.
[0019] Question 2: The efficiency of complex query processing is limited by the serial execution mode. When faced with complex queries containing multiple logically independent subtasks, the current system lacks an effective task decomposition and parallel scheduling mechanism, and can only process them serially. The response time increases linearly with the number of subtasks, which cannot meet the performance requirements of real-time interaction.
[0020] Question 3: There is a structural contradiction between the generalization and specialization of agent capabilities. Single-agent systems require agents to be capable of handling all task types, resulting in high model complexity and performance degradation for various tasks. While fixed-task multi-agent systems achieve specialization, they lack the ability to dynamically select and combine agents based on task characteristics, thus failing to fully leverage the professional advantages of each agent.
[0021] Question 4: Inefficient system resource utilization and the full-load mode limit scalability. Regardless of query complexity, the existing system requires loading and maintaining all functional modules. In high-concurrency scenarios, it cannot elastically adjust resource configuration according to actual load, limiting system throughput and deployment flexibility.
[0022] Question 5: Lack of explicit modeling of inter-task dependencies leads to insufficient execution reliability. Existing systems employ implicit management of sub-task dependencies in multi-step reasoning or multi-source information integration scenarios. When the task chain is long, problems such as incorrect execution order, loss of intermediate results, or duplicate execution can easily occur, affecting the quality of the final answer and the reliability of the system.
[0023] Question 6: High system expansion costs and the need to modify core logic for integrating new agents. When adding new types of agents or optimizing existing agents, existing systems often require modification of core scheduling logic or retraining of planning models, resulting in high maintenance costs, significant iteration risks, and hindering the system's continuous evolution capabilities.
[0024] The technical terms used in this invention are as follows: RAG (Retrieval-Augmented Generation): A technical architecture that combines information retrieval with the generation capabilities of large language models, enhancing the quality of model generation by retrieving relevant information from external knowledge bases.
[0025] LLM (Large Language Model): A deep learning-based natural language processing model that has the ability to understand and generate human language.
[0026] Agent: A smart agent is a software entity that has the ability to perceive the environment, make autonomous decisions, and execute actions, and can complete tasks according to specific goals.
[0027] Task decomposition: Breaking down complex queries or problems into multiple independent or dependent subtasks for parallel or sequential processing.
[0028] Capability Profile: A structured description of an agent's capabilities, including its expertise in knowledge domains, data types, retrieval strategies, processing speed, and other multi-dimensional attributes.
[0029] Central Coordinator: The core scheduling module of the system, responsible for task decomposition, agent selection and allocation, execution management, and result fusion.
[0030] Task dependency refers to the sequential order or data transfer relationship between subtasks, where the execution of some subtasks depends on the output of other subtasks.
[0031] Specialized Agent: An agent optimized for specific task types, such as fact retrieval agent, numerical computation agent, and text summarization agent.
[0032] Vector Retrieval: A retrieval method based on semantic vector similarity, which finds relevant documents by calculating the distance between the query vector and the document vector.
[0033] Hybrid Retrieval: A retrieval method that combines multiple retrieval strategies (such as sparse retrieval BM25 and dense vector retrieval).
[0034] To address the above problems, embodiments of the present invention provide a retrieval enhancement generation method.
[0035] like Figure 1 As shown, the retrieval enhancement generation method includes the following steps: The system involved in the retrieval enhancement generation method of this invention consists of five core modules, such as... Figure 2 As shown: the module includes a query analysis module, a task decomposition and planning module, an agent capability profiling management module, a collaborative execution and scheduling module, and a result fusion and generation module. The functions, inputs and outputs, processing flows, and interrelationships of each module are as follows: The query analysis module is the system's entry point, and its main function is to perform multi-dimensional feature extraction and semantic understanding on the user's raw query. This module receives the user's natural language query Q as input and processes it through three parallel sub-components.
[0036] (1) Intent recognition component: Uses BERT-based classification model to classify query intent and determine whether the query belongs to fact retrieval, calculation, comparative analysis, summary generation or compound reasoning.
[0037] (2) The entity recognition component uses named entity recognition technology to extract key entities in the query, including people's names, place names, organization names, time, values, etc.
[0038] (3) The query complexity evaluation component calculates the query complexity score based on multiple feature dimensions.
[0039] The task decomposition and planning module is the core decision-making module of the system, responsible for decomposing complex queries into multiple sub-tasks and formulating execution plans.
[0040] The Agent Capability Profile Management module maintains the capability characteristic information of all available Agents in the system and is responsible for matching the most suitable Agent according to the requirements of sub-tasks.
[0041] The collaborative execution and scheduling module is the system's execution engine, responsible for managing the parallel or serial execution of multiple agents, handling task dependencies, and optimizing resources.
[0042] The results fusion and generation module is the system's output module, responsible for integrating the execution results of multiple subtasks and generating the final user answer.
[0043] Therefore, through modular architecture design, each module interacts through clearly defined interfaces and data contracts. The internal implementation of different modules can be independently iterated and upgraded. When it is necessary to replace the retrieval algorithm, upgrade the generation model, or add a new professional agent type, there is no need to modify other modules. This significantly reduces the long-term maintenance cost and iteration risk of the system, and improves the maintainability and evolvability of the architecture.
[0044] In step S101, in response to the natural language query task, the complexity score of the natural language query task is calculated.
[0045] In some embodiments, calculating the complexity score of a natural language query task includes: extracting the query length, number of entities, semantic depth, and temporal complexity from the natural language query task; and calculating the complexity score of the natural language query task based on the query length, number of entities, semantic depth, and temporal complexity from the natural language query task.
[0046] Specifically, the workflow of the query decomposition module is as follows: Figure 3 As shown, the query analysis module receives natural language query tasks input by the user, performs multi-dimensional feature extraction and semantic understanding, and the intent recognition component uses a BERT-based classification model to classify the query intent and determine whether the query belongs to the fact retrieval, calculation, comparative analysis, summary generation or compound reasoning category.
[0047] The entity recognition component uses named entity recognition technology to extract key entities from queries, including people's names, place names, organization names, time, and numerical values.
[0048] The query complexity evaluation component calculates the complexity score C of a natural language query task based on multiple feature dimensions. The formula for calculating the complexity score of a natural language query task is as follows: ; in, This is the normalized value of the query length (number of terms divided by the maximum length limit). The normalized value for the number of extracted entities. The depth of the dependency parsing tree (a measure of the semantic complexity of a query). Temporal complexity (whether it involves comparison of multiple time periods or temporal reasoning, with a value of 0 or 1). Weight parameter. It was trained on a labeled dataset using logistic regression.
[0049] The output of the query analysis module is a structured query representation. ,in It is the intent label for identification. It is the list of extracted entities. It is a complexity score. It is a set of required capability types initially inferred based on intent tags (such as...) This output serves as input to the task decomposition and planning module, which uses this feature information to determine whether and how to decompose the task. Data is shared between modules via memory sharing, and queries are performed on the representation. The data structure is written to the shared memory area, and the task decomposition module directly reads the data structure for subsequent processing, avoiding the overhead of data serialization and deserialization.
[0050] The above technical solution extracts features from four dimensions: query length, number of entities, semantic depth, and temporal complexity. The complexity score is calculated uniformly using a weighted formula, enabling an objective, quantitative, and comparable assessment of the task's complexity, thus avoiding the subjectivity and uncertainty of human judgment.
[0051] In some embodiments, after calculating the complexity score of a natural language query task in response to the natural language query task, the method further includes: determining whether the complexity score is greater than or equal to a preset threshold; if the complexity score is greater than or equal to the preset threshold, determining that the natural language query task meets the preset decomposition conditions; otherwise, determining that the natural language query task does not meet the preset decomposition conditions.
[0052] The preset threshold can be a threshold set by the user, a threshold obtained through a limited number of experiments, or a threshold obtained through a limited number of computer simulations; no specific limitation is made here.
[0053] The task decomposition and planning module is the core decision-making module of the system. Its workflow is as follows: Figure 4 As shown, when the complexity exceeds a preset threshold, this module is responsible for decomposing complex queries into multiple subtasks and formulating execution plans. The input to this module is the query representation output by the query analysis module. and the original query .
[0054] Specifically, the process of task decomposition and generating task execution plans is as follows: Figure 3As shown, firstly, the complexity score of the natural language query task is used to determine whether the natural language query task needs to be decomposed. If the complexity score of the natural language query task... Preset Threshold If so, a single task is generated and directly enters the execution phase.
[0055] If complexity score ≥Preset threshold If the condition is met, the task decomposition process is initiated. The task decomposition and planning module adopts a few-shot learning method based on a large language model. By using a designed prompt word template, the model is guided to generate a list of subtasks, resulting in at least one subtask. The prompt word template contains the principles of task decomposition, examples, and contextual information of the current query. The model outputs a structured description of the subtasks. The few-shot prompt word template guides the large language model to perform task decomposition. The decomposition principles and multi-type query examples embedded in the prompt words enable the decomposition results to have cross-query type generalization ability. There is no need to design decomposition rules separately for each query mode. In engineering practice, this significantly reduces the adaptation cost when accessing new business scenarios and improves the reusability of the system.
[0056] Through the above technical solution, simple queries are directly generated via a direct path, while complex queries trigger a complete multi-agent collaborative process. This avoids imposing unnecessary decomposition overhead on simple queries, achieving an effective balance between single-query latency and complex query processing capabilities, thus improving the overall resource utilization efficiency of the system. By automatically decomposing complex queries into clearly defined sub-tasks and assigning them to specialized agents, each agent can be deeply optimized for specific task types, approaching the performance level of specialized systems on tasks they excel at. This overcomes the problem of insufficient performance for specialized tasks caused by the generalization of capabilities of a single general agent, significantly improving the overall processing quality in heterogeneous query scenarios.
[0057] In step S102, if the natural language query task meets the preset decomposition conditions based on the complexity score, the natural language query task is decomposed into at least one subtask, and the dependency relationship between at least one subtask is determined.
[0058] In some embodiments, determining the dependency between at least one subtask includes: identifying the task description of at least one subtask; based on the task description of any subtask, identifying whether there is a target subtask that is referenced by any subtask; and if there is a target subtask that is referenced by any subtask, determining that there is a dependency between any subtask and the target subtask.
[0059] Each subtask after decomposition Represented as a quadruple ,in For natural language task description, For task type tags, This is a set of prerequisite task IDs. This is the initial priority.
[0060] Dependencies between tasks are automatically inferred by analyzing the referential relationships and semantic dependencies in the subtask descriptions, such as... Figure 3 As shown: The task decomposition and planning module automatically infers dependencies by analyzing pronouns ("the above results", "based on the foregoing", etc.) and semantic implications in the subtask descriptions. For implicit dependencies that are not explicitly labeled by the large language model, the module uses a semantic similarity matrix to assist in identification: if the subtask... The input entity set and The output entity sets have high overlap (Jaccard similarity) Then the system is established. By using semantic similarity to assist in identifying implicit dependencies during the task decomposition stage (Jaccard similarity threshold filtering), potential data dependencies are captured when they cannot be explicitly labeled in the large language model decomposition. This reduces the risk of execution order errors caused by missing dependencies and improves the robustness of complex query processing.
[0061] The above technical solution automatically infers the relationships between subtasks by identifying subtask descriptions, detecting reference relationships, and determining dependencies. In particular, it can accurately establish dependency relationships between corresponding subtasks and clarify the execution order of subtasks by using referential expressions in the subtask descriptions based on the above search results.
[0062] In step S103, a task execution plan for at least one subtask is generated based on the task dependency relationship between at least one subtask, and a target agent corresponding to at least one subtask is determined. Based on the task execution plan, the corresponding subtask is executed through the target agent corresponding to at least one subtask to obtain the retrieval results of the natural language query task.
[0063] After completing the task breakdown, in such cases... Figure 3 This is touched upon in the text; the task decomposition and planning module constructs a directed acyclic graph based on the dependencies between subtasks. , where vertex set ,like rely Then there exists a directed edge. Module to Execute Kahn's algorithm (a queue implementation of topological sorting), and move all vertices with an in-degree of 0 to the first execution layer. ;whenever After all tasks are completed, the new vertex with an in-degree of 0 will be added. Generate execution plan Tasks within the same layer can be executed in complete parallelism, while strict order is maintained between different layers. This scheme achieves the theoretical maximum parallelism while satisfying all dependency constraints.
[0064] By designing a directed acyclic graph (DAG) structure for the task dependency graph, the possibility of circular dependencies and deadlocks between tasks is fundamentally eliminated at the system level. The Kahn topological sorting algorithm can detect and report illegal circular dependencies during the graph construction phase, which theoretically guarantees the correctness of dependency management. Without relying on runtime heuristic protection, the reliability and predictability of the system are improved.
[0065] The task decomposition and planning module identifies all tasks with an in-degree of 0 as the first batch of executable tasks and adds them to the execution queue. When a task completes, the in-degree of other tasks that depend on it is updated. If the in-degree of a task drops to 0, it is added to the execution queue. This dynamic scheduling mechanism ensures the correctness of the task execution order while maximizing parallelism.
[0066] The output of the task decomposition and planning module includes a list of subtasks. and implementation plan The output is passed to the collaborative execution and scheduling module, while the subtask type information is sent to the Agent capability profile management module for Agent selection. Data transmission is achieved through a task queue. Each subtask is encapsulated as a task object and pushed into the queue with the corresponding priority. The collaborative execution and scheduling module, acting as a consumer, retrieves tasks from the queue for processing.
[0067] In some embodiments, determining the target agent corresponding to at least one subtask includes: identifying the task type and application domain corresponding to at least one subtask, and the task type, application domain, performance metric, and load metric corresponding to at least one agent in a preset agent library; determining the task type matching degree and application domain matching degree between at least one subtask and at least one agent in the preset agent library; calculating the matching degree score between at least one subtask and at least one agent in the preset agent library based on the task type matching degree and application domain matching degree between at least one subtask and at least one agent in the preset agent library, and the performance metric and load metric of at least one agent; and determining the target agent corresponding to at least one subtask based on the matching degree score between at least one subtask and at least one agent.
[0068] The workflow of the Agent Capability Profile Management module is as follows: Figure 4As shown, the Agent Capability Profile Management module maintains the capability characteristic information of all available Agents in the system and is responsible for matching the most suitable Agent according to the sub-task requirements. Internally, this module maintains an Agent registry, where each registered Agent has a detailed capability profile. .
[0069] in, A unique identifier for the Agent. It is a collection of task types that it is good at (supports multiple types). For those with expertise in a collection of knowledge areas (such as technology, finance, healthcare, law, etc.) For performance indicators, This represents the recent average response time. This is the average quality score of recent answers (filled back by the quality check component of the results fusion module). The number of tasks currently being processed (updated in real time).
[0070] When the collaborative execution and scheduling module needs to handle a certain subtask When selecting the target agent for execution, the capability profile management module calculates the matching score between each candidate agent in the preset agent library and the task based on the matching algorithm:
[0071] ; in, The type matching score is 1 for a perfect match, 0.5 for a partial match (where the capability sets overlap), and 0 for a complete mismatch. For domain matching, the Jaccard similarity is calculated between the domain of the query entity and the domain set of the Agent. To normalize the quality score, high-quality agents are encouraged to be prioritized for selection. To normalize the current load (inverted), agents with lower loads are encouraged to be selected first, with weight parameters... .
[0072] Agent Capability Profile Management Module Returns The structure is provided to the collaborative execution and scheduling module. Furthermore, if this query involves multiple related subtasks, the module also queries the Agent collaboration matrix. (where elements) Agent With Agent (Gain coefficient of historical quality when collaboratively completing related tasks), under the premise of meeting the matching score of independent sub-tasks, priority is given to recommending Agent combinations with better historical collaborative performance.
[0073] The Agent capability profile management module exposes the `registerAgent(profile)` interface, supporting the dynamic registration of new Agent types during system runtime without requiring service restarts or modifications to core scheduling logic. New Agents immediately participate in subsequent task matching and scheduling after registration. This runtime dynamic Agent registration mechanism (using the `registerAgent` interface) allows for the integration of new professional Agent types without system downtime. Enterprises can extend the system's capability boundaries at any time according to specific business needs without modifying core scheduling code or restarting services, demonstrating the system's open architecture's ability to support rapid business iteration.
[0074] By introducing an Agent capability profile data structure, the above technical solution describes each Agent's task type coverage, knowledge domain, real-time performance metrics, and current load status in a multi-dimensional and quantitative manner. This provides fine-grained Agent description capabilities that go beyond "type matching," enabling the system to further differentiate performance and load balancing among Agents of the same type. This avoids the mismatch between Agent capabilities and task requirements in a fixed-division model. A multi-factor weighted scoring algorithm achieves intelligent matching between tasks and Agents, comprehensively considering four dimensions: type matching degree, domain matching degree, historical quality score, and real-time load. Compared to simple round-robin or random allocation strategies, each subtask is handled by the Agent in its current optimal state, significantly improving the overall service quality and response stability of the system. 。
[0075] In some embodiments, after obtaining the retrieval results of the natural language query task by executing the corresponding subtask through the target agent corresponding to at least one subtask based on the task execution plan, the process includes: evaluating the performance indicators of the target agent after executing the corresponding subtask based on preset indicators; updating the performance indicators of the target agent based on the performance indicators of the target agent after executing the corresponding subtask, and obtaining the updated performance indicators of the target agent.
[0076] The initial values of the capability profile are set based on the Agent's design specifications and offline test results, but the system will continuously track the performance of each Agent and dynamically update the capability profile.
[0077] Specifically, after each agent completes a task, the system records preset metrics such as the task's execution time and result quality score, and updates the agent's performance metrics using an exponential moving average method. .
[0078] in, This means that historical performance carries greater weight, but new data can also have an impact. The performance metrics for task k after the update. The current performance metrics for task k are... The measured performance of task k is given. This dynamic update mechanism allows the system to adapt to changes in agent performance. For example, if an agent's performance improves due to a model update, its capability profile will be adjusted accordingly.
[0079] For example: Agent "Retrieves current performance metrics for Agent_1": =0.85 (standardized score combining accuracy and speed); Actual performance in this task: =0.90 (excellent performance); α=0.8.
[0080] but =0.8×0.85+0.2×0.90=0.68+0.18=0.86.
[0081] The performance improved from 0.85 to 0.86 after the update, reflecting the excellent performance of this update. However, the improvement was controlled by a smoothing factor to avoid overreaction.
[0082] By maintaining agent capability profiles and continuously tracking the performance of each agent for dynamic updates, the system can adapt to changes in agent performance. When an agent's performance improves due to model upgrades or parameter tuning, the system automatically adjusts its usage strategy for that agent, allowing users to enjoy performance improvements without manual intervention and reducing system maintenance costs.
[0083] By employing the above technical solution and continuously updating the Agent capability profile using the exponential moving average method, the system can smoothly adapt to the gradual changes in Agent performance, avoiding performance evaluation bias caused by single abnormal data, while maintaining sensitivity to long-term performance trends, thus achieving a balance between the stability and accuracy of Agent performance evaluation.
[0084] In some embodiments, before executing the corresponding subtask through the target agent corresponding to at least one subtask based on the task execution plan to obtain the retrieval result of the natural language query task, the method includes: identifying whether the target agent corresponding to the currently executed subtask exists in the instance pool; if the target agent corresponding to the currently executed subtask does not exist in the instance pool, then instantiating the target agent corresponding to the currently executed subtask.
[0085] The collaborative execution and scheduling module is the system's execution engine, responsible for managing the parallel and serial execution of multiple agents, runtime maintenance of task dependencies, and elastic management of computing resources. Internally, the module maintains three core data structures: (1) Hierarchical task queue: based on execution plan Tasks to be executed are organized hierarchically, with tasks at the same level located in the same priority bucket.
[0086] (2) Execution status table: key-value mapping ,in , Store the execution results returned by the Agent. It records execution time, selects AgentID and other metadata, and manages data transfer between subtasks through an explicit execution status table mechanism. It supports complex data flow patterns such as one-to-one, one-to-many broadcast and many-to-one aggregation, effectively avoiding the loss of intermediate results and cross-task data pollution problems common in implicit context passing, and providing a reliable state management infrastructure for complex multi-step reasoning scenarios.
[0087] (3) Agent instance pool: manages instantiated Agent objects and supports dynamic loading and unloading.
[0088] For multiple tasks within the same level, the collaborative execution and scheduling module creates an independent asynchronous coroutine for each task, allowing each agent to process its assigned task in true parallel. The module uses an event-driven mechanism to monitor the coroutine status: when a task... When a coroutine completes, the result is immediately written to the execution status table, and all dependencies are updated. The in-degree count of subsequent tasks is used to add new tasks with an in-degree of 0 to the execution queue. This mechanism avoids CPU waste caused by busy waiting and is particularly suitable for I / O-intensive retrieval task scenarios. By automatically identifying all independent subtasks that can be executed in parallel and initiating asynchronous parallel processing, compared with the traditional serial execution mode, the total response time can be significantly compressed for complex queries containing multiple independent retrieval subtasks. The increase in parallelism makes the overall response time approach a linear function of the critical path length rather than the total number of subtasks.
[0089] By using the above technical solution, existing Agent instances in the instance pool are reused first, avoiding redundant resource consumption such as repeated instantiation of the same Agent and memory occupation. The dynamic loading process is only executed when the Agent does not exist, thereby maximizing the reuse rate of Agent instances, reducing the system's memory and computing power overhead, and improving resource utilization efficiency.
[0090] In some embodiments, after identifying whether the target agent corresponding to the currently executing subtask exists in the instance pool, the method includes: if the target agent corresponding to the currently executing subtask exists in the instance pool, detecting the current load of the target agent corresponding to the currently executing subtask; if the current load of the target agent corresponding to the currently executing subtask is greater than a preset load value, then starting a new target agent to execute the corresponding subtask; otherwise, starting the target agent to execute the corresponding subtask.
[0091] Among them, the preset load The threshold can be a user-preset threshold, a threshold obtained through a limited number of experiments, or a threshold obtained through a limited number of computer simulations; no specific limitations are made here.
[0092] Specifically, such as Figure 4 As shown, if the target proxy corresponding to the currently executing subtask exists in the instance pool, and the current load of the target proxy is... Too high (i.e., the number of tasks being processed by the agent exceeds the preset load) ,default If so, you can choose to wait for the Agent's current load. Less than or equal to the preset load Execute, or start a new Agent instance to execute the corresponding subtask (if system resources allow). If the current load of the target agent corresponding to the currently executing subtask is less than or equal to the preset load value, then directly start the target agent to execute the corresponding subtask.
[0093] Through the above technical solution, when the load of a certain Agent is too high, a new instance can be started to share the load, preventing the resource exhaustion caused by unrestrained Agent instantiation, realizing the dynamic balance between Agent load and system resources, ensuring the stable operation of the entire system. Compared with the single instance design, it can better cope with sudden traffic and high concurrency scenarios, and improve the system throughput and service quality.
[0094] In some embodiments, based on the task execution plan, the corresponding subtask is executed by the target agent corresponding to at least one subtask to obtain the retrieval results of the natural language query task, including: based on the task execution plan, the corresponding subtask is executed by the target agent corresponding to at least one subtask to obtain the retrieval results of at least one subtask; and the retrieval results of the natural language query task are obtained based on the retrieval results of at least one subtask.
[0095] In some embodiments, obtaining the retrieval results of a natural language query task based on the retrieval results of at least one subtask includes: constructing an inference chain based on the task dependency relationship between at least one subtask to obtain a first retrieval result, and processing and integrating the retrieval results of at least one subtask based on the non-task dependency relationship between at least one subtask to obtain a second retrieval result; and fusing the first retrieval result and the second retrieval result to obtain the retrieval results of the natural language query task.
[0096] Specifically, the final output of the collaborative execution and scheduling module is a set of subtask results. Each of them It includes data returned by the Agent, execution status, and metadata. The processing flow of the result fusion and generation module is triggered via callback functions, such as... Figure 5 As shown.
[0097] The result fusion and generation module receives the result set from the subtasks. Original query and task dependency graph It is responsible for integrating multi-source heterogeneous results and generating a high-quality final answer.
[0098] The results fusion and generation module is based on the dependency graph. The reverse topological order determines the priority of result integration, prioritizing the inclusion of base results (results with an in-degree of 0) that will be referenced by other results into the fusion context to ensure the correctness of the logical deduction chain. The module dynamically selects the fusion strategy based on the subtask type. (1) For results where there is no task dependency between subtasks: reorder the documents according to the document relevance score returned by the retrieval agent, remove duplicate fragments by document fingerprint (SimHash), and retain the set of documents with complementary semantics.
[0099] (2) For results where there is a task dependency relationship between sub-tasks: the conclusion of the previous task is used as the semantic premise of the subsequent task, and they are linked together in the form of "reasoning chain" to form a traceable multi-hop reasoning path.
[0100] (3) For the results of the comparative analysis: organize multiple data points in a structured form (table or key-value pair list) to facilitate the generation of Agent to understand and output a well-organized comparative analysis.
[0101] The results fusion and generation module calls a dedicated generation agent (a large language model with fine-tuned instructions) to organize the structured fusion results and the original query into the generated prompt words: "User query: {Q}. Completed subtasks and results: { describe}:{ };{ describe}:{ Please generate a complete, accurate, and logically clear answer based on the above information, citing specific factual evidence.
[0102] Through the above technical solution, and by designing a differentiated fusion strategy in the result fusion module, relevance rearrangement and deduplication fusion are adopted for independent search results, inference chain concatenation is adopted for inference-dependent results, and structured organization is adopted for comparative analysis results. This ensures that the contextual logic is coherent and the information is complete after fusion, avoiding the fragmentation of answers and logical breaks caused by simple splicing.
[0103] In some embodiments, after obtaining the retrieval results of the natural language query task by executing the corresponding subtask through the target agent corresponding to at least one subtask based on the task execution plan, the method further includes: identifying the duration of idle state and memory usage of at least one agent in the preset agent library; identifying the agent to be uninstalled in the preset agent library whose idle state duration is greater than a preset time and whose memory usage is greater than a preset usage rate, and triggering the uninstallation operation of the agent to be uninstalled.
[0104] In terms of resource optimization, the collaborative execution and scheduling module implements a dynamic unloading mechanism for the target agent. Figure 4 As mentioned earlier, when an Agent completes a task, if that Agent is no longer needed in the subsequent execution plan and the system memory pressure is high, the module will unload the Agent instance to release resources. The unloading decision is based on a simple heuristic rule: If the agent's idle time exceeds the preset time (e.g., 30 seconds) and system memory usage exceeds the preset usage rate. If the resource usage reaches 80% (e.g., 80%), then the agent will be uninstalled. This mechanism effectively controls resource consumption while maintaining system responsiveness.
[0105] Through the above technical solution, the dynamic Agent loading and unloading mechanism only instantiates and loads the corresponding Agent into memory when the task actually needs it. When the Agent is idle for a timeout and the system memory pressure is high, the resources are automatically released. This completely changes the traditional system mode of full-scale resident loading. In systems containing a large number of specialized Agents, it effectively reduces the basic memory overhead and improves the deployment feasibility of the system in resource-constrained environments.
[0106] In some embodiments, after obtaining the retrieval results of the natural language query task by executing the corresponding subtask through the target agent corresponding to at least one subtask based on the task execution plan, the method further includes: evaluating the quality score of the retrieval results of the natural language query task; if the quality score of the retrieval results of the natural language query task is less than a preset score, then regenerating the retrieval results of the natural language query task.
[0107] The results fusion and generation module also includes an answer quality check mechanism during the answer generation process. The module uses a lightweight evaluation model to score the quality of the generated answers. The scoring dimensions include completeness (whether it covers all aspects of the query), accuracy (whether the answer content is consistent with the subtask results), and coherence (whether the logic is clear and consistent). The quality score of the retrieval results for the natural language query task is obtained by weighting the average of the three scores.
[0108] If the quality score of the natural language query task is lower than the preset score (default 0.7), the result fusion and generation module will automatically trigger the regeneration process, and at the same time adjust the prompt word strategy (such as requiring more focus on the result of a certain subtask) or request extended information of a specific subtask from the collaborative execution and scheduling module.
[0109] By introducing a multi-dimensional answer quality check mechanism in the result fusion stage, and using a lightweight evaluation model to independently score the three dimensions of completeness, accuracy and coherence, the above technical solution triggers a regeneration process and automatically adjusts the prompt word strategy for answers that do not meet the quality standards. Compared with the solution of single generation without quality control, this significantly improves the reliability of the final answer in boundary queries and complex queries.
[0110] In some embodiments, after obtaining the retrieval results of the natural language query task by executing the corresponding subtask through the target agent corresponding to at least one subtask based on the task execution plan, the method includes: displaying the retrieval results of the natural language query task and recording the execution trajectory of the target agent executing the corresponding subtask to the log system.
[0111] Specifically, the final output of the result fusion and generation module is a structured response object containing the answer text, confidence score, and source citations, which is returned to the user interface for display. Simultaneously, the module records the complete execution trajectory of this query (including task decomposition results, execution status of each agent, and final answer) to the log system for subsequent system analysis and capability profile updates.
[0112] In summary, the overall data flow of the system is as follows: User query → Output of the query analysis module →The task decomposition module outputs a list of subtasks. With the execution plan →The Agent Capability Profile Management Module provides various Recommending the optimal Agent → The collaborative execution and scheduling module schedules Agents to execute in parallel and collects the result set. →Result fusion and generation module integration Generate the final answer → Return to the user interface display.
[0113] Through the above technical solution and a complete execution trajectory recording mechanism, the task decomposition structure, agent selection decision, execution time of each stage, intermediate result summary and quality score of each query are persisted to the log system. This provides a complete data foundation for system performance analysis, continuous optimization of capability profiles, root cause location of faults and SLA (Service Level Agreement) auditing, and significantly improves the observability and debuggability of the system.
[0114] In some embodiments, when executing a corresponding subtask through a target agent corresponding to at least one subtask based on a task execution plan, the method further includes: identifying the initial priority of at least one subtask, the waiting time of at least one subtask, and the number of subtasks that depend on the subtask; calculating the current priority of at least one subtask based on the initial priority of at least one subtask, the waiting time of at least one subtask, and the number of subtasks that depend on the subtask; adjusting the task execution plan according to the current priority of at least one subtask, and executing the corresponding subtask through the target agent corresponding to at least one subtask according to the adjusted task execution plan.
[0115] In the above basic implementation scheme, if task priorities remain unchanged after being determined in the planning phase, some high-priority tasks may become blocked due to dependency waiting during actual execution. This could cause high-dependency tasks on the critical path to be delayed due to resource contention, thereby blocking the overall progress. This embodiment introduces a runtime priority adjustment algorithm to periodically (once per second) recalculate the effective priorities of all tasks to be executed.
[0116] in, The initial priority of the subtasks assigned to the planning phase. This represents the cumulative waiting time (in seconds) of the subtask in the queue. The total number of successor tasks that depend on this subtask (a measure of the criticality of a task in the dependency graph). and To adjust parameters (default) ).
[0117] This formula embodies three scheduling principles: maintaining the basic ordering authority of the initial priority; preventing low-priority tasks from starving by rewarding tasks with longer waiting times logarithmic rewards; and prioritizing scheduling blocked nodes on the critical path (with many subsequent tasks) to minimize the overall completion time.
[0118] The above technical solution, through a dynamic task priority adjustment mechanism, comprehensively considers the initial priority, cumulative waiting time, and fan-out number of subsequent tasks during runtime, periodically recalculates the effective priority and rearranges the scheduling queue accordingly, effectively preventing low-priority task starvation and critical path blocking problems, and optimizing the overall completion time in scenarios where multiple tasks compete for resources concurrently.
[0119] This embodiment further improves the Agent collaboration matrix. The system's construction and usage are discussed. The system analyzes all agent combinations from the execution logs. The synergistic gain coefficient is defined as the ratio of the quality of results obtained when both parties participate in the same query to the quality obtained when each party participates alone.
[0120] Positive values indicate synergistic gains in the combination (e.g., the combination of retrieval agent A and summary agent B is complementary in long-text summary retrieval tasks), while negative values indicate potential interference. In multi-subtask scenarios, the agent capability profiling management module incorporates the synergistic gain coefficient as an additional reward into the matching score. This allows the system to recommend agent combinations with historically better synergistic effects, while still meeting the independent requirements of each subtask. By constructing an agent synergy matrix and continuously calculating and updating the synergistic gain coefficient from the execution trajectory, the system prioritizes agent combinations that have historically generated synergistic gains in multi-subtask scenarios. This captures the complementary effects between agents that are imperceptible from a single agent perspective, further improving the overall quality of multi-agent collaborative processing and exceeding the upper limit of the effect of simply superimposing the best independent agents.
[0121] In some embodiments, after responding to a natural language query task, the method further includes: identifying the current query intent type based on the natural language query task; predicting the agent corresponding to the current query intent type and the demand probability corresponding to the agent based on the current query intent type and the corresponding historical agent data; and loading the corresponding first agent to execute the natural language query task based on the predicted agent corresponding to the current query intent type and the demand probability corresponding to the agent.
[0122] This embodiment adds a historical statistics module to the above implementation scheme to record the Agent usage patterns corresponding to different query types. For each query intent type (such as fact retrieval, numerical calculation, etc.), the statistics module calculates historical query statistics for each type of Agent (including Agent usage frequency and average activation time). When the system receives a new query, the query analysis module, while outputting the query representation, predicts the Agent type and its probability distribution that may be used in this query based on the identified intent type and historical query statistics. Before starting the actual task allocation, the collaborative execution and scheduling module loads the corresponding first agent to execute the natural language query task based on the predicted agent type and probability distribution corresponding to the current query intent type.
[0123] In some embodiments, loading a first agent to perform a natural language query task based on the agent corresponding to the predicted current query intent type and the demand probability corresponding to the agent includes: identifying a first agent among the corresponding agents whose current probability value is greater than a preset probability value based on the agent corresponding to the current query intent type and the demand probability corresponding to the agent, and loading the first agent to perform a natural language query task.
[0124] Specifically, for each type of intent The statistics module maintains the probability vector. ,in Intended meaning The query requires calling the Agent. The historical conditional probability (calculated on the execution trajectory log by maximum likelihood estimation).
[0125] Once the system receives a new query and completes intent recognition, simultaneously with the task decomposition process, the collaborative execution and scheduling module queries the historical statistics module in parallel to predict the probability of demand for each Agent based on the identified intent tags. A tiered preloading strategy is then employed based on the probability of demand for each Agent. The probability of demand corresponding to the agent Greater than the preset probability value , Immediately and completely load the Agent instance into memory, achieving zero-latency invocation.
[0126] Demand probability corresponding to the agent The Agent model weights are prefetched into the disk cache (PageCache), the runtime environment is initialized but GPU memory is not allocated yet, and activation can be completed in hundreds of milliseconds.
[0127] Demand probability corresponding to the agent The Agent remains dormant and is only loaded on demand when a task is actually assigned.
[0128] The above technical solution balances response speed and resource consumption through a tiered loading strategy. It achieves zero-latency calls for agents with high demand probability, fast loading for agents with medium demand probability, and saves resources for agents with low demand probability, significantly improving system execution efficiency and avoiding all agents remaining resident in memory or repeated initialization, thus achieving a significant balance between response speed and memory efficiency.
[0129] To enable those skilled in the art to further understand the embodiments of this application, the following description is provided in conjunction with the accompanying drawings.
[0130] 1. The process of task decomposition and dependency graph construction is as follows: Figure 3 As shown: Step S301: Receive natural language query task.
[0131] Step S302: Determine whether the complexity score is ≥ the preset threshold.
[0132] If the complexity is below the threshold, proceed to step S311.
[0133] If the complexity exceeds the threshold, proceed to step S303.
[0134] Step S311: Without task decomposition, the entire natural language query is encapsulated into a single independent task and sent directly into the scheduling queue.
[0135] Step S303: Break down the natural language query task into a list of subtasks.
[0136] The algorithm employs a few-sample prompt word LLM decomposition logic to break down composite queries into multiple independent subtasks, outputting a set of structured subtasks. Each subtask carries a task description, task type, and initial priority field.
[0137] Step S304: Identify explicit dependencies through pronoun analysis.
[0138] Traverse all subtask description texts, identify referential statements such as "the aforementioned result", "the data above", and "the calculated value", extract explicit reference relationships between subtasks, and initially label the subtask's prerequisite dependency IDs.
[0139] Step S305: Supplement implicit dependencies by entity set similarity.
[0140] Jaccard entity similarity matching is used to supplement implicit data dependencies not identified in step S304: if the output entity set of subtask A highly overlaps with the input entity set of subtask B, then an association edge of B depending on A is automatically added to make up for the implicit data dependencies missed by LLM decomposition and improve the integrity of dependency relationships.
[0141] Step S306: Construct a directed graph of task dependencies.
[0142] Step S307: Determine if there is a circular dependency in the dependency graph.
[0143] If a circular dependency exists, proceed to step S309; if no circular dependency exists, it is a valid directed acyclic graph, proceed to step S308.
[0144] Step S309: Report the error and return the correction request.
[0145] If a circular dependency is detected, it means that the user's query logic is contradictory (such as task A depending on B, and task B also depending on A). The system will throw an exception log, return a query correction prompt to the user, terminate the process, and not generate an execution plan.
[0146] Step S308: Topological sorting generates a hierarchical execution plan P.
[0147] Perform Kahn topological sorting on the acyclic dependency graph: tasks without prerequisite dependencies are assigned to the first layer for parallel execution; after all tasks in the upper layer are completed, the lower-level tasks with in-degree set to zero are released, thus dividing the graph into multiple execution sequences. Subtasks at the same level can be executed in parallel, while tasks at different levels are strictly executed sequentially, maximizing task parallelism and outputting a hierarchical execution plan.
[0148] Step S310: Output the list of subtasks and the execution plan.
[0149] The list of subtasks and the generated hierarchical execution plan are summarized and output to the Agent matching and collaborative scheduling module, and then proceed to the subsequent agent allocation and task execution stages.
[0150] 2. The process of agent matching and parallel scheduling execution is as follows: Figure 4 As shown: Step S401: Input execution plan P.
[0151] It receives the hierarchical task execution plan output from the previous task decomposition process and uses it as input to the scheduling process.
[0152] Step S402: Initialize the hierarchical task queue.
[0153] Based on the hierarchical structure of the execution plan, a hierarchical task queue is constructed, and the sub-tasks to be processed are stored in order of execution to achieve hierarchical and orderly scheduling.
[0154] Step S403: Determine if the queue is not empty.
[0155] If empty, proceed to step S404. If not empty, proceed to step S405.
[0156] Step S404: Summarize the results of all subtasks, output the complete result set, and the scheduling process ends.
[0157] Step S405: Retrieve the set of all parallel tasks in the current layer. Extract all independent subtasks that can run simultaneously within the same execution layer, supporting batch parallel processing.
[0158] Step S406: Calculate the proxy matching score.
[0159] The Agent capability profile management module is invoked to calculate the matching score between each candidate agent and the subtask by combining subtask type, domain, agent performance, and real-time load in a multi-dimensional weighted manner, and to select the optimal target agent.
[0160] Step S407: Optimize agent combination based on agent collaboration matrix.
[0161] By querying the historical Agent collaboration gain matrix, and prioritizing agent combinations with better historical collaboration results based on the best single-task matching, the quality of multi-task collaborative output is improved.
[0162] Step S408: Determine if the target proxy exists in the instance pool.
[0163] If not in the instance pool, proceed to step S409: dynamically load the proxy instance and complete the model / runtime environment initialization.
[0164] If it is in the instance pool, then proceed to step S412.
[0165] If the load exceeds the preset load threshold, proceed to step S413; if the load is normal, proceed to step S410.
[0166] Step S410: Asynchronous coroutines execute all subtasks at the same level in parallel.
[0167] Create independent asynchronous coroutines for all subtasks in the current layer, and concurrently call the corresponding target agent to perform retrieval / inference operations, maximizing the parallel efficiency of tasks at the same level.
[0168] Step S411: Write the result and update the in-degree of the subsequent task.
[0169] After a subtask is completed, the result is stored in the global task status table; the in-degree of subsequent subtasks that depend on this task is updated synchronously, and if the in-degree is zero, they are moved to the execution queue.
[0170] Step S412: Detect whether the load of the current proxy instance exceeds the preset load threshold.
[0171] Step S413: Start a new agent instance or place the task in a waiting queue to divert traffic and prevent blocking.
[0172] Step S414: Determine whether the idle duration of the agent exceeds the preset threshold and whether the memory usage rate is higher than the preset threshold.
[0173] If so, proceed to step S415: asynchronously unload idle agent instances to release computing power and memory resources.
[0174] If not, proceed to step S416.
[0175] Step S416: Proceed to the next execution layer.
[0176] Once all tasks at the current level have been processed and the resource recycling logic is complete, switch to the next level of tasks and return to the S403 cyclic verification queue until all level tasks have been executed.
[0177] 3. The process of results fusion and quality control is as follows: Figure 5 As shown: Step S501: Input the result set, the original query, and the dependency graph.
[0178] The system receives all subtask retrieval results, the user's original query text, and the subtask dependency DAG graph from the scheduling module, which serve as the entire input data source for result fusion.
[0179] Step S502: Determine the fusion priority according to the inverse topological order of the dependency graph.
[0180] The reverse traversal task relies on the topological sequence, prioritizes the integration of the results of the underlying basic subtasks, ensures the logical sequence of multi-hop reasoning, and avoids logical gaps in derivation.
[0181] Step S503: Matching and fusion strategy.
[0182] Automatic task routing is implemented based on the task type and dependencies of the subtasks, employing three targeted fusion solutions: (1) Comparative analysis results: The data of multiple sets are structured and organized into tables and key-value lists to facilitate horizontal comparison; (2) Reasoning depends on the result: Based on the chain of reasoning that depends on the subtasks, a traceable multi-hop reasoning path is constructed to form a coherent reasoning context; (3) Independent search results: Reordered by document relevance, duplicate fragments were removed by SimHash document fingerprint, and semantic complementary information was retained.
[0183] Step S504: Integrate and merge the results.
[0184] The structured data processed from the three branches are linked and merged together to form a complete contextual material.
[0185] Step S505: Generate the answer.
[0186] The merged materials and original queries are encapsulated into standardized prompt words, and the generated Agent is invoked to output complete natural language candidate answers.
[0187] Step S506: Evaluate the answer from multiple dimensions.
[0188] Candidate answers are scored based on three dimensions: completeness, accuracy, and coherence, and the overall quality score is obtained by weighted calculation.
[0189] Step S507: Determine whether the quality score is greater than or equal to the preset score.
[0190] If the quality score fails to meet the standard, proceed to step S509.
[0191] If the quality score meets the standard, proceed to step S508.
[0192] Step S508: Record the entire agent execution trajectory, write the current quality score back to the Agent capability profile management module, and dynamically update the agent performance indicators.
[0193] Step S509: Adjust the prompt word generation strategy, or request supplementary subtask extension information from the scheduling module, and return to S505 to generate the answer.
[0194] Step S510: Output the final answer A. Return the qualified structured final answer to the user interface, and the process ends.
[0195] Through the above improvements, this embodiment, while maintaining all the functions of the basic implementation scheme, further enhances the system's adaptability and resource utilization efficiency in dynamic environments, making it particularly suitable for production environments that need to handle a large number of concurrent queries and have limited computing resources.
[0196] Next, the retrieval enhancement generation system proposed according to an embodiment of the present invention is described with reference to the accompanying drawings.
[0197] Figure 6 This is a schematic diagram of the retrieval enhancement generation system according to an embodiment of the present invention.
[0198] like Figure 6 As shown, the retrieval enhancement generation system 10 includes: a calculation module 100, a task decomposition module 200, and a retrieval generation module 300.
[0199] The calculation module 100 is used to calculate the complexity score of the natural language query task in response to the natural language query task; the task decomposition module 200 is used to decompose the natural language query task into at least one subtask based on the complexity score and determine the dependency relationship between the at least one subtask; the retrieval generation module 300 is used to generate the task execution plan of at least one subtask according to the task dependency relationship between the at least one subtask, determine the target agent corresponding to the at least one subtask, and execute the corresponding subtask through the target agent corresponding to the at least one subtask based on the task execution plan to obtain the retrieval result of the natural language query task.
[0200] In some embodiments, the calculation module 100 is used to: extract the query length, number of entities, semantic depth, and temporal complexity in the natural language query task; and calculate the complexity score of the natural language query task based on the query length, number of entities, semantic depth, and temporal complexity in the natural language query task.
[0201] In some embodiments, after calculating the complexity score of a natural language query task in response to the natural language query task, the calculation module 100 is configured to: determine whether the complexity score is greater than or equal to a preset threshold; if the complexity score is greater than or equal to the preset threshold, determine that the natural language query task meets the preset decomposition conditions; otherwise, determine that the natural language query task does not meet the preset decomposition conditions.
[0202] In some embodiments, the task decomposition module 200 is configured to: identify task descriptions of at least one subtask; identify, based on the task description of any subtask, whether there is a target subtask that is referenced by any subtask; and, if there is a target subtask that is referenced by any subtask, determine that there is a dependency between any subtask and the target subtask.
[0203] In some embodiments, the retrieval generation module 300 is configured to: identify the task type and application domain corresponding to at least one subtask, and the task type, application domain, performance index, and load index corresponding to at least one agent in a preset agent library; determine the task type matching degree and application domain matching degree between at least one subtask and at least one agent in the preset agent library; calculate the matching degree score between at least one subtask and at least one agent in the preset agent library based on the task type matching degree and application domain matching degree between at least one subtask and at least one agent in the preset agent library, and the performance index and load index of at least one agent; and determine the target agent corresponding to at least one subtask based on the matching degree score between at least one subtask and at least one agent.
[0204] In some embodiments, after obtaining the retrieval results of the natural language query task by executing the corresponding subtask through the target agent corresponding to at least one subtask based on the task execution plan, the retrieval generation module 300 is further configured to: evaluate the performance indicators of the target agent after executing the corresponding subtask based on preset indicators; update the performance indicators of the target agent based on the performance indicators of the target agent after executing the corresponding subtask, and obtain the updated performance indicators of the target agent.
[0205] In some embodiments, before obtaining the retrieval results of a natural language query task by executing the corresponding subtask through the target agent corresponding to at least one subtask based on the task execution plan, the retrieval generation module 300 is used to: identify whether the target agent corresponding to the currently executed subtask exists in the instance pool; if the target agent corresponding to the currently executed subtask does not exist in the instance pool, then instantiate the target agent corresponding to the currently executed subtask.
[0206] In some embodiments, after identifying whether the target agent corresponding to the currently executed subtask exists in the instance pool, the retrieval and generation module 300 is further configured to: if the target agent corresponding to the currently executed subtask exists in the instance pool, detect the current load of the target agent corresponding to the currently executed subtask; if the current load of the target agent corresponding to the currently executed subtask is greater than a preset load value, start a new target agent to execute the corresponding subtask; otherwise, start the target agent to execute the corresponding subtask.
[0207] In some embodiments, the retrieval generation module 300 is further configured to: based on the task execution plan, execute the corresponding subtask through the target agent corresponding to at least one subtask to obtain the retrieval results of at least one subtask; and obtain the retrieval results of the natural language query task based on the retrieval results of at least one subtask.
[0208] In some embodiments, the retrieval generation module 300 is further configured to: construct an inference chain based on the retrieval results of at least one subtask to obtain a first retrieval result based on the task dependency relationship between at least one subtask; process and integrate the retrieval results of at least one subtask based on the non-task dependency relationship between at least one subtask to obtain a second retrieval result; and obtain the retrieval result of the natural language query task by associating and fusing the first retrieval result and the second retrieval result.
[0209] In some embodiments, after obtaining the retrieval results of the natural language query task by executing the corresponding subtask through the target agent corresponding to at least one subtask based on the task execution plan, the retrieval generation module 300 is further configured to: identify the duration of idle state and memory usage of at least one agent in the preset agent library; identify the agent to be uninstalled in the preset agent library whose idle state duration is greater than a preset time and whose memory usage is greater than a preset usage rate, and trigger the uninstallation operation of the agent to be uninstalled.
[0210] In some embodiments, after obtaining the retrieval results of the natural language query task by executing the corresponding subtask through the target agent corresponding to at least one subtask based on the task execution plan, the retrieval generation module 300 is further configured to: evaluate the quality score of the retrieval results of the natural language query task; if the quality score of the retrieval results of the natural language query task is less than a preset score, then regenerate the retrieval results of the natural language query task.
[0211] In some embodiments, after obtaining the retrieval results of the natural language query task by executing the corresponding subtask through the target agent corresponding to at least one subtask based on the task execution plan, the retrieval generation module 300 is further configured to: display the retrieval results of the natural language query task and record the execution trajectory of the target agent executing the corresponding subtask to the log system.
[0212] In some embodiments, when executing a corresponding subtask through a target agent corresponding to at least one subtask based on a task execution plan, the retrieval enhancement generation system 10 further includes: a first identification module, configured to identify the initial priority of at least one subtask, the waiting time of at least one subtask, and the number of subtasks dependent on the subtask; a priority calculation module, configured to calculate the current priority of at least one subtask based on the initial priority of at least one subtask, the waiting time of at least one subtask, and the number of subtasks dependent on the subtask; and an adjustment module, configured to adjust the task execution plan according to the current priority of at least one subtask, and execute the corresponding subtask through the target agent corresponding to at least one subtask according to the adjusted task execution plan.
[0213] In some embodiments, after responding to a natural language query task, the retrieval enhancement generation system 10 further includes: a second identification module, configured to identify the current query intent type based on the natural language query task; a prediction module, configured to predict the agent corresponding to the current query intent type and the demand probability corresponding to the agent based on the current query intent type and the corresponding historical agent data; and an agent determination module, configured to load the corresponding first agent to execute the natural language query task based on the predicted agent corresponding to the current query intent type and the demand probability corresponding to the agent.
[0214] In some embodiments, the agent determination module is used to: identify the first agent whose current probability value is greater than a preset probability value among the corresponding agents based on the agent corresponding to the current query intent type and the demand probability corresponding to the agent, and load the first agent to perform the natural language query task.
[0215] It should be noted that the descriptions of the features in the embodiments corresponding to the retrieval enhancement generation system can be found in the relevant descriptions of the embodiments corresponding to the retrieval enhancement generation method described above, and will not be repeated here.
[0216] Figure 7 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. The electronic device may include: The memory 701, the processor 702, and the computer program stored on the memory 701 and executable on the processor 702.
[0217] When the processor 702 executes the program, it implements the retrieval enhancement generation method provided in the above embodiments.
[0218] Furthermore, electronic devices also include: Communication interface 703 is used for communication between memory 701 and processor 702.
[0219] The memory 701 is used to store computer programs that can run on the processor 702.
[0220] The memory 701 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.
[0221] If the memory 701, processor 702, and communication interface 703 are implemented independently, then the communication interface 703, memory 701, and processor 702 can be interconnected via a bus to complete communication between them. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized into address buses, data buses, control buses, etc. For ease of representation, Figure 7 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0222] Optionally, in a specific implementation, if the memory 701, processor 702, and communication interface 703 are integrated on a single chip, then the memory 701, processor 702, and communication interface 703 can communicate with each other through an internal interface.
[0223] The processor 702 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention.
[0224] Embodiments of the present invention also provide a non-volatile computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described retrieval enhancement generation method embodiments at runtime.
[0225] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0226] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described search enhancement generation method.
[0227] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0228] The foregoing has provided a detailed description of the retrieval enhancement generation method, system, electronic device, medium, and program product provided by this invention. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are only intended to help understand the method and core ideas of this invention. It should be noted that those skilled in the art can make various improvements and modifications to this invention without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this invention.
Claims
1. A retrieval enhancement generation method, characterized in that, Includes the following steps: In response to a natural language query task, calculate the complexity score of the natural language query task; If the natural language query task satisfies the preset decomposition conditions based on the complexity score, the natural language query task is decomposed into at least one subtask, and the dependency relationship between the at least one subtask is determined. Based on the task dependencies between the at least one subtask, a task execution plan for the at least one subtask is generated, and a target agent corresponding to the at least one subtask is determined. Based on the task execution plan, the corresponding subtask is executed through the target agent corresponding to the at least one subtask to obtain the retrieval results of the natural language query task.
2. The retrieval enhancement generation method according to claim 1, characterized in that, Calculating the complexity score of the natural language query task includes: Extract the query length, number of entities, semantic depth, and temporal complexity from the natural language query task; The complexity score of the natural language query task is calculated based on the query length, number of entities, semantic depth, and temporal complexity.
3. The retrieval enhancement generation method according to claim 1, characterized in that, After calculating the complexity score of the natural language query task in response to the natural language query task, the process includes: Determine whether the complexity score is greater than or equal to a preset threshold; If the complexity score is greater than or equal to the preset threshold, the natural language query task is determined to meet the preset decomposition condition; otherwise, the natural language query task is determined not to meet the preset decomposition condition.
4. The retrieval enhancement generation method according to claim 1, characterized in that, Determining the dependencies between the at least one subtask includes: The task description for identifying the at least one subtask; Based on the task description of any subtask, identify whether there is a target subtask that has a reference relationship with any of the subtasks; If there is a target subtask that references any of the subtasks, a dependency relationship is determined between the target subtask and the target subtask.
5. The retrieval enhancement generation method according to claim 1, characterized in that, Determining the target agent corresponding to the at least one subtask includes: Identify the task type, application domain, performance metrics, and load metrics corresponding to the at least one subtask and the at least one agent in the preset agent library; Determine the task type matching degree and application domain matching degree between the at least one subtask and at least one agent in the preset agent library; The matching score between the at least one subtask and at least one agent in the preset agent library is calculated based on the matching degree of the task type and application domain between the at least one subtask and at least one agent in the preset agent library, as well as the performance index and load index of the at least one agent. The target agent corresponding to the at least one subtask is determined based on the matching score between at least one subtask and at least one agent.
6. The retrieval enhancement generation method according to claim 5, characterized in that, After obtaining the retrieval results of the natural language query task by executing the corresponding subtask through the target agent corresponding to the at least one subtask based on the task execution plan, the process includes: The performance metrics of the target agent after executing the corresponding subtasks are evaluated based on preset metrics. The performance metrics of the target agent are updated based on the performance metrics after the target agent executes the corresponding subtask, thus obtaining the updated performance metrics of the target agent.
7. The retrieval enhancement generation method according to claim 5, characterized in that, Before obtaining the retrieval results of the natural language query task by executing the corresponding subtask through the target agent corresponding to the at least one subtask based on the task execution plan, the process includes: Identify whether the target proxy corresponding to the currently executing subtask exists in the instance pool; If the target agent corresponding to the currently executing subtask does not exist in the instance pool, then the target agent corresponding to the currently executing subtask is instantiated.
8. The retrieval enhancement generation method according to claim 7, characterized in that, After identifying whether the target proxy corresponding to the currently executing subtask exists in the instance pool, the process includes: If the target agent corresponding to the currently executing subtask exists in the instance pool, detect the current load of the target agent corresponding to the currently executing subtask; If the current load of the target agent corresponding to the currently executing subtask is greater than the preset load value, then a new target agent is started to execute the corresponding subtask; otherwise, the target agent is started to execute the corresponding subtask.
9. The retrieval enhancement generation method according to claim 1, characterized in that, The step of executing the corresponding subtask through the target agent corresponding to the at least one subtask based on the task execution plan to obtain the retrieval results of the natural language query task includes: Based on the task execution plan, the corresponding subtask is executed by the target agent corresponding to the at least one subtask to obtain the retrieval results of at least one subtask; The retrieval results of the natural language query task are obtained based on the retrieval results of the at least one subtask.
10. The retrieval enhancement generation method according to claim 9, characterized in that, Obtaining the retrieval results of the natural language query task based on the retrieval results of the at least one subtask includes: Based on the task dependencies between the at least one subtask, a reasoning chain is constructed according to the retrieval results of the at least one subtask to obtain a first retrieval result, and based on the non-task dependencies between the at least one subtask, the retrieval results of the at least one subtask are processed and integrated to obtain a second retrieval result; The retrieval results for the natural language query task are obtained by associating and fusing the first retrieval result and the second retrieval result.
11. The retrieval enhancement generation method according to claim 1, characterized in that, After obtaining the retrieval results of the natural language query task by executing the corresponding subtask through the target agent corresponding to the at least one subtask based on the task execution plan, the process includes: Identify the duration of idle state and memory usage of at least one agent in the preset agent library; Identify the agents to be uninstalled in the preset agent library that have been idle for a period of time longer than a preset time and whose memory usage rate is greater than a preset usage rate, and trigger the uninstallation operation on the agents to be uninstalled.
12. The retrieval enhancement generation method according to claim 1, characterized in that, After obtaining the retrieval results of the natural language query task by executing the corresponding subtask through the target agent corresponding to the at least one subtask based on the task execution plan, the method further includes: Evaluate the quality score of the retrieval results for the natural language query task; If the quality score of the retrieval result of the natural language query task is less than the preset score, the retrieval result of the natural language query task will be regenerated.
13. The retrieval enhancement generation method according to claim 1, characterized in that, After obtaining the retrieval results of the natural language query task by executing the corresponding subtask through the target agent corresponding to the at least one subtask based on the task execution plan, the process includes: The system displays the retrieval results of the natural language query task and records the execution trajectory of the corresponding subtasks executed by the target agent to the log system.
14. The retrieval enhancement generation method according to claim 1, characterized in that, When executing the corresponding subtask through the target agent corresponding to the at least one subtask based on the task execution plan, the method further includes: Identify the initial priority of the at least one subtask, the waiting time of the at least one subtask, and the number of subtasks that depend on the at least one subtask; The current priority of the at least one subtask is calculated based on the initial priority of the at least one subtask, the waiting time of the at least one subtask, and the number of subtasks that depend on the at least one subtask. The task execution plan is adjusted according to the current priority of the at least one subtask, and the corresponding subtask is executed by the target agent corresponding to the at least one subtask according to the adjusted task execution plan.
15. The retrieval enhancement generation method according to claim 1, characterized in that, Following the response to natural language query tasks, it also includes: The current query intent type is identified based on the natural language query task. Based on the current query intent type and the corresponding historical proxy data, predict the proxy corresponding to the current query intent type and the demand probability corresponding to the proxy. Based on the predicted current query intent type and the corresponding demand probability of the agent, the first agent is loaded to execute the natural language query task.
16. The retrieval enhancement generation method according to claim 15, characterized in that, The step of loading the corresponding first agent based on the predicted current query intent type and the corresponding demand probability of the agent to execute the natural language query task includes: Based on the agent corresponding to the current query intent type and the demand probability corresponding to the agent, identify the first agent whose current probability value is greater than the preset probability value among the corresponding agents, and load the first agent to execute the natural language query task.
17. A retrieval enhancement generation system, characterized in that, include: A computation module is used to calculate the complexity score of a natural language query task in response to the natural language query task. The task decomposition module is used to decompose the natural language query task into at least one subtask based on the complexity score and the determination of the dependency relationship between the at least one subtask. The retrieval generation module is used to generate a task execution plan for the at least one subtask based on the task dependency relationship between the at least one subtask, determine the target agent corresponding to the at least one subtask, and execute the corresponding subtask through the target agent corresponding to the at least one subtask based on the task execution plan to obtain the retrieval result of the natural language query task.
18. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the program to implement the retrieval enhancement generation method as described in any one of claims 1-16.
19. A non-volatile computer-readable storage medium having a computer program stored thereon, characterized in that, The program is executed by the processor to implement the retrieval enhancement generation method as described in any one of claims 1-16.
20. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the retrieval enhancement generation method as described in any one of claims 1-16.