Method and device for generating task and training data, equipment, medium and product

Through the bottom-up and top-down data generation method, multiple rounds of interaction combined tasks and training data are generated, which solves the problem that existing data sets cannot effectively improve the interaction ability of large language models and external tools, and realizes the function Supervised fine-tuning of call capabilities and improved performance of complex task processing.

CN119415949APending Publication Date: 2025-02-11BAICHUAN INTELLIGENT TECHNOLOGY CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411441062.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

The existing function call datasets are mainly concentrated on single-round interactions, and cannot effectively improve the ability of large language models to interact with external tools.

Method used

A bottom-up and top-down data generation method (BUTTON method) is used to generate a combined task that can perform multiple rounds of interaction, and to generate training data based on the combined task to achieve supervised fine-tuning of function call capabilities.

Benefits of technology

By generating multiple rounds of interaction combined tasks and corresponding training data, the ability of large language models to interact with external tools is significantly improved, and the performance of the model in complex task processing is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415949A_ABST
    Figure CN119415949A_ABST
Patent Text Reader

Abstract

The invention provides a task and training data generation method and device, equipment, a medium and a product. According to the method, a first large-scale language model is used for generating a plurality of instructions for calling corresponding sub-functions based on received language data corresponding to a combined task, a second large-scale language model is used for calling the sub-functions based on the plurality of instructions and outputting a result obtained based on the sub-functions, and the combined task is generated based on a plurality of sub-tasks. Each sub-task can realize a single function through calling of a sub-function, and the combined task realizes a combined function through combination of calling of the sub-function corresponding to each sub-task; training data is obtained based on the language data, the plurality of indications, and the result. According to the method provided by the invention, the combined task of multiple rounds of interaction can be generated, and the training data for training the large language model can be generated based on the task, so that supervision and fine adjustment of the capability of calling the function can be realized, and the capability of interaction between the model and the external tool is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of natural language processing, and more specifically, to a method, apparatus, device, medium and product for generating tasks and training data. Background Art

[0002] Current large language models (LLMs) have demonstrated remarkable capabilities in a variety of natural language tasks, often outperforming traditional models. In addition to generating human-like natural language text, recent studies have revealed that LLMs can perform specific tasks through function calls.

[0003] It is a very effective way to improve the performance of LLM by leveraging external tools through function calls. For example, retrieving relevant knowledge from an external knowledge base through a search function can alleviate the hallucination problem of LLM. In addition, LLM-based agents can interact with external application programming interfaces (APIs) and even the physical world through function calls. These functions provide standardized interfaces for interaction with various systems, thereby expanding the practicality and versatility of LLM in real-world applications.

[0004] Like other capabilities of LLM, the function calling capability also requires a lot of data for supervised fine-tuning. However, most existing function calling datasets are single-round interactions and focus on calling the correct function and providing the correct parameters for a simple task that can be completed in one round, which limits the model's ability to interact with external tools in real applications.

[0005] Therefore, a new approach is needed to address the above issues and improve the model's ability to interact with external tools. Summary of the invention

[0006] In view of the above problems, the present disclosure provides a bottom-up and then top-down data generation method (hereinafter referred to as BUTTON method). According to the method provided by the present disclosure, a combined task capable of multiple rounds of interaction can be generated, and training data for training a large language model can be generated based on the combined task, thereby enabling supervised fine-tuning of the ability to call functions to further improve the ability of the model to interact with external tools.

[0007] An embodiment of the present disclosure provides a method for generating a combined task, wherein the combined task is used to generate training data for training a large language model, the method comprising: generating a plurality of subtasks based on collected scenario data, each of the plurality of subtasks being capable of implementing a single function by calling a subfunction, wherein the scenario data comprises data related to query and answer scenarios; and obtaining the combined task based on the generated plurality of subtasks, wherein the combined task is capable of implementing the combined function by combining calls to subfunctions corresponding to each of the plurality of subtasks.

[0008] According to an embodiment of the present disclosure, the multiple subtasks include a first subtask and a second subtask, the second subtask is generated based on the result of the first subtask, and the combined task is obtained based on the generated multiple subtasks, including: obtaining the combined task based on the first subtask and the second subtask.

[0009] According to an embodiment of the present disclosure, the multiple subtasks include a third subtask, a fourth subtask and a fifth subtask, the third subtask and the fourth subtask can be executed in parallel, the fifth subtask is generated based on a result of the third subtask and a result of the fourth subtask, and the combined task is obtained based on the generated multiple subtasks, including: obtaining the combined task based on the third subtask and the fifth subtask.

[0010] According to an embodiment of the present disclosure, wherein the multiple subtasks include a sixth subtask and a seventh subtask, the sixth subtask and the seventh subtask can be executed in parallel, and obtaining the combined task based on the generated multiple subtasks includes: obtaining the combined task based on the sixth subtask and the seventh subtask.

[0011] According to an embodiment of the present disclosure, the combined task can realize the combined function by a combination of calls to sub-functions corresponding to each of the multiple sub-tasks, including: the combined task can realize the combined function by calling the sub-functions corresponding to each of the multiple sub-tasks in sequence.

[0012] The disclosed embodiment provides a method for generating training data using a large language model, wherein the large language model includes a first large language model and a second large language model, and the method includes: using the first large language model to generate multiple instructions for calling corresponding sub-functions based on received language data corresponding to a combined task, and using the second large language model to call the corresponding sub-function based on the multiple instructions and output a result obtained based on the sub-function, wherein the combined task is generated based on multiple sub-tasks, each of the multiple sub-tasks is generated based on collected scenario data and can implement a single function by calling a sub-function, and the combined task can implement the combined function by combining calls to sub-functions corresponding to each of the multiple sub-tasks, and the scenario data includes data related to query and answer scenarios; and obtaining training data based on the language data, the multiple instructions, and the result.

[0013] According to an embodiment of the present disclosure, the large language model further includes a third large language model, and the method further includes: using the third large language model to output the language data based on the combined task.

[0014] According to an embodiment of the present disclosure, the multiple subtasks include a first subtask and a second subtask, wherein the using the first large language model based on the received language data corresponding to the combined task to generate multiple instructions for calling the corresponding subfunction, and using the second large language model based on the multiple instructions to call the corresponding subfunction and output the result obtained based on the subfunction, includes: using the first large language model based on the received language data corresponding to the combined task to generate a first instruction for calling the first subfunction corresponding to the first subtask; using the second large language model based on the first instruction to call the corresponding first subfunction and output the first result obtained based on the first subfunction; based on the first result, using the first large language model to generate a second instruction for calling the second subfunction corresponding to the second subtask; and using the second large language model based on the second instruction to call the corresponding second subfunction and output the second result obtained based on the second subfunction; wherein the obtaining of training data based on the language data, the multiple instructions and the result includes: obtaining training data based on the language data, the first instruction, the first result, the second instruction and the second result.

[0015] According to an embodiment of the present disclosure, the multiple subtasks include a third subtask and a fourth subtask, wherein the using the first large language model based on the received language data corresponding to the combined task to generate multiple instructions for calling the corresponding subfunction, and using the second large language model based on the multiple instructions to call the corresponding subfunction and output the result obtained based on the subfunction, includes: using the first large language model based on the received language data corresponding to the combined task to generate a third instruction for calling the third subfunction corresponding to the third subtask and a fourth instruction for calling the fourth subfunction corresponding to the fourth subtask; using the second large language model to call the corresponding third subfunction based on the third instruction and output the third result obtained based on the third subfunction and to call the corresponding fourth subfunction based on the fourth instruction and output the fourth result obtained based on the fourth subfunction; wherein the obtaining training data based on the language data, the multiple instructions and the result includes: obtaining training data based on the language data, the third instruction, the third result, the fourth instruction and the fourth result.

[0016] According to an embodiment of the present disclosure, the combined task can realize the combined function by a combination of calls to sub-functions corresponding to each of the multiple sub-tasks, including: the combined task can realize the combined function by calling the sub-functions corresponding to each of the multiple sub-tasks in sequence.

[0017] An embodiment of the present disclosure provides a method for training a large language model, the method comprising: training the large language model using training data generated based on any of the methods described above.

