Hybrid expert multi-model task processing method and system based on AI Agent scene
By fine-grained division and dynamic decomposition of user tasks in AI Agent scenarios and combining multi-objective optimization strategies to select the optimal expert model, the problem of low collaborative efficiency of Agent tools in complex task scenarios is solved, and efficient and accurate multi-model task processing is achieved.
Patent Information
- Application Number
- CN202511095717.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-06
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2045-08-06
AI Technical Summary
Existing agent tools are unable to flexibly respond to complex and changing user needs and task scenarios in task scheduling and resource allocation. The collaboration efficiency between models is low, especially when multiple tasks are concurrent and complex tasks are nested, the execution efficiency and resource utilization are difficult to meet the requirements.
A hybrid expert multi-model task processing method based on AI Agent scenarios is adopted. By performing semantic segmentation on unstructured and semi-structured data, a knowledge block set is generated, a RAG text knowledge base is constructed, and a vector representation is generated using the Embedding model. The similarity between user input and the knowledge base is calculated, sub-task division and dependency matrix construction are performed, and task allocation is performed by combining the scoring model and multi-objective optimization strategy. The optimal expert model is dynamically selected for answer generation.
It achieves fine-grained division and dynamic decomposition of user tasks, improves the collaborative efficiency of multiple models, improves the accuracy, diversity and authenticity of answers, enhances the stability and scalability of the system, and reduces the delay in task execution time.
Smart Images

