Model training method, sample data generation method, device, storage medium and program product

By obtaining tool description information from service tools to generate sample data and train AI models, the problem of low accuracy of AI models in complex scenarios is solved, thereby improving the accuracy of the models and the user experience.

CN123048688APending Publication Date: 2026-11-06ALIBABA CLOUD COMPUTING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510578183.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-06
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

AI models have low accuracy in calling external tools in complex application scenarios, which limits their performance and commercialization process.

Method used

By obtaining the tool description information of the service tools, sample data is generated and used to train the service model. The sample data includes sample questions and input parameters of sample service tools to enhance the model's ability to call service tools.

Benefits of technology

It significantly improves the accuracy of AI models calling service tools, especially in private domain service tool scenarios, thereby improving model training accuracy and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123048688A_ABST
    Figure CN123048688A_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a model training method and sample data generation method, equipment, a storage medium and a program product. In the embodiment of the application, a service model selects a service tool from at least one service tool for a user question and calls the selected service tool to solve the question; for a service model to be trained, tool description information corresponding to the called service tool is obtained, the tool description information includes functions, input parameters and return values, the content is rich and abundant, sample data is generated by calling a sample generation model according to the tool description information, the sample data not only includes a sample question and a sample service tool, but also includes sample input parameters corresponding to the sample service tool, and the quality of the sample data is improved; the sample question is used as the input of the service model, the sample service tool and the sample input parameters thereof are used as the labeled result, the service model is trained, the ability of the service model to call the service tool is enhanced, and the accuracy of model training is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to model training methods and sample data generation methods, devices, storage media and program products. Background Technology

[0002] With the rapid development of Artificial Intelligence (AI) technology, users are paying increasing attention to AI models. One of the fundamental capabilities of AI models is the ability to invoke external tools to complete specific tasks; this capability can be simply referred to as tool use. Taking a language model (LM) as an example, the external tools it can invoke include, but are not limited to: search engines, database query interfaces, application programming interfaces (APIs) provided by weather forecast services, and calculators, etc.

[0003] In some application scenarios, AI models can achieve high accuracy when calling external tools, thus demonstrating high model performance. However, in other application scenarios (such as more complex ones), the AI ​​models have lower accuracy when calling external tools due to their complexity, which limits the performance and commercialization of AI models. Summary of the Invention

[0004] This application provides a model training method, a sample data generation method, an apparatus, a storage medium, and a program product to improve the accuracy of service models calling service tools.

[0005] This application provides a model training method, comprising: determining a service model to be trained, wherein the service model is used to select a service tool from at least one service tool for a user problem and call the selected service tool to answer the problem; obtaining tool description information corresponding to the service tool, wherein the tool description information is used to describe at least one function supported by the corresponding service tool, at least one target input parameter, and at least one target return value; generating sample data by calling a sample generation model according to the tool description information to obtain multiple sample data corresponding to the service tool, wherein the sample data includes: a first sample problem, and a sample service tool adapted to the first sample problem and its corresponding sample input parameters; using the first sample problem from the multiple sample data corresponding to at least one service tool as the input of the service model, and using the sample service tool adapted to the first sample problem and its sample input parameters as the first annotation result to train the service model to enhance the service model's ability to call service tools.

[0006] This application also provides a sample data generation method, comprising: determining at least one service tool, the at least one service tool being used to return answer information for a user question; obtaining tool description information corresponding to the service tool, the tool description information being used to describe at least one function supported by the corresponding service tool, at least one target input parameter, and at least one target return value; and, based on the tool description information, calling a sample generation model to generate sample data to obtain multiple sample data corresponding to the service tool, the sample data including: a first sample question, and a sample service tool adapted to the first sample question and its corresponding sample input parameters. This application also provides an electronic device, comprising: a memory and a processor; the memory being used to store a computer program; and the processor, coupled to the memory, being used to execute the computer program to implement the steps in the model training method and sample data generation method provided in this application.

[0007] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to implement the steps in the model training method and sample data generation method provided in this application.

[0008] This application also provides a computer program product, including a computer program / instructions, which, when executed by a processor, cause the processor to implement the steps in the model training method and sample data generation method provided in this application.

[0009] In this embodiment, the service model can select a service tool from at least one service tool to answer a user's question. For the service model to be trained, the tool description information corresponding to the service tools it can call is obtained. The tool description information includes functions, input parameters, and return values, which is rich and comprehensive. Based on the tool description information, a sample generation model is called to generate sample data. The sample data includes not only sample questions and sample service tools, but also sample input parameters corresponding to the sample service tools, thus improving the quality of the sample data. Therefore, by using sample questions as input to the service model and sample service tools and their sample input parameters that are compatible with the sample questions as annotation results, the service model is trained to enhance its ability to call service tools and significantly improve the accuracy of model training. Attached Figure Description

[0010] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0011] Figure 1A flowchart illustrating a model training method provided for an exemplary embodiment of this application;

[0012] Figure 2 A flowchart illustrating a sample data generation method provided for an exemplary embodiment of this application;

[0013] Figure 3 A flowchart illustrating another model training method provided for an exemplary embodiment of this application;

[0014] Figure 4 A flowchart illustrating another sample data generation method provided in an exemplary embodiment of this application;

[0015] Figure 5 This is a schematic diagram of the structure of an electronic device provided as an exemplary embodiment of this application. Detailed Implementation

[0016] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0017] It should be noted that, in the cases involving user information in the embodiments of this application, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse. In addition, the various models involved in this application (including but not limited to language models or large models) comply with relevant laws and standards.

[0018] To address the issue of low accuracy in calling service tools by AI models, this embodiment of the application allows the service model to select a service tool from at least one available tool to answer a user's question. For the service model to be trained, tool description information corresponding to the service tools it can call is obtained. This tool description information includes functions, input parameters, and return values, providing rich and comprehensive content. Based on this tool description information, a sample generation model is invoked to generate sample data. This sample data includes not only sample questions and sample service tools but also the corresponding sample input parameters, improving the quality of the sample data. Therefore, by using sample questions as input to the service model and sample service tools and their input parameters that are compatible with the sample questions as annotation results, the service model is trained to enhance its ability to call service tools, significantly improving the accuracy of model training.

[0019] Furthermore, the service tool is implemented as a private domain service tool. The tool description information of the private domain service tool is enhanced. When generating sample questions, sample questions are generated by combining real user question examples and text style to produce sample questions that closely resemble real-world problems. Additionally, the generated sample data is cleaned to obtain sample data that meets the requirements. Based on the obtained sample data, the service model is trained to further improve the accuracy of the service model in calling the private domain service tool. The following, with reference to the accompanying drawings, provides a detailed description of a solution provided by an embodiment of this application.

[0020] Figure 1 This is a flowchart illustrating a model training method provided for an exemplary embodiment of this application. Figure 1 As shown, the method includes:

[0021] 101. Determine the service model to be trained. The service model is used to select a service tool from at least one service tool for a user's question and call the selected service tool to answer the question.

