Method and device for data analysis based on multiple agents
Through supervised training language big models to extract tasks, intentions and entity information, and perform multi-agent data analysis, solving the problems of low accuracy and information loss of collaborative execution in the existing technology, and achieving efficient data analysis results.
Patent Information
- Application Number
- CN202510538887.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-25
- Publication Date
- 2025-07-29
AI Technical Summary
The prior art has problems such as inability to understand vertical domain expression, processing multisense information, model illusion, inclusion complexity and context length limitation in multiagent collaborative data analysis, resulting in low accuracy of collaborative execution.
Use the supervised and trained language model to extract tasks, intent and entity information, conduct task planning, determine serial and parallel strategies, and pass data through predetermined data structures, and call the target agent to perform tasks.
It improves the accuracy and stability of data analysis, avoids information loss and error, and enhances the ability to understand complex natural languages.
Smart Images

Figure CN120386603A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of computer technology, and more particularly, to a method and apparatus for performing data analysis based on multiple agents. Background Art
[0002] An agent is an entity that possesses at least one of the following capabilities: perception, decision-making, and execution. With the rapid development of the agent concept, many pre-packaged agents have emerged in fields such as data analysis. Users are no longer satisfied with simply completing single data analysis tasks using natural language, but are turning to more complex tasks that require the collaboration of multiple agents.
[0003] The concept of a gated agent originates from a multi-agent architecture and is used to understand, route, and distribute user commands. A gated agent can perform business processing (such as data analysis) through intent perception, task planning, and agent collaboration. It understands user commands, converts them into tasks that can be executed by agents, and identifies and extracts key information from these tasks (such as intent and entities). It then generates an execution plan for each identified task based on its execution order and dependencies, and coordinates the results of tasks distributed to each agent. For example, in the execution of dependent tasks, the execution results of the previous agent are processed and handed off to the next agent for execution. An agent can be an entity that understands user intent, performs task planning, or executes tasks. For example, a model for understanding user intent can be an agent, as can a task module that performs search tasks, and so on. In the execution of various agents, such as data analysis, data extraction, chart creation, and Q&A, a gated agent acts as a central hub, performing tasks planning and distribution based on user instructions. Summary of the invention
[0004] One or more embodiments of this specification describe a method and apparatus for performing data analysis based on multiple agents to solve one or more problems mentioned in the background art.
[0005] According to a first aspect, a method for data analysis based on multi - agents is provided. The method includes: for a current data analysis request, using a fine - tuned large language model to simultaneously extract the following information: at least one task, and the respective intent and entity corresponding to each task; performing task planning to determine the execution order of each task, where the execution order includes the serial - parallel strategy between tasks; according to the task planning result, based on the intent corresponding to each task, calling target agents from multiple candidate agents to execute each task to obtain a data analysis result, where the multiple candidate agents respectively correspond to different intents, and tasks with data dependencies transfer data through a predetermined data structure, and the predetermined data structure is determined based on the task information in the data analysis field.
[0006] In one embodiment, a single intent is an operation implemented by a single candidate agent, a single entity is an object, operation item, or operation result in a task, a single task corresponds to a single intent, and several entities.
[0007] In one embodiment, each entity in a single task is further processed by at least one of the following: entity filling, entity disambiguation.
[0008] In one embodiment, the fine - tuning of the large language model is supervised fine - tuning through multiple training samples. A single training sample includes: a historical data analysis request as input data, and several tasks and the respective intent and entity corresponding to each task as labeled data.
[0009] In one embodiment, the information extracted by using the large language model further includes the data dependencies between tasks; the performing task planning to determine the execution order of each task includes: determining that tasks with data dependencies are executed serially, and tasks without data dependencies are executed in parallel.
[0010] In a further embodiment, the performing task planning to determine the execution order of each task further includes: determining the candidate agent called for task execution according to the intent; using the dependency rules between candidate agents to check and filter the planned task execution order to eliminate the task execution order planning outside the dependency rules.
[0011] In one embodiment, the data structure corresponds to multiple predetermined attributes, and a single attribute value corresponding to a single predetermined attribute is used to describe a single entity; during the process of calling target agents from multiple candidate agents to execute each task, the execution result of a previous task is described by the attribute value of the corresponding attribute, and the agent corresponding to a subsequent task obtains the execution result of the previous task by acquiring the attribute value in the corresponding attribute of the data structure.
[0012] In a further embodiment, each of the predetermined attributes is based on each data type refined from the information to be transmitted between the multiple candidate agents, and each data type includes at least one of the following: dimension, metric, filter, sort, limit.
[0013] In one embodiment, the planning result includes at least one directed acyclic graph, and the step of calling a target agent from the multiple candidate agents to execute each task to obtain a data analysis result includes: merging the execution results of each directed acyclic graph to obtain the data analysis result.
[0014] According to a second aspect, there is provided an apparatus for data analysis based on multiple agents, the apparatus including:
[0015] An extraction unit configured to, for a current data analysis request, use a fine-tuned large language model to simultaneously extract the following information: at least one task, and the intent and entity corresponding to each task respectively;
[0016] A planning unit configured to perform task planning to determine the execution order of each task, where the execution order includes the serial and parallel strategies between tasks;
[0017] An execution unit configured to, according to the task planning result, based on the intent corresponding to each task, call a target agent from the multiple candidate agents to execute each task to obtain a data analysis result, where the multiple candidate agents respectively correspond to different intents, and data is transmitted between tasks with data dependencies through a predetermined data structure, and the predetermined data structure is determined based on the task information in the data analysis field.
[0018] According to a third aspect, there is provided a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed in a computer, the computer is made to execute the method of the first aspect.
[0019] According to a fourth aspect, there is provided a computing device including a memory and a processor, where an executable code is stored in the memory, and when the processor executes the executable code, the method of the first aspect is implemented.
[0020] Through the device and method provided in the embodiments of this specification, during the data analysis process, for the current data analysis request, a pre-supervised fine-tuned large language model is used to simultaneously extract task information such as intents, entities, and tasks. Then, based on the task information, a plan is made to determine the serial and parallel strategies between tasks. Then, the target agent corresponding to the intent of each task is called from the candidate agents, and the entity is used as a parameter for data analysis to obtain the data analysis result. Among them, by outputting simultaneously in combination with intents, entities, and tasks, it is possible to avoid the errors or more uncertainties introduced in the case of sequential derivation and construct a data structure for task collaboration, which can effectively solve the problem of information loss caused by too long context lengths. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0022] Figure 1 This shows a schematic diagram of a specific implementation architecture of the gated Agent in this specification;
[0023] Figure 2 This shows a schematic flowchart of data analysis based on multiple agents in an embodiment of this specification;
[0024] Figure 3 This shows a task planning flowchart (DAG diagram) according to a specific example of this specification;
[0025] Figure 4 This shows a schematic flowchart of data analysis based on multiple agents in a specific example;
[0026] Figure 5 This shows a schematic diagram of the computing architecture for data analysis based on multiple agents according to the embodiments of this specification;
[0027] Figure 6 This shows a block diagram of the structure of a device for data analysis based on multiple agents according to an embodiment of this specification. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0028] The following describes the solutions provided in this specification in conjunction with the drawings.
[0029] Figure 1 This shows a schematic diagram of a specific implementation architecture of the gated Agent in this specification. As Figure 1As shown in the figure, in the implementation architecture of the gating Agent, the gating Agent, as a control center, can receive user input or select a data analysis request (input query, for example, a specific example is "query the monthly per capita water consumption and monthly per capita gas consumption of cities with a monthly per capita water consumption exceeding 3 tons and analyze the correlation therein"), analyze it, call relevant Agents to execute relevant services, and feedback the data analysis results to the user (such as feedback "city list and analysis results").
[0030] Specifically, the gating Agent can expose the input or selection interface of the data analysis service to the user through the human-computer interaction interface, and the user inputs a data analysis request or selects a data analysis item (as the input query, which is uniformly referred to as the data analysis request in this specification). In the case of receiving a data analysis request, the data analysis request can be analyzed to understand the target intention contained therein, and task splitting can be performed, such as splitting out "query cities with a monthly per capita water consumption exceeding 3 tons", "obtain the monthly per capita water consumption of the corresponding cities", "obtain the monthly per capita gas consumption of the corresponding cities", "analyze the correlation between the monthly per capita water consumption and the monthly per capita gas consumption", and so on. Then, an execution plan for the split tasks is made. Among them, the execution plan can include the execution order planning of parallel strategies and serial strategies for each task, and so on. The execution of tasks can be carried out by calling Agents, and the Agents called can be selected from candidate Agents. For example, the corresponding Agent can be selected through the candidate Agent identification list. A single candidate Agent can correspond to a packaged functional module to implement corresponding functions, such as data fetching functions, analysis functions, etc. Then, during the execution process, relevant data is obtained by calling Agents to execute relevant tasks, and data analysis results are obtained. The relevant data can, for example, include at least one of the following: various data tables, feature data in the feature center, knowledge graph data, representation vectors in the vector library, and so on.
[0031] In the conventional design of the gating Agent, the following several types are included:
[0032] (1) Based on the open Manus Planning Flow, through the method of prompt engineering of the large model, based on the capabilities of the large model itself, combined with the description texts of each provided Agent, the understanding of the planning tasks is completed. After the task planning is completed, the results of the Agents are processed by the large model and the next task is planned;
[0033] (2) Based on Natural Language Understanding (NLU), the goal of NLU is to understand the user's natural language and map the user's expression into structured semantics, such as intent + entity. The more specific and clear the user's expressed intent is, the higher the user's expression cost, and the easier the NLU processing. The more ambiguous and concise the user's expressed intent is, the lower the user's expression cost, and the more difficult the NLU processing. NLU usually includes two important capabilities: intent understanding and entity extraction, and is usually implemented in two ways: first identify the intent, and then extract the entity according to the intent; extract the intent and entity simultaneously;
[0034] (3) It is achieved through the multi-round dialogue and natural language understanding capabilities of the large model itself. For example, by designing the prompt, generate the execution task for the output result of the previous Agent and the input parameter information of the next Agent.
[0035] In conventional technologies, there may be other data analysis methods based on gated Agents, which will not be elaborated here. Problems that may exist in the solutions of conventional technologies are, for example: relying on the open Manus plan flow and large model, it may not be able to understand relevant expressions in vertical fields; it cannot process information not explicitly mentioned in the query, such as the data extraction instruction "who audits the fastest", and cannot recognize the target business requirement of "the name of the person with the shortest audit time"; it cannot process polysemous information in the query, such as the same description may correspond to multiple entity types, this kind of polysemous information; model hallucination, which may lead to input parameters that do not exist in the generated instruction during task planning; in the case of relatively complex input parameters, the model cannot understand the data input parameters, resulting in relatively low accuracy of collaborative execution; the context length brings limitations, and tasks that are too long and too complex may not be executable, and so on.
[0036] In view of this, this specification provides a data analysis technical solution applied to gated Agents. Based on multi-agent for data analysis, after receiving a data analysis request, use an information extraction model based on supervised training to simultaneously extract the following information from the data analysis request: at least one task and the intent and entity corresponding to the task. Then, plan each task to determine the corresponding execution order (including serial and parallel strategies). Next, use the entity as a known item (such as known parameters, fields, etc.), and call the corresponding Agent in the candidate Agents to execute each task to obtain the data analysis result. Among them, the output structure combining task planning, intent understanding, and entity extraction can solve the polysemy problem that traditional NER may face, reduce the error in the case of sequential determination. During the task execution process, transfer data between the front and back Agents through a predetermined data structure for engineering collaboration to avoid the loss of context information caused by too long information.
[0037] In terms of further technical details, using a large language model (LLM) based on supervised fine-tuning (SFT) as an information extraction model can solve the problems of insufficient knowledge in related fields and overly complex input parameters for data analysis agents. Supervised training ensures the stability and accuracy of the output.
[0038] The technical concept of this specification is described in detail below with reference to the embodiments shown in the accompanying drawings.
[0039] Figure 2 The flow chart of data analysis based on multi-agent proposed in the embodiment of this specification is shown. The execution subject of this process can be a computer, device, or server with certain computing capabilities. More specifically, it can be a computing platform that implements the gated agent (refer to Figure 1 ).like Figure 2 As shown, the process of data analysis based on multiple agents includes the following steps: Step 201, for the current data analysis request, using a fine-tuned language model to simultaneously extract the following information: at least one task, and the intent and entity corresponding to each task; Step 202, performing task planning to determine the execution order of each task, and the execution order includes a serial and parallel strategy between tasks; Step 203, according to the task planning results, based on the intent corresponding to each task, calling the target agent from multiple candidate agents to perform each task to obtain data analysis results, wherein the multiple candidate agents correspond to different intents respectively, and data is transferred between tasks with data dependencies through a predetermined data structure, and the predetermined data structure is determined based on the task information in the data analysis field.
[0040] First, in step 201 , for the current data analysis request, the fine-tuned language model is used to simultaneously extract the following information: at least one task, and the intent and entity corresponding to each task.
[0041] It can be understood that a data analysis request is a description of the target business that requires data analysis. It can be input by the user or selected from multiple candidate data analysis businesses (usually provided by the service platform). It can also be a phased business generated when processing more complex businesses, such as two data analysis tasks generated during the process of performing multiple data analyses. Among them, data analysis requests can be described in natural language, such as "Correlation analysis of the number of park visitors and the average length of stay per park in April" and so on.
[0042] For data analysis requests, task information can be extracted using a pre-trained information extraction model. This information extraction model can be a natural language processing model. Self-attention mechanisms like the Transformer are generally effective at processing natural language information, so the information extraction model can be implemented using the Transformer architecture, but other reasonable architectures are not excluded. Taking the Transformer architecture as an example, the information extraction model can be a model designed based on the Transformer architecture or a pre-trained model based on the Transformer architecture (such as the Large Language Model (LLM)).
[0043] The task information here may, for example, include at least one task and its respective intents and entities. A task can be an operational goal achieved through one or more (usually one) independent functional modules, which can be associated with an agent. A task can be implemented by an agent as a functional module, but a single agent can also implement several similar tasks. For example, the task of "querying April's park admission information" can be implemented by a single agent. This single agent can not only implement the task "querying April's park admission information" but also other similar business goals, such as "querying June's park admission information," and so on. At least one task can be extracted from a data analysis request. It will be appreciated that for more complex data analysis requests, tasks can be broken down based on the corresponding descriptive information, resulting in multiple specific tasks that can be implemented by agents. The operations performed to achieve the operational goal can be recorded as intents. In the data analysis business scenario, intents may include, for example, "get data," "analyze," "create charts," and so on. Intents are generally associated with agents, with one intent being implemented by one agent. In alternative embodiments, intents and candidate agents may have a one-to-one correspondence. An entity can be the target object of the operation in the intent, an operation item (such as a field in a data table), or an operation result, etc. For example, the entities corresponding to the intent of "getting data" can include "date", "April", "park", etc.
[0044] The information extraction model can be pre-trained using training samples from relevant business scenarios. To more accurately extract information about tasks, intents, and entities in data analysis services from data analysis requests, training samples can be constructed using historical data related to the data analysis scenarios. For example, training samples can be constructed by collecting a large amount of historical data analysis records from relevant applications. Training samples can include input data and labeled data. The input data, for example, can be historical data analysis requests described in natural language, while the labeled data can include the corresponding tasks, intents, and entities.
[0045] In order to enable the information extraction model to more stably output the expected results, reduce randomness and instability, and achieve higher accuracy in entity recognition, intent recognition, and task planning, in one embodiment, label data can be constructed for tasks, intents, and entities using a predetermined format, and tasks, intents, and entities can be mixed and associated. For example, for the input data of "Correlation analysis of the number of park visitors and the average length of stay in each park in April", the corresponding label data can be:
[0046] "taks1:
[0047] Task: Filter records for April, group by park, and count the number of park visitors
[0048] Intent: Get data
[0049] Entity: Date Month 4 Park admissions
[0050] taks2:
[0051] Task: Filter records for April, group by park, number of people entering the park, and length of stay
[0052] Intent: Get data
[0053] Entity: Date Month 4 Average length of stay in the park
[0054] taks3:
[0055] Task: Analyze the correlation between the number of park visitors and the average length of stay
[0056] Intent: Analyze
[0057] Entity: Number of park visitors and average length of stay.
[0058] The above predefined format can identify multiple tasks, each corresponding to a single intent, and entities describing the target object, operation item (such as a table field), or operation result of the corresponding operation. Using the predefined format shown above, the corresponding intent and entity can be determined for each identified task, thereby strongly associating the task with the intent and entity.
[0059] In an optional embodiment, the task and intention can be selected from a plurality of predetermined candidate tasks and candidate intentions. For example, each intention can be associated with a candidate Agent (refer to Figure 1corresponds to (as shown), such as a single candidate intent corresponding to a single Agent. Additionally, a single task can correspond to a single or multiple intents. As a specific example, candidate intents can include multiple types of intents such as analysis, data fetching, question answering, etc. In some embodiments, entities can also be distinguished by type. For example, there can be entities corresponding to multiple candidate types such as metrics, dimension values, dimensions, etc. Entities under each type can be mined by the information extraction model itself.
[0060] According to an optional embodiment, during the information extraction process for a data analysis request, the information extraction model can also fill in entities through synonyms, related words, etc. using the corpus accumulated by the model itself or relying on external corpora. Additionally, according to some other optional embodiments, for the extracted entities, entity disambiguation operations can also be performed. Entity disambiguation is also entity normalization, which is the process of merging the same entities. Entity disambiguation can be performed by merging synonyms or other conventional methods, which will not be elaborated here.
[0061] In the case where the information extraction model is a self-designed natural language processing model, the information extraction model can be directly supervised-trained using training samples. In the case where the information extraction model is a pre-trained open-source model (such as an open-source large language model), the pre-trained open-source model can be supervised fine-tuned (also called instruction tuning) using training samples. In some cases, the RoLA form can also be used to perform supervised instruction tuning on pre-trained models with a large number of parameters in the form of appending a low-rank matrix, which will not be elaborated here.
[0062] In this way, the information extraction model after supervised training can stably output the expected results and can accurately and effectively extract the task information in the data analysis request. In the case where the information extraction model uses a large language model, it can also have better language understanding and generalization capabilities to solve complex natural language understanding problems.
[0063] Additionally, the task information can also include the data dependency relationships between tasks. For example, in the previous example, the task of taks3 needs to depend on the output data of task1 and task2, that is, the result of "data fetching", etc.
[0064] Next, after step 202, task planning is performed to determine the corresponding execution order.
[0065] Planning tasks is the process of arranging the order in which tasks are to be executed. For example, the order of tasks (serial strategy), parallel strategy, and so on. Generally, tasks with data dependencies need to be executed serially, and tasks without data dependencies can be executed in parallel. For example, in the previous example, the intents in task1 and task2 are both "get data", and the two can be performed independently of each other, so they can be executed in parallel. However, the intent analysis of task3 requires the execution result data corresponding to the intents in task1 and task2, so it needs to be executed after task1 and task2 are completed.
[0066] In some optional implementations, the extracted task information may also include data dependencies between tasks. In this case, task planning can be understood as the process of converting the extracted task information into a flowchart of task execution (e.g., recorded as a planning result). In one embodiment, the planning result can be described by a directed acyclic graph (DAG). In graph theory, if a directed graph cannot start from a vertex and return to the point through several edges, then the graph is a directed acyclic graph. In an optional embodiment, the intention contained in the task information has a corresponding relationship with the candidate agent, and the planning result is reflected in the calling order of the agent.
[0067] For example, if planning results are described using a directed acyclic graph (DAG), one or more DAGs can be generated based on each task. Multiple DAGs are often generated due to the type of data analysis being performed. For example, consider the request "Analyze the trend difference between the combined GDP of each province and the GDP of the provincial capital over the past 10 years." This data analysis request includes a parallel analysis requirement for "each province." In this case, each province can correspond to a DAG. For a single DAG, serial and / or parallel dependencies can be determined based on the node combinations. For example, in the example "Correlation analysis of the number of park visitors and length of stay in each park in April," the planning results could be: "Filter records for April, group by park, number of park visitors (data acquisition agent) - parallel → analyze, perform correlation analysis on the number of park visitors and length of stay (analysis agent); filter records for April, group by park, number of park visitors, length of stay (data acquisition agent) - parallel → analyze, perform correlation analysis on the number of park visitors and length of stay (analysis agent)." This means task1 - parallel → task3, and task2 - parallel → task3. Use a directed acyclic graph to express Figure 3 , where nodes t1, t2, and t3 can represent task1, task2, and task3 respectively.
[0068] In some alternative embodiments, task planning can be performed according to a predetermined rule by detecting the correspondence between tasks, intents, and Agents. The predetermined rule can be determined, for example, based on the input and output parameters between Agents. For example, if the input parameter of one Agent is the output parameter of another Agent, then according to the intent, a data dependency relationship is determined to exist between the corresponding two tasks. For example, assume that the input parameter of an Agent a is A. In the case where there is an Agent with an output parameter of A, the predetermined rule can include that the Agent with an output parameter of A and the Agent with an input parameter of A have a data dependency relationship. Then, according to the predetermined rule, it can be determined that there is a data dependency relationship between the task to which the intent with an output parameter of A belongs and the task to which the intent corresponding to Agent a belongs. In this way, the tasks can be associated according to the Agents corresponding to the intents, and then the execution order of the tasks can be determined.
[0069] Considering that due to incorrect model output or overly divergent data analysis requests input by users, illegal dependencies may occur. For example, a task corresponding to an intent corresponding to a comparison Agent is connected after a task corresponding to an intent corresponding to an analysis Agent, which is an obviously illegal dependency relationship. Therefore, according to a possible design, it is also possible to perform task dependency verification and pruning on the planned task execution order (such as DAG connection relationships) according to a predetermined dependency rule to filter out the plans under obviously incorrect or illegal dependency relationships (if any). The dependency rule can define the legal and correct dependency relationships between various Agents (or intents), and the dependency relationships outside the dependency rule can be determined as unreasonable, illegal, or incorrect dependencies.
[0070] In alternative embodiments, the legal dependency relationships (i.e., dependency rules) between candidate Agents can be clarified through a state machine or a rule set, etc. Then, the planned task execution order is matched with a dependency rule set such as a state machine or a rule set (whitelist data set), and the task execution order plans that cannot match the corresponding dependency rules are filtered out, and the legal and valid planning results are retained.
[0071] In this way, through task planning, the execution order of each task can be determined, and the execution order defines the serial and parallel strategies between tasks.
[0072] Then, through step 203, according to the task planning result, based on the intents corresponding to each task, the target Agent is called from multiple candidate agents to execute each task, and the data analysis result is obtained.
[0073] Candidate Agent can be a pre - encapsulated module for implementing corresponding functions. Since a task corresponds to an intention and an intention corresponds to an Agent, corresponding Agent (denoted as the target Agent in this specification) can be called according to the planning result, and corresponding operations can be performed through corresponding data. Among them, the operation objects of some Agents are databases, such as data table fields, feature centers, knowledge graphs, vector libraries, etc., while the operation objects of some Agents are the parameters obtained by the previous Agents, such as the number of people entering the park and the average stay duration in the previous text, etc., and these parameters are embodied by entities. Therefore, when calling candidate Agents to execute each task, relevant data can also be obtained according to the entities in the task.
[0074] According to a possible design, considering that there may be situations such as overly long information, transmission errors, and the task cannot be executed smoothly during the parameter transmission process, in this step 203, a data structure for task collaboration can be defined during the task execution process, and the common attributes used by each candidate Agent are mapped to the attributes of this data structure, so as to store the information as the attribute values of the data structure, effectively avoiding the problem of overly long information. Taking Java implementation as an example, this data structure can be implemented by defining a class in Java, and the attributes of the class are the attributes of this data structure. The attributes of the data structure can be understood as fields, which can be set in advance and selected for use according to needs during the task execution process.
[0075] The common attributes used by each candidate Agent can be attributes that may be used as the input of some Agents and may also be used as the output of some Agents, and they can be determined in advance through manual experience. Taking the data analysis business scenario as an example, by refining the information transmitted for the collaborative tasks among the Agents corresponding to intentions such as measurement, definition, data extraction, analysis, chart generation, etc., elements such as dimensions, measurements, filtering, sorting, and restrictions can be abstracted as the attributes of the data structure. Among them, dimensions can be the splitting and grouping of fields, etc., measurements can be a certain measurement index for the target field of the query, such as average value, statistical value, sum value, etc., filtering can be the corresponding conditions, such as the date is in April, sorting can be the numerical sorting order such as ascending or descending, and restrictions provide the corresponding result filtering conditions, such as taking the top 10 (top10) according to a certain measurement standard (such as from large to small), etc.
[0076] In this way, the execution results of the previous Agents are recorded in the form of attribute values through the attributes of the data structure for collaboration, and the subsequent Agents can obtain the attribute value data from the attribute records of this data structure for relevant operations, effectively avoiding possible errors caused by overly long information, etc.
[0077] In an optional embodiment, after each task is completed, the execution results can be merged to obtain a final data analysis result, which can be provided to the user.
[0078] In order to clarify the above technical solutions, Figure 4 FIG. 1 shows a schematic diagram of a data analysis process based on multiple agents in a specific embodiment. Figure 4 As shown, the user question represents the user input data analysis request "Correlation analysis of the number of park visitors and the average length of stay in each park in April". The task perception stage corresponds to information extraction (corresponding to step 201), that is, the process of extracting task information such as tasks, intentions, entities, etc. from the questions input by the user through the information extraction model. Here, tasks, intentions, and entities are displayed in a predetermined format. In addition, in Figure 4 In the example, the dependencies between tasks are also shown in a single task. Figure 4 As shown in the figure, task1 and task2 do not depend on other tasks, and task3 depends on task1 and task2. A single task corresponds to a single intent, a single intent can correspond to a single candidate agent, and a single candidate agent can correspond to multiple tasks.
[0079] Then, in the task planning stage (corresponding to step 202), according to the task information extracted in the task perception stage, the tasks are planned in series and parallel. For example, if the planning result is task1 ( Figure 4 t1), task2( Figure 4 t2) in parallel, and then parallel with task3 (corresponding to Figure 4 t3) in the serial execution. Figure 4 In , the planning results are described by DAG.
[0080] Then, in the task collaboration stage (corresponding to step 203), the agents corresponding to task1 and task2 can be called in parallel according to the plan, and the execution results can be written into the collaborative structure. For example, "park" is written to the "dimension" attribute, and "April" is written to the "filter" attribute. Task1 writes "number of park visitors" to the "measurement" attribute, indicating that the measurement "number of park visitors" of the "April" and "park" dimensions are filtered out. Task2 writes "average length of stay per person" to the "measurement" attribute, indicating that the measurement "average length of stay per person" of the "April" and "park" dimensions are filtered out. During the execution of Task3, the corresponding data is obtained from the "dimension", "measurement", and "filter" attributes. The execution results of Task3 can be written into the collaborative space or directly stored as data analysis results, which are not limited here.
[0081] Figure 5shows a further computing architecture of this specification, including a service layer, a perception layer, a planning layer, a collaboration layer, and underlying capabilities. The underlying capabilities correspond to auxiliary tools or data that may be used by other layers, such as models (e.g., information extraction models, Figure 5 in the example, it is a large language model LLM for supervised fine-tuning SFT) and data ( Figure 5 labeled as retrieval media, such as feature centers, knowledge graphs, vector libraries, etc.).
[0082] The service layer can be a human-computer interaction layer facing users, providing inputs or selections for target services to users. Taking the data analysis scenario as an example, the target services can include, for example, self-service analysis Copilot, report generation Copilt, etc. The perception layer is connected to the service layer, corresponding to step 201. By obtaining a data analysis request from the service layer, it uses the information extraction model in the underlying capabilities for semantic understanding and extracts task information including tasks, intents, entities, dependency information between tasks, etc.
[0083] The planning layer can correspond to step 202, which is used to construct an execution graph or an execution path, etc. that can be used to assist in guiding the data analysis process according to the dependency relationships between tasks, such as a DAG. Serial and parallel order planning between tasks can be performed in the constructed architecture. Optionally, the constructed architecture can also be optimized, such as through dependency relationship verification, trimming unreasonable dependency relationships, and retaining valid dependency relationships. The planning layer serves as a connection link between the perception layer and the collaboration layer, transforming the task information obtained from semantic understanding into an execution architecture executed by the collaboration layer.
[0084] The collaboration layer can correspond to step 203, which is used to call relevant target Agents according to the execution architecture constructed by the planning layer and sequentially execute corresponding tasks based on the data (retrieval media) in the underlying capabilities. Among them, during the task execution process, a common data structure for each Agent is also defined, which is used for data transfer between tasks with data dependency relationships. This data structure can be accessed by the Agents corresponding to each task, so in Figure 5 it can also be called a common structure. This data structure is constructed through relevant code, and several attributes are set for the defined structure, and relevant data is saved by filling the attribute values, so that subsequent tasks can execute relevant tasks by reading the attribute values. For example, in the data analysis process implemented by Java, a Java class can be defined to implement the data structure for collaboration, and the attributes of the class can correspond to various data types. After each task is executed, the execution results can also be merged as the final result that can be presented to the user.
[0085] It can be understood that Figure 2 、 Figure 4 、 Figure 5The technical concept of this specification is described from different perspectives, and the corresponding parts can be adapted to each other, which will not be elaborated here.
[0086] Reviewing the above process, in the method for data analysis based on multi-agent provided under the technical concept of this specification, during the data analysis process based on multi-agent, for the current data analysis request, using a pre-trained information extraction model, at least one task and task information such as the intention and entity in the task are extracted simultaneously. Then, task planning is carried out to determine the serial and parallel strategies between tasks. Then, the target agents corresponding to each intention are called from the candidate agents, and the entity is used as a parameter for data analysis to obtain the data analysis result. Among them, by combining intention, entity and task and outputting simultaneously, errors caused by overly complex input parameters can be avoided, and the construction of a collaborative data structure can effectively solve the problem of information loss caused by too long context length.
[0087] In addition, by obtaining professional field training data to construct training samples and performing supervised training on the information extraction model, sufficient vertical field professional knowledge can be given to the information extraction model, enabling the model to stably and effectively extract the expected information. The constructed training samples adopt a reasonable structure of mixing intention, entity and task, which can effectively identify the polysemous information in the data analysis request. When the information extraction model adopts a large language model, the large language model can automatically perform entity filling and entity disambiguation according to its pre-trained and instruction-tuned corpus, realize complex semantic understanding, and has better generalization ability.
[0088] It is worth noting that taking the data analysis scenario as an example, by using the historical retained data analysis requirement data and applying the technical solution provided in this specification, on the basis of using the SFT (supervised fine-tuning) to process the large prediction model as the information extraction model, after being evaluated by the self-built data analysis task evaluation set, the overall task execution accuracy can reach as high as 98%.
[0089] According to an embodiment of another aspect, there is also provided a device for data analysis based on multi-agent. This device can be set in a computer, terminal, or server with certain computing capabilities. Figure 6 Figure 600 shows a device for data analysis based on multi-agent according to an embodiment. As Figure 6 shown, the device 600 may include:
[0090] An extraction unit 601, configured to, for the current data analysis request, use the fine-tuned large language model to simultaneously extract the following information: at least one task, and the intention and entity corresponding to each task respectively;
[0091] A planning unit 602, configured to perform task planning to determine the execution order of each task, and the execution order includes the serial and parallel strategies between tasks;
[0092] The execution unit 603 is configured to, according to the task planning result, call a target intelligent agent from multiple candidate intelligent agents to execute each task based on the intention corresponding to each task, and obtain a data analysis result.
[0093] Among them, the multiple candidate intelligent agents respectively correspond to different intentions, and data is transmitted between tasks with data dependencies through a predetermined data structure, and the predetermined data structure is determined based on the task information in the data analysis field.
[0094] It is worth noting that Figure 6 the shown apparatus 600 corresponds to Figure 2 the described method, Figure 2 and the corresponding descriptions in the illustrated method embodiments are equally applicable to the apparatus 600, and will not be repeated here.
[0095] According to an embodiment of another aspect, a computer-readable storage medium is further provided, on which a computer program is stored. When the above computer program is executed in a computer, the computer is made to execute the method described in combination with Figure 2 etc.
[0096] According to an embodiment of still another aspect, a computing device is further provided, including a memory and a processor. An executable code is stored in the memory. When the processor executes the above executable code, the method described in combination with Figure 2 etc. is implemented. Those skilled in the art should be able to realize that in the above one or more examples, the functions described in the embodiments of this specification can be implemented by hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.
[0097] The specific implementation manners described above further elaborate on the purpose, technical solution, and beneficial effects of the technical concept of this specification. It should be understood that the above description is only the specific implementation manners of the technical concept of this specification, and is not used to limit the protection scope of the technical concept of this specification. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solutions in the embodiments of this specification shall be included in the protection scope of the technical concept of this specification.
Claims
1. A method for data analysis based on multi - agents, the method comprising: For a current data analysis request, use a fine - tuned large language model to simultaneously extract the following information: at least one task, and the respective intents and entities corresponding to each task; Perform task planning to determine the execution order of each task, where the execution order includes the serial - parallel strategy between tasks; According to the task planning result, based on the intent corresponding to each task, call target agents from multiple candidate agents to execute each task to obtain a data analysis result. Among them, the multiple candidate agents respectively correspond to different intents, and data between tasks with data dependencies is transmitted through a predetermined data structure, and the predetermined data structure is determined based on the task information in the data analysis field.
2. The method according to claim 1, wherein A single intent is an operation implemented by a single candidate agent, a single entity is an object, operation item, or operation result in a task, a single task corresponds to a single intent, and several entities.
3. The method according to claim 1 or 2, wherein, Each entity in a single task is also processed by at least one of the following: entity filling, entity disambiguation.
4. The method according to claim 1, wherein The fine - tuning of the large language model is supervised fine - tuning through multiple training samples. A single training sample includes: a historical data analysis request as input data, and several tasks and the intents and entities corresponding to each task as label data.
5. The method according to claim 1, wherein, The information extracted by the large language model also includes the data dependencies between tasks; The performing task planning to determine the execution order of each task includes: Determine that tasks with data dependencies are executed serially, and tasks without data dependencies are executed in parallel.
6. The method according to claim 5, wherein, The performing task planning to determine the execution order of each task further includes: Determine the candidate agents called for task execution according to the intent; Use the dependency rules between candidate agents to verify and filter the planned task execution order to filter out the task execution order plans outside the dependency rules.
7. The method according to claim 1, wherein The data structure corresponds to multiple predetermined attributes, and a single attribute value corresponding to a single predetermined attribute is used to describe a single entity; During the process of calling target agents from multiple candidate agents to execute each task, the execution result of the previous task is described by the attribute value of the corresponding attribute, and the agent corresponding to the subsequent task obtains the execution result of the previous task by obtaining the attribute value in the corresponding attribute of the data structure.
8. The method according to claim 7, wherein, Each predetermined attribute is refined from each data type required to be transmitted between the multiple candidate agents, and each data type includes at least one of the following: dimension, measure, filter, sort, limit.
9. The method according to claim 1, wherein, The planning result includes at least one directed acyclic graph. The calling target agents from multiple candidate agents to execute each task to obtain a data analysis result includes: Merge the execution results corresponding to each directed acyclic graph to obtain the data analysis result.
10. A device for data analysis based on multi - agents, the device comprising: An extraction unit configured to, for a current data analysis request, use a fine - tuned large language model to simultaneously extract the following information: at least one task, and the respective intents and entities corresponding to each task; A planning unit, configured to perform task planning to determine the execution order of each task, where the execution order includes the serial and parallel strategies between tasks; An execution unit, configured to, according to the task planning result, based on the intention corresponding to each task, call a target intelligent agent from multiple candidate intelligent agents to execute each task, and obtain a data analysis result, where the multiple candidate intelligent agents respectively correspond to different intentions, and data is transmitted between tasks with data dependencies through a predetermined data structure, and the predetermined data structure is determined based on the task information in the field of data analysis.
11. A computer-readable storage medium, on which a computer program is stored. When the computer program is executed on a computer, the computer is made to execute the method according to any one of claims 1-9.
12. A computing device, comprising a memory and a processor, characterized in that, Executable code is stored in the memory. When the processor executes the executable code, the method according to any one of claims 1-9 is implemented.