[0018] An embodiment of the present disclosure provides a device for generating a combined task, wherein the combined task is used to generate training data for training a large language model, the device comprising: a subtask generating unit, configured to generate a plurality of subtasks based on collected scenario data, wherein the plurality of subtasks can implement a single function by calling a subfunction, wherein the scenario data includes data related to query and answer scenarios; and a combined task obtaining unit, configured to obtain the combined task based on the generated plurality of subtasks, wherein the combined task can implement the combined function by combining calls to subfunctions corresponding to each of the plurality of subtasks.

[0019] The embodiment of the present disclosure provides an apparatus for generating training data using a large language model, wherein the large language model includes a first large language model and a second large language model, and the apparatus includes: an instruction generation and result output unit, configured to generate multiple instructions for calling corresponding sub-functions based on received language data corresponding to a combined task using the first large language model, and to call the corresponding sub-function based on the multiple instructions using the second large language model and output a result obtained based on the sub-function, wherein the combined task is generated based on multiple sub-tasks, each of the multiple sub-tasks is generated based on collected scenario data and can implement a single function by calling a sub-function, and the combined task can implement the combined function by combining calls to sub-functions corresponding to each of the multiple sub-tasks, and the scenario data includes data related to query and answer scenarios; and a training data acquisition unit, configured to obtain training data based on the language data, the multiple instructions, and the result.

[0020] An embodiment of the present disclosure provides a device for training a large language model, the device comprising: a training unit configured to train the large language model using training data generated based on any of the methods described above.

[0021] An embodiment of the present disclosure provides a device for generating a combination task, wherein the combination task is used to generate training data for training a large language model. The device includes: a processor, and a memory, wherein the memory stores computer-executable instructions, and when the computer-executable instructions are executed by the processor, the processor is prompted to execute any of the methods described above.

[0022] An embodiment of the present disclosure provides a device for generating training data using a large language model, including: a processor, and a memory, wherein the memory stores computer executable instructions, and when the computer executable instructions are executed by the processor, the processor is prompted to execute any of the methods described above.

[0023] An embodiment of the present disclosure provides a device for training a large language model, including: a processor, and a memory, wherein the memory stores computer-executable instructions, and when the computer-executable instructions are executed by the processor, the processor is prompted to execute the method for training a large language model as described above.

[0024] An embodiment of the present disclosure provides a computer-readable recording medium storing computer-executable instructions, wherein when the computer-executable instructions are executed by a processor, the processor is prompted to execute any of the above methods.

[0025] An embodiment of the present disclosure provides a computer program product, comprising computer executable instructions, wherein when the computer executable instructions are executed by a processor, the processor is prompted to perform any of the above methods.

[0026] The present disclosure provides a method, apparatus, device, medium and product for generating a combined task, a method, apparatus, device, medium and product for generating training data using a large language model, and a method, apparatus, device, medium and product for training a large language model. The above method provided by the present disclosure can generate a combined task capable of multiple rounds of interaction, and can generate training data for training a large language model based on the combined task, thereby enabling supervised fine-tuning of the ability to call a function to further improve the ability of the model to interact with external tools. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some exemplary embodiments of the present disclosure, and a person of ordinary skill in the art can obtain other drawings based on these drawings without creative work.

[0028] Figure 1 is a flowchart illustrating a method 100 for generating a combined task according to an embodiment of the present disclosure;

[0029] Figure 2 is a flowchart illustrating a method 200 for generating training data using a large language model according to an embodiment of the present disclosure;

[0030] Figure 3 is a schematic diagram illustrating combined task generation and trajectory generation according to an embodiment of the present disclosure;

[0031] Figure 4 A schematic diagram showing key statistical data of a data set in an example according to an embodiment of the present disclosure;

[0032] Figure 5 A schematic diagram showing experimental results of ablation studies according to an embodiment of the present disclosure is shown;

[0033] Figure 6 A block diagram of an apparatus 600 for generating a group task according to an embodiment of the present disclosure is shown;

[0034] Figure 7 A block diagram of an apparatus 700 for generating training data using a large language model according to an embodiment of the present disclosure is shown;

[0035] Figure 8A block diagram of an apparatus 800 for training a large language model according to an embodiment of the present disclosure is shown;

[0036] Fig. 9 is a block diagram illustrating a device 900 according to an embodiment of the present disclosure;

[0037] Fig.10 A schematic diagram of a recording medium 1000 according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0038] In order to make the purpose, technical solution and advantages of the present disclosure more obvious, the exemplary embodiments according to the present disclosure will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments of the present disclosure, and it should be understood that the present disclosure is not limited to the exemplary embodiments described here.

[0039] In this specification and the accompanying drawings, substantially the same or similar steps and elements are represented by the same or similar reference numerals, and repeated descriptions of these steps and elements will be omitted. At the same time, in the description of the present disclosure, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance or ranking.

[0040] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present disclosure pertains. The terms used herein are only for the purpose of describing the embodiments of the present invention and are not intended to limit the present invention.

[0041] To facilitate description of the present disclosure, concepts related to the present disclosure are introduced below.

[0042] The data processing related to the large language model mentioned in the present disclosure can be based on artificial intelligence (AI). Artificial intelligence is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. For example, for a large language model based on artificial intelligence, it can learn the subtasks, combined tasks and training data to be introduced next in a similar way to humans based on their acquired knowledge and use the learned content to handle subsequent similar problems.

[0043] The data processing related to the large language model mentioned in the present disclosure can be based on natural language processing (NLP). Natural language processing is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can realize effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language used by people in daily life, so it is closely related to the study of linguistics. Natural language processing technology generally includes text processing, semantic understanding, machine translation, robot question and answer, knowledge graph and other technologies. The large language model mentioned in the present disclosure can use natural language processing technology to obtain natural language that is more in line with people's daily language based on the obtained combined tasks, and fine-tune the large language model based on the training data to be introduced below to improve the large language model's understanding and expression capabilities for input data, and use the fine-tuned large language model to automatically and efficiently process tasks similar to the above-mentioned combined tasks.

[0044] The data processing related to the large language model mentioned in the present disclosure can be based on a large language model (LargeLanguage Model, LLM). A large language model is a language model in the field of NLP that is trained on a large amount of language corpus using an autoregressive method for analyzing and processing language texts, and is intended to understand and generate human language. Large language models are trained on a large amount of text data and can perform a wide range of tasks, including text summarization, translation, sentiment analysis, function calls, etc. Large language models are characterized by their large scale, which can contain billions of parameters to help them learn complex patterns in language text data. By training a large language model, the model can interact with external APIs and even the physical world by calling different functions, so that more tasks can be performed and more functions can be achieved.

[0045] The data processing related to the large language model mentioned in the present disclosure can be based on fine-tuning (Tuning) for the large language model. Fine-tuning a large language model means that on the basis of pre-training, further training is performed on specific tasks to adapt to the needs of specific tasks and language patterns in specific fields. Fine-tuning can improve the performance, adaptability and generalization ability of the model on specific tasks. Through fine-tuning, the large language model can be customized according to the characteristics of the task and the characteristics of the data, so as to improve the performance on specific tasks and provide more demanding language processing capabilities for applications in specific fields. For example, in an embodiment of the present disclosure, the generated combined task can be used to obtain training data and train the large language model based on the training data, so that the pre-trained large language model can be fine-tuned to make it more suitable for performing processing work for tasks similar to the above-mentioned combined task, so that more tasks can be performed and more functions can be realized.

[0046] In summary, the data processing related to the large language model mentioned in the present disclosure can be based on artificial intelligence, natural language processing, large language models, fine-tuning of large language models, etc.

[0047] In addition, regarding the description of tasks and instructions (i.e., the language data corresponding to the tasks to be introduced below), the essential content of tasks and instructions is the same, but the expression form is slightly different. Instructions are a statement that is more in line with natural language than tasks. For example, a task can be to buy a ticket from Beijing to Shanghai in the morning, while an instruction can be to buy me a ticket from Beijing to Shanghai tomorrow morning.