[0022] 102. Obtain the tool description information corresponding to the service tool. The tool description information is used to describe at least one function supported by the corresponding service tool, at least one target input parameter, and at least one target return value.

[0023] 103. Based on the tool description information, call the sample generation model to generate sample data to obtain multiple sample data corresponding to the service tool. The sample data includes: the first sample problem, and the sample service tool adapted to the first sample problem and its corresponding sample input parameters.

[0024] 104. Take the first sample problem from multiple sample data corresponding to at least one service tool as the input of the service model, and take the sample service tool and its sample input parameters that are adapted to the first sample problem as the first annotation result to train the service model, so as to enhance the service model's ability to call the service tool.

[0025] In this embodiment, the service model is used to select a service tool from at least one service tool to answer a user's question and invoke the selected service tool to provide the answer. For example, a user can provide a question to the service model, which can then select a suitable service tool from a variety of tools, invoke that tool, and have it return an answer to the question. The service model then returns the answer to the user.

[0026] In terms of model scale, the embodiments of this application do not limit the number of model parameters supported by the service model, with the goal of meeting application requirements. In terms of model functionality, the service model can be implemented as an artificial intelligence-based language model (LM), without limitation. In terms of model architecture implementation, the service model can be implemented using, but is not limited to, the following model architectures: Generative Adversarial Networks (GANs), Convolutional Neural Networks (CNNs), Recurrent Neural Networks (RNNs), Deep Neural Networks (DNNs), Residual Networks, Encoder-Only architectures, Decoder-Only architectures, Encoder-Decoder architectures, and architectures based on self-attention mechanisms, etc.

[0027] In this embodiment, the service model can provide question-and-answer services to users, who may include technical personnel, consumers, students, educators, researchers, and company employees, among others. The service model can exist independently, providing services to users, or it can be integrated into the target application as a module to provide question-and-answer services to users of the target application. The target application may include, but is not limited to, shopping applications, live streaming applications, video applications, and search engine applications.

[0028] In this embodiment, the service model maintains at least one service tool. A service tool refers to the various technologies, resources, and platforms relied upon by the service model in processing user requests or resolving problems. For example, from the perspective of implementation, service tools may include, but are not limited to: software systems, cloud services, and custom software, etc. From the perspective of function, service tools may include, but are not limited to: data processing and management tools, search and information retrieval tools, natural language processing (NLP) tools, machine learning and artificial intelligence tools, etc. In this embodiment, the service tools maintained by different service models are different. For example, for a question-and-answer service model, used to provide answers to users' questions through natural language processing technology, the service tools maintained by the question-and-answer service model may include, but are not limited to: 1) natural language processing tools for parsing user input; 2) knowledge base systems, such as databases or document management systems, for storing and retrieving answers to common questions; 3) search engine tools for quickly finding relevant information; 4) dialogue management tools for building multi-turn dialogue logic, etc. For example, intelligent customer service models (such as intelligent customer service on e-commerce platforms) are used to handle various user inquiries (such as order inquiries, return policies, product recommendations, etc.) and call upon different service tools to generate accurate answers. The service tools that intelligent customer service models can call upon include, but are not limited to: order status inquiry tools, logistics information inquiry tools, payment status inquiry tools, and product recommendation tools.

[0029] In this embodiment, the service model has training requirements. Training can be direct training or fine-tuning. Fine-tuning refers to further training the model on the basis of an existing pre-trained model by using a dataset of a specific task or domain to adjust the model parameters so that it can better adapt to the specific task or domain.

[0030] The reasons why a service model needs training or fine-tuning may include at least one of the following: 1) While the service model possesses broad knowledge and capabilities, it may not fully understand the terminology, context, or application logic of a specific domain. 2) The service model's answers may be too broad or imprecise, failing to meet the user's actual needs. 3) The service model may contain errors or biases when handling complex or specialized problems. 4) An enterprise's internal data, service rules, and processes are often unique, and the service model may not be directly adaptable to these.

[0031] In this embodiment, to better adapt the service model to specific tasks or scenarios, thereby improving its performance, accuracy, and user experience, the service model can be trained. The service model to be trained is determined. The method of determination is not limited. For example, based on the user's question, a target task can be determined, and a service model adapted to the target task can be selected as the service model to be trained. Alternatively, from the perspective of performance and efficiency, the service model to be trained can be determined based on at least one dimension such as inference speed, memory usage, and deployment cost. For instance, if the target task has high real-time requirements (such as online customer service), a lightweight model is preferred. If cloud resources are sufficient, a service model with a larger data volume is selected; there is no limitation in this regard.

[0032] In this embodiment, for the service model to be trained, at least one tool description information corresponding to at least one service tool can be obtained, such as... Figure 2 As shown. The tool description information is used to describe at least one function supported by the corresponding service tool, at least one target input parameter, and at least one target return value. For example, the tool description information may include: function description, parameter description, and return description, such as... Figure 2 As shown. The service tool's functional description describes its core function or goal, explaining what tasks it can accomplish or what problems it can solve. For example, a service tool's functions may include, but are not limited to, data analysis, image processing, and natural language processing. Each service tool may have one or more functions. The target input parameters are the data or configuration information required when calling the service tool. Target input parameters refer to the conditions or content upon which the service tool depends for performing its task. Target input parameters may include, but are not limited to, information such as name, type, and description. The target return value refers to the result output by the service tool after completing the task; it can be data or status information generated by the service tool after processing the input parameters.

[0033] In this embodiment, from the perspective of service tools, based on the tool description information of the service tools, a sample generation model is invoked to generate sample data, thereby obtaining multiple sample data corresponding to the service tools. For example... Figure 3 As shown, this demonstrates the process of generating sample data based on the tool description information of the service tool.

[0034] The sample data includes: a first sample question, a sample service tool adapted to the first sample question, and its corresponding sample input parameters. For example, the sample data can be implemented as a dictionary, which includes three key-value pairs: the user question (question), the service tool (tool) that the service model needs to call to answer the user question, and the input parameters (args) used when calling the service tool. For example, if the service tool is implemented as a virtualization instance basic information query tool, the sample data can be implemented as a dictionary in the following format: {"question":"instance i-abc","tool":"virtualization instance basic information query tool","args":{"instance identifier":"i-abc"}}.

[0035] From the perspective of model scale, the embodiments of this application do not limit the number of model parameters supported by the sample generation model, with the goal of meeting application requirements. From the perspective of model functionality, the sample generation model can be implemented as an artificial intelligence-based language model or other models with data generation capabilities, and there are no limitations on this. From the perspective of model architecture implementation, the model architecture that the sample generation model can adopt includes, but is not limited to: generative adversarial networks, convolutional neural networks, recurrent neural networks, deep neural networks, residual networks, encoder architectures, decoder architectures, encoder-decoder architectures, and architectures based on self-attention mechanisms, etc.