Figure CN120653404A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of LLM multi-model task allocation technology, and in particular to a hybrid expert multi-model task processing method and system based on an AI agent scenario. Background Art
[0002] The development of AI technology has spawned agent tools for integrating large models. Existing agent technology uses LLM (Learning Modeling) to generate a series of workflows based on user requirements. Ultimately, these workflows call upon different large models to generate aggregated answers. Workflows enable the dominant model to clearly and sequentially execute tasks, but improving the efficiency and applicability of large models remains a pressing challenge.
[0003] Traditional agent tools often employ fixed models for task scheduling and resource allocation, making them inflexible in responding to complex and ever-changing user needs and task scenarios. Furthermore, significant differences in functionality and performance exist between large models, leading to inefficient collaboration between models, further limiting the overall performance of agent tools. Existing methods often offer unsatisfactory execution efficiency and resource utilization, particularly when faced with multi-tasking concurrency and complex nested tasks. Stability and scalability still require significant improvement. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide a hybrid expert multi-model task processing method and system based on AI Agent scenario. This method and system perform fine-grained division of user tasks and routing selection of model pools, which can effectively improve the accuracy, diversity and authenticity of answers to user needs and enhance the multi-model parallel utilization of the Agent system.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: a hybrid expert multi-model task processing method based on an AI Agent scenario, comprising the following steps:
[0006] Step S1: Unstructured data and semi-structured data Perform semantic segmentation and generate a set of knowledge blocks ; Generate vector representation set through Embedding model , and stored in the FAISS vector database to build the RAG text knowledge base;
[0007] Step S2: User input text , construct the query vector , calculate the similarity between user input and RAG text knowledge base , select the one with high similarity knowledge blocks constitute a set of related document vectors ;
[0008] Step S3: Concatenate the user input and the reverse decoded document and input them into the large language model LLM, divide the user task into a set of subtasks , and generate the subtask dependency matrix , construct a directed acyclic graph ;
[0009] Step S4: Based on the scoring model and expert model pool Building a task assignment dataset ;
[0010] Step S5: Task allocation dataset constructed based on step S4 ,A multi-objective optimization strategy is adopted to jointly train the hybrid expert routing network;
[0011] Step S6: For a given user task, follow the method of steps S1 to S5 to assign multiple experts to process the subtasks according to the dependency relationship, and use the hybrid expert routing network to weight the answers to each subtask. ; Generate dependency aggregation for subtask answers ,Finally, the aggregated answer of each subtask is used as the user task result.
[0012] In a preferred embodiment, step S1 specifically includes the following steps:
[0013] Step S11: Unstructured data and semi-structured data Standardize them separately;
[0014] Unstructured text extraction function Extract text from unstructured data ;
[0015]
[0016] Semi-structured conversion text function Extracting text from semi-structured data ;
[0017]
[0018] in, Indicates the file type;
[0019] Step S12: Generate a knowledge block set using semantic block segmentation algorithm ,in, Indicates the A knowledge block, Indicates the A knowledge block, Indicates the A knowledge block, Indicates the number of knowledge blocks in the set;
[0020]
[0021] Generative Algorithms Defined as;
[0022]
[0023] in, Indicates the Split blocks to A collection of documents for each partition, is the sliding window size, is the step size of the sliding window, Indicates the total number of documents;
[0024] Step S13: Use the pre-trained BERT model as the vector encoding generator, denoted as the embedding model f emb , generate the embedding vector representation set corresponding to each knowledge block ,in, Indicates the The knowledge blocks correspond to vectors, Indicates the The knowledge blocks correspond to vectors, Indicates the The knowledge blocks correspond to vectors, Represents the number of knowledge block vectors in the set;
[0025]
[0026] in, is the vector corresponding to the knowledge block The vector dimension of
[0027] Step S14: Store the vector into the FAISS database using the inverted index function Build the knowledge base index:
[0028]
[0029] in, represents the number of cluster centers in the inverted list, represents the number of product quantization subspace partitions, Indicates the number of coding bits for each subspace.
[0030] In a preferred embodiment, step S2 specifically includes the following steps:
[0031] Step S21: User inputs text Through the embedding model Converted into query vector ;
[0032]
[0033] Step S22: Normalize the query vector and the knowledge block vector, and calculate the cosine similarity between the query vector and all vectors in the RAG knowledge base:
[0034]
[0035] in, Indicates L2 normalization, T indicates transpose, for vector The calculation formula is:
[0036]
[0037] Step S23: Sort in descending order of similarity and select the one with the highest similarity. knowledge blocks, forming a set of related document vectors, which are expressed as follows:
[0038]
[0039] Among them, topN represents the optimal N values, V topN express Knowledge blocks constitute a collection of related document vectors. represents the knowledge block vector that meets the conditions, Indicates the minimum similarity threshold.
[0040] In a preferred embodiment, step S3 specifically includes the following steps:
[0041] Step S31: reverse decode the topN knowledge block vectors to obtain the original text and aggregate the user input text :
[0042]
[0043]
[0044] in, is the first reverse decoding result that meets the topN vector, This is the reverse decoding result of the second topN vector. For the The reverse decoding results of the topN vectors are matched. The Nth reverse decoding result of the topN vector is: is the aggregated document after reverse decoding of the topN vector set, Represents a splicing operation;
[0045] Step S32: Decompose the task based on the large language model LLM, and the input includes the user input text , aggregated documents after reverse decoding of the topN vector set , output subtask , Subtask Description and subtask dependencies , expressed as:
[0046]
[0047] in, Represents the prompt word input into the large language model LLM based on user input and related document collection;
[0048] Step S33: For the extracted subtask set ,in, Indicates the subtasks, Indicates the subtasks, Indicates the subtasks, Indicates the total number of subtasks and establishes a dependency matrix , build a directed acyclic graph of subtask dependencies :
[0049]
[0050]
[0051]
[0052] Among them, the subtask set As a graph The vertex, For the picture The directed edge of Represents a set of other subtasks that a subtask depends on.
[0053] In a preferred embodiment, step S4 specifically includes the following steps:
[0054] Step S41: For the expert pool ,in is the first Expert models, is the first Expert models, is the first Expert models, is the total number of models in the model pool; assign simple tasks to all expert models , using the scoring model Match the generated results of each expert model , fluency and credibility Multidimensional scoring, scoring model Expressed as:
[0055]
[0056] Matching measures the similarity between questions and answers generated by the model , defined as:
[0057]
[0058] Fluency measures the logical relevance of the sentences before and after the model generates the result , defined as:
[0059]
[0060] Credibility measures the consistency between the model-generated results and the real content , defined as:
[0061]
[0062]
[0063] in, Representation Model For tasks The scoring matrix, For the The output of the model, For the The model output A sentence, Calculate the logical relationship between two sentences, Indicates that the output sentence is consistent with the facts. Indicates the The total number of model output sentences;
[0064] Step S42: Perform weighted summation on the multi-dimensional scores to calculate the final score of each model :
[0065]
[0066]
[0067] in, are the weights of matching, fluency and credibility respectively;
[0068] Re-sort all models and outputs according to the comprehensive score to obtain the sorted set representation corresponding to the model: ,in , Respectively represent the ranking The comprehensive rating of Respectively represent the ranking The model corresponding to the comprehensive score, Respectively represent the ranking The comprehensive score corresponds to the answer of the model, and the two models with the highest scores and the corresponding task input are added to the task-model assignment dataset :
[0069]
[0070] Step S43: Reselect a simple task , repeat steps S41 and S42 to construct a complete data set.
[0071] In a preferred embodiment, step S5 specifically includes the following steps:
[0072] Step S51: Generate task feature vector from simple task , each model constructs a model feature vector for the output of the task express:
[0073]
[0074]
[0075] in, represents the task feature vector generated by the MLP model from the simple task, Represents the model feature vector constructed by each model in the MLP model for the task output result, Represents a subtask The number of tokens contained in Indicates the number of tokens in the output text of each model, represents the dimension of the task feature vector, Represents the dimension of the model feature vector;
[0076] Step S52: Concatenate and fuse the task feature vector and the model feature vector, and map them. At the same time, perform global pooling on the features to obtain the corresponding feature representation:
[0077]
[0078]
[0079] in, Represents the first layer, Indicates the The model feature vector representation obtained by concatenating the two vector features of the layer is and Respectively represent The weight matrix and bias weights of the layer model, express The vector dimension of is the number of neurons in the current hidden layer, is the feature vector after global pooling;
[0080] Step S53: After adopting MLP multi-layer mapping, the hybrid routing expert model performs Softmax normalization to output the probability of each expert being elected. , expressed as:
[0081]
[0082] in, Indicates processing tasks The number of expert models, and Represents the original prediction of the MLP model experts and The probability value of an expert being selected, is the transpose of the weight matrix of the original output, express Dimensions;
[0083] Step S54: Calculate the loss function of the model score of the hybrid expert routing assignment. Defined as:
[0084]
[0085] in, Indicates the total number of subtasks, is the current subtask, In the subtask The optimal model obtained by training The two models with the best performance in the dataset, Indicates that hybrid expert routing is used in tasks The model score obtained by Softmax during training, Indicates that in the task Next, the dataset The optimal model score corresponding to the task in .
[0086] In a preferred embodiment, step S6 specifically includes the following steps:
[0087] Step S61: According to step S3, the user inputs text After the subtask graph is constructed, for each subtask , calculate its vertex indegree :
[0088]
[0089] If and only if hour The dependency value of the task after execution All are updated to 0;
[0090] Step S62: traverse the remaining task nodes once to obtain a set of executable tasks , the probability of an executable task being output by the routing model:
[0091]
[0092] in, Represents model y The probability vector of subtasks, represents the routing network, for The vector dimension of
[0093] exist The model corresponding to the two largest probability values is expressed as:
[0094]
[0095]
[0096] in, ( ) function to realize the output probability vector The two models with the largest median and , and Respectively in subtasks The probability of being elected output by the optimal and suboptimal models is: are the probability and threshold;
[0097] Step S63: Input the subtask result into the post-processing model T5 to generate the best answer to the subtask , the non-dependent subtasks are input into the expert model in parallel for processing, and the feedback results of the multi-expert model are obtained:
[0098]
[0099]
[0100]
[0101] in, Indicates that the top1 model processes the subtask Output results, Indicates top2 model processing Subtask output results, Indicates processing subtasks The best results obtained, express The maximum number of tokens in the output result after processing, Indicates For input weights, use a lightweight model About content Perform weighted fusion output;
[0102] Step S64: According to the directed acyclic task graph, aggregate the best results of the subtasks generated by the expert model to generate the dependency aggregation of the subtask answers. , expressed as:
[0103]
[0104] in, Represents each user task The total number of subtasks broken down.
[0105] The present invention also provides a hybrid expert multi-model task processing system based on an AI Agent scenario, which is characterized by including a knowledge base construction, a task parsing and construction module, a hybrid expert routing network, and a subtask parallel execution strategy. The modules work together to achieve the hybrid expert multi-model task processing based on the AI Agent scenario as described above.
[0106] Compared with the prior art, the present invention has the following beneficial effects:
[0107] (1) This invention performs fine-grained division of user tasks and constructs a directed acyclic graph (DAG) based on the subtask dependency matrix, enabling dynamic task decomposition and parallel scheduling. Compared to the traditional agent-based fixed workflow model, this invention can intelligently identify the logical dependencies between subtasks, support the parallel execution of subtasks, significantly improve the collaborative efficiency of multiple models, and reduce the time delay of task execution.
[0108] (2) This paper proposes a multi-objective optimization routing strategy based on a scoring model, dynamically selecting the optimal expert model through multi-dimensional scoring of matching, fluency, and credibility. Compared with existing static allocation methods, this paper can adaptively adjust network weights, combining task characteristics with model capabilities to improve the accuracy, diversity, and authenticity of the agent system.
[0109] (3) This paper integrates the RAG knowledge base into knowledge retrieval, achieving efficient knowledge retrieval through semantic block segmentation and embedding. Compared with existing keyword matching methods, this paper can enhance the association between user input and knowledge base content, alleviate the LLM illusion problem, and improve the credibility of the generated results.
[0110] (4) The present invention supports the dynamic expansion of the expert model pool and achieves re-evaluation and adaptation of model capabilities through joint training of the routing network, which requires fewer training parameters. Compared with agent systems with fixed model combinations, the present invention can flexibly cope with complex task scenarios and improve the stability and scalability of the system.
[0111] (5) This paper introduces the T5 lightweight model to perform weighted fusion of multiple expert outputs, avoiding redundancy and conflict caused by direct splicing. Compared with traditional aggregation methods, this paper ensures the coherence and information density of the output through dynamic weight allocation and token length restriction, while reducing computational overhead. BRIEF DESCRIPTION OF THE DRAWINGS
[0112] Figure 1 A flow chart of a method according to a preferred embodiment of the present invention;
[0113] Figure 2 Schematic diagram of the training process of the expert routing network in the preferred embodiment of the present invention. DETAILED DESCRIPTION
[0114] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0115] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present application belongs.
[0116] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application; as used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form, and it should be understood that when the terms "comprise" and / or "include" are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or their combinations.
[0117] like Figure 1 As shown, this embodiment provides a hybrid expert multi-model task processing system based on an AI Agent scenario, including the following steps:
[0118] Step S1: Unstructured data and semi-structured data Perform semantic segmentation and generate a set of knowledge blocks ; Generate vector representation set through Embedding model , and stored in the FAISS vector database to build the RAG text knowledge base.
[0119] In this embodiment, step S1 specifically includes the following steps:
[0120] Step S11: Unstructured data and semi-structured data Standardize them separately;
[0121] Unstructured text extraction function Extract text from unstructured data ;
[0122]
[0123] Semi-structured conversion text function Extracting text from semi-structured data ;
[0124]
[0125] in, Indicates the file type;
[0126] Step S12: Generate a knowledge block set using semantic block segmentation algorithm ,in, Indicates the A knowledge block, Indicates the number of knowledge blocks in the set;
[0127]
[0128] Generative Algorithms Defined as;
[0129]
[0130] in, Indicates the Split blocks to A collection of documents for each partition, is the sliding window size, is the step size of the sliding window, Indicates the total number of documents;
[0131] Step S13: Use the pre-trained BERT model as the vector encoding generator, denoted as , generate the embedding vector representation set corresponding to each knowledge block ,in, Indicates the The knowledge blocks correspond to vectors, Indicates the The knowledge blocks correspond to vectors, Indicates the The knowledge blocks correspond to vectors, Represents the number of knowledge block vectors in the set;
[0132]
[0133] in, The vector dimension of
[0134] Step S14: Store the vector into the FAISS database using the inverted index function Build the knowledge base index:
[0135]
[0136] in, represents the number of cluster centers in the inverted list, represents the number of product quantization subspace partitions, Indicates the number of coding bits for each subspace.
[0137] Step S2: For the text input by the user , construct the query vector , calculate the similarity between user input and RAG knowledge block , select the one with the highest similarity knowledge blocks constitute a set of related document vectors ;
[0138] In this embodiment, step S2 specifically includes the following steps:
[0139] Step S21: User inputs text Embed the model as described in step 13 Convert to query vector;
[0140]
[0141] in, is the vector after the text is transformed by the embedding model, For word vector Dimensions;
[0142] Step S22: Normalize the query vector and the knowledge block vector, and calculate the cosine similarity between the query vector and all vectors in the RAG knowledge base:
[0143]
[0144] in, Indicates L2 normalization, for vector The calculation formula is:
[0145]
[0146] Step S23: Sort in descending order of similarity and select the one with the highest similarity. knowledge blocks, forming a set of related document vectors, which are expressed as follows:
[0147]
[0148] Among them, topN represents the optimal N values, V topN Indicates that the topN knowledge blocks constitute a related document vector set, represents the knowledge block vector that meets the conditions, Indicates the minimum similarity threshold.
[0149] Step S3: Concatenate the user input and the reverse decoded document and input them into the LLM to divide the user task into a set of subtasks. , and generate the subtask dependency matrix , construct a directed acyclic graph .
[0150] In this embodiment, step S3 specifically includes the following steps:
[0151] Step S31: Reverse decode the topN knowledge block vectors to obtain the original text and aggregate the user input :
[0152]
[0153]
[0154] in, This is the reverse decoding result of the first topN vector. For the The reverse decoding results of the topN vectors are matched. The Nth reverse decoding result of the topN vector is: is the aggregated document after reverse decoding of the topN vector set, Represents a splicing operation;
[0155] Step S32: Decompose the task based on LLM, input includes user-given task , related knowledge base data , output subtask , Subtask Description and subtask dependencies , which can be expressed as:
[0156]
[0157] in, Represents the prompt words input into the LLM by combining user input and related document sets;
[0158] Step S33: For the extracted subtask set ,in, Indicates the subtasks, Indicates the total number of subtasks and establishes a dependency matrix , build a directed acyclic graph of subtask dependencies :
[0159]
[0160]
[0161]
[0162] Among them, the subtask set As a graph The vertex, For the picture The directed edge of Indicates dependent subtasks Other subtask sets.
[0163] Step S4: Based on the scoring model and expert model pool Building a task assignment dataset .
[0164] In this embodiment, step S4 specifically includes the following steps:
[0165] Step S41: For the expert pool ,in is the first Models, is the total number of models in the model pool; for all expert models Assign simple tasks , using the scoring model Match the generated results of each model , fluency and credibility Multidimensional scoring, scoring model Expressed as:
[0166]
[0167] The matching degree measures the similarity between the question and the answer generated by the model and is defined as:
[0168]
[0169] Fluency measures the logical relevance of the sentences before and after the model generates the result, and is defined as:
[0170]
[0171] Credibility measures the consistency between the model-generated results and the real content and is defined as:
[0172]
[0173]
[0174] in, For the The output of the model, For the The model output A sentence, Calculate the logical relationship between two sentences, Indicates that the output sentence is consistent with the facts. Indicates the The total number of model output sentences;
[0175] Step S42: Perform weighted summation on the multi-dimensional scores to calculate the final score of each model :
[0176]
[0177]
[0178] in, are the weights of matching, fluency and credibility respectively;
[0179] Re-sort all models and outputs according to the comprehensive score to obtain the sorted set representation corresponding to the model: ,in , Respectively represent the ranking The comprehensive rating of Respectively represent the ranking The model corresponding to the comprehensive score, Respectively represent the ranking The comprehensive score corresponds to the answer of the model, and the two models with the highest scores and the corresponding task input are added to the task-model assignment dataset :
[0180]
[0181] Step S43: Reselect a simple task , repeat steps S41 and S42 to construct a complete data set.
[0182] Step S5: Based on the task allocation dataset constructed in step S4, a multi-objective optimization strategy is adopted to jointly train the hybrid expert routing network.
[0183] In this embodiment, step S5 specifically includes the following steps:
[0184] Step S51: Generate task feature vector from simple task , each model constructs a model feature vector for the output of the task express:
[0185]
[0186]
[0187] in, Represents the MLP model The task feature vector, Indicates the MLP model Output the model feature vector constructed by the result, Indicates a task Indicates the number of tokens in the output text of each model, represents the dimension of the task feature vector, Represents the dimension of the model feature vector;
[0188] Step S52: Concatenate and fuse the task feature vector and the model feature vector, and map them. At the same time, perform global pooling on the features to obtain the corresponding feature representation:
[0189]
[0190]
[0191] in, Represents the first layer, Indicates the The model feature vector representation obtained by concatenating the two vector features of the layer is and Respectively represent The weight matrix and bias weights of the layer model, express The vector dimension of is the number of neurons in the current hidden layer, is the feature vector after global pooling;
[0192] Step S53: After adopting MLP multi-layer mapping, the hybrid routing expert model performs Softmax normalization to output the probability of each expert being elected, which is expressed as:
[0193]
[0194] in, Indicates processing tasks The number of expert models, and Represents the original prediction of the MLP model experts and The probability of an expert being selected is the transpose of the weight matrix of the original output, Dimensions;
[0195] Step S54: Calculate the loss function of the model score of the hybrid expert routing assignment. Defined as:
[0196]
[0197] in, Indicates the total number of subtasks, is the current subtask, In the subtask The optimal model obtained by training The two models with the best performance in the dataset, Indicates that hybrid expert routing is used in tasks The model score obtained by Softmax during training, Indicates that in the task Next, the dataset The optimal model score corresponding to the task in .
[0198] The training process of the expert routing network in this embodiment is as follows: Figure 2 shown.
[0199] Step S6: For a given user task, follow the method of steps S1-S5 to assign multiple experts to process the subtasks according to the dependency relationship, and use the hybrid expert routing network to weight the best answer for each subtask. ; Generate dependency aggregation for subtask answers ,Finally, the aggregated answer of each subtask is used as the user task result.
[0200] In this embodiment, step S6 specifically includes the following steps:
[0201] Step S61: Based on step S3, the user's input After the subtask graph is constructed, for each subtask , calculate its vertex indegree:
[0202]
[0203] If and only if hour The dependency value of the task after execution All are updated to 0;
[0204] Step S62: traverse the remaining task nodes once to obtain a set of executable tasks , the probability of an executable task being output by the routing model:
[0205]
[0206] in, Represents model y Subtasks vector, represents the routing network, for The vector dimension of
[0207] exist Find the largest two The corresponding model is expressed as:
[0208]
[0209]
[0210] in, ( ) function to realize the output probability vector The two models with the largest median and , and Respectively in subtasks The probability of being elected output by the optimal and suboptimal models is: are the probability and threshold;
[0211] Step S63: Input the subtask result into the post-processing model T5 to generate the best answer to the subtask , the non-dependent subtasks are input into the expert model in parallel for processing, and the feedback results of the multi-expert model are obtained:
[0212]
[0213]
[0214]
[0215] in, Indicates that the top1 model processes the subtask Output results, Indicates top2 model processing Subtask output results, Indicates processing subtasks The best results obtained, express The maximum number of tokens in the output result after processing, Indicates For input weights, use a lightweight model About content Perform weighted fusion output;
[0216] Step S64: According to the directed acyclic task graph, aggregate the best results of the subtasks generated by the expert model to generate the dependency aggregation of the subtask answers. , which can be expressed as:
[0217]
[0218] in, Represents each user task The total number of subtasks decomposed;
[0219] This embodiment also provides a hybrid expert multi-model task processing system based on an AI Agent scenario, including knowledge base construction, task parsing and construction modules, a hybrid expert routing network, and a subtask parallel execution strategy. The coordinated operation of these modules can realize the above-mentioned task processing method based on the hybrid expert architecture.
[0220] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0221] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0222] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0223] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0224] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any other manner. Any person skilled in the art may utilize the above-disclosed technical content to modify or modify the present invention into equivalent embodiments. However, any simple modifications, equivalent variations, and modifications to the above embodiments that do not depart from the technical content of the present invention and are based on the technical essence of the present invention remain within the scope of protection of the present invention.
Claims
1. A hybrid expert multi-model task processing method based on AI Agent scenario, characterized by: The following steps are involved: Step S1: Unstructured data and semi-structured data Perform semantic segmentation and generate a set of knowledge blocks ; Generate vector representation set through Embedding model , and stored in the FAISS vector database to build the RAG text knowledge base; Step S2: User input text , construct the query vector , calculate the similarity between user input and RAG text knowledge base , select the one with high similarity knowledge blocks constitute a set of related document vectors ; Step S3: Concatenate the user input and the reverse decoded document and input them into the large language model LLM, divide the user task into a set of subtasks , and generate the subtask dependency matrix , construct a directed acyclic graph ; Step S4: Based on the scoring model and expert model pool Building a task assignment dataset ; Step S5: Task allocation dataset constructed based on step S4 ,A multi-objective optimization strategy is adopted to jointly train the hybrid expert routing network; Step S6: For a given user task, follow the method of steps S1 to S5 to assign multiple experts to process the subtasks according to the dependency relationship, and use the hybrid expert routing network to weight the answers to each subtask. ; Generate dependency aggregation for subtask answers ,Finally, the aggregated answer of each subtask is used as the user task result.
2. The hybrid expert multi-model task processing method based on the AI Agent scenario according to claim 1 is characterized in that: The step S1 specifically includes the following steps: Step S11: Unstructured data and semi-structured data Standardize them separately; Unstructured text extraction function Extract text from unstructured data ; Semi-structured conversion text function Extracting text from semi-structured data ; in, Indicates the file type; Step S12: Generate a knowledge block set using semantic block segmentation algorithm ,in, Indicates the A knowledge block, Indicates the A knowledge block, Indicates the A knowledge block, Indicates the number of knowledge blocks in the set; Generative Algorithms Defined as; in, Indicates the Split blocks to A collection of documents for each partition, is the sliding window size, is the step size of the sliding window, Indicates the total number of documents; Step S13: Use the pre-trained BERT model as the vector encoding generator and embed the model f emb , generate the embedding vector representation set corresponding to each knowledge block ,in, Indicates the The knowledge blocks correspond to vectors, Indicates the The knowledge blocks correspond to vectors, Indicates the The knowledge blocks correspond to vectors, Represents the number of knowledge block vectors in the set; in, is the vector corresponding to the knowledge block The vector dimension of Step S14: Store the vector into the FAISS database using the inverted index function Build the knowledge base index: in, represents the number of cluster centers in the inverted list, represents the number of product quantization subspace partitions, Indicates the number of coding bits for each subspace.
3. The hybrid expert multi-model task processing method based on the AI Agent scenario according to claim 1 is characterized in that: The step S2 specifically includes the following steps: Step S21: User inputs text Through the embedding model Converted into query vector ; Step S22: Normalize the query vector and the knowledge block vector, and calculate the cosine similarity between the query vector and all vectors in the RAG knowledge base: in, Indicates L2 normalization, T indicates transpose, for vector The calculation formula is: Step S23: Sort in descending order of similarity and select the one with the highest similarity. knowledge blocks, forming a set of related document vectors, which are expressed as follows: Among them, topN represents the optimal N values, V topN express Knowledge blocks constitute a collection of related document vectors. represents the knowledge block vector that meets the conditions, Indicates the minimum similarity threshold.
4. The hybrid expert multi-model task processing method based on the AI Agent scenario according to claim 1 is characterized in that: The step S3 specifically includes the following steps: Step S31: reverse decode the topN knowledge block vectors to obtain the original text and aggregate the user input text : in, is the first reverse decoding result that meets the topN vector, This is the reverse decoding result of the second topN vector. For the The reverse decoding results of the topN vectors are matched. The Nth reverse decoding result of the topN vector is: is the aggregated document after reverse decoding of the topN vector set, Represents a splicing operation; Step S32: Decompose the task based on the large language model LLM, and the input includes the user input text , aggregated documents after reverse decoding of the topN vector set , output subtask , Subtask Description and subtask dependencies , expressed as: in, Represents the prompt word input into the large language model LLM based on user input and related document collection; Step S33: For the extracted subtask set ,in, Indicates the subtasks, Indicates the subtasks, Indicates the subtasks, Indicates the total number of subtasks and establishes a dependency matrix , build a directed acyclic graph of subtask dependencies : Among them, the subtask set As a graph The vertex, For the picture The directed edge of Represents a set of other subtasks that a subtask depends on.
5. The hybrid expert multi-model task processing method based on the AI Agent scenario according to claim 1 is characterized in that: The step S4 specifically includes the following steps: Step S41: For the expert pool ,in is the first Expert models, is the first Expert models, is the first Expert models, is the total number of models in the model pool; assign simple tasks to all expert models , using the scoring model Match the generated results of each expert model , fluency and credibility Multidimensional scoring, scoring model Expressed as: Matching measures the similarity between questions and answers generated by the model , defined as: Fluency measures the logical relevance of the sentences before and after the model generates the result , defined as: Credibility measures the consistency between the model-generated results and the real content , defined as: in, Representation Model For tasks The scoring matrix, For the The output of the model, For the The model output A sentence, Calculate the logical relationship between two sentences, Indicates that the output sentence is consistent with the facts. Indicates the The total number of model output sentences; Step S42: Perform weighted summation on the multi-dimensional scores to calculate the final score of each model : in, are the weights of matching, fluency and credibility respectively; Re-sort all models and outputs according to the comprehensive score to obtain the sorted set representation corresponding to the model: ,in , Respectively represent the ranking The comprehensive rating of Respectively represent the ranking The model corresponding to the comprehensive score, Respectively represent the ranking The comprehensive score corresponds to the answer of the model, and the two models with the highest scores and the corresponding task input are added to the task-model assignment dataset : Step S43: Reselect a simple task , repeat steps S41 and S42 to construct a complete data set.
6. The hybrid expert multi-model task processing method based on the AI Agent scenario according to claim 1 is characterized in that: The step S5 specifically includes the following steps: Step S51: Generate task feature vector from simple task , each model constructs a model feature vector for the output of the task express: in, represents the task feature vector generated by the MLP model from the simple task, Represents the model feature vector constructed by each model in the MLP model for the task output result, Represents a subtask The number of tokens contained in Indicates the number of tokens in the output text of each model, represents the dimension of the task feature vector, Represents the dimension of the model feature vector; Step S52: Concatenate and fuse the task feature vector and the model feature vector, and map them. At the same time, perform global pooling on the features to obtain the corresponding feature representation: in, Represents the first layer, Indicates the The model feature vector representation obtained by concatenating the two vector features of the layer is and Respectively represent The weight matrix and bias weights of the layer model, express The vector dimension of is the number of neurons in the current hidden layer, is the feature vector after global pooling; Step S53: After adopting MLP multi-layer mapping, the hybrid routing expert model performs Softmax normalization to output the probability of each expert being elected. , expressed as: in, Indicates processing tasks The number of expert models, and Represents the original prediction of the MLP model experts and The probability value of an expert being selected, is the transpose of the weight matrix of the original output, express Dimensions; Step S54: Calculate the loss function of the model score of the hybrid expert routing assignment. Defined as: in, Indicates the total number of subtasks, is the current subtask, In the subtask The optimal model obtained by training The two models with the best performance in the dataset, Indicates that hybrid expert routing is used in tasks The model score obtained by Softmax during training, Indicates that in the task Next, the dataset The optimal model score corresponding to the task in .
7. The hybrid expert multi-model task processing method based on the AI Agent scenario according to claim 1 is characterized in that: The step S6 specifically includes the following steps: Step S61: According to step S3, the user inputs text After the subtask graph is constructed, for each subtask , calculate its vertex indegree : If and only if hour The dependency value of the task after execution All are updated to 0; Step S62: traverse the remaining task nodes once to obtain a set of executable tasks , the probability of an executable task being output by the routing model: in, Represents model y The probability vector of subtasks, represents the routing network, for The vector dimension of exist The model corresponding to the two largest probability values is expressed as: in, ( ) function to realize the output probability vector The two models with the largest median and , and Respectively in subtasks The probability of being elected output by the optimal and suboptimal models is: are the probability and threshold; Step S63: Input the subtask result into the post-processing model T5 to generate the best answer to the subtask , the non-dependent subtasks are input into the expert model in parallel for processing, and the feedback results of the multi-expert model are obtained: in, Indicates that the top1 model processes the subtask Output results, Indicates top2 model processing Subtask output results, Indicates processing subtasks The best results obtained, express The maximum number of tokens in the output result after processing, Indicates For input weights, use a lightweight model About content Perform weighted fusion output; Step S64: According to the directed acyclic task graph, aggregate the best results of the subtasks generated by the expert model to generate the dependency aggregation of the subtask answers. , expressed as: in, Represents each user task The total number of subtasks broken down.
8. A hybrid expert multi-model task processing system based on AI Agent scenario, characterized by: It includes knowledge base construction, task parsing and construction modules, hybrid expert routing network, and subtask parallel execution strategy. The modules work together to implement the hybrid expert multi-model task processing method based on the AI Agent scenario as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for reducing multi-model task queuing time delay
CN115686776A
Method and device for dynamically generating multi-modal hybrid expert model
CN118865409A
Evaluation method and device based on multi-model interaction
CN119357607A
Automatic RAG knowledge base construction method and system based on large model
CN119558393A
Artificial intelligence routing method, artificial intelligence routing system and computer equipment
CN119814634A
Cited By
Multi-domain task processing method, system and equipment based on knowledge fusion and Agent cooperation and medium
CN120996215A
Multi-scene electric quantity load prediction method and system based on hybrid expert model
CN121172755A
Collaborative matching method and device for large language model, equipment and medium
CN121434798A
Dynamic routing method and device based on self-purification expert feedback pool
CN121936598A