[0048] In the prior art, large language models have demonstrated extraordinary capabilities in a variety of tasks. In addition to generating human-like text, recent studies have shown that large language models can also call functions (i.e., use external tools) to perform specific actions or operations. Utilizing external tools through function call capabilities has been proven to be an effective way to improve the performance of large language models. As introduced in the background technology, retrieving relevant knowledge from external knowledge bases through search functions can help alleviate the hallucination problem in large language models. In addition, intelligent agents based on large language models can interact with various existing external APIs using function calls. These functions provide standardized interfaces for interacting with different systems, thereby enhancing the practicality and versatility of large language models in practical applications.

[0049] However, as mentioned in the background, existing methods for large language models of function calls mainly focus on single-round methods (i.e., implementing simple functions through single-step tasks), which mainly focus on building instruction data to guide and evaluate its selection of appropriate functions and providing correct parameters. Although learning how to understand and use functions is important for large language models, these methods often ignore the key ability to plan with functions.

[0050] Many real-world user queries are complex and cannot be solved in one step. For example, "list flight schedules from London to Edinburgh" may be a single-step task because simply retrieving accurate information can accomplish it, while "book me the first flight from London to Edinburgh" requires calling multiple functions in sequence: first retrieve the flight schedule and find the first one, then book a ticket for that flight. Complex real-world tasks are combinatorial in nature, which requires large language models not only to call functions, but also to be able to break down these complex tasks into manageable steps and plan the order of function calls.

[0051] Therefore, based on the above considerations, the present invention focuses on how to construct combined tasks and how to obtain training data for training large language models based on combined tasks, so that large language models can decompose complex tasks into manageable steps and plan the order of function calls.

[0052] Next, the method provided by the present disclosure will be described in detail with reference to the accompanying drawings.

[0053] Figure 1 1 is a flow chart showing a method 100 for generating a combined task according to an embodiment of the present disclosure. The combined task can be used to generate training data for training a large language model. The method 100 can be executed by a suitable processor or processing unit in any system.

[0054] Reference Figure 1 In step S110, a plurality of subtasks may be generated based on the collected scene data.

[0055] According to the embodiment of the present disclosure, each subtask (Atomic Task) among the multiple subtasks can implement a single function by calling a subfunction.

[0056] As an example, the context data may include data related to a query and answer scenario (eg, a question and answer scenario).

[0057] When collecting scenarios, in order to ensure that the generated subtasks are based on daily scenario experience rather than meaningless, the present invention first uses external tools to extract a series of real-world scenarios from existing data sets. Such a scenario can be a concise overview, such as "booking a flight" or "ordering a meal." Then, a deduplication operation is performed on the collected scenarios. This involves using sentence embedding to calculate scene similarity and setting a specific threshold to filter out similar scenes. In addition, in order to expand the collected scenarios, the present invention can also generate new scenarios by changing the actions or themes of existing scenarios based on any existing suitable scenario generation technology. This makes the scenarios collected by the present disclosure and the subsequent subtasks and combined tasks diverse.

[0058] As an example, the generated subtask can be considered as a simple question, query, task or instruction. The subtask is simple and clear, which does not require complex planning for people to solve. Such a subtask can serve as the basis for subsequent combined tasks.

[0059] Being able to implement a subtask with a single function by calling a subfunction means that the subtask needs to meet the following requirements:

[0060] (1) Reasonable: Subtasks should be realistic, reasonable, and representative of tasks that are frequently encountered in the real world.

[0061] (2) Independent: The subtask should be solvable based on the information it provides. It must contain enough detailed information required to call the function.

[0062] (3) Function agnostic: In the process of clarifying the subtask, the specific function that can be used to solve this task is not considered, that is, the subtask should not mention any specific function or solution. For example, a subtask can be: buy a flight from Beijing to Shanghai tomorrow; but a subtask cannot be: buy a flight from Beijing to Shanghai tomorrow through Ctrip.

[0063] It should be noted that the present invention does not provide a strict definition of subtasks, but only requires that subtasks can realize a single function by calling subfunctions. In addition, the calling of subfunctions can be any of the following: a single calling of a single subfunction, multiple calling of a single subfunction, and a single or multiple calling of each subfunction in multiple subfunctions.

[0064] Continue to refer to Figure 1 In step S120, the combined task may be obtained based on the generated multiple subtasks.

[0065] According to the embodiment of the present disclosure, the combined task can realize the combined function by combining the calls of the sub-functions corresponding to each of the multiple sub-tasks.

[0066] As an example, the combined task can realize the combined function by combining the calls of the sub-functions corresponding to each of the multiple sub-tasks, which may include: the combined task can realize the combined function by calling the sub-functions corresponding to each of the multiple sub-tasks in sequence.

[0067] According to an embodiment of the present disclosure, the multiple subtasks may include a first subtask and a second subtask, and the second subtask is generated based on the result of the first subtask. The obtaining of the combined task based on the generated multiple subtasks includes: obtaining the combined task based on the first subtask and the second subtask.

[0068] As an example, the first subtask may be: Who is the author of the book The Great Gatsby? The second subtask that can be generated based on the result of the first subtask may be: When was the author of the book born? In the above case, the combined task obtained based on the first subtask and the second subtask may be: When was the author of the book The Great Gatsby born? The above method of obtaining the combined task can be called a sequential combination method.

[0069] According to an embodiment of the present disclosure, the multiple subtasks may include a third subtask, a fourth subtask, and a fifth subtask, the third subtask and the fourth subtask can be executed in parallel, and the fifth subtask is generated based on a result of the third subtask and a result of the fourth subtask. The obtaining of the combined task based on the generated multiple subtasks may include: obtaining the combined task based on the third subtask and the fifth subtask.

[0070] As an example, the third subtask may be: give me today's flight schedule from London to Edinburgh. The fourth subtask may be: find today's hourly weather forecast for Edinburgh. The fifth task that can be generated based on the results of the third subtask and the fourth subtask may be: what will the weather be like when the first flight arrives? In the above case, the combined task obtained based on the third subtask and the fifth subtask may be: I am in London and want to know what the weather will be like when the first flight arrives in Edinburgh today. The above method of obtaining the combined task can be called a parallel and then sequential combination method.

[0071] According to an embodiment of the present disclosure, the multiple subtasks may include a sixth task and a seventh task, and the sixth subtask and the seventh subtask can be executed in parallel. The obtaining of the combined task based on the generated multiple subtasks may include: obtaining the combined task based on the sixth subtask and the seventh subtask.

[0072] As an example, the sixth subtask may be to query the stock price of Company X. The seventh subtask may be to query the stock price of Company Y. In the above case, the combined task obtained based on the sixth subtask and the seventh subtask may be to query the stock prices of Company X and Company Y. The above method of obtaining the combined task may be referred to as a parallel combination method.

[0073] It can be seen from the above description that the present invention provides a bottom-up (abbreviated as Buttom-Up) data generation method.

[0074] In order to further improve the quality of the combined tasks obtained by the above methods, the present invention further performs filtering processing on the obtained combined tasks to filter out any tasks that are inconsistent with their subtasks. The filtering criteria can be: Since the quality of subtasks is more controllable, the combined tasks can be filtered by checking whether each combined task can be completed by its subtasks. This can filter out low-quality combined tasks.

[0075] After the combined tasks are obtained through the above-mentioned methods and processing, the sub-functions that may be called in these tasks can be generated. The prior art is to first collect sub-functions, and then generate tasks based on these collected sub-functions. Unlike the prior art, the sub-functions in the process of generating the above-mentioned combined tasks are unknown in the present invention, because the present invention believes that this allows the generation or construction of more sub-tasks, and for a series of combined tasks built based on the sub-tasks, these combined tasks know the corresponding sub-tasks (that is, the decomposition of the combined tasks). These task decompositions can serve as prompts for the generation of sub-functions. This represents the advantage of the bottom-up combined task construction method of the present invention. In this method provided by the present invention, the decomposition of the combined task can be checked and the corresponding sub-functions can be generated. In the generation process of the sub-function definition, for the sub-function, the following aspects can be met:

[0076] (1) Descriptive: The name and description of the sub-function should be descriptive to help distinguish different sub-functions. The input parameters and output returns should also be clear, because the present invention not only uses these definitions, but also uses them to simulate the corresponding sub-functions.