[0036] In this embodiment, the first sample problem from multiple sample data corresponding to at least one service tool is used as the input of the service model, and the sample service tools and their sample input parameters that are compatible with the first sample problem from multiple sample data corresponding to at least one service tool are used as the annotation results to train the service model, so as to enhance the service model's ability to call service tools.

[0037] The training method is not limited. For example, Low-Rank Adaptation (LoRA) and accelerated training can be used to efficiently train the service model. The core idea of ​​LoRA is to update a small number of parameters in the model through low-rank decomposition, rather than updating all parameters of the entire model. LoRA assumes that the changes in model weights can be approximated as a low-rank matrix. During training, the parameters in these low-rank matrices are trained, while most of the parameters of the service model are frozen. This significantly reduces the number of parameters that need to be optimized, greatly reducing the computational resources and storage overhead required during training, while preserving the improvement in model performance. Accelerated training can be achieved by partitioning the optimizer state, gradients, and model parameters into different processes, thereby greatly reducing the amount of data that needs to be stored in each process. In addition, model parallelism can be used to distribute the service model across multiple processors or multiple nodes for training, thereby improving training speed.

[0038] In this embodiment, the service model can select a service tool from at least one service tool to answer a user's question. For the service model to be trained, the tool description information corresponding to the service tools it can call is obtained. The tool description information includes functions, input parameters, and return values, which is rich and comprehensive. Based on the tool description information, a sample generation model is called to generate sample data. The sample data includes not only sample questions and sample service tools, but also sample input parameters corresponding to the sample service tools, thus improving the quality of the sample data. Therefore, by using sample questions as input to the service model and sample service tools and their sample input parameters that are compatible with the sample questions as annotation results, the service model is trained to enhance its ability to call service tools and significantly improve the accuracy of model training.

[0039] In one optional embodiment, the implementation of generating sample data by calling a sample generation model based on tool description information to obtain multiple sample data corresponding to the service tool is not limited. An example is provided below, obtaining a first prompt word template corresponding to the sample generation model. The first prompt word template includes a first task instruction, which describes the task that the sample generation model needs to perform. The first task instruction instructs the sample generation model to generate a sample problem and to determine a sample service tool suitable for the sample problem, as well as the sample input parameters corresponding to the sample service tool, using the sample problem information, the sample service tool, and its sample input parameters as sample data. Tool description information is added to the first prompt word template to obtain a first model prompt word. The first model prompt word is then input into the sample generation model. In the sample generation model, from the perspective of service tools, user questions can be inferred by back-reasoning based on at least one target return value of the service tool, at least one function supported by the service tool, and at least one target input parameter. Specifically, according to the first task instruction, back-reasoning is performed on the target return value of at least one service tool, at least one function supported by the service tool, and at least one target input parameter to obtain multiple sample questions. The service tool is then used as a sample service tool adapted to each of the multiple sample questions, and the target input parameters used in the back-reasoning of the multiple sample question information are used as sample input parameters adapted to each of the multiple sample question information, thus obtaining multiple sample data corresponding to the service tool. For example, each sample question information corresponds to one sample data, and the sample data includes the sample question information, the sample service tool corresponding to the sample question information, and its sample input parameters.

[0040] For example, in a sample generation model, a sample service tool can be determined from at least one service tool. Based on the target return value of the determined sample service tool, at least one function supported by the sample service tool, and at least one target input parameter, multiple sample questions are obtained through reverse reasoning. From the input parameters of the determined sample service tool, the target input parameters used for reverse reasoning of multiple sample question information are selected as the sample input parameters adapted to the multiple sample question information respectively. The sample question information, sample service tool, and sample input parameters are used as sample data.

[0041] For example, a service tool can be determined from at least one service tool. Target input parameters can be selected sequentially from the target input parameters of the determined service tool. These selections can be random or based on set rules. Backward reasoning is then performed based on the selected target input parameters and their corresponding target return values ​​and functions to obtain multiple sample questions. The sample question information, along with the target input parameters required for directional reasoning of the sample question information and the determined service tool, are used as sample data.

[0042] The first task instruction provides clear task guidance for the sample generation model. Generating sample questions by reverse-engineering the target return value of at least one service tool ensures that the generated questions are based on real service logic or expected results, thus guaranteeing the authenticity and validity of the sample questions.

[0043] Optionally, the first prompt template, in addition to including the first system instruction and at least one tool description, also includes: style prompts. Style prompts are used to indicate the text style of the first sample question. For example, style prompts may include, but are not limited to: sentence structure prompts, tone prompts, vocabulary selection prompts, perspective prompts, cultural prompts, and social context prompts. Sentence structure prompts may include, but are not limited to: prompts for general questions, special questions, alternative questions, tag questions, and nested questions. Tone may include, but is not limited to: prompts for seriousness, lightness, humor, and irony. Different vocabulary choices can convey different styles, such as formal versus informal, professional versus popular, simple versus complex. Perspective prompts may include, but are not limited to: first-person perspective, second-person perspective, and third-person perspective. Cultural and social context prompts may reflect specific cultural characteristics and social values, such as colloquialisms and dialects.

[0044] Based on this, the text style of the first sample question in multiple sample datasets can be adjusted according to style cue words. These style cue words may or may not belong to the first system instructions; there is no limitation on this. Furthermore, the style cue words can be used to explicitly instruct the sample generation model to generate user questions with different styles, thereby improving the diversity and realism of the sample data.

[0045] Optionally, the implementation of adding tool description information to the first prompt word template to obtain the first model prompt word is not limited. To fully utilize the in-context learning capability of the sample generation model, some real sample examples can be obtained. Sample examples include real user questions and service tools and their input parameters adapted to real user questions. These sample examples guide the sample generation model to understand the task requirements indicated by the first task instruction and generate sample questions that conform to user questioning habits. For example, sample examples can be implemented as user information and artificial intelligence (AI) information pairs, i.e., (Human Message, AI Message). Based on this, tool description information and at least one sample example are added to the first prompt word template to obtain the first model prompt word. Sample examples can serve as a few-shot sample to assist the sample generation model in better understanding the task requirements, thereby generating higher quality data.

[0046] Further optionally, according to the first task instruction, reverse reasoning is performed on at least one target return value of the service tool, at least one function supported by the service tool, and at least one target input parameter to obtain multiple sample questions. The service tool is used as a sample service tool adapted to the multiple sample questions respectively. The target input parameters used for reverse reasoning the information of the multiple sample questions are used as sample input parameters adapted to the information of the multiple sample questions respectively, so as to obtain multiple sample data corresponding to the service tool, is not limited. This part pertains to the internal implementation of the sample generation model. An example is provided below: Based on at least one sample example, semantic understanding is performed on the first task instruction to obtain task requirements. These requirements instruct the generation of sample questions and the determination of sample service tools and their input parameters that are compatible with the sample questions. Information structure and language style are learned from the real user questions of at least one sample example to obtain descriptive information about user questioning habits. Based on the task requirements and the descriptive information about user questioning habits, reverse reasoning is performed on the target return value of the service tool, at least one function supported by the service tool, and the target input parameters to obtain multiple sample questions. According to the task requirements, the service tool is used as a sample service tool adapted to each of the multiple sample questions, and the target input parameters used in the reverse reasoning of the multiple sample question information are used as the sample input parameters adapted to each of the multiple sample question information to obtain multiple sample data. For example... Figure 2The illustration shows an example of adding a first task instruction and a sample example to a first prompt word template, but is not limited to this.

