Fine-tuning method and apparatus for tool calling of large language model, and device
By fine-tuning the large language model and using the tool information and parameter analysis contained in the training data, the accuracy and reliability problems of the large language model when calling external tools are solved, ensuring stable data processing in multi-tool scenarios.
Patent Information
- Application Number
- PCT/IB2024/061979
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-02-04
- Filing Date
- 2024-11-28
- Publication Date
- 2025-08-07
AI Technical Summary
When calling external tools in large language models, there are problems such as inaccurate tool selection, errors in digital calculation operations, and difficulty in format identification. Especially in multi-tool scenarios, it is difficult to ensure the stability and accuracy of data processing.
By obtaining training data, including tool description, description of problems, and the identity identification and parameter analysis information of calling the tool, fine-tuning the large language model to enable it to learn the ability to select adaptive application tools.
It improves the accuracy and reliability of calling tools in different application scenarios of large language models, and enhances the practicality of methods.
Smart Images

Figure IB2024061979_07082025_PF_FP_ABST
Abstract
Description
[0001] This disclosure claims priority to Chinese patent application number 202410160256.2, filed with the China Patent Office on February 4, 2024, entitled "Method, Apparatus, and Device for Fine-tuning Tool Invocation of a Large Language Model," the entire contents of which are incorporated herein by reference. Technical Field This disclosure relates to the field of large model technology, and more particularly to a method, apparatus, and device for fine-tuning tool invocation of a large language model. Background: Large language models (LLMs) are essentially generative models, also known as generative large language models. With their powerful natural language processing (NLP) understanding and generation capabilities, large language models are increasingly being applied. Specifically, in addition to being used in conversational scenarios, large language models can also be used to solve complex problems by invoking external tools. However, ensuring that LLMs invoke the correct tools is key to ensuring stable data processing. SUMMARY OF THE INVENTION Embodiments of the present disclosure provide a method, apparatus, and device for fine-tuning tool invocations of a large language model. These methods enable a large language model to learn the ability to select a more suitable application tool from among unrelated application tools, thereby improving the accuracy and reliability of the large language model's invocation of application tools in different application scenarios. In a first aspect, embodiments of the present disclosure provide a method for fine-tuning tool invocations of a large language model, comprising: obtaining a large language model to be fine-tuned, the large language model being communicatively connected to multiple application tools that can be invoked; determining training data for fine-tuning the large language model, the training data comprising a tool description, a problem description, and an identifier and parameter parsing information of a calling tool corresponding to the tool description and the problem description, wherein the calling tool is at least a portion of the multiple application tools; and fine-tuning the large language model based on the training data to obtain a fine-tuned large language model.In a second aspect, embodiments of the present disclosure provide a fine-tuning apparatus for tool invocation of a large language model, comprising: a first acquisition module for acquiring a large language model to be fine-tuned, wherein the large language model is communicatively connected to multiple application tools that can be invoked; a first determination module for determining training data for fine-tuning the large language model, wherein the training data includes a tool description, a problem description, and an identifier and parameter parsing information of a calling tool corresponding to the tool description and the problem description, wherein the calling tool is at least a portion of the multiple application tools; and a first processing module for fine-tuning the large language model based on the training data to obtain a fine-tuned large language model. In a third aspect, embodiments of the present disclosure provide an electronic device, comprising: a memory and a processor; wherein the memory is configured to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the method for fine-tuning tool invocation of a large language model described in the first aspect. In a fourth aspect, embodiments of the present disclosure provide a computer storage medium for storing a computer program, wherein the computer program, when executed by a computer, implements the method for fine-tuning tool invocation of a large language model described in the first aspect. In a fifth aspect, embodiments of the present disclosure provide a computer program product, comprising: a computer program that, when executed by a processor of an electronic device, causes the processor to perform the steps of the method for fine-tuning tool invocation for a large language model described in the first aspect. In a sixth aspect, embodiments of the present disclosure provide a data processing method based on a large language model, comprising: obtaining a data processing request for input to a large language model, wherein the large language model is communicatively connected to multiple application tools that can be invoked; determining problem description information and parsing parameters corresponding to the data processing request; utilizing the large language model to determine a target application tool from the multiple application tools that matches the problem description information; and utilizing the target application tool to process the parsing parameters to obtain a data processing result corresponding to the data processing request.In a seventh aspect, embodiments of the present disclosure provide a data processing device based on a large language model, comprising: a second acquisition module for acquiring a data processing request for input to the large language model, wherein the large language model is communicatively connected to multiple application tools that can be called; a second determination module for determining problem description information and parsing parameters corresponding to the data processing request; a second processing module for using the large language model to determine a target application tool that matches the problem description information from multiple application tools; and the second processing module for processing the parsing parameters using the target application tool to obtain a data processing result corresponding to the data processing request. In an eighth aspect, embodiments of the present disclosure provide an electronic device, comprising: a memory and a processor; wherein the memory is configured to store one or more computer instructions, wherein when executed by the processor, the one or more computer instructions implement the fine-tuning method for tool calling a large language model described in the sixth aspect. In a ninth aspect, embodiments of the present disclosure provide a computer storage medium for storing a computer program that, when executed by a computer, causes the computer to implement the fine-tuning method for tool calling a large language model described in the sixth aspect. In a tenth aspect, an embodiment of the present disclosure provides a computer program product, comprising: a computer program, which, when executed by a processor of an electronic device, causes the processor to perform the steps in the tool-invoked fine-tuning method for a large language model in the sixth aspect. The method, apparatus, and device for fine-tuning tool invocation of a large language model provided in this embodiment obtain a large language model to be fine-tuned, determine training data for fine-tuning the large language model, and then fine-tune the large language model based on the training data to obtain a fine-tuned large language model. Since the training data includes a tool description, a problem description, and the identity and parameter parsing information of the invocation tool corresponding to the tool description and the problem description, the identity of the invocation tool corresponding to the problem description identifies the correct application tool that can solve the described problem, the tool description identifies or reflects the degree of association between the described problem and the invocation tool, and the parameter parsing information corresponding to the problem description identifies the parameter information required for the correct application tool to perform data processing operations for the described problem. Therefore, when fine-tuning the large language model based on the training data, the large language model can learn to select a more suitable application tool from unrelated application tools. This ensures the accuracy and reliability of the large language model's invocation of application tools in different application scenarios, further improving the practicality of the method.To more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or prior art descriptions. Obviously, the drawings described below represent some embodiments of the present disclosure. Persons skilled in the art can derive other drawings based on these drawings without inventive effort. Figure 1 is a schematic diagram illustrating the principles of a tool-invoked fine-tuning method for a large language model according to an embodiment of the present disclosure; Figure 2 is a flowchart illustrating a tool-invoked fine-tuning method for a large language model according to an embodiment of the present disclosure; Figure 3 is a schematic diagram illustrating a large language model according to an embodiment of the present disclosure; and Figure 4 is a flowchart illustrating a process for determining training data for fine-tuning the large language model according to an embodiment of the present disclosure.
[0002] LLM: Large Language Mode I, large language model.
[0003] Prompt: The prompt of the large language model is the input for interacting with the large language model, usually including instructions, context, input and output formats, etc.
[0004] AI Agent: Artificial Intelligence Agent, an intelligent agent based on artificial intelligence technology. Token: The smallest unit of text processed by a large language model.
[0005] API: App I i cat i onProgrammi ng I interface, application program interface, the channel for interaction between the intelligent agent system and the application platform.
[0006] SFT: Supr i vsedF i ne-Tun i ng, a supervised model fine-tuning method.
[0007] LoRA (Low-Rank Adaptation) is a method for fine-tuning models. To help understand the specific implementation process of the technical solution in this embodiment, the following briefly describes the relevant technologies: Large Language Models (LLMs) are essentially generative models, also known as generative large language models. With their powerful natural language processing (NLP) understanding and generation capabilities, large language models are finding increasingly widespread application. In addition to their application in conversational scenarios, LLMs can call external tools through AI agents. Specifically, LLMs can call external tools through application programming interfaces (APIs) to solve complex problems. Therefore, the ability of large language models to call external tools and solve complex problems has attracted considerable attention. Furthermore, LLMs can call a variety of tools, such as search tools, flight booking tools, hotel reservation tools, and tools for data query and calculation using the Structured Query Language (SQL). These application tools called by large language models can be used to solve various technical problems. For example, a user might ask a question like "What's the traffic congestion situation in Hangzhou today?" The LLM can use semantic analysis to determine which tool to call to query the traffic congestion index. It can then parse the parameters required by the tool, such as "Hangzhou" and "today," ensuring that the tool returns the correct answer. When using the LLM for data processing, whether the LLM can call the correct tool and accurately parse the tool's parameters is crucial to successful data processing. However, tool invocation presents several challenges:
[0008] (1) When there are a large number of application tools, the input prompts corresponding to all application tools will exceed the input prompt token length limit that LLM can support. For example: the input prompts corresponding to all application tools are 2048k, while the token length limit can be 1024k, etc.
[0009] (2) How to ensure that the correct tool is selected from multiple tools.
[0010] (3) Large language models are mainly used to process natural language and are not good at performing numerical calculations. Therefore, in the process of multi-parameter extraction, date reasoning operations or unit conversion operations are prone to errors.
[0011] (4) How to ensure that the LLM generates a format that can be recognized by the LangChain framework. In order to solve the above technical problems, this embodiment provides a fine-tuning method, device and equipment for tool calls of a large language model. Referring to Figure 1, the execution subject of the fine-tuning method for tool calls of a large language model provided in this embodiment can be a fine-tuning device for tool calls of a large language model. It should be noted that the fine-tuning device for tool calls of a large language model can be implemented as any device that can provide fine-tuning services for tool calls of a large language model, such as: a terminal device, a personal computer, a tablet computer, a local server or a server in the cloud. At this time, when the fine-tuning device for tool calls of a large language model is implemented as a server in the cloud, the fine-tuning method for tool calls of a large language model can be executed in the cloud. Several computing nodes (cloud servers) can be deployed in the cloud, and each computing node has processing resources such as computing and storage. In the cloud, multiple computing nodes can be organized to provide a certain service. Of course, a computing node can also provide one or more services. The cloud can provide the service by providing a service interface to the outside world, and users call the service interface to use the corresponding service. Service interfaces include software development kits (SDKs) and application programming interfaces (APIs). The fine-tuning device for the large language model's tool calls is communicatively connected to a client. The client is used by users to implement fine-tuning operations for the large language model's tool calls. The client can be any computing device with sufficient data transmission capabilities. In specific implementations, the client can be a mobile phone, a personal computer (PC), a tablet computer, a configuration application, and so on. Furthermore, the basic structure of the client can include at least one processor. The number of processors depends on the configuration and type of the client. The client can also include memory, which can be volatile, such as random access memory (RAM), non-volatile, such as read-only memory (ROM), flash memory, etc., or a combination of both types. The memory typically stores an operating system (OS), one or more application programs, and may also store program data and the like.In addition to a processing unit and memory, the client also includes some basic configurations, such as a network card chip, an I / O bus, a display component, and some peripheral devices. Optionally, some peripheral devices may include, for example, a keyboard, a mouse, a stylus, a printer, etc. Other peripheral devices are well known in the art and are not described in detail here. A fine-tuning device for tool invocation of a large language model refers to a device that can provide fine-tuning operations for tool invocation of a large language model in a network virtual environment. It typically refers to a device that utilizes a network for information planning and fine-tuning operations for tool invocation of a large language model. In physical implementation, a fine-tuning device for tool invocation of a large language model can be any device that can provide computing services, respond to fine-tuning requests for a large language model, and perform fine-tuning operations for tool invocation of the large language model based on the fine-tuning requests. For example, it can be a cluster server, a conventional server, a cloud server, a cloud host, a virtual center, etc. The data processing device primarily comprises a processor, a hard disk, memory, a system bus, etc., similar to a general computer architecture. In the above-described embodiment, a client establishes a network connection with the fine-tuning device invoked by the tool for the large language model. This network connection can be a wireless or wired network connection. If the client can establish a communication connection with the fine-tuning device invoked by the tool for the large language model, the mobile network standard can be any one of 2G (GSM), 2.5G (GPRS), 3G (WCDMA, TD-SCDMA, CDMA2000, UTMS), 4G (LTE), 4G+ (LTE+), Wi-Max, 5G, 6G, etc. In the disclosed embodiment, the client is configured to generate or obtain a fine-tuning request for the large language model. Specifically, the client can display a human-computer interaction interface, obtain an execution operation input by a user in the human-computer interaction interface, generate or obtain a fine-tuning request for the large language model based on the execution operation, and transmit the fine-tuning request to the fine-tuning device invoked by the tool for the large language model to implement the fine-tuning operation invoked by the tool for the large language model. The fine-tuning device invoked by the tool of the large language model is used to obtain a fine-tuning request sent by the client, and then obtain the large language model to be fine-tuned based on the fine-tuning request. The large language model can be communicatively connected to multiple application tools that can be invoked. The multiple application tools can include at least one of the following: an information search tool, an air ticket booking tool, a hotel reservation tool, a data query tool, etc.After obtaining the large language model to be fine-tuned, training data for fine-tuning the large language model can be determined to improve the accuracy and reliability of tool invocation operations using the large language model. To enable the large language model to learn to select appropriate application tools for data processing in different application scenarios, the determined training data may include: tool descriptions, problem descriptions, and tool invocation and parameter parsing information corresponding to the tool descriptions and problem descriptions. The tool descriptions may include information describing the functions that the training tool can implement, the problem descriptions may include different questions corresponding to different application scenarios, the invocation tool may refer to the name of the training tool or its preset identity, and the parameter parsing information may refer to parsed data generated when the training tool is used for data processing operations. After determining the training data for fine-tuning the large language model, the training data can be used to fine-tune the large language model, thereby obtaining a fine-tuned large language model. Because the training data includes tool descriptions, problem descriptions, tool invocation, and parameter parsing information, fine-tuning the large language model enables the large language model to learn to select a more suitable application tool from among unrelated ones. This ensures the accuracy and reliability of the large language model in invoking application tools in different application scenarios, effectively improving the accuracy and reliability of the large language model's application while ensuring the practicality of this method. The following detailed description of some embodiments of the present disclosure is provided in conjunction with the accompanying drawings. The following embodiments and features may be combined unless they conflict with each other. Furthermore, the sequence of steps in the following method embodiments is provided for illustrative purposes only and is not a strict limitation. FIG2 is a flow chart illustrating a method for fine-tuning tool invocation for a large language model provided by an embodiment of the present disclosure. Referring to FIG2 , this embodiment provides a method for fine-tuning tool invocation for a large language model. The method may be performed by a device for fine-tuning tool invocation for a large language model. It is understood that the device for fine-tuning tool invocation for a large language model may be implemented as software or a combination of software and hardware. Specifically, when the device for fine-tuning tool invocation for a large language model is implemented as hardware, it includes, but is not limited to, a tablet computer, a personal computer (PC), a server, and the like. When the device for fine-tuning tool invocation for a large language model is implemented as software, it may be installed in any of the electronic devices listed above. Based on the device for fine-tuning tool invocation for a large language model, the method for fine-tuning tool invocation for a large language model in this embodiment may include the following steps: Step S201: Obtain a large language model to be fine-tuned, wherein the large language model is communicatively connected to multiple application tools that can be invoked.Step S202: Determine training data for fine-tuning the large language model. The training data includes a tool description, a problem description, and the identity and parameter parsing information of a calling tool corresponding to the tool description and problem description. The calling tool is at least a portion of multiple application tools. Step S203: Fine-tune the large language model based on the training data to obtain a fine-tuned large language model. The specific implementation principles and effects of each of the above steps are described in detail below: Step S201: Obtain a large language model to be fine-tuned. The large language model is communicatively connected to multiple application tools that can be called. When a user needs to fine-tune a large language model, a fine-tuning device (hereinafter referred to as the "fine-tuning device") invoked by the large language model tool can be configured to obtain the large language model to be fine-tuned. In some instances, the large language model to be fine-tuned can be obtained through human-computer interaction. In this case, obtaining the large language model to be fine-tuned may include: displaying a human-computer interaction interface displaying multiple candidate large language models, obtaining a user selection operation for any of the candidate large language models, and obtaining the large language model to be fine-tuned based on the selection operation. In other instances, the large language model to be fine-tuned can be obtained not only through human-computer interaction but also through a client or a third device. In this case, obtaining the large language model to be fine-tuned may include: determining a client or a third device in communication with the fine-tuning device, wherein the client or the third device stores the large language model to be fine-tuned; and actively or passively obtaining the large language model to be fine-tuned through the client or the third device. This effectively ensures stable and reliable acquisition of the large language model. It should be noted that when using a large language model for data processing, in order to solve or address various complex problems in different application scenarios, the large language model in this embodiment can be communicatively connected to multiple application tools that can be called. These multiple application tools may include, but are not limited to, search tools, flight booking tools, hotel reservation tools, and tools for data query and calculation using the Structured Query Language (SQL). To meet the different data processing requirements in different application scenarios, the large language model can call application tools that are compatible with the data processing requirements to perform corresponding data processing operations, thereby ensuring stable and reliable data processing. Step S202: Determine training data for fine-tuning the large language model. The training data includes a tool description, a problem description, and the identity and parameter parsing information of a calling tool corresponding to the tool description and problem description. The calling tool is at least a portion of the multiple application tools.When using a large language model for data processing, the large language model can call upon a wide variety of application tools, and different application scenarios require completely different application tools. To improve the accuracy and reliability of the large language model's call upon application tools, training data for fine-tuning the large language model can be determined. In some instances, the training data can be determined using a preset mapping relationship. Determining the training data for fine-tuning the large language model may include: obtaining the tool type corresponding to each of the multiple application tools communicatively connected to the large language model; and determining the distribution of call tools corresponding to the large language model based on the tool type. Different call tool distributions may correspond to different training data. Therefore, after obtaining the call tool distribution, the training data for fine-tuning the large language model can be determined based on the call tool distribution, effectively ensuring the stability and reliability of the training data determination. Furthermore, to improve the accuracy of the large language model in calling application tools, the training data may include: a tool description, a description of the problem, and the calling tool and parameter parsing information corresponding to the tool description and description of the problem. The tool description is used to describe the functions or effects that the training tool can achieve, and it identifies or reflects the degree of association between the description of the problem and the calling tool. For example, for a traffic query tool, its tool description may be "Road Section Congestion Delay Index Query Tool, which can obtain the congestion index of a specified road section (a certain road) and determine the congestion situation, i.e., is it congested?" The description of the problem may be information about the problem that the training tool can solve. For example, for a traffic query tool, the corresponding description of the problem may be "What is the congestion index for a certain time period in the morning?" The identification of the calling tool corresponding to the tool description and description of the problem may be the name of the calling tool, which is used to identify the correct application tool that can solve the description of the problem, such as "Traffic Query Tool A". The parameter parsing information may be field parsing information corresponding to the description of the problem, which is used to identify the parameter information required for the correct application tool to perform data processing operations for the description of the problem. For example, if the question is "What is the congestion index for XX road section during XXX morning hours?", the road section in the training question can be determined to be "XX road section" and the time range to be "XXX morning hours." Step S203: Fine-tune the large language model based on the training data to obtain a fine-tuned large language model. After obtaining the training data, fine-tune the large language model based on the training data to improve the accuracy of the large language model's invocation of application tools, thereby obtaining a fine-tuned large language model.In some instances, to improve the quality and efficiency of fine-tuning operations and reduce resource consumption, fine-tuning may be performed only on parameters corresponding to non-dense network layers in a large language model. In this case, fine-tuning the large language model based on training data to obtain a fine-tuned large language model in this embodiment may include: obtaining a fine-tuned non-dense network layer in the large language model; and fine-tuning parameters of the non-dense network layer in the large language model based on the training data to obtain the fine-tuned large language model. For example, as shown in FIG3 , the large language model may include: an input layer, multiple dense network layers and multiple non-dense network layers communicatively connected to the input layer, and an output layer communicatively connected to the dense network layers and the non-dense network layers. The dense network layers include multiple model parameters corresponding to the large language model, and the non-dense network layers include a small number of model parameters corresponding to the large language model. Therefore, in order to reduce the resource information required for fine-tuning the large language model, a non-dense network layer that can be fine-tuned in the large language model can be obtained. The above-mentioned non-dense network layer can be determined by the layer identifier of the network layer in the large language model. For example, the dense network layer corresponds to the identity identifier "1". After obtaining the large language model, it can be determined that the large language model includes the layer identifiers corresponding to each network layer, and then the layer identifiers corresponding to each network layer are analyzed and matched with the identity identifier of the dense network layer. If the layer identifier corresponding to the network layer is the same as the identity identifier of the dense network layer, the network layer is determined to be a dense network layer; if the layer identifier corresponding to the network layer is different from the identity identifier of the dense network layer, the network layer is determined to be a non-dense network layer. After obtaining the non-dense network layer, parameters of the non-dense network layer in the large language model can be fine-tuned based on the training data, thereby obtaining a fine-tuned large language model. This effectively fixes the network parameters in the dense network layer while fine-tuning the network parameters in the non-dense network layer. This effectively reduces the number of network parameters required for fine-tuning, further improving the quality and efficiency of fine-tuning the large language model. In other examples, when fine-tuning the large language model, not only can the network layer parameters corresponding to the fine-tuning operation be considered to minimize the resource information required for the fine-tuning operation, but also the fine-tuning method required for the fine-tuning operation be considered. In this case, fine-tuning the large language model based on the training data to obtain the fine-tuned large language model may include: obtaining a low-order adaptation model for fine-tuning the large language model; determining the parameter information required for fine-tuning the low-order adaptation model; and fine-tuning the large language model using the low-order adaptation model, the parameter information, and the training data to obtain the fine-tuned large language model.Since LoRA belongs to the adapter family and can migrate knowledge from the source domain (e.g., representation space and low-rank decomposition) to the target domain, thereby improving performance in the target domain, this embodiment can employ a low-rank adapter or a low-rank adaptation model (LoRA) to fine-tune the large language model. Specifically, to improve the quality and effectiveness of fine-tuning the large language model, a low-rank adaptation model for fine-tuning the large language model can be obtained. The low-rank adaptation model can be stored in a preset area. When fine-tuning the large language model is required, the low-rank adaptation model for fine-tuning the large language model can be obtained by accessing the preset area. To fine-tune the large language model based on the low-rank adaptation model, after obtaining the low-rank adaptation model, parameter information required for fine-tuning the low-rank adaptation model can be determined. The parameter information corresponding to the low-rank adaptation model can include preset parameters such as the ratio or quantity used to adjust model parameters of the large language model. Furthermore, this embodiment does not limit the specific method for obtaining parameter information. In some instances, the parameter information required for fine-tuning the low-level adaptation model may be pre-configured default parameters. In this case, determining the parameter information required for fine-tuning the low-level adaptation model may include: determining a preset area for storing default parameter information; and determining the default parameter information required for fine-tuning the low-level adaptation model by accessing the preset area. This effectively ensures the accuracy and reliability of the parameter information determination. In other instances, the parameter information may be obtained through human-computer interaction. In this case, determining the parameter information required for fine-tuning the low-level adaptation model may include: displaying a human-computer interaction interface; obtaining an execution operation input by a user in the human-computer interaction interface; and determining the parameter information required for fine-tuning the low-level adaptation model based on the execution operation. This also ensures the accuracy and reliability of the parameter information determination. After obtaining a low-order adaptation model for fine-tuning the large language model and determining the parameter information required for fine-tuning the low-order adaptation model, the large language model can be fine-tuned using the low-order adaptation model, parameter information, and training data. This allows for a stable fine-tuned large language model and ensures the quality and effectiveness of the fine-tuning operation on the large language model.The fine-tuning method for tool invocation of a large language model provided in this embodiment obtains a large language model to be fine-tuned, determines training data for fine-tuning the large language model, and then fine-tunes the large language model based on the training data to obtain the fine-tuned large language model. Since the training data includes a tool description, a problem description, and the identity and parameter parsing information of the invocation tool corresponding to the tool description and the problem description, the identity of the invocation tool corresponding to the problem description identifies the correct application tool that can solve the described problem, the tool description identifies or reflects the degree of association between the described problem and the invocation tool, and the parameter parsing information corresponding to the problem description identifies the parameter information required for the correct application tool to perform data processing operations for the described problem. Therefore, when fine-tuning the large language model based on the training data, the large language model can learn to select a more suitable application tool from unrelated application tools. This ensures the accuracy and reliability of the large language model's invocation of application tools in different application scenarios, further improving the practicality of the method. FIG4 is a schematic diagram of a process for determining training data for fine-tuning a large language model according to an embodiment of the present disclosure. Based on the above embodiment, referring to FIG4 , the training data can be determined not only through a preset mapping relationship but also by separately acquiring various types of data constituting the training data to determine the complete training data. In this case, determining the training data for fine-tuning the large language model may include: Step S401: Acquiring multiple description questions, wherein the description questions include date inference data. Since the description questions are composed of description questions corresponding to various application tools, in order to accurately acquire the description questions, the description questions corresponding to each application tool may first be acquired. In some instances, the multiple description questions may be acquired based on human-computer interaction. In this case, acquiring the multiple description questions may include: acquiring multiple application tools to be invoked, determining a question description operation input by a user for the multiple application tools, and acquiring the description questions corresponding to the multiple application tools based on the question description operation. This effectively ensures the accuracy and reliability of the acquisition of the description questions. In other instances, since one application tool often corresponds to one description problem, the number and types of application tools are limited, which results in a limited number of description problems obtained.A limited number of description questions may not guarantee the quality and effectiveness of fine-tuning a large language model. Therefore, to increase the amount of training data and ensure the quality and effectiveness of fine-tuning a large language model, this embodiment not only directly obtains description questions through manual operation, but also utilizes generalization to obtain a larger number of description questions. In this case, obtaining multiple description questions may include: obtaining a preset standard question; generalizing the preset standard question to obtain a generalized question; and determining the preset standard question and the generalized question as multiple description questions. For application tools, to ensure normal invocation, the application tool often corresponds to a preset standard question. When the user's data processing requirements in the application scenario correspond to the preset standard question, the large language model can invoke the corresponding application tool based on the preset standard question to meet the user's data processing requirements. As can be seen above, the invocation of an application tool often corresponds to a preset standard question. Therefore, to stably obtain multiple description questions, the preset standard question can be obtained first. The preset standard question can be determined through human-computer interaction or a preset mapping relationship. Since the number of preset standard questions is limited and their formats and expressions are relatively fixed, this greatly increases the restrictions on calling application tools. Therefore, in order to enable flexible calling operations on application tools, after obtaining the preset standard questions, a preset generalization algorithm or a pre-trained machine learning model or neural network model can be used to generalize the preset standard questions to obtain generalized questions. It should be noted that for generalized questions and preset standard questions, the generalized questions and the preset standard questions have the same question theme but different specific expression methods. For example, when the preset standard question is "What is the congestion index of XX road section during time period A?", after generalizing the preset standard question, the following generalized questions can be obtained: "What is the congestion level of XX road section during time period A?", "What is the congestion level of XX road section during time period A?", "Is XX road section congested during time period A?", "Is there a traffic jam on XX road section during time period A?", etc. Since the generalized questions and the preset standard questions have the same question theme but different specific expression methods, when questions with the same question theme but different expression methods appear, the large language model can accurately call more accurate application tools, thereby greatly expanding the flexibility and reliability of calling the application tools corresponding to the preset standard questions.After obtaining the preset standard questions and generalized questions, the set of questions consisting of the preset standard questions and the generalized questions can be determined as multiple description questions. This not only ensures the accuracy and reliability of the description questions, but also effectively increases the number of description questions, which helps improve the quality and effectiveness of fine-tuning the large language model based on multiple description questions. Furthermore, since the large language model is designed to process natural language, its date reasoning capabilities are somewhat weak, which may lead to date reasoning errors. To improve the accuracy and reliability of the large language model's date reasoning capabilities, the training data used for fine-tuning the large language model can include relevant data that is expected to help the large language model learn date reasoning capabilities. Specifically, the question description may include date reasoning data. For example, if the question description is "Query the congestion index ranking of road section A within the past 7 days," the "in the past 7 days" in the question description is date reasoning data related to the date reasoning capability. If the question description is "Find flight information from city A to city B within the next 3 days," the "in the next 3 days" in the question description is date reasoning data related to the date reasoning capability. Step S402: Determine the tool description for the calling tool. Training data includes not only the question description but also a tool description that introduces the functions and effects that the training tool can implement. Therefore, to accurately obtain training data, once the calling tool that can be called by the large language model is determined, the tool description of the calling tool can be determined. Specifically, the tool description can be determined through human-computer interaction. Determining the tool description for the calling tool may include: displaying an interactive interface for configuring the tool description; obtaining an execution operation entered by the user in the interactive interface; and determining the tool description for the calling tool based on the execution operation. Alternatively, the large language model may be determined not only through human-computer interaction but also through a preset mapping relationship. In this case, determining the tool description of the calling tool may include: obtaining a tool identifier corresponding to the calling tool and a preset mapping relationship, where the preset mapping relationship includes multiple tool identifiers and tool descriptions corresponding to each tool identifier; and determining the tool description corresponding to the calling tool based on the tool identifier and the preset mapping relationship.It should be noted that the execution order of step S402 and step S401 in this embodiment is not limited to the order defined in the above embodiment. For example, step S402 can be executed simultaneously with step S401, or step S402 can be executed before step S401. Those skilled in the art can flexibly adjust the execution order of the above two steps based on specific application scenarios or application requirements, and this will not be described in detail here. Step S403: Based on the tool description, the calling tool and parameter parsing information that match each description question are determined. The parameter parsing information includes the date parsing result. Since there is no corresponding relationship between description questions and calling tools, in order to accurately enable the large language model to learn the ability to correctly call the calling tool, after obtaining the tool description, description question, and calling tool, a mapping relationship can be established between the three. Specifically, the calling tool and parameter parsing information that match each description question can be determined based on the tool description. It should be noted that the target calling tool can correspond to one or more description questions, which can be preset standard questions or generalized questions. Specifically, when establishing mappings between tool descriptions, problem descriptions, and calling tools, since the number of calling tools can be in the tens of thousands, if the problem descriptions corresponding to these tens of thousands of calling tools constitute an input prompt for input into the large language model, the input prompt will be lengthy. This not only increases the amount of data analyzed and processed by the large language model, but also reduces the quality and efficiency of determining the mapping relationship between calling tools and problem descriptions. To avoid this, a calling tool matching each parameter problem description can be determined based on a pre-configured number of compatible calling tools. In this case, determining a calling tool matching each problem description based on the tool description can include: obtaining a set of application tools that can be called by the large language model, where the application tool set may include multiple application tools; determining, within the application tool set, an compatible calling tool matching each problem description, where the number of compatible calling tools is less than the number of application tools in the application tool set; and processing the tool description, problem description, and compatible calling tool using the large language model to obtain a target calling tool matching each problem description.To ensure the accuracy of the mapping between problem descriptions and invocation tools, a set of application tools that can be invoked by the large language model can be first obtained. Specifically, the application tool set can be determined using a preset application configuration file or preset application interface data in the large language model. The problem description and the application tool set can then be analyzed and matched to determine, from the application tool set, an adaptation invocation tool that matches each problem description. It should be noted that a pre-configured number of adaptation invocation tools is used to limit the number of adaptation invocation tools that match each problem description. In this case, the number of adaptation invocation tools is less than the number of application tools in the application tool set. For example, a problem description may match two, three, four, or five adaptation invocation tools, etc. Those skilled in the art can flexibly configure the number of adaptation invocation tools based on specific application requirements. After obtaining the tool description, problem description, and adaptation invocation tool, the large language model can be used to process these tools, obtain target invocation tools that match each problem description. This allows the large language model (LLM) to learn the ability to select a more appropriate invocation tool from multiple adaptation invocation tools. Furthermore, to accurately determine the adaptation tool that matches each description question in the application tool set, the number of adaptation tools in the application tool set can be determined before determining the adaptation tool that matches each description question. In this case, the method in this embodiment can further include: obtaining an upper limit on the length of input prompts supported by the large language model; and determining the number of adaptation tools based on the upper limit, such that the total length of input prompts formed by the adaptation tools that meet the upper limit is less than or equal to the upper limit. Specifically, since there is a correlation between the number of adaptation tools and the length of input prompts supported by the large language model, to accurately determine the number of adaptation tools, the upper limit on the length of input prompts supported by the large language model can be obtained. This upper limit can be a pre-configured default value corresponding to the large language model, or it can be a value configured through human-computer interaction corresponding to the large language model. In some examples, the upper limit on the length of the input prompt can be 1024k. oAfter obtaining the length limit, the number of adaptable calling tools can be determined based on the length limit. Specifically, the requirement or restriction is that the total length of the input prompts formed by the adaptable calling tools meeting the required number of tools is less than or equal to the length limit. This effectively prevents the input prompts formed by the determined adaptable calling tools from exceeding the preset length limit corresponding to the large language model, thereby ensuring accurate and reliable determination of the calling tools. Furthermore, to enable the large language model to have a certain degree of date inference capability, after obtaining the tool description, the tool description can be analyzed and processed to determine parameter parsing information that matches each description question. This parameter parsing information can include date parsing results. In some instances, the date parsing results included in the parameter parsing information can be obtained by analyzing and processing the tool description and description question using a pre-trained machine learning model or a preset algorithm. Step S404: Determine training data based on the tool description, description question, and the identifier and parameter parsing information of the calling tools corresponding to the tool description and description question. After obtaining the tool description, the problem description, and the corresponding tool calling and parameter parsing information, the set consisting of the tool description, the problem description, and the corresponding tool calling identifier and parameter parsing information can be determined as training data. This effectively ensures the accuracy and reliability of the training data determination. Furthermore, after determining the training data for fine-tuning the large language model, to improve the accuracy and reliability of the training data acquisition, the training data can be formatted in a format supported or recognized by the large language model. The method in this embodiment may further include: obtaining a preset data format for defining the training data; and processing the training data based on the preset data format to obtain target training data that meets the preset data format. Specifically, in order to enable the large language model to accurately recognize the training data, after determining the training data for fine-tuning the large language model, a preset data format for defining the training data can be obtained. In some instances, the preset data format can be obtained through human-computer interaction, or the preset data format can be a pre-configured default data format. Specifically, the preset data format can be a lightweight data interaction format json. oAfter obtaining the preset data format, the training data can be processed based on the preset data format to obtain target parameter data that meets the preset data format. The large language model can then be fine-tuned based on the target parameter data. Since the target parameter data is in a data format that the large language model can accurately recognize, this effectively ensures the quality and effectiveness of the fine-tuning of the large language model. Furthermore, different application tools can have different corresponding application tool names, which can serve as identifiers for calling tools. Since different application tool names can have different lengths, when analyzing and recognizing long application tool names, the large language model can avoid identifying the same application tool name as multiple segmented phrases, which could result in the large language model not being able to call the correct application tool. To avoid the above situation, after determining the training data for fine-tuning the large language model, the method in this embodiment may include: obtaining the tool name of the calling tool included in the training data; when the length of the tool name is greater than or equal to a preset length threshold, determining the calling tool corresponding to the tool name as a single, inseparable prompt word. Specifically, after determining the training data for fine-tuning the large language model, the tool name of the calling tool included in the training data can be obtained, and then the length information of the tool name can be determined. The length of the tool name can be analyzed and compared with a preset length threshold. The preset length threshold can be flexibly configured based on the application scenario or application requirements. For example, the preset length threshold can be 5, 6, 7, etc. If the analysis and comparison result shows that the length of the tool name is less than the preset length threshold, it means that the tool name of the calling tool is short. In this case, normal data processing operations can be performed on the calling tool. If the analysis and comparison result shows that the length of the tool name is greater than or equal to the preset length threshold, it means that the tool name of the calling tool is long. In this case, to avoid identifying the tool name of the same calling tool as multiple split phrases, the tool name can be determined as a single, indivisible prompt word. For example, if the tool name of the calling tool is "AreaDe I ay IndexFetch", since the above tool name is greater than the preset length threshold (10), the tool name of the calling tool can be configured with a separate single prompt word token. This not only prevents the accuracy and reliability of the identification of the calling tool, It can also ensure the accuracy and reliability of calling the calling tool, further improving the practicality of the method.In this embodiment, multiple description questions are obtained, tool descriptions for calling tools are determined, and based on the tool descriptions, the calling tools and parameter parsing information matching each description question are determined. Training data is then determined based on the tool descriptions, the description questions, and the identifiers and parameter parsing information of the calling tools corresponding to the tool descriptions and description questions. This effectively ensures the accuracy and reliability of training data acquisition, further improving the practicality of the method. In specific applications, referring to FIG5 , this application embodiment provides a method for improving the tool calling accuracy of a large language model using LoRA fine-tuning technology. This method may include tool retrieval, automatic generation of a fine-tuning dataset, and large language model fine-tuning. Specifically, the steps of the above method are implemented as follows: Step 1: Obtain a tool list. The tool list includes all tools that can be called by the large language model (LLM). This tool list can be obtained through human-computer interaction. After obtaining all tools included in the tool list, the tool information corresponding to each tool can be determined. This tool information can be obtained through human-computer interaction and can include a tool description that explains the functions that the tool can implement and the input parameter information required for tool calling. This tool information needs to be added to the input prompt corresponding to the large language model. That is, the tool information corresponding to all tools can form an input prompt, allowing the large language model to select a tool from all tools. Step 2: Perform a tool search operation based on the tool list. When the tool list includes too many tools, the input prompt consisting of all tool information may exceed the maximum length token supported by the LLM. To avoid this, a tool retrieval module can be used to address this technical issue. Specifically, all tools available to the LLM can be retrieved, and then the tool retrieval module can be used to perform a rough screening of tools. This rough screening process can include the following steps: the tool retrieval module writes all tool information into a preset knowledge base, retrieves the input user question, and then uses vector matching to select n tools (for example, n is 4) that match the user question. After retrieving n tools, the LLM can select a suitable tool from these n tools and call it. In this case, the input prompt corresponding to the LLM can be composed of the n pre-screened tools, effectively addressing the token limitation issue associated with the LLM. Step 3: Generate a fine-tuning dataset for fine-tuning the LLM.The fine-tuning data set may be generated by a fine-tuning data module. Specifically, the fine-tuning data module may generate the fine-tuning data set by the following steps:
[0012] (1) Generate core questions based on the tool list. Specifically, the core questions can be obtained through manual interaction or by analyzing and processing the tool information through the LLM model;
[0013] (2) Using LLM to generalize key questions, derive multiple different questions, and obtain multiple generalized questions, so that a smaller number of key questions can be solved;
[0014] (3) The LLM model is used to analyze the key issues and generalized issues mentioned above, and the calling tools and parameter analysis that are suitable for the key issues and generalized issues are given to generate a fine-tuning dataset. Specifically, the fine-tuning dataset can include the following three types of keywords: "explanatory information", "problem description", and "tool invocation and parameter analysis". For the "explanatory information", in order to ensure that the fine-tuning dataset meets the Jason framework supported by LLM, a fixed input prompt can be appended or configured before and after the "explanatory information". For example, the explanatory information can be expressed as: "Today is 20170828. You are an agent that can fetch data for humans as accurate as possible. Use a jsonb library to specify a too I by providing an activity key (too I name) and an activity_inputkey (too I input). \nFor each step, You should choose ONE AND ONLY ONE activity from the value activity list: \n1.; The key question or generalized question can be expressed as "What is the congestion index of XXX road this morning?" \n", the corresponding calling tool and parameter parsing can be expressed as "This problem requires the use of [LinkDelayIndexFetch] to obtain the congestion index of the specified road section. According to the road section name \ "xxx Road\" and the time range \ "morning\" prompted in the question, I can use the road section congestion delay index query tool to obtain the congestion index. \n\ "nAct i on: \n ' ' ' \n {\n\ "action",":' "LinkDelayIndexFetch",", \n \ "action_input\": {\n\ "Link_name\": \ "xxx Road\" \n\ "time_span\": \ "1\" \n \ "dt\": \ "20170828", \n} \n' ' ' \n".To enable the large language model to learn the ability to select an adaptive tool from unrelated tools and the ability to reason about dates, the fine-tuning dataset can include a simple dataset for date reasoning. This can address the LLM model's tendency to make errors in date reasoning, effectively improving its performance. Furthermore, for the tools in the fine-tuning dataset, long tool names or those that rarely appear can be configured as separate prompts. For example, for the tool called "AreaDelayIndexFetch," to ensure tool call accuracy and prevent unexpected tool calls, the tool name can be configured as a separate prompt token. This can be achieved by training the encoding and decoding layers. This effectively ensures accurate and reliable calls to the tool "AreaDelayIndexFetch." Step 4: Fine-tune the large language model based on the fine-tuning dataset to obtain a fine-tuned model. Specifically, a large language model can be fine-tuned using a low-rank adaptation model (LoRA) and a fine-tuning dataset. Since LoRA belongs to the adapter family, it can leverage the representation space and low-rank decomposition of the source domain to transfer knowledge from the source domain to the target domain, thereby improving performance in the target domain. Therefore, when fine-tuning a large language model based on a fine-tuning dataset, different application scenarios may require different hyperparameters. To ensure stable and reliable fine-tuning of the LLM model, the corresponding hyperparameters of LoRA can be configured according to the following rules:
[0015] (1) For the Rank parameter and the a parameter used to limit the proportion or number of fine-tuning parameters (the complexity of the fine-tuning operation can be configured), the Rank parameter and the a parameter can be configured moderately. If the Rank and a are too large, they tend to be full parameters, which is easy to overfit; otherwise, the regularization is too strong, which is easy to underfit. In this application embodiment, the Rank and a can be configured as the following parameters: Rank = 8, a = 16;
[0016] (2) The learning rate of LoRA (used to limit the speed of model convergence) can be slightly larger, and the full-parameter SFT needs to be smaller. In this application embodiment, the learning rate can be set to 1e-3. When the learning rate is larger, it means that the model can converge faster; when the learning rate is smaller, it means that the model can converge slower.
[0017] (3) The batch size corresponding to LoRA (used to limit the size of the model parameters adjusted each time, the degree of parallelism, etc.) can be as large as possible. Specifically, it can be flexibly adjusted according to the size of the video memory. In this application embodiment, Batch size = 32. A larger Batch size can appropriately increase the learning rate. After the above parameters are configured, the large language model can be fine-tuned based on the above parameters, LoRA model and fine-tuning data set to obtain a fine-tuned model. The fine-tuning method for calling a large model tool provided in this application embodiment fine-tunes the LLM model through the LoRA model and the fine-tuning data set, which not only ensures the quality and effect of the fine-tuning operation on the LLM model, but also effectively ensures the accuracy and reliability of the LLM model calling the application tool. Specifically, the calling accuracy of the LLM model can reach more than 80%. In addition, the fine-tuning method can be applied to various types of LLM models currently available, making the method have good compatibility, which greatly expands the scope of application of the method, effectively improves the practicality of the technical solution, and is conducive to market promotion and application. FIG6 is a schematic structural diagram of a fine-tuning apparatus for tool invocation of a large language model provided by an embodiment of the present disclosure. Referring to FIG6 , this embodiment provides a fine-tuning apparatus for tool invocation of a large language model. The invocation apparatus can execute the fine-tuning method for tool invocation of a large language model shown in FIG2 . Specifically, the fine-tuning apparatus for tool invocation of a large language model may include: a first acquisition module 11, configured to acquire a large language model to be fine-tuned, where the large language model is communicatively connected to multiple application tools that can be invoked; a first determination module 12, configured to determine training data for fine-tuning the large language model, where the training data includes a tool description, a problem description, and an identity and parameter parsing information of a calling tool corresponding to the tool description and problem description, where the calling tool is at least a portion of the multiple application tools; and a first processing module 13, configured to fine-tune the large language model based on the training data to obtain a fine-tuned large language model. In some examples, when the first determination module 12 determines training data for fine-tuning the large language model, the first determination module 12 is configured to: obtain multiple description questions, where the description questions include date inference data; determine a tool description for a calling tool; based on the tool description, determine a calling tool and parameter parsing information that matches each description question, where the parameter parsing information includes a date parsing result; and determine the training data based on the tool description, the description questions, and the identity of the calling tool and the parameter parsing information corresponding to the tool description and the description questions.In some instances, when the first determination module 12 obtains multiple description questions, the first determination module 12 is configured to: obtain a preset standard question; generalize the preset standard question to obtain a generalized question; and determine the preset standard question and the generalized question as multiple description questions. In some instances, when the first determination module 12 determines a calling tool that matches each description question based on a tool description, the first determination module 12 is configured to: obtain a set of application tools that can be called by the large language model; determine, within the set of application tools, an adapted calling tool that matches each description question, where the number of adapted calling tools is less than the number of application tools in the set of application tools; and process the tool description, the description question, and the adapted calling tool using the large language model to obtain a target calling tool that matches each description question. In some examples, before determining the appropriate adaptation tools matching each description problem in the application tool set, the first acquisition module 11 and the first processing module 13 in this embodiment are configured to perform the following steps: the first acquisition module 11 is configured to obtain the upper limit of the length of input prompts supported by the large language model; the first processing module 13 is configured to determine the number of adaptation tools based on the upper limit, such that the total length of the input prompts formed by the adaptation tools meeting the upper limit is less than or equal to the upper limit. In some examples, after determining the training data for fine-tuning the large language model, the first acquisition module 11 and the first processing module 13 in this embodiment are configured to perform the following steps: the first acquisition module 11 is configured to obtain a preset data format for defining the training data; the first processing module 13 is configured to process the training data based on the preset data format to obtain target training data that meets the preset data format. In some examples, when the first processing module 13 fine-tunes the large language model based on the training data to obtain the fine-tuned large language model, the first processing module 13 is configured to: obtain a non-dense network layer in the large language model that can be fine-tuned; and fine-tune the parameters of the non-dense network layer in the large language model based on the training data to obtain the fine-tuned large language model. In some examples, after determining the training data for fine-tuning the large language model, the first acquisition module 11 and the first processing module 13 in this embodiment are configured to perform the following steps: the first acquisition module 11 is configured to obtain the tool name of the calling tool included in the training data; and the first processing module 13 is configured to determine that the tool name is a single, indivisible prompt word if the length of the tool name is greater than or equal to a preset length threshold.In some instances, when the first processing module 13 fine-tunes the large language model based on the training data to obtain the fine-tuned large language model, the first processing module 13 is configured to: obtain a low-order adaptation model for fine-tuning the large language model; determine parameter information required for fine-tuning the low-order adaptation model; and fine-tune the large language model using the low-order adaptation model, parameter information, and training data to obtain the fine-tuned large language model. The apparatus shown in FIG6 can execute the methods of the embodiments shown in FIG1-FIG5 . For portions not described in detail in this embodiment, reference is made to the relevant descriptions of the embodiments shown in FIG1-FIG5 . The execution process and technical effects of this technical solution are described in the embodiments shown in FIG1-FIG5 and will not be further elaborated here. In one possible design, the structure of the fine-tuning apparatus for tool-invoked large language models shown in FIG6 can be implemented as an electronic device, which can be a controller, a personal computer, a partition, or other devices. As shown in FIG7 , the electronic device can include a first processor 21 and a first memory 22. The first memory 22 is used to store a program corresponding to the fine-tuning method for the tool call of the large language model provided in the embodiments shown in Figures 1-5 by the electronic device. The first processor 21 is configured to execute the program stored in the first memory 22. The program includes one or more computer instructions. When executed by the first processor 21, the one or more computer instructions can implement the following steps: obtaining a large language model to be fine-tuned, where the large language model is communicatively connected to multiple application tools that can be called; determining training data for fine-tuning the large language model, where the training data includes a tool description, a problem description, and the identity and parameter parsing information of a calling tool corresponding to the tool description and problem description, where the calling tool is at least a portion of the multiple application tools; and fine-tuning the large language model based on the training data to obtain a fine-tuned large language model. Furthermore, the first processor 21 is further configured to execute all or part of the steps in the embodiments shown in Figures 1-5. The electronic device may also include a first communication interface 23 for communicating with other devices or a communication network. In addition, an embodiment of the present disclosure provides a computer storage medium for storing computer software instructions used by an electronic device, which includes a program for executing the fine-tuning method of the tool call of the large language model in the embodiments shown in Figures 1 to 5 above.Furthermore, embodiments of the present disclosure provide a computer program product comprising: a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to perform the steps of the fine-tuning method for tool calls for a large language model in the method embodiments shown in Figures 1-5 . Figure 8 is a flow chart illustrating a data processing method based on a large language model provided by embodiments of the present disclosure. Referring to Figure 8 , this embodiment provides a data processing method based on a large language model. The method may be executed by a data processing device based on a large language model. It is understood that the data processing device based on a large language model may be implemented as software or a combination of software and hardware. Specifically, when the data processing device based on a large language model is implemented as hardware, it includes, but is not limited to, a tablet computer, a personal computer (PC), a server, and the like. When the data processing device based on a large language model is implemented as software, it may be installed in the electronic devices listed above. Based on the aforementioned large language model-based data processing device, the large language model-based data processing method in this embodiment may include the following steps: Step S801: Obtaining a data processing request for input to the large language model, wherein the large language model is communicatively connected to multiple callable application tools. When a user requests data processing for the large language model, the large language model-based data processing device (hereinafter referred to as the "data processing device") may obtain the data processing request for input to the large language model. In some instances, the data processing request may be obtained through human-computer interaction. In this case, obtaining the data processing request for input to the large language model may include: displaying a human-computer interaction interface, obtaining an execution operation entered by the user in the human-computer interaction interface, and obtaining the data processing request based on the execution operation. In other examples, data processing requests can be obtained not only through human-computer interaction but also through a client or a third device. In this case, the data processing request can be stored in the client or the third device. Obtaining the data processing request for input into the large language model can include: determining a client or a third device in communication with the data processing apparatus; and actively or passively obtaining the data processing request through the client or the third device, thereby effectively ensuring the accuracy and reliability of obtaining the data processing request. It should be noted that the large language model in this embodiment can be communicatively connected to multiple application tools that can be called, and to ensure the stability and reliability of data processing operations, the large language model can be obtained by processing using the fine-tuning method in the embodiments shown in Figures 1-5 above.Step S802: Determine the problem description and parsing parameters corresponding to the data processing request. After obtaining the data processing request, the data processing request can be analyzed to determine the problem description and parsing parameters corresponding to the data processing request. In some instances, the problem description and parsing parameters can be obtained by analyzing the data processing request using a pre-trained machine learning model, neural network model, or large language model (LLM). Alternatively, the problem description and parsing parameters can be obtained by analyzing the data processing request using a pre-trained character recognition algorithm, as long as the accuracy and reliability of the problem description and parsing parameters can be guaranteed. Step S803: Utilize the large language model to determine a target application tool from multiple application tools that matches the problem description. Because the large language model is communicatively connected to multiple application tools, and different application tools can solve different problems, after obtaining the problem description information and parsing parameters, the large language model can be used to analyze and process the problem description to determine a target application tool from the multiple application tools that matches the problem description information. This target application tool is used to perform the corresponding data processing operation based on the problem description information and can solve the corresponding problem. Step S804: The target application tool processes the parsing parameters to obtain a data processing result corresponding to the data processing request. After determining the target application tool, the target application tool can analyze and process the parsing parameters to obtain a data processing result corresponding to the data processing request. This effectively ensures the stability and reliability of the data processing operation and meets the diverse data processing needs of different users. It should be noted that the method in this embodiment may include not only the aforementioned method steps, but also the method of the embodiments shown in Figures 1-5. For portions not described in detail in this embodiment, reference can be made to the relevant description of the embodiments shown in Figures 1-5. The implementation process and technical effects of this technical solution are described in the description of the embodiments shown in Figures 1-5 and will not be repeated here.The large language model-based data processing method provided in this embodiment obtains a data processing request for input to the large language model and determines the problem description and parsing parameters corresponding to the data processing request. The large language model is then used to identify a target application tool matching the problem description from multiple application tools. The target application tool then processes the parsing parameters to obtain a data processing result corresponding to the data processing request. Because the large language model can communicate with a wide variety of application tools, this technical solution can address diverse problems in various application scenarios. This ensures not only the stability and reliability of data processing operations but also the flexibility and reliability of the method, further enhancing its practicality. FIG9 is a schematic structural diagram of a data processing device based on a large language model according to an embodiment of the present disclosure. Referring to FIG9 , this embodiment provides a data processing device based on a large language model, configured to execute the data processing method based on a large language model shown in FIG8 . Specifically, the data processing device may include: a second acquisition module 31 configured to acquire a data processing request for input to the large language model, wherein the large language model is communicatively connected to multiple application tools that can be invoked; a second determination module 32 configured to determine problem description information and parsing parameters corresponding to the data processing request; a second processing module 33 configured to utilize the large language model to determine a target application tool from the multiple application tools that matches the problem description; and a second processing module 33 configured to process the parsing parameters using the target application tool to obtain a data processing result corresponding to the data processing request. The device shown in FIG9 can execute the method according to the embodiment shown in FIG8 . For portions not described in detail in this embodiment, reference is made to the relevant description of the embodiment shown in FIG8 . The execution process and technical effects of this technical solution are described in the embodiment shown in FIG8 and will not be further elaborated here. In one possible design, the structure of the large language model-based data processing device shown in FIG9 can be implemented as an electronic device, which can be a controller, a personal computer, a partition, or other devices. As shown in FIG10 , the electronic device may include a second processor 41 and a second memory 42. The second memory 42 is used to store a program that enables the electronic device to execute the large language model-based data processing method provided in the embodiment shown in FIG8 . The second processor 41 is configured to execute the program stored in the second memory 42.The program includes one or more computer instructions, wherein when executed by the second processor 41, the one or more computer instructions can implement the following steps: obtaining a data processing request for input to a large language model, wherein the large language model is communicatively connected to multiple application tools that can be called; determining problem description information and parsing parameters corresponding to the data processing request; using the large language model, determining a target application tool that matches the problem description information from the multiple application tools; and processing the parsing parameters using the target application tool to obtain a data processing result corresponding to the data processing request. Furthermore, the second processor 41 is also configured to execute all or part of the steps in the embodiment shown in FIG. 8 . The electronic device may also include a second communication interface 43 for communicating with other devices or a communication network. Furthermore, embodiments of the present disclosure provide a computer storage medium for storing computer software instructions for use in the electronic device, including a program for executing the data processing method based on the large language model in the embodiment shown in FIG. 8 . In addition, an embodiment of the present disclosure provides a computer program product, comprising: a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps of the data processing method based on a large language model in the method embodiment shown in FIG8 . The apparatus embodiment described above is merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one location or distributed across multiple network units. Some or all of the modules can be selected according to actual needs to achieve the objectives of the present embodiment. Persons skilled in the art can understand and implement the present embodiment without inventive effort. Through the description of the above embodiments, persons skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general-purpose hardware platform, or can also be implemented through a combination of hardware and software. Based on this understanding, the essence of the above technical solution, or the portion that contributes to the prior art, can be embodied in the form of a computer product. The present disclosure can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The present disclosure is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present disclosure.It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to produce a machine, such that the instructions executed by the processor of the computer or other programmable device produce means for implementing the functions specified in one or more processes in the flowcharts and / or one or more blocks in the block diagrams. These computer program instructions can also be stored in a computer-readable memory capable of directing the computer or other programmable device to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means, which implement the functions specified in one or more processes in the flowcharts and / or one or more blocks in the block diagrams. These computer program instructions can also be loaded onto a computer or other programmable device, causing the computer or other programmable device to execute a series of operational steps to produce a computer-implemented process, such that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowcharts and / or one or more blocks in the block diagrams. In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory. Memory may include non-persistent storage in computer-readable media, random access memory (RAM), and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. OMemory is an example of computer-readable media. Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can implement information storage using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change RAM (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmitting medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media, such as modulated data signals and carrier waves. Finally, it should be noted that the above embodiments are merely illustrative of the technical solutions of the present disclosure and are not intended to limit the present disclosure. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they may modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein with equivalents. However, such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present disclosure.
Claims
Claims 1. A fine-tuning method for tool calls of a large language model, comprising: Acquire a large language model to be fine-tuned, where the large language model is communicatively connected to a plurality of application tools that can be called; determining training data for fine-tuning the large language model, the training data including a tool description, a problem description, and an identity identifier and parameter parsing information of a calling tool corresponding to the tool description and the problem description, the calling tool being at least a portion of a plurality of application tools; Fine-tune the large language model based on the training data to obtain a fine-tuned large language model.
2. The method according to claim 1, wherein: Determining training data for fine-tuning the large language model includes: obtaining multiple description questions, wherein the description questions include date inference data; determining a tool description for the calling tool; based on the tool description, determining a calling tool and parameter parsing information that matches each description question, wherein the parameter parsing information includes a date parsing result; and determining the training data based on the tool description, the description questions, and an identity identifier and parameter parsing information of the calling tool corresponding to the tool description and the description questions.
3. The method according to claim 2, wherein: Acquiring multiple description questions includes: acquiring a preset standard question; generalizing the preset standard question to obtain a generalized question; and determining the preset standard question and the generalized question as multiple description questions.
4. The method according to claim 2 or 3, wherein: Determining, based on the tool description, a calling tool that matches each description question includes: obtaining a set of application tools that can be called by the large language model; determining, from the application tool set, an adapted calling tool that matches each description question, where the number of the adapted calling tools is less than the number of application tools in the application tool set; and processing, using the large language model, the tool description, the description question, and the identity identifier corresponding to the adapted calling tool to obtain a target calling tool that matches each description question.
5. The method according to claim 4, wherein: Before determining, in the application tool set, an adaptation calling tool that matches each description question, the method further includes: obtaining an upper limit on the length of an input prompt supported by the large language model; and determining, based on the upper limit, the number of adaptation calling tools, such that the total length of the input prompt formed by the adaptation calling tools meeting the upper limit is less than or equal to the upper limit.
6. The method according to any one of claims 1 to 5, wherein: After determining the training data for fine-tuning the large language model, the method further includes: obtaining a preset data format for limiting the training data; and processing the training data based on the preset data format to obtain target training data that meets the preset data format.
7. The method according to any one of claims 1 to 6, wherein: Fine-tuning the large language model based on the training data to obtain the fine-tuned large language model includes: obtaining a non-dense network layer that can be fine-tuned in the large language model; and fine-tuning parameters of the non-dense network layer in the large language model based on the training data to obtain the fine-tuned large language model.
8. The method according to any one of claims 1 to 7, wherein: After determining the training data for fine-tuning the large language model, the method further includes: obtaining a tool name of a calling tool included in the training data; and when a length of the tool name is greater than or equal to a preset length threshold, determining the tool name as an inseparable single prompt word.
9. The method according to any one of claims 1 to 6, wherein: Fine-tuning the large language model based on the training data to obtain a fine-tuned large language model includes: obtaining a low-order adaptation model for fine-tuning the large language model; determining parameter information required for fine-tuning the low-order adaptation model; and fine-tuning the large language model using the low-order adaptation model, the parameter information, and the training data to obtain the fine-tuned large language model.
10. A data processing method based on a large language model, comprising: Obtaining a data processing request for input to a large language model, wherein the large language model is communicatively connected to a plurality of application tools that can be called; determining problem description information and parsing parameters corresponding to the data processing request; utilizing the large language model to determine a target application tool that matches the problem description information among the plurality of application tools; and processing the parsing parameters using the target application tool to obtain a data processing result corresponding to the data processing request.
11. A fine-tuning device for tool invocation of a large language model, comprising: A first acquisition module is used to acquire a large language model to be fine-tuned, where the large language model is communicatively connected to a plurality of application tools that can be called; a first determining module configured to determine training data for fine-tuning the large language model, the training data including a tool description, a problem description, and an identification identifier and parameter parsing information of a calling tool corresponding to the tool description and the problem description, the calling tool being at least a portion of a plurality of application tools; A first processing module is configured to fine-tune the large language model based on the training data to obtain a fine-tuned large language model.
12. An electronic device, comprising: A memory and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the method of any one of claims 1 to 10.
13. A computer program product comprising: A computer program, which, when executed by a processor of an electronic device, causes the processor to perform the steps of the method of any one of claims 1 to 10.
14. A computer storage medium for storing a computer program, wherein the computer program enables a computer to implement the method of any one of claims 1 to 10 when executed.
Citation Information
Patent Citations
Trip planning method and device, electronic equipment and storage medium
CN117150153A
Cited By
Voltage sag state estimation method and system based on complex task decomposition reasoning
CN121189485A