[0077] (2) Versatility: The subfunction should be sufficiently versatile so that it can be used in future tasks. In the real world, subfunctions are more likely to be constructed for frequently encountered subtasks rather than for highly specific tasks. For example, the subfunction get weather(city) is more likely to be used than get weather in london().

[0078] (3) Consistency: Since the interaction traces of the sub-function calls involved in the training data need to be generated in the later steps, the input parameters and output results of these sub-functions should remain consistent. For example, if two sub-functions are called sequentially, the output of the first sub-function should be aligned with the input of the second sub-function, or constitute part of the input of the second sub-function, regardless of the changes in the parameter terms.

[0079] The generated sub-function definition may include five main fields: name, description, parameters, response, and require. The name indicates the sub-function name, while the description details its purpose and function. Parameters and responses cover inputs and outputs, including the type and description of each independent variable. The required field lists the necessary input parameters. The present invention allows flexible mapping of subtasks to sub-functions; a sub-task may require zero, one, or more sub-functions. If a sub-task involves logic, comparison, set operations, or calculations manageable by a language model, a sub-function may not be required, and the sub-function corresponding to the sub-task can be set to a NULL sub-function.

[0080] By combining the above Figure 1 It can be seen from the described method that the present disclosure provides a method for generating combined tasks from the bottom up. The method can start from a simple scenario and generate subtasks. Then, based on these subtasks, more complex combined tasks and their corresponding subfunctions are generated. The combined tasks generated according to the method provided by the present disclosure can realize the combined function by combining the calls of the subfunctions corresponding to each subtask, so that multiple rounds of interaction can be performed, so that the subsequent model can improve the model's processing ability for complex tasks through interaction with external tools.

[0081] In addition to providing the above method for generating a combination task, the present disclosure also provides a method for generating training data using a large language model, which will be described below in conjunction with the accompanying drawings.

[0082] Figure 2 2 is a flowchart showing a method 200 for generating training data using a large language model according to an embodiment of the present disclosure. The large language model may be any existing large language model described above. The method 200 may be executed by a suitable processor or processing unit in any system.

[0083] According to an embodiment of the present disclosure, the large-scale language model may include a first large-scale language model and a second large-scale language model.

[0084] Reference Figure 2In step S210, the first large language model can be used to generate multiple instructions for calling corresponding sub-functions based on the received language data corresponding to the combined task, and the second large language model can be used to call the corresponding sub-function based on the multiple instructions and output the result obtained based on the sub-function.

[0085] According to an embodiment of the present disclosure, the combined task can be generated based on multiple subtasks. Each of the multiple subtasks can be generated based on the collected scenario data and each subtask can implement a single function by calling a subfunction. The combined task can implement the combined function by combining the calls of the subfunctions corresponding to each of the multiple subtasks. The scenario data may include data related to the query and answer scenario, such as data related to the question and answer scenario. For details about generating a combined task based on multiple subtasks, please refer to the above combined task description. Figure 1 The corresponding ones described will not be repeated here.

[0086] As an example, the combined task may be: When was the author of The Great Gatsby born? The language data corresponding to the combined task may be: Hello, I want to know when was the author of The Great Gatsby born.

[0087] According to an embodiment of the present disclosure, the large language model may further include a third large language model, and the method 200 may further include: using the third large language model to output the language data based on the combined task. Since the large language model itself has certain analysis and thinking capabilities, it can output the above language data based on the combined task to make the task more consistent with the expression of natural language.

[0088] Continue to refer to Figure 2 In step S220, training data may be obtained based on the language data, the plurality of indications, and the result.

[0089] As an example, the above-mentioned language data, multiple instructions, and results may be used as training data.

[0090] According to an embodiment of the present disclosure, the multiple subtasks may include a first subtask and a second subtask. In this case, the use of the first large language model based on the language data corresponding to the combined task received to generate multiple instructions for calling the corresponding subfunction, and the use of the second large language model based on the multiple instructions to call the corresponding subfunction and output the result obtained based on the subfunction may include: using the first large language model based on the language data corresponding to the combined task received to generate a first instruction for calling the first subfunction corresponding to the first subtask; using the second large language model based on the first instruction to call the corresponding first subfunction and output the first result obtained based on the first subfunction; based on the first result, using the first large language model to generate a second instruction for calling the second subfunction corresponding to the second subtask; and using the second large language model based on the second instruction to call the corresponding second subfunction and output the second result obtained based on the second subfunction. In the above case, the acquisition of training data based on the language data, the multiple instructions and the result may include: obtaining training data based on the language data, the first instruction, the first result, the second instruction and the second result.

[0091] That is to say, through the above combination Figure 1 In the described sequential combination method or parallel and then sequential combination method, when a combined task is obtained based on each subtask, method 200 can disassemble the received language data based on the combined task and the corresponding subtasks and calling functions to call the corresponding subfunctions and output the results respectively. Finally, the trajectory data including the above-mentioned language data, each indication and each result is used as training data.

[0092] As an example, the combined task can be: When was the author of The Great Gatsby born? The language data corresponding to the combined task can be: Hello, I want to know when was the author of The Great Gatsby born. Figure 1 As described above, the first subtask may be: Who is the author of The Great Gatsby? The second subtask may be: When was the author of the book born?

[0093] In the above example, method 200 may include: using the first large language model based on the language data, generating a first instruction to call a first sub-function get_author (The Great Gatsby) corresponding to the first sub-task, such as a calling instruction, such as <call> get_author(The Great Gatsby)< / call>The first sub-function get_author(The Great Gatsby) is called based on the first instruction using the second large language model and a first result obtained based on the first sub-function is output, such as Scott Fitzgerald. Then, based on the first result, the first large language model is used to generate a second instruction for calling the second sub-function search_birthday(Scott Fitzgerald) corresponding to the second sub-task, such as a calling instruction such as <call> search_birthday(Scott Fitzgerald)< / call> . Next, the second large language model is used to call the second sub-function search_birthday(Scott Fitzgerald) based on the second indication and output the second result obtained based on the second sub-function, for example, September 24, 1896 (24Sept.1896). Finally, based on the above results, the final answer result corresponding to the above language data can be obtained by the first large language model, that is, the author of the book "The Great Gatsby" was born on September 24, 1896. In this case, the trajectory data including the above-mentioned language data, the first indication, the first result, the second indication and the second result can be used as training data. Alternatively, the trajectory data including the above-mentioned language data, the first indication, the first result, the second indication, the second result and the final answer result can be used as training data.

[0094] According to an embodiment of the present disclosure, the plurality of subtasks may include a third subtask and a fourth subtask.

[0095] In this case, the using of the first large language model to generate multiple instructions for calling corresponding sub-functions based on the received language data corresponding to the combined task, and using the second large language model to call the corresponding sub-function based on the multiple instructions and output the results obtained based on the sub-functions may include: using the first large language model to generate a third instruction for calling a third sub-function corresponding to the third sub-task and a fourth instruction for calling a fourth sub-function corresponding to the fourth sub-task based on the received language data corresponding to the combined task; using the second large language model to call the corresponding third sub-function based on the third instruction and output the third result obtained based on the third sub-function; and calling the corresponding fourth sub-function based on the fourth instruction and outputting the fourth result obtained based on the fourth sub-function.

[0096] In the above case, obtaining the training data based on the language data, the multiple indications and the result may include obtaining the training data based on the language data, the third indication, the third result, the fourth indication and the fourth result.

[0097] That is to say, through the above combination Figure 1 In the parallel combination described above, when a combined task is obtained based on each subtask, method 200 can decompose the received language data based on the combined task, the corresponding subtasks and the calling function to call the corresponding subfunctions and output the results. Finally, the trajectory data including the above-mentioned language data, each indication and each result is used as training data.

[0098] As an example, the combined task can be: query the stock prices of Company X and Company Y. The language data corresponding to the combined task can be: Hello, please help me query the stock prices of Company X and Company Y. Figure 1 As mentioned above, the third subtask may be: querying the stock price of Company X. The fourth subtask may be: querying the stock price of Company Y.