[0047] Specifically, by using sample examples, the auxiliary service model can better understand task requirements, thereby generating higher-quality data. Generating sample questions through reverse reasoning based on return values ​​ensures that the generated questions are based on real service logic or expected results, thus contributing to the authenticity and validity of the sample questions.

[0048] In one optional embodiment, the sample data generated by the sample generation model has a certain degree of randomness, and may generate some sample data that does not meet the requirements. For example, the sample data may have a "phantom problem." A "phantom problem" refers to the phenomenon where the sample data generated by the sample generation model appears reasonable but is actually inaccurate or fictitious. For example, user question information and input parameters may include the identification information of the object to be queried, which can be a virtual instance, table, file, product, or other object. Identification information may include, but is not limited to: identifier (ID), universally unique identifier, version information, validity period, source, tags, geographical location, etc. If a phantom problem exists, it means that at least one of the sample user question and sample input parameters does not include the identification information of the object to be queried, or that both the sample user question and sample input parameters include the identification information of the object to be queried, but the identification information of the object to be queried is different, resulting in a mismatch between the user question and the input parameters. If such training samples are not processed, they may reduce the effectiveness of subsequent training. Based on this, a dedicated verification mechanism is added for multiple sample data corresponding to the service tool to identify and delete invalid samples generated by phantoms, achieving sample cleaning (e.g., Figure 2 (As shown), this improves the accuracy of subsequent model training. Specifically, based on the tool description information, a sample generation model is invoked to generate sample data to obtain multiple sample data corresponding to the service tool. The implementation method is not limited, but an example is provided below. Based on the tool description information, a sample generation model is invoked to generate sample data to obtain multiple initial sample data corresponding to the service tool; invalid samples in the multiple initial sample data are identified and deleted to obtain multiple sample data corresponding to the service tool. The sample questions and sample input parameters of the sample data include the same identifier information of the query object; invalid samples include at least one of the following: sample data to which the sample question does not contain the identifier information of the query object belongs, sample data to which the sample input parameters do not contain the identifier information of the query object, and sample data to which the identifier information of the query object contained in the sample question and its adapted sample input parameters are different.

[0049] In addition, the sample service tools and their corresponding sample input parameters generated by the sample generation model can conform to a set format, such as a dictionary format, as detailed in the aforementioned embodiments. The sample service tools and their corresponding sample input parameters generated by the sample generation model may not conform to this set format. Therefore, for each sample data, it can be determined whether the sample service tools and their corresponding sample input parameters included in the sample data conform to the set format. If they do not conform, the sample data is deleted to ensure that the sample data conforms to the specifications.

[0050] In one optional embodiment, a first sample problem from multiple sample data is used as the input to the service model, and a sample service tool adapted to the first sample problem and its sample input parameters are used as the first annotation result. The implementation method for training the service model is not limited. Considering that the sample data may not directly adapt to the input of the service model, a sample format conversion model can be used to convert the sample data to an input format adapted to the service model. In terms of model scale, this embodiment does not limit the number of model parameters supported by the sample format conversion model, aiming to meet application requirements. In terms of model functionality, the sample format conversion model can be implemented as an artificial intelligence-based language model or other models with format conversion capabilities; this is not limited. In terms of model architecture implementation, the sample format conversion model can adopt model architectures including, but not limited to: generative adversarial networks, convolutional neural networks, recurrent neural networks, deep neural networks, residual networks, encoder architectures, decoder architectures, encoder-decoder architectures, and architectures based on self-attention mechanisms.

[0051] Based on this, multiple sample data can be added to the second prompt word template corresponding to the sample format conversion model to obtain the second model prompt word. According to the second model prompt word, the sample format conversion model is called to convert the multiple sample data into a triplet format adapted to the service model. The triplet format includes: task information, question information, and first response information. The triplet matches the service model's task instruction, user question, and model response. The information included in the triplet format can also be called: System Message, Human Message, and Model Response (AI Message). The task information includes a second task instruction, the problem information includes a first sample problem, and the first response information includes a sample service tool adapted to the sample problem and its sample input parameters. The task information and problem information are input into the service model. Under the instruction of the second task instruction, a target service tool is selected from at least one service tool based on the problem information, and the target input parameters used to call the target service tool are determined. The target service tool and its target input parameters are output as the second response information. The second response information is the inference result of the service model, and the first response information is the first annotation result. The first response information can be used as the first annotation result and the second response information to calculate the loss function. If the loss function does not meet the training termination condition, the service model continues to be trained until the loss function meets the training termination condition.

[0052] The loss function may include, but is not limited to: Mean Squared Error (MSE), Mean Absolute Error (MAE), Cross-Entropy Loss, and Log Loss.

[0053] The training termination conditions may include, but are not limited to: reaching a predetermined number of iterations or epochs, loss convergence, and reaching a predetermined iteration time.

[0054] In an optional embodiment, the multiple sample data generated by the sample generation model can be divided into a training set and a test set according to a set ratio, such as... Figure 3 As shown. The training set includes training samples, which include: a first sample problem, a sample service tool adapted to the first sample problem, and its corresponding sample input parameters; in addition, Figure 3The document also demonstrates the process of training a service model using training samples from the training set to obtain the trained service model. The test set includes test samples, which consist of a second sample question and second annotation results. The second annotation results include a sample service tool adapted to the second sample question and its corresponding sample input parameters. The ability of the service model to invoke service tools is evaluated using the test samples in the test set, with accuracy used as the evaluation metric.

[0055] Based on this, the second sample question from at least two test samples can be input into the trained service model to obtain the inference result of the service model. The inference result includes: an inference service tool adapted to the second sample question information and its corresponding inference input parameters; based on the inference result of at least two test samples and the second annotation result, the accuracy of the service model in selecting a service tool from at least one service tool for the user question is determined; according to the accuracy, the description information of at least one tool is adjusted to obtain the adjusted description information of at least one tool, and the model is trained again until a service model that meets the set accuracy requirement is obtained, such as... Figure 3 As shown.

[0056] For example, for each test sample, the problem information of the second sample is input into the service model. If the service model can correctly select the required service tool and accurately parse the input parameters required to call the service tool, then the service model's prediction for that sample is considered correct. The accuracy is calculated as the ratio of the number of correctly predicted samples to the total number of test samples.

[0057] The process involves determining the accuracy of the trained service model using test samples. Based on this accuracy, the tool description is iteratively optimized manually or automatically, and the service model continues to be trained to improve its accuracy. Optionally, based on the accuracy of the service model in selecting service tools from at least one service tool for a user problem, the description information of at least one tool is adjusted to obtain adjusted tool description information. The model continues to be trained until a service model meeting the set accuracy requirement is obtained. The implementation method is not limited. An example is provided below: if the accuracy is lower than a set accuracy threshold, the difference between the inference result and the second annotation result is statistically analyzed. This difference information includes at least one of tool selection error information and parameter parsing error information. Based on at least one of the tool selection error information and parameter parsing error information, the description information of at least one tool is adjusted to obtain adjusted tool description information. The model continues to be trained until a service model with an accuracy higher than or equal to the set accuracy threshold is obtained.

[0058] The main reason why the accuracy of the trained service model did not meet expectations is that at least one tool description failed to fully and accurately express its function. Discrepancies can help identify two types of problems: one is service tool confusion caused by inaccurate tool function descriptions, and the other is parsing errors caused by incomplete input parameter descriptions. At this stage, manual intervention is necessary to adjust the tool description information based on the discrepancies. For example, adjusting the service tool's function, input parameters, and return values. After adjustment, the "generate sample data -> train model -> evaluate performance" process can be restarted, continuously improving through multiple iterations until the service model's accuracy reaches a set accuracy threshold, at which point the service model can be deployed online. Accuracy thresholds can include, but are not limited to, 90%, 95%, or 99%.

[0059] The trained model is evaluated using test samples, and an evaluation report including discrepancy information is generated to assist in the iterative adjustment of tool descriptions, either manually or automatically. When dealing with a large number of service tools, this method can reduce manual costs and quickly and accurately identify inaccurate tool descriptions, providing a foundation for subsequent model training.

[0060] In an optional embodiment, the service tools in this application can be either public or private domain service tools, without limitation. Public domain service tools refer to service tools open to the public, accessible and usable by most users; examples include search engine tools, database query tools, weather forecast query tools, and calculators. Optionally, public domain service tools tend to have relatively simple functions and fewer parameters. Private domain service tools refer to proprietary service tools, accessible and usable by specific users, such as proprietary apps and email services from various manufacturers. Optionally, private domain service tools tend to have relatively complex functions and more parameters.

[0061] Considering that private domain service tools typically possess complex semantics, numerous functions, and a large number of input parameters, and that the tool invocation capability of service models primarily originates from the pre-training phase, the lack of private domain service tool data in the pre-training data prevents service models from correctly understanding the invocation methods of private domain service tools. To address this issue, this application provides an automated training scheme for private domain service tool invocation for service models, namely the model training method provided in this application embodiment, aiming to enable service models to learn private domain service tool invocation with the lowest possible human cost. Specifically, in the sample generation phase, sampling and enhancement of private domain service tools (such as...) are performed. Figure 2As shown, the sample data should cover the functions and parameter combinations of different private domain service tools as much as possible, and the similarity between samples should be low. By explicitly setting style prompts and sample examples, the generated user questions should be as close as possible to the real questions that users may ask in actual use. The generated sample data is cleaned to obtain sample data corresponding to private domain service tools, input parameters and sample questions. The service model can then be trained using the sample data corresponding to private domain service tools to enhance the service model's ability to call private domain service tools.

[0062] Of course, in this embodiment of the application, sample data can also be generated for public domain service tools; see details below. Figure 1 The methods described will not be elaborated further here. The service model is trained using sample data corresponding to the public domain service tools to enhance its ability to call these tools.

[0063] In an optional embodiment, to ensure that the sample data covers the functions and parameter combinations of different service tools as much as possible, and that the similarity between sample data is low, tool description information can be sampled to enhance the tool description information. Considering that each service tool has corresponding candidate tool description information, which includes descriptions of tool functions, parameters, and return values. For example, private domain service tools typically have complex function descriptions, multiple parameters (e.g., some private domain service tools may include up to 200 parameters), and multiple return values, with each parameter potentially having multiple values. Therefore, to ensure that the dataset covers different combinations of parameters and return values, the parameters and return values ​​and their possible values ​​can be sampled and enhanced. Optionally, the first prompt may indicate that the sampled tool description is used, and the first task instruction may require the sample generation model to generate a question containing all or part of the sampled parameters and return values. Figure 2 The diagram illustrates the first task instruction, but is not limited to it.

[0064] Based on this, the implementation method for obtaining the tool description information corresponding to the service tool includes: obtaining candidate tool description information corresponding to the service tool, the candidate tool description information including: at least one function, multiple candidate input parameters included in the function, and multiple candidate return values; selecting a first set number of target input parameters from the candidate input parameters, and selecting a target return value that matches the target input parameters from the multiple candidate return values; and using the target return value and the target input parameters as the tool description information corresponding to the service tool.

[0065] Further optionally, selecting a first predetermined number of target input parameters from candidate input parameters and selecting a target return value that matches the target input parameters from multiple candidate return values ​​includes: for any function, randomly selecting a first predetermined number of target input parameters from multiple candidate input parameters included in the function, and selecting a target return value that matches the target input parameters from multiple candidate return values; the first predetermined number can be 1, 2, or 3, etc., and is not limited thereto; or, for any function, based on the log information of multiple candidate input parameters included in the function, calculating the usage frequency of multiple candidate input parameters, and selecting at least some candidate input parameters as target input parameters from multiple candidate input parameters included in the service tool according to the usage frequency, and selecting a target return value that matches the target input parameters from multiple candidate return values; for example, the higher the usage frequency, the more candidate input parameters are selected.

[0066] Among them, sampling and enhancing the description information of candidate tools to obtain tool description information can ensure that the sample data can cover different combinations of parameters and return values, and that the similarity between samples is low, which can improve the accuracy of the service model calling service tools after training.

[0067] Figure 4 This is a schematic flowchart illustrating another sample data generation method adopted in an exemplary embodiment of this application, as shown below. Figure 4 As shown, the method includes:

[0068] 401. Identify at least one service tool, which is used to return answer information for user questions;

[0069] 402. Obtain the tool description information corresponding to the service tool. The tool description information is used to describe at least one function supported by the corresponding service tool, at least one target input parameter, and at least one target return value.

[0070] 403. Based on the tool description information, call the sample generation model to generate sample data to obtain multiple sample data corresponding to the service tool. The sample data includes: the first sample problem, and the sample service tool adapted to the first sample problem and its corresponding sample input parameters.

[0071] Among them, regarding Figure 4 For a detailed description of the method and its effects, please refer to the foregoing embodiments, which will not be repeated here.

[0072] It should be noted that the execution subject of each step of the method provided in the above embodiments can be the same device, or the method can be executed by different devices. For example, the execution subject of steps 101 to 103 can be device A; or the execution subject of steps 101 and 102 can be device A, and the execution subject of step 103 can be device B; and so on.

[0073] Furthermore, some processes described in the above embodiments and accompanying drawings include multiple operations appearing in a specific order. However, it should be clearly understood that these operations may not be executed in the order they appear herein, or they may be executed in parallel. The operation numbers, such as 101, 102, etc., are merely used to distinguish different operations and do not represent any execution order. Additionally, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel. It should be noted that the descriptions such as "first" and "second" in this document are used to distinguish different messages, devices, modules, etc., and do not represent a sequential order, nor do they limit "first" and "second" to different types.

[0074] Figure 5 A schematic diagram of the structure of an electronic device provided as an exemplary embodiment of this application, such as... Figure 5 As shown, the device includes a memory 54 and a processor 55.

[0075] Memory 54 is used to store computer programs and can be configured to store various other data to support operation on the electronic device. Examples of this data include instructions for any application or method used to operate on the electronic device.

[0076] The processor 55, coupled to the memory 54, is used to execute a computer program in the memory 54 for: determining a service model to be trained, the service model being used to select a service tool from at least one service tool for a user problem and call the selected service tool to answer the problem; obtaining tool description information corresponding to the service tool, the tool description information being used to describe at least one function supported by the corresponding service tool, at least one target input parameter, and at least one target return value; based on the tool description information, calling a sample generation model to generate sample data to obtain multiple sample data corresponding to the service tool, the sample data including: a first sample problem, and a sample service tool adapted to the first sample problem and its corresponding sample input parameters; using the first sample problem from the multiple sample data corresponding to at least one service tool as input to the service model, and using the sample service tool adapted to the first sample problem and its sample input parameters as a first annotation result to train the service model to enhance the service model's ability to call service tools.

[0077] In an optional embodiment, when the processor 55 calls the sample generation model to generate sample data according to the tool description information to obtain multiple sample data, it specifically performs the following steps: obtaining a first prompt word template corresponding to the sample generation model, the first prompt word template including a first task instruction, the first task instruction being used to instruct the sample generation model to generate sample questions and determine the sample service tool and its sample input parameters adapted to the sample questions to obtain sample data; adding the tool description information to the first prompt word template to obtain a first model prompt word, and inputting the first model prompt word into the sample generation model; in the sample generation model, according to the first task instruction, performing reverse reasoning on at least one target return value of the service tool, at least one function supported by the service tool, and at least one target input parameter to obtain multiple sample questions, using the service tool as a sample service tool adapted to the multiple sample questions respectively, and using the target input parameters used for reverse reasoning of the multiple sample question information as sample input parameters adapted to the multiple sample question information respectively, to obtain multiple sample data corresponding to the service tool.

[0078] Optionally, the first prompt word template also includes: style prompt words, used to provide prompts for the text style of the first sample question; the method also includes: adjusting the text style of the first sample question in multiple sample data according to the style prompt words.

[0079] Optionally, when adding tool description information to the first prompt word template to obtain the first model prompt word, the processor 55 is specifically used to: add tool description information and at least one sample example to the first prompt word template to obtain the first model prompt word; the sample example includes real user questions and service tools and their input parameters adapted to real user questions, used to guide the sample generation model to understand the task requirements indicated by the first task instruction and generate sample questions that conform to the user's questioning habits.

[0080] Further optionally, when the processor 55 performs reverse reasoning on at least one target return value of the service tool, at least one function supported by the service tool, and at least one target input parameter according to the first task instruction to obtain multiple sample questions, uses the service tool as a sample service tool adapted to each of the multiple sample questions, and uses the target input parameters used in the reverse reasoning of the multiple sample question information as sample input parameters adapted to each of the multiple sample question information to obtain multiple sample data corresponding to the service tool, specifically it is used to: perform semantic understanding on the first task instruction based on at least one sample example to obtain task requirements, the task requirements instructing the generation of sample questions and determining the sample data adapted to the sample questions. The system includes: a sample service tool and its sample input parameters; learning the information structure and language style of real user questions from at least one sample example to obtain descriptive information about user questioning habits; based on task requirements and the descriptive information about user questioning habits, performing reverse reasoning on the target return value of the service tool, at least one function supported by the service tool, and at least one target input parameter to obtain multiple sample questions; and, based on task requirements, using the service tool as a sample service tool adapted to each of the multiple sample questions, and using the target input parameters used for reverse reasoning of the information of the multiple sample questions as sample input parameters adapted to the information of the multiple sample questions to obtain multiple sample data corresponding to the service tool.

[0081] In an optional embodiment, when the processor 55 calls the sample generation model to generate sample data according to the tool description information to obtain multiple sample data corresponding to the service tool, it specifically performs the following: calling the sample generation model to generate sample data according to the tool description information to obtain multiple initial sample data corresponding to the service tool; identifying invalid samples in the multiple initial sample data and deleting invalid samples to obtain multiple sample data corresponding to the service tool, wherein the sample questions and sample input parameters of the sample data include the same identification information of the queried object; invalid samples include at least one of the following: sample data to which the sample question does not contain the identification information of the queried object belongs, sample data to which the sample input parameter does not contain the identification information of the queried object belongs, and sample data to which the identification information of the queried object contained in the sample question and its adapted sample input parameter is different.

[0082] In an optional embodiment, when the processor 55 trains the service model by taking a first sample question from multiple sample data as input to the service model and a sample service tool and its sample input parameters adapted to the first sample question as the first annotation result, the processor 55 specifically performs the following steps: adding multiple sample data to a second prompt word template corresponding to the sample format conversion model to obtain a second model prompt word; calling the sample format conversion model according to the second model prompt word to convert the multiple sample data into a triplet form adapted to the service model, the triplet form including: task information, question information, and first response information; the task information includes a second task instruction, the question information includes a first sample question, and the first response information includes a sample service tool and its sample input parameters adapted to the sample question; inputting the task information and question information into the service model, and under the instruction of the second task instruction, selecting a target service tool from at least one service tool for the question information and determining the target input parameters used to call the target service tool, and outputting the target service tool and its target input parameters as the second response information; calculating a loss function using the first response information as the first annotation result and the second response information, and continuing to train the service model until the loss function meets the training termination condition if the loss function does not meet the training termination condition.

[0083] In an optional embodiment, the multiple sample data includes: at least two training samples and at least two test samples; the training samples include: a first sample question, and a sample service tool adapted to the first sample question and its corresponding sample input parameters; the test samples include: a second sample question, and a second annotation result, the second annotation result including: a sample service tool adapted to the second sample question and its corresponding sample input parameters; the processor 55 is further configured to: input the second sample question from the at least two test samples into the trained service model to obtain the inference result of the service model, the inference result including: an inference service tool adapted to the second sample question information and its corresponding inference input parameters; based on the inference result of the at least two test samples and the second annotation result, determine the accuracy of the service model in selecting a service tool from at least one service tool for the user question; adjust the description information of at least one tool according to the accuracy to obtain the adjusted description information of at least one tool, and continue training the model until a service model that meets the set accuracy requirements is obtained.

[0084] Optionally, when the processor 55 adjusts at least one tool description information based on the accuracy to obtain at least one adjusted tool description information and continues training the model until a service model that meets the set accuracy requirement is obtained, the processor 55 specifically performs the following: if the accuracy is lower than the set accuracy threshold, it statistically analyzes the difference information between the inference result and the second annotation result, the difference information including: tool selection error information and / or parameter parsing error information; based on the tool selection error information and / or parameter parsing error information, it adjusts at least one tool description information to obtain at least one adjusted tool description information and continues training the model until a service model with an accuracy higher than or equal to the set accuracy threshold is obtained.

[0085] In an optional embodiment, when the processor 55 obtains the tool description information corresponding to the service tool, it is specifically configured to: obtain candidate tool description information corresponding to the service tool, the candidate tool description information including: at least one function, multiple candidate input parameters included in the function, and multiple candidate return values; for any function, randomly select a first predetermined number of target input parameters from the multiple candidate input parameters included in the function, and select a target return value that matches the target input parameters from the multiple candidate return values; or, based on the log information of the multiple candidate input parameters, count the usage frequency of the multiple candidate input parameters, and select at least some candidate input parameters as target input parameters from the multiple candidate input parameters included in the service tool according to the usage frequency, and select a target return value that matches the target input parameters from the multiple candidate return values; and use the target return value and the target input parameter as the tool description information corresponding to the service tool.

[0086] Regarding the embodiments provided in this application Figure 5 The detailed implementation methods and beneficial effects of each step in the device shown have been described in detail in the foregoing embodiments, and will not be elaborated here.

[0087] Furthermore, such as Figure 5 As shown, the electronic device also includes other components such as a communication component 56, a display 57, a power supply component 58, and an audio component 59. Figure 5 The diagram only shows some components and does not mean that the electronic device includes only these components. Figure 5 The components shown. Additionally... Figure 5The components within the dashed box are optional, not mandatory, and their specific requirements depend on the product form of the electronic device. The electronic device in this embodiment can be a desktop computer, laptop computer, smartphone, IoT (Internet of Things) device, or smart wearable device (such as a smartwatch or smart bracelet), or a server-side device such as a conventional server, cloud server, or server array. If the electronic device in this embodiment is a desktop computer, laptop computer, smartphone, or other terminal device, it may include... Figure 5 The components within the dashed box; if the electronic device in this embodiment is implemented as a conventional server, cloud server, or server array, it may be omitted. Figure 5 The component within the dashed box.

[0088] This application also provides an electronic device, the implementation structure of which is similar to... Figure 5 The implementation structure of the electronic devices shown is the same or similar, and can be referred to accordingly. Figure 5 The structure of the electronic device shown is implemented. The electronic device provided in this embodiment is similar to... Figure 5 The main difference between the electronic devices in the illustrated embodiments lies in the different functions implemented by the computer programs stored in the memory executed by the processor. For the electronic device provided in this embodiment, the processor executing the computer programs stored in the memory can be used to: determine at least one service tool, which is used to return answer information for a user's question; obtain tool description information corresponding to the service tool, the tool description information describing at least one function supported by the corresponding service tool, at least one target input parameter, and at least one target return value; and, based on the tool description information, call a sample generation model to generate sample data to obtain multiple sample data corresponding to the service tool, the sample data including: a first sample question, and a sample service tool adapted to the first sample question and its corresponding sample input parameters.

[0089] The detailed implementation methods and beneficial effects of the electronic devices provided in this application have been described in detail in the foregoing embodiments, and will not be elaborated further here.

[0090] The aforementioned memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0091] The aforementioned communication components are configured to facilitate wired or wireless communication between the device containing the communication components and other devices. The device containing the communication components can access wireless networks based on communication standards, such as WiFi, 2G, 3G, 4G / LTE, 5G, or combinations thereof. In one exemplary embodiment, the communication components receive broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication components also include a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID), Infrared Data Association (IrDA), Ultra Wide Band (UWB), Bluetooth (BT), and other technologies.

[0092] The aforementioned display includes a screen, which may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a Touch Panel, the screen can be implemented as a touchscreen to receive input signals from the user. The Touch Panel includes one or more touch sensors to sense touches, swipes, and gestures on the Touch Panel. The touch sensors can sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation.

[0093] The aforementioned power supply components provide power to various components within the device in which they reside. These power supply components may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device in which they reside.

[0094] The aforementioned audio component can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC) configured to receive external audio signals when the device containing the audio component is in an operating mode, such as call mode, recording mode, or voice recognition mode. The received audio signals can be further stored in memory or transmitted via a communication component. In some embodiments, the audio component also includes a speaker for outputting audio signals.

[0095] Accordingly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to implement the steps in the above-described method embodiments. The computer-readable storage medium includes volatile or non-volatile components, or a combination thereof, and can be removable or non-removable. Examples of computer-readable storage media include, but are not limited to, phase-change random access memory (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), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), flash memory or other memory technologies, CD-ROM, Digital Video Disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium.

[0096] Accordingly, this application also provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, the processor is able to implement the steps in the above method embodiments. It should be understood that each step or combination of steps in the above method flow can be implemented by the computer program or instructions. In addition, these computer programs or instructions can be applied to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device, so that the processor of the general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device can be implemented as a means to implement the corresponding functions in the above method embodiments.