[0099] In the above example, method 200 may include: using the first large language model based on the received language data corresponding to the combined task, generating a third instruction (e.g., a calling instruction, such as <call> search_shareprice(X)< / call> ) and a fourth instruction (eg, a calling instruction, such as a calling instruction, such as a calling instruction, for calling a fourth sub-function search_shareprice(Y) corresponding to the fourth sub-task <call> search_shareprice(Y)< / call> ); then, the second large language model is used to call the corresponding third sub-function search_shareprice(X) based on the third indication and output the third result (such as 20.35RMB) obtained based on the third sub-function, and the corresponding fourth sub-function search_shareprice(Y) is called based on the fourth indication and output the fourth result (such as 25.25RMB) obtained based on the fourth sub-function; finally, based on the above results, the final answer result corresponding to the above language data can be obtained by the first large language model, that is, the stock prices of Company X and Company Y are 20.35RMB and 25.25RMB respectively. In this case, the trajectory data including the language data, the third indication, the third result, the fourth indication and the fourth result can be used as training data. Alternatively, the trajectory data including the language data, the third indication, the third result, the fourth indication, the fourth result and the final answer result can be used as training data.

[0100] According to an embodiment of the present disclosure, the combined task can realize the combined function by a combination of calls to sub-functions corresponding to each of the multiple sub-tasks, which may include: the combined task can realize the combined function by calling the sub-functions corresponding to each of the multiple sub-tasks in sequence.

[0101] By combining the above Figure 2It can be seen from the relevant content of the described method 200 that after obtaining the combined task and the corresponding sub-function in a bottom-up manner, the present invention can also simulate how to call the corresponding sub-function based on language data through multiple large language models, and the training data generated by the simulation can also be used as supervision data to train subsequent large language models to guide the large language models to perform multiple rounds of function calls.

[0102] In addition, in order to perform the above-mentioned better simulation, a multi-agent environment can be constructed based on multiple large language models. In the constructed multi-agent environment, each agent can simulate a specific role, such as an agent based on the third large language model can be used to initiate interaction and provide, for example, queries to the first large language model based on a specific combined task, such as the above-mentioned language data. The agent based on the first large language model can decompose the received language data into tasks to obtain various subtasks, and issue instructions to call corresponding subfunctions to process these subtasks, such as the first to fourth subtasks and the first to fourth instructions mentioned above. The agent based on the second large language model can be used to simulate the specific call to the subfunction and obtain the results obtained based on the subfunction, such as the first to fourth subfunctions and the first to fourth results mentioned above.

[0103] It should be noted that in the actual simulation, for a specific function simulated by the agent based on the second large language model, the actual function of the function can be omitted, because only reasonable feedback from the agent is needed to promote the interaction during the simulation. Specifically, the agent based on the second large language model knows the available sub-functions, combined tasks and task decomposition. Since the combined tasks are constructed in a bottom-up manner, the decomposition of these tasks naturally includes their sub-tasks. The behavior of the agent can be controlled by its system prompts. In addition, for the collection of the above-mentioned trajectory data, after the above-mentioned multi-agent environment is established, given a specific combined task and the corresponding sub-function, the present invention can customize prompts for each agent. The interaction trajectory can start from the agent based on the third large language model (hereinafter referred to as the user agent); the agent based on the first large language model (hereinafter referred to as the assistant agent) checks the received language data corresponding to the combined task, decides which sub-functions to call, and determines the relevant parameters of the sub-functions. The assistant agent's response may include: first, observations and ideas in the free text (for example, "First, I need to know who is the author of this book"), which are functions of existing large language models and will not be repeated here; second, corresponding sub-function call instructions (such as the first to fourth instructions mentioned above); the corresponding sub-function call instructions are transmitted to an agent based on a second large language model (hereinafter referred to as a sub-function agent (function agent or tool agent)) and obtain corresponding results; finally, when the assistant agent obtains the final answer to the user's question, it calls the function that provides the final response to the user. The ability to call the function here is a function of existing large language models and will not be repeated here.

[0104] The above combination Figure 2 The method for generating training data using a large language model provided by the present disclosure is described in detail. From the above content, it can be seen that the method provided by the present disclosure can generate training data for training the above model based on the combined task, so as to achieve supervised fine-tuning of the ability to call functions, so as to further improve the ability of the model to interact with external tools. To this end, the present disclosure also provides a method for training a large language model, which may include: using a combination of Figure 2 The training data generated by the described method is used to train the large language model, so that the trained large language model can handle complex tasks in subsequent task processing.

[0105] In addition, the above combination Figure 2It can also be seen from the described method that the method 200 provided by the present disclosure implements a top-down task processing process. The top-down means simulating and collecting the above-mentioned interaction trajectory data as training data from a combined task with corresponding sub-functions, wherein the interaction trajectory data shows the decomposition of complex tasks and calling corresponding sub-functions in multiple rounds. In essence, the above combination Figure 1 The bottom-up generation process of the composition task described is a combination process, and the combination Figure 2 The top-down process described for obtaining training data is a decomposition process.

[0106] The above combination Figure 1 and Figure 2 The described process can be briefly described as follows: First, collect real-world scenes C = {c i}, and based on them generate multiple subtasks A = {a i For a combination task that requires multiple rounds of sub-function calls, the sub-task set S is obtained by the above-mentioned sequential combination method, parallel then sequential combination method and / or parallel combination method. i This subtask set can be used to obtain the combined task c i , which can be expressed as C = {(c i , S i )}. Then construct sub-functions based on these tasks, which can form an instruction tuple I = {(c i , F i , S i )}, where F i It is task c i These sub-functions can be defined by their description, allowing the interaction to be simulated without actual implementation. i is retained to enhance the multi-agent interaction of trajectory generation, but is not retained in the final training data. After obtaining I, the above-mentioned user agent, assistant agent and sub-function agent for interaction can be generated, and the obtained data is recorded as D = {(F i , t i )}, where t i These sub-function definitions and trajectories are integrated together to finally obtain the training data.

[0107] In order to better understand the present disclosure, Figure 1 and Figure 2 The described content will be further explained in the form of examples. It should be noted that the content described below is only an example and does not constitute a limitation of the present disclosure.

[0108] Figure 3is a schematic diagram illustrating combined task generation and trajectory generation according to an embodiment of the present disclosure.

[0109] Reference Figure 3 , the left side shows the combination Figure 1 The bottom-up construction of the combined task is shown on the right. Figure 2 The top-down trajectory generation described by Figure 3 It can be clearly seen from the content shown that the corresponding combined tasks and the sub-functions generated can be obtained based on the generated sub-tasks, and then a multi-agent setting environment is constructed for the sub-tasks, combined tasks and sub-functions to generate trajectories through the interaction between agents. The following content is the training data:

[0110] User Agent: Hello, I would like to know when the author of the book The Great Gatsby was born.

[0111] Assistant Agent: First, I need to know who the author of this book is.

[0112] <call> get_author(The Great Gatsby)< / call>

[0113] Subfunction Agents: Scott Fitzgerald

[0114] Assistant Agent: This book was written by Scott Fitzgerald. Then, I need to find out when he was born. <call> search_birthday(Scott Fitzgerald)< / call>

[0115] Subfunction Agent: September 24, 1896

[0116] Assistant Agent: The author of The Great Gatsby was born on September 24, 1896. <final> September 24, 1896< / final>

[0117] In actual simulation, the present invention utilizes the most advanced large-scale language model, GPT-4o, to generate data at each step of the bottom-up composition task construction, including proceeding from simple scenarios to composition tasks and sub-functions, and trajectory generation as an agent. The present invention ultimately collected 8,000 multi-round sub-function call data points, each of which contained several entries, such as content with roles such as "system", "user", "assistant", and "sub-function". The system prompt lists the available sub-functions for the current user question.

[0118] For parallel sub-function calls, the data collected by the present invention considers scenarios involving parallel sub-function calls. If multiple sub-functions can be called independently, they can be executed in parallel. In order to control the behavior of executing parallel calls, the present invention uses different system prompts to guide whether parallel calls should be executed.

[0119] Regarding data diversity, in order to demonstrate the diversity of the above data points collected, the present invention analyzes the distribution of the total number of assistant turns (#Turn) and the number of sub-function calls (#FC) in the entire trajectory and each step. Figure 4 As shown, attached Figure 4 The key statistics of the dataset are shown in the Appendix Figure 4 In (a), the frequency distribution of the total number of interactions shows that most data points involve three or more assistant responses. Figure 4 (b) plots the distribution of the total number of sub-function calls for each trajectory, and finds that most of the data points contain more than two sub-function calls. Figure 4 In (c), the average number of sub-function calls per round is plotted, and the present invention observes more than one sub-function call per round on average. These findings demonstrate the diversity of the data collected by the present invention and show that even if a simple heuristic strategy is used to generate a combined task from sub-tasks, the data collected in the end is different in different aspects.

[0120] In addition, in order to evaluate the above-mentioned Figure 1 and Figure 2 In order to improve the effectiveness of the training data obtained by the described method, the present invention trained two series of open source LLM models with different sizes as described below: Llama3-8B, Llama3-70B, Qwen2-7B and Qwen2-72B. The present invention uses the suffix -BUTTON to indicate the model that has been trained with the above training data. In the experiment, the present invention mainly focuses on the following issues: 1) Question Q1: Compared with existing models designed for general purposes, can the method proposed in the present invention enhance the ability of multiple rounds of function calls (i.e., be able to handle more complex tasks)? 2) Question Q2: Are the bottom-up and top-down processes effective and necessary? 3) Question Q3: What impact do data size and parallel calls have on model performance?