[0097] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-readable storage media (including, but not limited to, disk storage, compact disc read-only memory (CD-ROM), optical storage, etc.) containing computer-usable program code.

[0098] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations 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, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0099] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0100] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0101] In a typical configuration, a computing device includes one or more processors (Central Processing Unit, CPU), input / output interfaces, network interfaces, and memory.

[0102] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0103] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change random access memory (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, CD-ROM, Digital Video Disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0104] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0105] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A model training method, characterized in that, include: A service model to be trained is determined, which is used to select a service tool from at least one service tool for a user's question and call the selected service tool to answer the question; Obtain the tool description information corresponding to the service tool. The tool description information is used to describe at least one function supported by the corresponding service tool, at least one target input parameter, and at least one target return value. According to the tool description information, the sample generation model is invoked to generate sample data to obtain multiple sample data corresponding to the service tool. The sample data includes: a first sample problem, and a sample service tool adapted to the first sample problem and its corresponding sample input parameters. The service model is trained by taking the first sample question from multiple sample data corresponding to the at least one service tool as input, and taking the sample service tool and its sample input parameters adapted to the first sample question as the first annotation result, so as to enhance the service model's ability to call service tools.

2. The method according to claim 1, characterized in that, Based on the tool description information, the sample generation model is invoked to generate sample data, resulting in multiple sample data sets, including: Obtain the first prompt word template corresponding to the sample generation model, wherein the first prompt word template includes a first task instruction; The tool description information is added to the first prompt word template to obtain the first model prompt word, and the first model prompt word is input into the sample generation model; In the sample generation model, according to the first task instruction, at least one target return value of the service tool, at least one function supported by the service tool, and at least one target input parameter are back-reasoned to obtain multiple sample questions. The service tool is used as a sample service tool adapted to the multiple sample questions respectively, and the target input parameters used for back-reasoning the information of the multiple sample questions are used as sample input parameters adapted to the information of the multiple sample questions respectively, so as to obtain multiple sample data corresponding to the service tool.

3. The method according to claim 2, characterized in that, The first prompt word template also includes: style prompt words, used to provide prompts for the text style of the first sample question; The method further includes: adjusting the text style of the first sample question in the plurality of sample data according to the style cue words.

4. The method according to claim 2, characterized in that, Add the tool description information to the first prompt word template to obtain the first model prompt word, including: The tool description information and at least one sample example are added to the first prompt word template to obtain the first model prompt word; the sample example includes real user questions and service tools and their input parameters adapted to the real user questions, which are used to guide the sample generation model to understand the task requirements indicated by the first task instruction and generate sample questions that conform to the user's questioning habits.

5. The method according to claim 4, characterized in that, According to the first task instruction, reverse reasoning is performed on at least one target return value of the service tool, at least one function supported by the service tool, and at least one target input parameter to obtain multiple sample questions. The service tool is used as a sample service tool adapted to each of the multiple sample questions, and the target input parameters used for reverse reasoning the information of the multiple sample questions are used as sample input parameters adapted to each of the multiple sample question information, so as to obtain multiple sample data corresponding to the service tool, including: Based on the at least one sample example, the first task instruction is semantically understood to obtain task requirements, which instruct the generation of sample questions and the determination of sample service tools and their sample input parameters that are adapted to the sample questions. The information structure and language style of real user questions from at least one sample example are learned to obtain descriptive information about user questioning habits; Based on the description of the task requirements and the user's questioning habits, reverse reasoning is performed on the target return value of the service tool, at least one function supported by the service tool, and at least one target input parameter to obtain the multiple sample questions; According to the task requirements, the service tool is used as a sample service tool adapted to the multiple sample questions respectively, and the target input parameters used for reverse reasoning of the multiple sample question information are used as sample input parameters adapted to the multiple sample question information respectively, so as to obtain multiple sample data corresponding to the service tool.