[0121] Experimental setup

[0122] Benchmark. Two benchmarks (GTA and Tool-Query) are used to evaluate performance. GTA is a benchmark for general functional agents that contains 229 artificial queries, which are designed to reflect real-world tasks. These queries span a total of 14 real-world deployed tools (i.e., functions) in the categories of perception, operation, logic, and creation. Each query is accompanied by one or two real image files, and the task of LLM is to solve the query based on the multimodal context and the user query. The tasks in this benchmark require multiple steps to solve, and LLM is required to reason about appropriate tools and plan the solution steps. Tool-Query is a tool usage environment in the fields of weather, movies, and academics. It consists of 60 tasks that require complex multi-round interactions with corresponding tools. There are 18, 14, and 7 tools (i.e., functions) in the weather, movie, and academic environments, respectively, which are developed by corresponding real-world APIs and databases. The benchmark contains not only annotated final answers, but also intermediate sub-goals, which makes it easier to evaluate the process of function calls in multi-round interactions. Tasks are also marked as difficult or easy based on the number of sub-goals, which is counted as 4 in this benchmark.

[0123] Evaluation metrics. For each benchmark, the present disclosure follows their original evaluation strategies and metrics. For GTA, there are two modes and nine metrics. In the step-by-step (Setp-by-Setp) mode, the model has steps 1 to n from a set of human-labeled function call chains, and its task is to predict the function call in the n+1 step. This demonstrates performance in a fine-grained manner. In the end-to-end (End-to-End) mode, the model starts its function call process based only on the user's question and continues until it gets the answer. This reflects the performance of the model in practical applications. Four metrics are used during the step-by-step mode evaluation: instruction accuracy (Inst.) is the accuracy of error-free execution, which indicates that the model knows how to make function calls according to instructions; tool-selection accuracy (Tool.) and independent variable accuracy (Arg.) indicate the accuracy of selecting tools and predicting independent variables, respectively; summary accuracy (Summ.) indicates the ability of the model to summarize and derive answers based on all previous steps. In the end-to-end mode, the present invention shows the F1 scores of tool selection on perception (P.), operation (O.), logic (L.) and creativity (C.) tasks, as well as the final answer accuracy (Ans.). The final answer accuracy is calculated separately only on queries with plain text answers, excluding image generation queries. For tool-queries, grounding accuracy (GA) is used to represent the accuracy of generating valid, executable function calls. In the process of processing complex user queries, the processing rate is used to evaluate the completion ratio of sub-goals, and the sub-goals are marked in the dataset. Furthermore, the success rate is the accuracy of the final answer.

[0124] Baselining. The present disclosure demonstrates the performance of LLMs based on advanced APIs, including GPT-4o, GPT-4Turbo, and GPT-3.5-Turbo. In addition, since the training data collected by the present invention is suitable for adjusting the Llama3 and Qwen2 basic models, the present disclosure also uses their original instruction-adjusted versions as baselines, including Llama3-8B-Instruct, Llama3-70B-Instruct, Qwen2-7B-Instruct, and Qwen2-72B-Instruct.

[0125] Implementation. We perform full parameter supervised fine-tuning on all base models with a maximum sequence length of 8,192. The models are trained on a 4×8 NVIDIA H800 GPU. In addition, we randomly select 100,000 general instruction tuning data from OpenHermes-2.5 and mix them with the training data to adjust the basic instruction following ability of the model.

[0126] Experimental Results

[0127] As shown in Tables 2 and 3 below, LLMs adjusted based on the combined tasks constructed by the BUTTON method proposed in the present disclosure perform better than their corresponding original instruction versions. For smaller models, the improvement is significant. For example, the present disclosure improves the answer accuracy of Llama3-8B from 1.4% to 30.5%. The low performance of Llama3-8B-Instruct on this indicator is consistent with the findings in the original benchmark report. It is worth noting that the results of Llama3-80B-BUTTON and Qwen2-72B-BUTTON are similar to GPT-4o, which proves the effectiveness of the data collected by the data collection method proposed by the present disclosure. For tool-query, LLMs equipped with combined tasks proposed by the present disclosure show improved performance on various indicators. The present invention observes that even if the base accuracy of the original instruction model and those adjusted with the above training data provided by the present disclosure are quite high (close to or above 95%), the models trained with the above training data also achieve better process and success rates. This shows that the challenge is not only to use the functions correctly, but also to use them effectively for planning. In general, from the main results of GTA and Tool-Query, it can be concluded that the LLM trained with the above training data has better capabilities in multi-round function calls, so that it can handle tasks with large loads in the real world.

[0128]

[0129] Table 2

[0130] Table 2 shows the main results (%) on GTA. Inst., Tool., Arg., and Summ. indicate the accuracy of instruction following, tool selection, independent variable prediction, and answer summary in Setp-by-Setp mode, respectively. P., O., L., and C. are the F1 scores of tool selection in perception, operation, logic, and creativity. Ans. is the final answer accuracy. The bold numbers emphasize the better performance between the original instruction model and the model trained with the above training data, while the underlined numbers indicate the best performance among all models.

[0131]

[0132] Table 3

[0133] Table 3 shows the main results of the tool-query (%). GA indicates the basic accuracy. The processing rate and success rate are shown for easy, difficult and all test samples. The bold numbers highlight the better performance between the original instruction model and the model trained with the above training data, while the underlined numbers indicate the best performance among all models.

[0134] In addition, the present disclosure also conducted the following further experimental analysis.

[0135] In order to evaluate the effectiveness of the "bottom-up combined task construction" and "top-down trajectory generation" processes in the BUTTON method provided by the present disclosure, the present disclosure conducts an ablation study, that is, by simplifying these two processes into a single direct generation step, which uses a prompt with a generative LLM instead of the prompt and process involved in the present disclosure. Specifically, in order to simplify the bottom-up process, the present experiment instructs the generative LLM to directly generate complex combined tasks based on a given scenario. Therefore, the subsequent sub-function generation and trajectory generation steps do not display sub-tasks. In order to reduce the top-down process, the present experiment does not set up a multi-agent environment. Instead, the present experiment uses a single prompt that instructs the LLM to act as a user, an assistant, and a sub-function, thereby generating a trajectory based on any previously constructed with sub-functions. The results of the ablation study on the tool-query are shown in Figure 2. Figure 5 As shown. This experiment uses two ablation settings (i.e., w / oButtom-Up and w / o Top-Down) on Llama3-8B and Llama3-70B and the default setting (i.e., w / BUTTON) for comparison. By calculating the relative performance drop, this experiment found that the smaller models were more affected, with an average relative drop of 16.1% in processing rate and success rate, compared to 6.4% for Llama3-70B. From a metric perspective, this experiment found that under the two ablation settings, the average relative success rate of the two model sizes dropped by 15.0%, and the average relative drop in processing rate was 7.5%. This shows that while models that are not trained with the above training data can perform the correct functions that contribute to the processing rate, they have difficulty using these functions to effectively plan to obtain the final answer, which affects the success rate.

[0136] Data scaling. With respect to data scaling, the present invention studies the effect of data size on the combined tasks and training data constructed by the BUTTON method provided by the present disclosure. In this experiment, the data size was changed from 2,000 to 8,000, and Llama3-8B was adjusted with the corresponding data. As shown in Table 4 below, the present invention provides tool-query results for different data sizes. By calculating the average growth rate (AGR), the experiment found that as the data size increased, the processing rate and success rate also increased accordingly, with AGRs of 13.5% and 2.7%, respectively. In addition, the experiment also found that the improvement on difficult samples was greater than that on simple samples, which indicates that as the data size increases, the combined tasks constructed by the present disclosure and the acquisition of training data can effectively improve the performance of multiple rounds of function calls, especially for tasks that require more rounds of function calls (i.e., more complex tasks).

[0137]

[0138] Table 4

[0139] Efficiency of parallel calls. As mentioned above, the present disclosure has mentioned that when multiple sub-functions can be called independently in a single sub-task, the model trained with training data provided by the present disclosure can perform parallel sub-function calls. When running under restricted step conditions, this parallel capability can significantly improve performance. By changing the system prompt to turn off the parallel call capability, the present disclosure found that the performance of different indicators will be affected. For example, the success rate of Llama3-8B-BUTTON on Tool-Query dropped from 35.0% to 28.3%, and the processing rate dropped from 63.2% to 58.7%. This shows the effectiveness of parallel calls and the BUTTON method provided by the present disclosure.

[0140] In addition to providing the above-mentioned Figure 1 In addition to the method for generating a combined task described above, a corresponding device for generating a combined task is also provided. Figure 6 This is explained. Figure 6 FIG. 6 is a block diagram of an apparatus 600 for generating a group task according to an embodiment of the present disclosure. The above description of the method for generating a combined task is also applicable to the apparatus 600, unless otherwise explicitly stated.

[0141] Reference Figure 6 , the device 600 may include a subtask generating unit 610 and a combined task obtaining unit 620.

[0142] The subtask generating unit 610 may be configured to generate a plurality of subtasks based on the collected scenario data. The plurality of subtasks may implement a single function by calling a subfunction. As an example, the scenario data may include data related to the query and answer scenarios.

[0143] When collecting scenarios, in order to ensure that the generated subtasks are based on daily scenario experience rather than meaningless, the present invention first uses external tools to extract a series of real-world scenarios from existing data sets. Such a scenario can be a concise overview, such as "booking a flight" or "ordering a meal." Then, a deduplication operation is performed on the collected scenarios. This involves using sentence embedding to calculate scene similarity and setting a specific threshold to filter out similar scenes. In addition, in order to expand the collected scenarios, the present invention can also generate new scenarios by changing the actions or themes of existing scenarios based on any existing suitable scenario generation technology. This makes the scenarios collected by the present disclosure and the subsequent subtasks and combined tasks diverse.

[0144] As an example, the generated subtask can be considered as a simple question, query, task or instruction. The subtask is simple and clear, which does not require complex planning for people to solve. Such a subtask can serve as the basis for subsequent combined tasks.

[0145] The combined task obtaining unit 620 may be configured to obtain the combined task based on the generated multiple subtasks. The combined task can realize a combined function by combining calls of subfunctions corresponding to each of the multiple subtasks.

[0146] As an example, the combined task can realize the combined function by combining the calls of the sub-functions corresponding to each of the multiple sub-tasks, which may include: the combined task can realize the combined function by calling the sub-functions corresponding to each of the multiple sub-tasks in sequence.

[0147] In addition to providing the above-mentioned Figure 2 In addition to the method for generating training data using a large language model described above, a corresponding apparatus for generating training data using a large language model is also provided. Figure 7 This is explained. Figure 7 FIG. 7 is a block diagram of an apparatus 700 for generating training data using a large language model according to an embodiment of the present disclosure. The above description of the method for generating training data using a large language model is also applicable to the apparatus 700, unless otherwise explicitly stated.

[0148] Reference Figure 7 , the large language model includes a first large language model and a second large language model, and the device 700 may include an indication generation and result output unit 710 and a training data acquisition unit 720.

[0149] The instruction generation and result output unit 710 can be configured to use the first large language model to generate multiple instructions for calling corresponding sub-functions based on the received language data corresponding to the combined task, and use the second large language model to call the corresponding sub-function based on the multiple instructions and output the results obtained based on the sub-function.

[0150] The combined task is generated based on a plurality of subtasks, each of which is generated based on the collected scenario data and can realize a single function by calling a sub-function. The combined task can realize the combined function by combining the calls of the sub-functions corresponding to each of the plurality of subtasks. The scenario data includes data related to the query and answer scenarios.

[0151] The training data obtaining unit 720 may be configured to obtain training data based on the language data, the plurality of instructions, and the result.

[0152] In addition to providing a method for training a large language model, the present disclosure also provides a corresponding device for training a large language model. Figure 8 This is explained. Figure 8 FIG. 8 is a block diagram of an apparatus 800 for training a large language model according to an embodiment of the present disclosure. The above description of the method for training a large language model is also applicable to the apparatus 800, unless otherwise explicitly stated.

[0153] Reference Figure 8 , the apparatus 800 may include a training unit 810. The training unit may be configured to utilize the above-mentioned combination Figure 2 The training data generated by any of the methods described is used to train the large language model.

[0154] It should be noted that, although the above description of the apparatus 600-800 divides them into units for respectively performing corresponding processing, it is clear to those skilled in the art that the processing performed by each unit can also be performed without any specific unit division of the apparatus or without clear demarcation between the units. Figure 6-Figure 8 The described device is not limited to including the units described above, but some other units (for example, storage units, etc.) may be added as needed, or the above units may also be combined.

[0155] The present disclosure also provides corresponding devices, namely, a device for generating a combined task, the combined task is used to generate training data for training a large language model; a device for generating training data using a large language model and a device for training a large language model. Since the hardware structures of the above three devices are consistent, for the sake of simplicity, the following description will be made using device 900 to replace any of the above three devices.

[0156] Fig. 9 is a block diagram illustrating a device 900 according to an embodiment of the present disclosure.

[0157] See also Fig. 9 , the device 900 may include a processor 901 and a memory 902. The processor 901 and the memory 902 may be connected via a bus 903.

[0158] The processor 901 can perform various actions and processes according to the program stored in the memory 902. Specifically, the processor 901 can be an integrated circuit chip with signal processing capabilities. The above-mentioned processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The various methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., which can be an X86 architecture or an ARM architecture.

[0159] The memory 902 stores computer instructions, which are executed by the processor 901 to achieve the above combination. Figure 1 Any of the above methods, combined Figure 2 Any of the methods described or methods for training a large language model. Memory 902 may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. Non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. Volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous connection dynamic random access memory (SLDRAM), and direct memory bus random access memory (DR RAM). It should be noted that the memory of the method described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0160] According to yet another embodiment of the present disclosure, a computer-readable recording medium is also provided. Fig.10 A schematic diagram of a recording medium 1000 according to an embodiment of the present disclosure is shown.

[0161] like Fig.10 As shown, the computer recording medium 1000 stores a computer executable instruction 1010. When the computer executable instruction 1010 is executed by a processor, the above-mentioned combination Figure 1 Any of the above methods, combined Figure 2Any of the methods described or the method for training a large language model. The computer-readable recording medium in the disclosed embodiment may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of exemplary but not limiting explanation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous connection dynamic random access memory (SLDRAM), and direct memory bus random access memory (DR RAM). It should be noted that the memory of the method described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0162] Another embodiment of the present disclosure further provides a computer program product, which includes computer executable instructions. When the computer executable instructions are executed by a processor, the processor is prompted to perform the above-mentioned combination Figure 1 Any of the above methods, combined Figure 2 Any of the methods described above or a method for training a large language model.