6. The method according to any one of claims 1-5, characterized in that, Based on the tool description information, a sample generation model is invoked to generate sample data, thereby obtaining multiple sample data corresponding to the service tool, including: Based on the tool description information, a sample generation model is invoked to generate sample data to obtain multiple initial sample data corresponding to the service tool; invalid samples in the multiple initial sample data are identified and deleted to obtain multiple sample data corresponding to the service tool. The sample questions and sample input parameters of the sample data include the same identifier information of the queried object; the invalid samples include at least one of the following: sample data to which the sample question does not contain the identifier information of the queried object belongs, sample data to which the sample input parameter does not contain the identifier information of the queried object belongs, and sample data to which the identifier information of the queried object contained in the sample question and its matching sample input parameter is different.

7. The method according to any one of claims 1-5, characterized in that, The service model is trained by using a first sample question from the plurality of sample data as input to the service model, and using a sample service tool adapted to the first sample question and its sample input parameters as the first annotation result. The training process includes: The multiple sample data are added to the second prompt word template corresponding to the sample format conversion model to obtain the second model prompt word; Based on the second model prompt, the sample format conversion model is invoked to convert the multiple sample data into a triplet form adapted to the service model. The triplet form includes: task information, question information, and first response information. The task information includes a second task instruction, the question information includes the first sample question, and the first response information includes a sample service tool adapted to the sample question and its sample input parameters. The task information and problem information are input into the service model. Under the instruction of the second task command, a target service tool is selected from the at least one service tool for the problem information, and the target input parameters used to call the target service tool are determined. The target service tool and its target input parameters are output as the second response information. The first response information is used as the first annotation result, and the loss function is calculated together with the second response information. If the loss function does not meet the training termination condition, the service model continues to be trained until the loss function meets the training termination condition.

8. The method according to any one of claims 1-5, characterized in that, The plurality of sample data includes: at least two training samples and at least two test samples; the training samples include: a first sample problem, and a sample service tool adapted to the first sample problem and its corresponding sample input parameters; the test samples include: a second sample problem, and a second annotation result, the second annotation result including: a sample service tool adapted to the second sample problem and its corresponding sample input parameters; the method further includes: The second sample question from the at least two test samples is input into the trained service model to obtain the inference result of the service model. The inference result includes: an inference service tool adapted to the information of the second sample question and its corresponding inference input parameters. Based on the inference results of the at least two test samples and the second annotation results, determine the accuracy of the service model in selecting a service tool from at least one service tool for the user problem; Based on the accuracy rate, the at least one tool description information is adjusted to obtain the adjusted at least one tool description information, and the model is trained again until a service model that meets the set accuracy requirements is obtained.

9. The method according to claim 8, characterized in that, Based on the accuracy rate, the at least one tool description information is adjusted to obtain adjusted at least one tool description information. The model is then trained again until a service model that meets the set accuracy requirements is obtained, including: If the accuracy rate is lower than the set accuracy rate threshold, the difference information between the inference result and the second annotation result is statistically analyzed. The difference information includes: tool selection error information and / or parameter parsing error information. Based on the tool selection error information and / or parameter parsing error information, the description information of at least one tool is adjusted to obtain the adjusted description information of at least one tool. Model training continues until a service model with an accuracy higher than or equal to the set accuracy threshold is obtained.

10. The method according to any one of claims 1-5, characterized in that, Obtain the tool description information corresponding to the service tool, including: Obtain candidate tool description information corresponding to the service tool, wherein the candidate tool description information includes: at least one function, multiple candidate input parameters included in the function, and multiple candidate return values; For any of the functions, a first predetermined number of target input parameters are randomly selected from a plurality of candidate input parameters included in the function, and a target return value that matches the target input parameters is selected from a plurality of candidate return values; or, based on log information of a plurality of candidate input parameters, the usage frequency of the plurality of candidate input parameters is statistically analyzed, and at least a portion of the candidate input parameters are selected as target input parameters from a plurality of candidate input parameters included in the service tool according to the usage frequency, and a target return value that matches the target input parameters is selected from a plurality of candidate return values. The target return value and the target input parameters are used as the tool description information corresponding to the service tool.

11. A method for generating sample data, characterized in that, include: Identify at least one service tool, said at least one service tool being used to return answer information in response to user questions; Obtain the tool description information corresponding to the service tool. The tool description information is used to describe at least one function supported by the corresponding service tool, at least one target input parameter, and at least one target return value. Based on the tool description information, a sample generation model is invoked to generate sample data to obtain multiple sample data corresponding to the service tool. The sample data includes: a first sample problem, and a sample service tool adapted to the first sample problem and its corresponding sample input parameters.

12. An electronic device, characterized in that, include: Memory and processor; The memory is used to store a computer program; the processor, coupled to the memory, is used to execute the computer program to implement the steps of the method according to any one of claims 1-10 and 11.

13. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it causes the processor to perform the steps of the method according to any one of claims 1-10 and 11.

14. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, the processor is caused to perform the steps of the method according to any one of claims 1-10 and 11.