[0163] It should be noted that the flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the methods, devices, media, equipment and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment, or a part of a code, and the module, program segment, or a part of a code contains at least one executable instruction for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0164] In general, various example embodiments of the present disclosure may be implemented in hardware or dedicated circuits, software, firmware, logic, or any combination thereof. Certain aspects may be implemented in hardware, while other aspects may be implemented in firmware or software that may be executed by a controller, microprocessor, or other computing device. When various aspects of the embodiments of the present disclosure are illustrated or described as block diagrams, flow charts, or using some other graphical representation, it will be understood that the blocks, devices, systems, techniques, or methods described herein may be implemented in hardware, software, firmware, dedicated circuits or logic, general purpose hardware or controllers or other computing devices, or some combination thereof as non-limiting examples.

[0165] The exemplary embodiments of the present disclosure described in detail above are merely illustrative and not restrictive. It should be understood by those skilled in the art that various modifications and combinations may be made to these embodiments or their features without departing from the principles and spirit of the present disclosure, and such modifications should fall within the scope of the present disclosure.

Claims

1. A method for generating a combination task, wherein the combination task is used to generate training data for training a large language model, the method comprising: Based on the collected scenario data, a plurality of subtasks are generated, each of the plurality of subtasks can implement a single function by calling a subfunction, wherein the scenario data includes data related to the query and answer scenarios; as well as Based on the generated multiple subtasks, the combined task is obtained, and the combined task can realize a combined function by combining calls of sub-functions corresponding to each of the multiple subtasks.

2. The method according to claim 1, wherein: The plurality of subtasks include a first subtask and a second subtask, wherein the second subtask is generated based on a result of the first subtask, The step of obtaining the combined task based on the generated multiple subtasks includes: The combined task is obtained based on the first subtask and the second subtask.

3. The method according to claim 1, wherein: The multiple subtasks include a third subtask, a fourth subtask and a fifth subtask, the third subtask and the fourth subtask can be executed in parallel, and the fifth subtask is generated based on the result of the third subtask and the result of the fourth subtask, The step of obtaining the combined task based on the generated multiple subtasks includes: The combined task is obtained based on the third subtask and the fifth subtask.

4. The method according to claim 1, wherein: The plurality of subtasks include a sixth subtask and a seventh subtask, and the sixth subtask and the seventh subtask can be executed in parallel. The step of obtaining the combined task based on the generated multiple subtasks includes: Based on the sixth subtask and the seventh subtask, the combined task is obtained.

5. The method according to any one of claims 1 to 4, wherein: The combined task can realize the combined function by combining the calls of the sub-functions corresponding to each of the multiple sub-tasks, including: The combined task can realize the combined function by sequentially calling the sub-function corresponding to each of the multiple sub-tasks.

6. A method for generating training data using a large language model, wherein the large language model comprises a first large language model and a second large language model, the method comprising: Using the first large language model to generate multiple instructions for calling corresponding sub-functions based on the received language data corresponding to the combined task, and using the second large language model to call the corresponding sub-function based on the multiple instructions and output a result obtained based on the sub-function, wherein the combined task is generated based on multiple sub-tasks, each of the multiple sub-tasks is generated based on the collected scenario data and can realize a single function by calling a sub-function, and the combined task can realize the combined function by combining the calls of the sub-functions corresponding to each of the multiple sub-tasks, and the scenario data includes data related to the query and answer scenarios; as well as Training data is obtained based on the language data, the plurality of indications, and the result.

7. The method according to claim 6, wherein: The large language model further includes a third large language model, and the method further includes: The language data is output based on the combined task using the third large language model.

8. The method according to claim 6, wherein the plurality of subtasks comprises a first subtask and a second subtask, in, The using the first large language model to generate a plurality of instructions for calling a corresponding sub-function based on the received language data corresponding to the combined task, and using the second large language model to call the corresponding sub-function based on the plurality of instructions and output a result obtained based on the sub-function, comprises: Generate a first instruction to call a first sub-function corresponding to the first sub-task based on the received language data corresponding to the combined task using the first large language model; Using the second large language model to call a corresponding first sub-function based on the first indication and output a first result obtained based on the first sub-function; Based on the first result, using the first large language model, generating a second instruction to call a second sub-function corresponding to the second sub-task; and Using the second large language model to call a corresponding second sub-function based on the second indication and outputting a second result obtained based on the second sub-function; Wherein, obtaining training data based on the language data, the multiple instructions and the result includes: Training data is obtained based on the language data, the first indication, the first result, the second indication, and the second result.

9. The method according to claim 6, wherein the plurality of subtasks include a third subtask and a fourth subtask, in, The using the first large language model to generate a plurality of instructions for calling a corresponding sub-function based on the received language data corresponding to the combined task, and using the second large language model to call the corresponding sub-function based on the plurality of instructions and output a result obtained based on the sub-function, comprises: Generate, using the first large language model based on the received language data corresponding to the combined task, a third instruction for calling a third sub-function corresponding to the third sub-task and a fourth instruction for calling a fourth sub-function corresponding to the fourth sub-task; Using the second large language model to call a corresponding third sub-function based on the third indication and output a third result obtained based on the third sub-function, and calling a corresponding fourth sub-function based on the fourth indication and output a fourth result obtained based on the fourth sub-function; Wherein, obtaining training data based on the language data, the multiple instructions and the result includes: Training data is obtained based on the language data, the third indication, the third result, the fourth indication, and the fourth result.

10. The method according to claim 6, wherein: The combined task can realize the combined function by combining the calls of the sub-functions corresponding to each of the multiple sub-tasks, including: The combined task can realize the combined function by sequentially calling the sub-function corresponding to each of the multiple sub-tasks.

11. A method for training a large language model, the method comprising: The large language model is trained using the training data generated based on the method according to any one of claims 6 to 10.

12. A device for generating a combined task, wherein the combined task is used to generate training data for training a large language model, the device comprising: A subtask generating unit, configured to generate a plurality of subtasks based on the collected scenario data, wherein the plurality of subtasks can realize a single function by calling a subfunction, wherein the scenario data includes data related to the query and answer scenarios; as well as The combined task obtaining unit is configured to obtain the combined task based on the generated multiple subtasks, and the combined task can realize the combined function by combining the calls of the subfunctions corresponding to each of the multiple subtasks.

13. A device for generating training data using a large language model, wherein the large language model comprises a first large language model and a second large language model, the device comprising: an instruction generation and result output unit, configured to generate a plurality of instructions for calling corresponding sub-functions based on the received language data corresponding to the combined task using the first large language model, and to call the corresponding sub-function based on the plurality of instructions using the second large language model and output a result obtained based on the sub-function, wherein the combined task is generated based on a plurality of sub-tasks, each of the plurality of sub-tasks is generated based on the collected scenario data and can realize a single function by calling a sub-function, the combined task can realize the combined function by combining the calls of the sub-functions corresponding to each of the plurality of sub-tasks, and the scenario data includes data related to the query and answer scenarios; as well as The training data obtaining unit is configured to obtain training data based on the language data, the plurality of instructions, and the result.

14. A device for training a large language model, the device comprising: A training unit is configured to train the large language model using training data generated based on the method according to any one of claims 6 to 10.

15. A device for generating a combined task, the combined task being used to generate training data for training a large language model, the device comprising: processor, and A memory storing computer executable instructions, which, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 5.

16. A device for generating training data using a large language model, comprising: processor, and A memory storing computer executable instructions, which, when executed by a processor, cause the processor to perform the method according to any one of claims 6 to 10.

17. A device for training a large language model, comprising: processor, and A memory storing computer executable instructions, which when executed by a processor cause the processor to perform the method of claim 11.

18. A computer-readable recording medium storing computer-executable instructions, wherein: The computer executable instructions, when executed by a processor, cause the processor to perform the method of any one of claims 1-11.

19. A computer program product comprising computer executable instructions, wherein: The computer executable instructions, when executed by a processor, cause the processor to perform the method of any one of claims 1-11.

Citation Information

Patent Citations

  • Method and device for executing complex task by using large language model

    CN116594757A

  • Intelligent agent scheduling method, system and equipment based on large language model and medium

    CN118132227A

  • Large language model training method and method for generating codes by using large language model

    CN118261201A

  • Prompt game learning-based planning method during generation of large language model agent

    CN118468920A