Machine learning task template generation method, training method, fine adjustment method and device

By generating task templates that are naturally connected to the original text, pre-training and fine-tuning of the machine learning model is solved, and the model's pre-training effect is not good in specific fields, improving the multi-task adaptability and performance of the model.

WO2025050842A1PCT designated stage expired Publication Date: 2025-03-13ALIBABA (CHINA) CO LTD

Patent Information

Application Number
PCT/CN2024/105817
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-09-06
Filing Date
2024-07-16
Publication Date
2025-03-13

AI Technical Summary

Technical Problem

The prior art uses domain-specific data to pre-train machine learning models, the model is poor and is limited to downstream tasks in a specific domain, limiting the applicability of the model.

Method used

By obtaining the pending original text and at least one task, using the generative model to generate a task template that is naturally connected to the original text, constructing target text for pre-training and fine-tuning of machine learning models.

Benefits of technology

The multi-task pre-training effect of machine learning models is improved, allowing the model to process user input more naturally, and improve the performance of downstream tasks under low resources, enhancing the model's migration and robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024105817_13032025_PF_FP_ABST
    Figure CN2024105817_13032025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present application are a machine learning task template generation method, a training method, a fine adjustment method and a device. The machine learning task template generation method comprises: acquiring an original text to be processed; and by means of a generation model, obtaining a template corresponding to each task on the basis of said original text and at least one task, wherein a target text formed by said original text and the templates is used for being input into a machine learning model for processing, and the templates are used for indicating tasks to be executed by the machine learning model. The present application can generate templates that seamlessly connect original texts and conform to actual language habits of users, so as to enable machine learning models to have more natural input forms and respond to input forms corresponding to various tasks in various fields; additionally, the present application helps to increase the final training sample size on the basis of the original texts, so as to enable the machine learning models to better improve the performance of downstream tasks in low resources situations such as zero sample or few samples, thus effectively improving the mobility and robustness of models.
Need to check novelty before this filing date? Find Prior Art

Description

Machine learning task template generation method, training method, fine-tuning method and equipment

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on September 6, 2023, with application number 202311148338.7 and application name “Machine Learning Task Template Generation Method, Training Method, Fine-tuning Method and Device”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to artificial intelligence technology, and in particular to a machine learning task template generation method, training method, fine-tuning method and equipment. Background Art

[0003] With the continuous development of artificial intelligence, the application of various machine learning models is becoming more and more widespread. To improve the training effect of machine learning models, you can use pre-trained machine learning models for fine-tuning training. This can improve the overall training efficiency while ensuring the training performance of the machine learning model.

[0004] Pre-training a model using only data from a specific domain can lead to poor results. For example, after pre-training a model based on data from a specific domain, the model is only suitable for downstream tasks in that specific domain, limiting the applicability of the machine learning model.

[0005] To solve this problem, we can consider using a multi-task approach to pre-train the machine learning model. However, how to ensure the effectiveness of multi-task pre-training becomes a problem that needs to be solved.

[0006] Summary of the Invention

[0007] This application provides a machine learning task template generation method, training method, fine-tuning method and equipment to obtain a task template that is naturally connected with the original text and conforms to the user's language habits, thereby improving the effect of multi-task pre-training of the machine learning model.

[0008] In a first aspect, an embodiment of the present application provides a method for generating a machine learning task template, comprising:

[0009] Get the original text to be processed;

[0010] According to the original text and at least one task, a template corresponding to each task is obtained by generating a model;

[0011] Among them, the target text composed of the original text and the template is used to be input into the machine learning model for processing, and the template is used to indicate the task to be performed by the machine learning model.

[0012] In a second aspect, an embodiment of the present application provides a pre-training method for a machine learning model, comprising:

[0013] Obtaining a training sample, wherein the training sample is a target text composed of a template obtained by the method described in the first aspect and an original text;

[0014] Pre-train the machine learning model based on the obtained training samples.

[0015] In a third aspect, an embodiment of the present application provides a method for fine-tuning a machine learning model, comprising:

[0016] Obtaining a fine-tuning sample set, wherein the fine-tuning sample set is constructed through a conversation between a user and a customer service representative, and the tasks corresponding to the fine-tuning sample set include at least one of the following: intent recognition, conversation state tracking, and reply generation;

[0017] Fine-tune the machine learning model according to the fine-tuning sample set;

[0018] Among them, the machine learning model is a pre-trained machine learning model obtained by the method described in the second aspect.

[0019] In a fourth aspect, an embodiment of the present application provides an intelligent dialogue method, including:

[0020] Get user input information;

[0021] Determining output information for replying to the user based on the machine learning model according to the input information;

[0022] Among them, the machine learning model is a fine-tuned machine learning model obtained by the method described in the third aspect.

[0023] In a fifth aspect, an embodiment of the present application provides a machine learning task template generation device, comprising:

[0024] A first acquisition module is used to acquire the original text to be processed;

[0025] A processing module, configured to obtain a template corresponding to each task by generating a model based on the original text and at least one task;

[0026] Among them, the target text composed of the original text and the template is used to be input into the machine learning model for processing, and the template is used to indicate the task to be performed by the machine learning model.

[0027] In a sixth aspect, an embodiment of the present application provides a pre-training device for a machine learning model, comprising:

[0028] A second acquisition module is configured to acquire a training sample, wherein the training sample is a target text composed of a template obtained by the method described in the first aspect and an original text;

[0029] The training module is used to pre-train the machine learning model based on the acquired training samples.

[0030] In a seventh aspect, an embodiment of the present application provides a fine-tuning device for a machine learning model, comprising:

[0031] A third acquisition module is configured to acquire a fine-tuning sample set, wherein the fine-tuning sample set is constructed through a conversation between a user and a customer service representative, and the tasks corresponding to the fine-tuning sample set include at least one of the following: intent recognition, conversation state tracking, and reply generation;

[0032] A fine-tuning module, configured to perform fine-tuning training on the machine learning model based on the fine-tuning sample set;

[0033] Among them, the machine learning model is a pre-trained machine learning model obtained by the method described in the second aspect.

[0034] In an eighth aspect, an embodiment of the present application provides an intelligent dialogue device, including:

[0035] The fourth acquisition module is used to obtain user input information;

[0036] A reply module, configured to determine output information for replying to the user based on the input information and a machine learning model;

[0037] Among them, the machine learning model is a fine-tuned machine learning model obtained by the method described in the third aspect.

[0038] In a ninth aspect, an embodiment of the present application provides an electronic device, including:

[0039] at least one processor; and

[0040] a memory communicatively coupled to the at least one processor;

[0041] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the electronic device to execute the method described in any one of the above aspects.

[0042] In a tenth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the method described in any one of the above aspects is implemented.

[0043] In an eleventh aspect, an embodiment of the present application provides a computer program product, comprising a computer program, which implements the method described in any of the above aspects when executed by a processor.

[0044] The machine learning task template generation method, training method, fine-tuning method and device provided in the embodiments of the present application can obtain the original text to be processed, and obtain the template corresponding to each task by generating a model based on the original text and at least one task, wherein the target text composed of the original text and the template is used to input into the machine learning model for processing, and the template is used to indicate the task to be performed by the machine learning model, so that a template that naturally connects with the original text and conforms to the user's actual language habits can be generated according to different tasks. With the assistance of the template, the machine learning model is pre-trained or other operations are performed, so that the machine learning model has a more natural input form and can respond to the input form corresponding to each task in each field; in addition, it helps to increase the final training sample size based on the original text, and enables the machine learning model to better improve the performance of downstream tasks in low-resource conditions such as zero samples or few samples, and improve the performance of the machine learning model on unseen tasks. The machine learning model can exhibit good transferability and robustness, thereby improving the overall training effect of the machine learning model. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0046] FIG1 is a schematic diagram showing the principle of a multi-task pre-training method;

[0047] FIG2 is a schematic diagram showing the principle of a multi-task multi-template pre-training method provided in an embodiment of the present application;

[0048] FIG3 is a diagram of an application scenario provided by an embodiment of the present application;

[0049] FIG4 is a flow chart of a method for generating a machine learning task template according to an embodiment of the present application;

[0050] FIG5 is a schematic diagram of a generation template provided in an embodiment of the present application;

[0051] FIG6 is a schematic diagram showing the principle of a machine learning model provided in an embodiment of the present application;

[0052] FIG7 is a schematic diagram of an interactive interface provided in an embodiment of the present application;

[0053] FIG8 is a schematic diagram of another interactive interface provided in an embodiment of the present application;

[0054] FIG9 is a flow chart of a method for fine-tuning a machine learning model provided in an embodiment of the present application;

[0055] FIG10 is a flow chart of an intelligent dialogue method provided in an embodiment of the present application;

[0056] FIG11 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.

[0057] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION

[0058] Exemplary embodiments are described in detail herein, with examples illustrated in the accompanying drawings. When the following description refers to the drawings, identical numerals in different drawings represent identical or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with this application.

[0059] It should be noted that the user information (including but not limited to user device information, user attribute information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0060] First, let’s explain the terms involved in this application:

[0061] Template: Also known as a template, in natural language processing, it refers to a way of organizing input and output. Connecting input and output through templates generally produces smoother results than direct splicing. It can also make pre-trained samples closer to actual user input, which can improve the predictive performance of language models in downstream tasks.

[0062] Multi-task pre-training: refers to the process of pre-training a language model by combining samples from multiple different tasks for training, so that the trained language model has the ability to perform multiple tasks.

[0063] Conversational language model: refers to a language model whose corpus during pre-training is mainly targeted at conversation-related tasks and is mainly used for conversation-related tasks.

[0064] A large language model refers to a deep learning language model with a large number of language model parameters, typically containing hundreds of millions, tens of billions, hundreds of billions, trillions, or even more than ten trillion language model parameters. Large language models, also known as foundational language models, are pre-trained on large, unlabeled corpora to produce pre-trained language models with over 100 million parameters. These models are adaptable to a wide range of downstream tasks and exhibit good generalization capabilities. Examples include large language models (LLMs) and multi-modal pre-training models.

[0065] In practical applications, large language models only require a small number of samples to fine-tune the pre-trained language model and can be applied to different tasks. Large language models can be widely used in natural language processing (NLP), computer vision and other fields. Specifically, they can be applied to computer vision tasks such as visual question answering (VQA), image caption (IC), and image generation, as well as natural language processing tasks such as text-based sentiment classification, text summary generation, and machine translation. The main application scenarios of large language models include digital assistants, intelligent robots, search, online education, office software, e-commerce, and intelligent design.

[0066] With the development of pre-training technology, language models pre-trained in specific domains (such as conversation) can improve their performance in downstream tasks. However, these pre-trained language models are limited to a specific domain and can often only be used for downstream tasks in that specific domain. They are unable to cover all downstream tasks, limiting their broad applicability.

[0067] To improve the performance of the language model, you can consider using multi-task pre-training. To distinguish between multiple tasks during pre-training, you can concatenate the original text with the tasks and input them into the language model.

[0068] Figure 1 is a schematic diagram of the principles of a multi-task pre-training method. As shown in Figure 1, during pre-training, the original text is "Please reserve a table for 8." Based on this original text, different task names can be spliced ​​together and input into the language model to obtain outputs for different tasks. For example, tasks may include: dialogue state tracking (slot identification), intent recognition, sentiment classification, response generation, etc. After splicing the intent recognition task with the original text and inputting it into the language model, the corresponding output (i.e., the recognized intent) is: "Reserve a table." This allows for the unification of multiple tasks by splicing tasks together.

[0069] Although this training method can achieve multi-task pre-training, the input and output formats are not natural enough. The language model obtained by pre-training can only respond to specific forms of input, which does not match the real input of users in actual applications. It is difficult to achieve the language model's response to the user's natural language. Moreover, in this pre-training method, the number of training samples often depends on the number of original samples, which limits the scale of training samples. Serious negative transfer may occur during multi-task training, affecting the performance of the final language model training and resulting in poor training effect of the language model.

[0070] To solve this problem, the embodiment of the present application provides a multi-template training method that is more in line with natural language habits, which can make the input of the language model closer to the user's actual input, and effectively expand the scale of training samples to improve the performance of the language model.

[0071] Figure 2 is a schematic diagram of the principle of a multi-task multi-template pre-training method provided by an embodiment of the present application. As shown in Figure 2, the original text is "Please reserve a table for 8 people." Based on the original text, a template that conforms to natural language habits can be obtained through a generative model with text generation capabilities. The original text and the template are spliced ​​to obtain training samples. The training samples corresponding to different tasks are input into the language model to obtain outputs for different tasks. For example, for the task of intent recognition, a corresponding template can be generated: "What is the intention of this sentence?" In this way, a template that naturally connects with the original text and conforms to the user's language habits can be obtained, which assists the language model in achieving multi-task training.

[0072] In addition, by utilizing the generative model's generation capabilities, multiple templates corresponding to the original text can be generated for each task. By splicing multiple templates with the original text, multiple training samples can be obtained. For example, for the task of intent recognition, additional templates can be generated, such as "Please analyze the purpose of this sentence", to increase the scale of training samples.

[0073] Figure 3 illustrates an application scenario provided by an embodiment of the present application. As shown in Figure 3, multiple tasks to be trained can be set for the language model. These tasks can include conversation-related tasks, such as intent recognition and sentiment classification, as well as tasks outside the conversation domain, such as summary generation and text-to-SQL (Structured Query Language) conversion. Based on the tasks and the original text, the generative model is used to generate corresponding templates, which are then input into the language model to pre-train the language model.

[0074] After pre-training, the language model can be fine-tuned. Specifically, the language model can be fine-tuned using downstream tasks in a specific domain. For example, input text from the downstream task is fed into the language model to generate the corresponding output text, and the language model parameters are adjusted based on the output text. After fine-tuning, the language model can be applied to specific downstream tasks, such as intent recognition and sentiment classification.

[0075] The method provided in the embodiment of the present application can generate templates that are naturally connected with the original text and conform to the user's actual language habits according to different tasks. With the assistance of the templates, the language model is pre-trained so that the language model has a more natural input and output form and can respond to the input form corresponding to each task in each field. In addition, a large number of templates are generated, which effectively increases the scale of pre-training samples, and enables the language model to better improve the performance of downstream tasks in low-resource conditions such as zero samples or few samples, and improve the performance of the language model on unseen tasks. The language model can show good transferability and robustness, thereby improving the overall training effect of the language model.

[0076] The following detailed description of some embodiments of the present application is provided in conjunction with the accompanying drawings. The following embodiments and features thereof may be combined with one another unless they conflict with each other. Furthermore, the sequence of steps in the following method embodiments is provided for illustrative purposes only and is not intended to be a strict limitation.

[0077] FIG4 is a flow chart of a method for generating a machine learning task template provided by an embodiment of the present application. The execution subject of the method in this embodiment can be applied to any device with data processing capabilities, such as a terminal device or a server. In practical applications, the method in this embodiment can be implemented on the cloud, locally deployed, implemented on a client, implemented on an IOT (Internet of Things) device, etc. As shown in FIG4 , the method may include:

[0078] Step 401: Obtain the original text to be processed.

[0079] Optionally, the original text may be obtained in various ways, for example, from other devices, or input by a user, etc. The original text may be obtained individually, or multiple original texts may be obtained simultaneously and the original text to be processed may be selected from them.

[0080] Exemplarily, the template obtained in this embodiment can be applied to pre-training of a machine learning model. In this step, a training corpus can be obtained, and the original text to be processed is selected from the training corpus.

[0081] Optionally, the training corpus can be obtained in a variety of ways, for example, from a conversation platform or other platform, or by having a pre-trained user input the training corpus. The number of the training corpus can be one or more, and this embodiment of the application does not limit this.

[0082] In a supervised training scenario, the training corpus may include multiple training corpora, and the training corpora may include original texts and labels.

[0083] For example, the original text may be "Please reserve a table for 8 people." When the training task is intent recognition, the corresponding label may be "reserve a seat."

[0084] Optionally, in some other scenarios, labels are not necessary. For example, labels can be omitted, that is, the language model can be trained without annotation.

[0085] Step 402: Based on the original text and at least one task, a template corresponding to each task is generated by generating a model. The target text composed of the original text and the template is input into the machine learning model for processing, and the template indicates the task to be performed by the machine learning model. For example, the original text may be "Please reserve a table for 8 people." and the template may be "What is the intention of this sentence?"

[0086] The target text, composed of the original text and the template, can be used as a training sample to process a machine learning model. The machine learning model can be a language model or any other model capable of processing the target text, such as a multimodal processing model. For ease of description, the solution of this embodiment is described in detail below using the target text as an example training sample.

[0087] Optionally, the generative model can be a model with natural language processing capabilities that can generate text that conforms to natural language habits as needed. For each task, one or more templates can be generated by the generative model, and a training sample can be obtained by splicing the original text with a template.

[0088] Exemplarily, the at least one task may include: dialogue state tracking, intent recognition, sentiment classification, reply generation, etc. Given a task and an original text, a generative model may be used to construct one or more corresponding templates.

[0089] Optionally, the pre-training stage of the machine learning model corresponds to multiple tasks, that is, the machine learning model is pre-trained through multiple tasks.

[0090] The obtaining of the original text to be processed includes: obtaining a training corpus, wherein the training corpus includes multiple original texts; selecting any original text from the training corpus as the original text to be processed, so as to obtain a corresponding template based on the original text; wherein the target texts obtained respectively from the multiple original texts in the training corpus are specifically used to train the machine learning model for multiple tasks.

[0091] Optionally, each original text in the training corpus can be processed separately. For each original text, the original text can be used as the original text to be processed. According to the method provided in this embodiment, a corresponding template is generated. The original text and the template constitute a training sample, so that multiple training samples can be obtained based on multiple original texts in the training corpus to achieve pre-training of the machine learning model. Each original text to be processed can be recorded as a target original text, and the target tasks corresponding to each target original text can be the same or different. A template under one task can be generated for one target original text, or templates under at least two tasks can be generated.

[0092] Exemplarily, the machine learning model is pre-trained through the above four tasks, that is, the pre-training stage covers the above four tasks, and for each target original text, at least part of the above four tasks can be used to generate a template corresponding to the target original text.

[0093] For example, some target original texts are applicable to four tasks, and corresponding templates can be generated based on the four tasks respectively. Some target original texts are only applicable to some of the four tasks. For example, the target original text does not contain slot information and may not be suitable for the task of dialogue state tracking. In this case, corresponding templates can be generated only based on other tasks.

[0094] When there are multiple training corpora, the original texts in the training corpora can be divided into overall tasks according to the characteristics of the training corpora. For example, if a training corpus does not contain slot information, when processing the training corpus, no templates corresponding to the dialogue state tracking task are constructed for the multiple original texts contained therein, and there is no need to confirm each original text in the training corpus separately.

[0095] In an optional implementation, the collected training corpus only contains original texts, and the corresponding labels can be determined according to the tasks to be trained. Among them, the tasks to be trained can be set according to actual needs, for example, they can be configured by the user. For any task, the label of the target original text is determined according to the task, which can be achieved in the following way: the target original text is input into the task processing model corresponding to the task to obtain the corresponding label. For example, if the task to be trained includes intent recognition, an intent recognition model can be obtained, and the target original text is input into the intent recognition model. The intent recognition model can identify the intent corresponding to the target original text as the label corresponding to the target original text. In addition, the corresponding label can also be obtained through manual annotation or other methods.

[0096] For example, for the target original text "Please reserve a table for 8 people.", when the target task is intent recognition, the corresponding label is determined to be "reserve a seat". A template corresponding to intent recognition can also be generated based on the generative model, so that training samples for different tasks can be obtained according to actual needs.

[0097] In another optional implementation, the collected training corpus itself contains raw text and labels. The target task can be determined based on the labels corresponding to the target raw text. For example, if the target raw text is "Please reserve a table for 8." and the corresponding label is "Reserve a seat," the target task can be determined to be intent recognition. A template corresponding to the intent recognition task can then be generated based on the generative model. This allows pre-training using the labeled training corpus, reducing the labeling workload and improving efficiency.

[0098] By performing multi-task training on the machine learning model in the above manner, corresponding tasks can be selected for template generation in a targeted manner based on the situation of the original text. The tasks are matched with the labels, and the training samples corresponding to multiple original texts cover multiple tasks. On the basis of ensuring a certain accuracy, multiple training samples are obtained to meet the requirements of pre-training.

[0099] When pre-training a machine learning model in an unlabeled manner, the target task corresponding to each original sample can be set according to actual needs. For example, a cloze task can be set for a certain original text.

[0100] When generating a template, the template may be directly obtained according to the target task, or a plurality of keywords may be set for each task and a template may be generated according to each keyword.

[0101] Optionally, the target task corresponds to multiple keywords; based on the original text to be processed and the target task, a corresponding template is generated through a generation model, including: inputting the original text to be processed and any keyword corresponding to the target task into the generation model to obtain a target text containing the template.

[0102] The keywords may be words that can characterize the task. For example, keywords corresponding to the intent recognition task may include intent, purpose, etc. Based on each keyword, at least one template may be generated. For example, one template may be generated based on the keyword "intent," and another template may be generated based on the keyword "purpose."

[0103] By generating templates corresponding to the original text through multiple keywords corresponding to the task, the diversity of training samples can be effectively improved, simulating different inputs of users in various situations in actual applications, and the scale of training samples can be increased, thereby improving the effect of pre-training.

[0104] Optionally, the original text to be processed and any keyword corresponding to the target task are input into the generation model to obtain a target text containing a template, including:

[0105] Adding content before or after the original text to be processed, wherein the added content sequentially includes: at least one mask character, a keyword, and at least one mask character;

[0106] The original text to be processed and the added content are input into the generation model, and the mask characters are filled using the generation model to obtain the corresponding target text.

[0107] Figure 5 is a schematic diagram of a generation template provided by an embodiment of the present application. As shown in Figure 5, a box is used to represent a space, which can be understood as a mask character. Content containing mask characters can be added before or after the target original text (the original text to be processed), and the target original text, keywords, and mask characters are spliced ​​together and input into the generation model. The generation model has the function of filling in the mask characters, and the mask characters can be completed to obtain the corresponding template.

[0108] Among them, the template can be set before or after the target original text, and correspondingly, keywords and mask characters can be added before or after the target original text as input to the generation model. The number of mask characters is not limited and can be fixed or non-fixed. In addition, the mask characters can also be set only before the keywords, or only after the keywords. The generation model can fill in all the mask characters, or only fill in part. For example, if five mask characters are set after the keyword, the generation model can end after filling in only three characters, without having to complete the five mask characters.

[0109] Through the above method, the natural language processing capabilities of the generative model can be used to obtain templates that meet both task requirements and natural language habits, so that the machine learning model can be pre-trained using more natural text.

[0110] In addition to the above methods, template generation can also be achieved through other methods. For example, the target task and target original text can be directly input into the generative model without distinguishing multiple keywords, thereby obtaining a training sample containing the target original text and the template. Alternatively, the task name or keywords can be directly input into the generative model, and the generative model can output the corresponding template. The template is then spliced ​​with the target original text to obtain a training sample.

[0111] Optionally, the obtained template can be directly spliced ​​with the original text to obtain the corresponding training sample, or it can be manually screened and then spliced ​​with the original sample to obtain the training sample.

[0112] After obtaining the training samples, the machine learning model can be trained using the training samples, for example, pre-training or fine-tuning training.

[0113] In addition to training machine learning models, the target text consisting of the original text and the template can also be used in other scenarios. For example, it can be applied to the actual use of machine learning models.

[0114] Specifically, the original text may be text input by the user. The method provided in this embodiment can be used to add a template to the original text to obtain a target text. The target text is then input into the machine learning model to generate output text corresponding to the original text and display it to the user. Because the template can indicate the task to be performed by the machine learning model, the machine learning model can better process user input, improving the user experience.

[0115] Among them, the corresponding tasks when generating templates can be set according to actual needs. For example, in a dialogue scenario, the corresponding tasks can be set as intent recognition, etc., or the tasks can be input by the user to meet the actual needs of different scenarios.

[0116] In an embodiment of the present application, the original text to be processed can be obtained, and based on the original text and at least one task, a template corresponding to each task can be obtained by generating a model, wherein the target text composed of the original text and the template is used to input into the machine learning model for processing, and the template is used to indicate the task to be performed by the machine learning model, so that a template that naturally connects with the original text and conforms to the user's actual language habits can be generated according to different tasks. With the assistance of the template, the machine learning model is pre-trained or other operations are performed, so that the machine learning model has a more natural input form and can respond to the input form corresponding to each task in each field; in addition, it helps to increase the final training sample size based on the original text, and enables the machine learning model to better improve the performance of downstream tasks in low-resource conditions such as zero samples or few samples, and improve the performance of the machine learning model on unseen tasks. The machine learning model can exhibit good transferability and robustness, thereby improving the overall training effect of the machine learning model.

[0117] This application also provides a pre-training method for a machine learning model, including:

[0118] Obtaining a training sample, wherein the training sample is a target text composed of a template obtained by the method described in any one of the above embodiments and an original text;

[0119] Pre-train the machine learning model based on the obtained training samples.

[0120] The machine learning model may be a conversational language model or any other type of machine learning model.

[0121] Optionally, the training samples can be input into the machine learning model to obtain corresponding output text. The parameters of the machine learning model can be updated based on the output text and the labels corresponding to the training samples. Once a stopping condition is met, such as the performance of the machine learning model meeting the requirements or after a certain number of iterations, the pre-trained machine learning model can be obtained.

[0122] In this embodiment of the present application, templates can be used to unify the format of training samples for various tasks. Assuming the original text is X, a corresponding template P can be generated through task t. Template P is used to assist in inferring the task. Template P is concatenated with the original text X to generate a training sample. The training sample is input into the machine learning model to generate the output text Y.

[0123] For the convenience of modeling, we can assume that the template P only contains information related to task t, while the original text X contains other input information. Specifically, it can be represented by the following formula: p(t|X,P)≈p(t|P) (1) p(Y|X,P,t)≈p(Y|X,t) (2)

[0124] From formula (1), we can see that obtaining task t through original text X and template P is equivalent to obtaining task t through template P. Because original text X and task t are decoupled, it can be considered that original text X is basically unrelated to task t. From formula (2), we can see that obtaining output text Y through original text X, template P, and task t is equivalent to obtaining output text Y through original text X and task t. Because template P is constrained by task t, information about task t can replace template P.

[0125] Based on this idea, a corresponding machine learning model structure can be constructed. Optionally, the machine learning model can be used to: determine the corresponding task based on the template in the training sample, and determine the corresponding output text based on the task and the original text in the training sample.

[0126] FIG6 is a schematic diagram of the principle of a machine learning model provided in an embodiment of the present application. As shown in FIG6 , the machine learning model may include: an encoding module, a task parsing module, and a decoding module. After the training sample is input into the machine learning model, the machine learning model obtains the output text by the following method:

[0127] Extracting encoding features of the original text in the training sample and encoding features of the template in the training sample based on the encoding module;

[0128] Based on the task parsing module, determining the coding features of the corresponding task according to the coding features of the template;

[0129] Based on the decoding module, a decoding operation is performed according to the encoding features of the original text and the encoding features of the task to obtain a corresponding output text.

[0130] Exemplarily, the original text X and the template P are input into the encoding module to obtain the encoding features of the original text X and the encoding features of the template P. Optionally, the encoding features can be specifically embeddings.

[0131] Referring to formula (1), the original text X and task t are decoupled. The original text X "Please reserve a table for 8 people." and the template P "What is the intention of this sentence?" are used to obtain the task t "intention recognition", which is equivalent to obtaining the task t "intention recognition" through the template P "What is the intention of this sentence?" Therefore, within the machine learning model, the encoding features of the template P can be input into the task parsing module to obtain the corresponding encoding features of the task t.

[0132] Referring to formula (2), the template P "What is the intention of this sentence?" is subject to the task t "Intent Recognition." The output text Y "Book a seat" is obtained by combining the original text X "Please book a table for 8 people.", the template P "What is the intention of this sentence?", and the task t "Task Recognition." This is equivalent to obtaining Y "Book a seat" from the original text X "Please book a table for 8 people." and the task t "Intent Recognition." Therefore, after obtaining the encoding features of task t, the encoding features of task t and the encoding features of the original text X can be input into the decoding module to obtain the corresponding output text Y.

[0133] Optionally, in order to distinguish between the template and the original text, special characters or separators may be added to the training samples so that the machine learning model can process the template and the original text separately.

[0134] Through the above method, task t can be decoupled from the original text X, and template P is constrained by task t. Therefore, within the machine learning model, the corresponding task t can be obtained through template P, and then the output text Y can be obtained based on task t and the original text X. This can simplify the model structure, improve the accuracy of the output, and enhance the interpretability of the machine learning model.

[0135] In addition to the above approach, other machine learning model structures can also be used. For example, without distinguishing between the original text and the template, the machine learning model uses unified encoding and decoding operations to obtain the final output text. Furthermore, modules can be added or removed based on actual needs, and this is not a limitation here.

[0136] Optionally, the embodiment of the present application may adopt a multi-template pre-training method, that is, each task may correspond to multiple templates. Specifically, there are multiple training samples obtained, and pre-training the machine learning model based on the obtained training samples may include:

[0137] Input each training sample into the machine learning model respectively, determine the loss value based on the output text of the machine learning model and the label corresponding to each training sample; and update the parameters of the machine learning model according to the loss value.

[0138] The loss value is determined as follows:

[0139] For any original text, the loss values ​​corresponding to the training samples obtained by splicing the original text with various templates are added together to obtain the loss value corresponding to the original text; wherein the loss value corresponding to any training sample is determined by the output text corresponding to the training sample and the label corresponding to the training sample;

[0140] For any task, add the loss values ​​corresponding to each original text under the task to get the loss value corresponding to the task;

[0141] The loss values ​​corresponding to each task are added together to obtain a final loss value, which is used to update the parameters of the machine learning model.

[0142] For example, suppose there are K tasks in the training sample, and task t corresponds to M t templates and N t original text, the loss function in pre-training can be expressed as follows:

[0143] In the above loss function, the part related to multiple templates is specifically expressed as follows: in, is the jth template corresponding to task t, is the i-th original text corresponding to task t, for The corresponding label, p means and After input into the machine learning model, the output text is probability.

[0144] In the above formula, for the original text Using M t Using multiple templates for training can improve the accuracy of machine learning models when processing unseen test templates. This is because as the number of training templates increases, the distance between the closest pair of training templates and test templates in the task space will continue to decrease, that is:

[0145] Where N is the number of training samples, P i is the i-th training template, where the training template refers to the template used in the pre-training process, which has the same meaning as the template P in the previous text. test is the test template, that is, the template used in the test process, and emb is the embedding feature corresponding to the training module or test template. When the training sample is large enough, the expectation of the difference between the embedding features of the closest pair of training templates and test templates approaches 0. It can be proved that the target distribution of the test template in this case is: Distribution of training templates: It will be close enough, which is equivalent to directly optimizing the test template during training, thereby greatly improving the performance of the machine learning model on unseen test templates.

[0146] Therefore, in practical applications, pre-training of machine learning models through multiple templates can effectively improve the accuracy of machine learning models. Moreover, since one task can correspond to multiple templates, the weights of different tasks or training corpora can be adjusted by adjusting the number of templates corresponding to different tasks or different training corpora, so that important tasks or training corpora can be used more for pre-training to meet the usage needs in different scenarios.

[0147] In addition to the above methods, other optional methods can also be used to pre-train machine learning models. For example, some tasks can be assigned to multiple templates, while the remaining tasks can be assigned to only one template. In addition to the aforementioned loss function, other loss functions can be used to pre-train machine learning models. When determining the loss value, different weights can be added to different tasks.

[0148] The pre-training method of the machine learning model provided in the embodiment of the present application can generate templates that are naturally connected with the original text and conform to the user's actual language habits according to different tasks, and pre-train the machine learning model with the assistance of the template, so that the machine learning model has a more natural input form and can respond to the input form corresponding to each task in each field; by introducing task-related templates to better integrate various tasks and adopting multi-template training, the final training sample size can be increased, and the machine learning model can be enabled to better improve the performance of downstream tasks in low-resource conditions such as zero samples or few samples, and improve the performance of the machine learning model on unseen tasks. The machine learning model can exhibit good transferability and robustness, thereby improving the overall training effect of the machine learning model.

[0149] Based on the technical solutions provided in the above embodiments, optionally, the original text is the original text in multiple training corpora; the multiple training corpora cover multiple tasks; the method also includes: outputting indication information, the indication information is used to indicate the multiple training corpora and multiple tasks used for pre-training on the interactive interface of the pre-training platform; obtaining classification information input by the pre-training user through the interactive interface, and the classification information is used to determine at least one task corresponding to each training corpus.

[0150] Optionally, the indication information can be sent by the server to the terminal device, and the terminal device can display relevant information, such as multiple training corpora and multiple tasks, on the interactive interface displayed to the pre-training user according to the indication information. Among them, the pre-training user can be a user who uses the pre-training platform, specifically a developer or designer who performs pre-training operations on the machine learning model, which is different from the user described above. In the embodiment of the present application, the pre-training user is a person who performs pre-training operations on the machine learning model, and the user is a person who uses the machine learning model. The pre-training platform can be any platform that can provide pre-training functions.

[0151] FIG7 is a schematic diagram of an interactive interface provided in an embodiment of the present application. As shown in FIG7 , multiple training corpora can be displayed on the interactive interface, such as training corpus AAA, training corpus BBB, training corpus CCC, etc. Optionally, relevant information of each training corpus can be further displayed on the interactive interface, such as a brief introduction of the training corpus, label type, the number of original texts included, etc. Alternatively, after the pre-training user clicks on the name of the training corpus, relevant information can be further displayed to facilitate the pre-training user to select the corresponding task for the training corpus based on the relevant information.

[0152] In addition, multiple tasks can be displayed on the interactive interface, such as intent recognition, sentiment classification, summary generation, etc. The pre-trained user can determine at least one corresponding task for each training corpus based on the multiple tasks and multiple training corpora displayed. The at least one task can include tasks selected from multiple tasks, or tasks newly added by the pre-trained user. Specifically, the pre-trained user can interact with the terminal device through clicking, connecting, text input, etc. The terminal device can obtain corresponding classification information and feed the classification information back to the server. The classification information can include at least one task selected by the pre-trained user for each training corpus.

[0153] The server can construct a corresponding template for the original text in the training corpus according to at least one task corresponding to each training corpus, thereby obtaining training samples to complete the pre-training operation.

[0154] Optionally, based on the technical solutions provided in the above embodiments, you may also:

[0155] Obtaining attribute information input by a pre-training user through an interactive interface of the pre-training platform; the attribute information includes: the importance of each task, and / or the quality of annotations corresponding to each training corpus;

[0156] Determining the number of unit templates corresponding to each task according to the importance, and / or determining the number of unit templates corresponding to each training corpus according to the annotation quality;

[0157] Among them, the number of unit templates corresponding to the task includes the number of templates corresponding to any original text under the task; the number of unit templates corresponding to the training corpus includes the number of templates corresponding to any original text in the training corpus, which can be the number of templates corresponding to any original text under any task, or the number of templates corresponding to any original text under all tasks.

[0158] FIG8 is a schematic diagram of another interactive interface provided by an embodiment of the present application. As shown in FIG8 , on the interactive interface, pre-training users can be allowed to select the importance of each task. The more asterisks there are, the more important the task is. Pre-training users can also be allowed to select the annotation quality of each training corpus, for example, high, medium, and low, where the annotation quality refers to the quality of the manually annotated labels. There are many ways to select, such as through a drop-down option box, direct input, etc., which are not limited here.

[0159] After obtaining the importance or annotation quality, the corresponding number of unit templates can be determined based on the importance and annotation quality, that is, how many templates correspond to one original text. Usually, one original text and one template are spliced ​​together to obtain a training sample. Therefore, the number of unit templates also determines the number of training samples that can be generated by one original text.

[0160] In other optional implementations, the number of unit templates may also be directly selected by the pre-trained user.

[0161] Through the above method, pre-training users can set relevant pre-training strategies through the interactive interface. For example, if the original text in some training corpora contains more slot information and is more suitable for dialogue state tracking task training than other training corpora, they can be assigned the dialogue state tracking task, fully utilizing the information provided by the training corpora to improve the training effect of the machine learning model. If some training corpora have higher annotation quality or some tasks are more important, the number of unit templates corresponding to these training corpora or tasks can be appropriately increased. This allows for better utilization of these important training corpora and tasks, further improving the training effect of the machine learning model and meeting the pre-training needs of different scenarios.

[0162] In practical applications, based on the method provided in the embodiments of the present application, hundreds of training corpora covering dozens of tasks have been constructed for the pre-training of machine learning models. The scale of these training corpora far exceeds the corpus scale of current pre-trained machine learning models, mainly covering task-based dialogue-related tasks (intent recognition, dialogue state tracking and task dialogue), open domain chat and other dialogue-related tasks (sentiment classification, natural language generation, summarization, text to SQL, question and answer and multiple choice), etc. Through the approach of multiple training corpora, multiple tasks and multiple templates, the pre-training effect of the machine learning model is effectively improved.

[0163] The machine learning model obtained based on the method provided in the embodiments of this application has demonstrated strong capabilities in various downstream tasks, especially in low-resource environments (zero-sample and few-sample environments), achieving significant improvements in performance. In addition, the machine learning model trained in the embodiments of this application can cover a wider range of downstream tasks, from task dialogue to casual chatting.

[0164] After pre-training is complete, the machine learning model can be fine-tuned for specific downstream tasks. After fine-tuning, the machine learning model can be applied to specific downstream tasks. The following describes the fine-tuning and application processes.

[0165] FIG9 is a flow chart of a method for fine-tuning a machine learning model provided in an embodiment of the present application. As shown in FIG9 , the method includes:

[0166] Step 901: Obtain a fine-tuning sample set, wherein the fine-tuning sample set is constructed through a conversation between a user and customer service, and the tasks corresponding to the fine-tuning sample set include at least one of the following: intent recognition, conversation state tracking, and reply generation.

[0167] Optionally, the fine-tuning samples in the fine-tuning sample set may include: input text and labels, wherein the input text is similar to the combination of the original text and the template described above, and is close to the input information during actual use by the user.

[0168] The fine-tuning sample set can be obtained in a variety of ways. Optionally, in the field of intelligent customer service, conversations between users and customer service can be collected, and a fine-tuning sample set can be constructed based on the conversations. The conversations can specifically be conversations collected from various platforms, and in particular, they can be conversations between users and customer service on a cloud platform. A cloud platform refers to any platform used to provide cloud services. The platform can provide an interactive interface to users through web pages, applications, and the like. Users can perform cloud service-related operations on the interactive interface, such as purchasing cloud services and configuring cloud service-related parameters. At the same time, users can also communicate with customer service through the interactive interface, consult customer service about cloud services, or provide feedback on problems encountered during use, which helps users better use cloud services.

[0169] The corresponding tasks in the fine-tuning process may include intent recognition, dialogue state tracking, and response generation, which are used to identify the intent of the sentence, slot information, and respond to the sentence respectively.

[0170] Step 902: Fine-tune the machine learning model based on the fine-tuning sample set.

[0171] The machine learning model is a pre-trained machine learning model obtained by any of the methods described above.

[0172] The method provided in this embodiment allows for fine-tuning training after pre-training using the corresponding fine-tuning sample set for downstream tasks. Because the pre-trained machine learning model has strong zero- and few-shot learning capabilities, it requires less labeled data to achieve good performance during fine-tuning of downstream tasks. Furthermore, during fine-tuning, even when using templates not seen in pre-training, the machine learning model still performs well, significantly outperforming other currently available pre-trained machine learning models.

[0173] FIG10 is a flow chart of an intelligent dialogue method provided by an embodiment of the present application. As shown in FIG10 , the method may include:

[0174] Step 1001: Obtain user input information.

[0175] Step 1002: Based on the input information, determine output information for replying to the user based on a machine learning model.

[0176] The machine learning model is a fine-tuned machine learning model obtained by the fine-tuning method described in any of the above embodiments. The machine learning model can obtain corresponding output information based on input information and display the output information to the user.

[0177] Optionally, the user may be a user of the cloud platform, and the machine learning model is used to assist in realizing the intelligent customer service function of the cloud platform.

[0178] Through the method provided in this embodiment, the user's input information is processed using a pre-trained and fine-tuned machine learning model, wherein the pre-training is combined with multi-task and multi-template training, which can enable the machine learning model to perform better in downstream tasks, improve the reply effect, and enhance the user experience.

[0179] During fine-tuning and use of downstream tasks, the content input to the machine learning model may or may not be distinguished by template. For example, the user may be prompted to enter a sentence to be analyzed and a desired task to be performed on the sentence, thereby allowing the user to enter the original text and template respectively according to the prompt. The original text and template constitute the input information, which is input into the machine learning model for processing.

[0180] Alternatively, the user can directly input a paragraph without distinguishing between the original text and the template. Since the pre-training process uses training samples that conform to natural language habits, it can respond to various forms of real input. Alternatively, the user's input information can be used as the original text, and the corresponding template can be obtained through the generative model. The target text composed of the original text and the template is input into the machine learning model to obtain the corresponding output information. Among them, the corresponding task when generating the template can be set according to actual needs. For example, in a dialogue scenario, the corresponding task can be set as intent recognition, etc. Alternatively, the task can be input by the user to meet the actual needs of different scenarios.

[0181] In addition to conversation scenarios, the machine learning model can also be applied to other scenarios, such as summary generation, translation, text-to-SQL, etc. The embodiments of this application do not limit the specific application scenarios of the machine learning model.

[0182] Corresponding to the above method, an embodiment of the present application further provides a machine learning task template generation device, comprising:

[0183] A first acquisition module is used to acquire the original text to be processed;

[0184] A processing module, configured to obtain a template corresponding to each task by generating a model based on the original text and at least one task;

[0185] Among them, the target text composed of the original text and the template is used to be input into the machine learning model for processing, and the template is used to indicate the task to be performed by the machine learning model.

[0186] The present invention also provides a pre-training device for a machine learning model, including:

[0187] A second acquisition module is configured to acquire a training sample, wherein the training sample is a target text composed of a template obtained by the method described in any one of the above embodiments and an original text;

[0188] The training module is used to pre-train the machine learning model based on the acquired training samples.

[0189] The present application also provides a device for fine-tuning a machine learning model, including:

[0190] A third acquisition module is configured to acquire a fine-tuning sample set, wherein the fine-tuning sample set is constructed through a conversation between a user and a customer service representative, and the tasks corresponding to the fine-tuning sample set include at least one of the following: intent recognition, conversation state tracking, and reply generation;

[0191] A fine-tuning module, configured to perform fine-tuning training on the machine learning model based on the fine-tuning sample set;

[0192] The machine learning model is a pre-trained machine learning model obtained by the method described in any of the above embodiments.

[0193] The present application also provides an intelligent dialogue device, including:

[0194] The fourth acquisition module is used to obtain user input information;

[0195] A reply module, configured to determine output information for replying to the user based on the input information and a machine learning model;

[0196] The machine learning model is a fine-tuned machine learning model obtained by the method described in any of the above embodiments.

[0197] The various devices provided in the embodiments of the present application can be used to execute the corresponding methods described above. The specific implementation principles and effects can be found in the aforementioned embodiments and will not be repeated here.

[0198] FIG11 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. As shown in FIG11 , the electronic device of this embodiment may include:

[0199] at least one processor 1101; and

[0200] a memory 1102 communicatively connected to the at least one processor;

[0201] The memory 1102 stores instructions that can be executed by the at least one processor 1101, and the instructions are executed by the at least one processor 1101 to enable the electronic device to execute the method as described in any of the above embodiments.

[0202] Optionally, the memory 1102 may be independent or integrated with the processor 1101 .

[0203] The implementation principle and technical effects of the electronic device provided in this embodiment can be found in the aforementioned embodiments and will not be described in detail here.

[0204] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the method described in any of the above embodiments is implemented.

[0205] An embodiment of the present application further provides a computer program product, including a computer program, which implements the method described in any of the aforementioned embodiments when executed by a processor.

[0206] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of modules is merely a logical function division. In actual implementation, other division methods may be used. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not implemented.

[0207] The above-mentioned integrated module implemented in the form of a software functional module can be stored in a computer-readable storage medium. The above-mentioned software functional module is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform some steps of the method described in each embodiment of the present application.

[0208] It should be understood that the above-mentioned processor can be a processing unit (Central Processing Unit, referred to as CPU), or it can be other general-purpose processors, digital signal processors (Digital Signal Processor, referred to as DSP), application-specific integrated circuits (Application Specific Integrated Circuit, referred to as ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor. The memory may include high-speed RAM memory, and may also include non-volatile storage NVM, such as at least one disk memory, and can also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.

[0209] The storage medium may be implemented by any type of volatile or non-volatile memory 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. The storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0210] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic device or a main control device.

[0211] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[0212] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0213] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0214] The above are only preferred embodiments of the present application and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for generating a machine learning task template, characterized in that: include: Get the original text to be processed; According to the original text and at least one task, a template corresponding to each task is obtained by generating a model; Among them, the target text composed of the original text and the template is used to be input into the machine learning model for processing, and the template is used to indicate the task to be performed by the machine learning model.

2. The method according to claim 1, characterized in that The obtaining of the original text to be processed includes: Obtaining a training corpus, wherein the training corpus includes a plurality of original texts; Selecting any original text from the training corpus as the original text to be processed, so as to obtain a corresponding template according to the original text; The target texts obtained from the multiple original texts in the training corpus are specifically used to train the machine learning model for multiple tasks; The step of obtaining a template corresponding to each task by generating a model according to the original text and at least one task includes: Generate a corresponding template through a generative model according to the original text to be processed and the target task; The target task is a task among the multiple tasks that matches a label corresponding to the original text to be processed.

3. The method according to claim 2, characterized in that The target task corresponds to a plurality of keywords; and a corresponding template is generated by a generation model according to the original text to be processed and the target task, including: The original text to be processed and any keyword corresponding to the target task are input into the generation model to obtain a target text containing a template.

4. The method according to claim 3, characterized in that Inputting the original text to be processed and any keyword corresponding to the target task into the generation model to obtain a target text containing a template, including: Adding content before or after the original text to be processed, wherein the added content includes: at least one mask character, a keyword, and at least one mask character in sequence; The original text to be processed and the added content are input into the generation model, and the mask characters are filled using the generation model to obtain the corresponding target text.

5. A pre-training method for a machine learning model, characterized in that: include: Obtaining a training sample, wherein the training sample is a target text composed of a template obtained by the method according to any one of claims 1 to 4 and an original text; The machine learning model is pre-trained based on the obtained training samples.

6. The method according to claim 5, characterized in that The machine learning model is used to determine a corresponding task based on a template in a training sample, and to determine a corresponding output text based on the task and the original text in the training sample.

7. The method according to claim 6, characterized in that The machine learning model includes: an encoding module, a task parsing module, and a decoding module; After the training sample is input into the machine learning model, the machine learning model obtains the output text by the following method: Based on the encoding module, extracting encoding features of the original text in the training sample and encoding features of the template in the training sample; Based on the task parsing module, determining the coding features of the corresponding task according to the coding features of the template; Based on the decoding module, a decoding operation is performed according to the encoding features of the original text and the encoding features of the task to obtain a corresponding output text.

8. The method according to any one of claims 5 to 7, characterized in that: There are multiple training samples obtained; based on the obtained training samples, the machine learning model is pre-trained, including: Input each training sample into the machine learning model respectively, and determine the loss value according to the output text of the machine learning model and the label corresponding to each training sample; Updating parameters of the machine learning model according to the loss value; Among them, any task corresponds to multiple templates, and the loss value is determined as follows: For any original text, the loss values ​​corresponding to the training samples obtained by splicing the original text with various templates are added together to obtain the loss value corresponding to the original text; wherein the loss value corresponding to any training sample is determined by the output text corresponding to the training sample and the label corresponding to the training sample; For any task, add the loss values ​​corresponding to each original text under the task to get the loss value corresponding to the task; The loss values ​​corresponding to each task are added together to obtain a final loss value, which is used to update the parameters of the machine learning model.

9. The method according to any one of claims 5 to 7, characterized in that: The original text is the original text in multiple training corpora; The multiple training corpora cover multiple tasks; the method further includes: Outputting indication information, wherein the indication information is used to indicate multiple training corpora and multiple tasks used for pre-training on an interactive interface of the pre-training platform; The classification information input by the pre-training user through the interactive interface is obtained, and the classification information is used to determine at least one corresponding task for each training corpus.

10. The method according to any one of claims 5 to 7, characterized in that: The original text is the original text in multiple training corpora; The method further comprises: Acquire attribute information input by the pre-training user through the interactive interface of the pre-training platform; the attribute information includes: the importance of each task, and / or the annotation quality corresponding to each training corpus; Determine the number of unit templates corresponding to each task according to the importance, and / or determine the number of unit templates corresponding to each training corpus according to the annotation quality; Among them, the number of unit templates corresponding to the task includes the number of templates corresponding to any original text under the task; the number of unit templates corresponding to the training corpus includes the number of templates corresponding to any original text in the training corpus.

11. A method for fine-tuning a machine learning model, characterized in that: include: Obtain a fine-tuning sample set, wherein the fine-tuning sample set is constructed through a conversation between a user and a customer service representative, and the tasks corresponding to the fine-tuning sample set include at least one of the following: intent recognition, conversation state tracking, and reply generation; Fine-tune the machine learning model according to the fine-tuning sample set; Wherein, the machine learning model is a pre-trained machine learning model obtained by the method described in any one of claims 5-10.

12. An intelligent dialogue method, characterized in that: include: Get user input information; According to the input information, determining output information for replying to the user based on a machine learning model; Wherein, the machine learning model is a fine-tuned model obtained by the method described in claim 11.

13. A machine learning task template generation device, characterized in that: include: A first acquisition module is used to acquire the original text to be processed; A processing module, configured to obtain a template corresponding to each task by generating a model according to the original text and at least one task; Among them, the target text composed of the original text and the template is used to be input into the machine learning model for processing, and the template is used to indicate the task to be performed by the machine learning model.

14. A pre-training device for a machine learning model, characterized in that: include: A second acquisition module, used to acquire a training sample, wherein the training sample is a target text composed of a template obtained by the method according to any one of claims 1 to 4 and an original text; The training module is used to pre-train the machine learning model based on the acquired training samples.

15. A fine-tuning device for a machine learning model, characterized in that: include: The third acquisition module is used to obtain a fine-tuning sample set, wherein the fine-tuning sample set is obtained through a conversation between the user and the customer service. The tasks corresponding to the fine-tuning sample set include at least one of the following: intent recognition, dialogue state tracking, and response generation; A fine-tuning module, used to perform fine-tuning training on the machine learning model according to the fine-tuning sample set; Wherein, the machine learning model is a pre-trained machine learning model obtained by the method described in any one of claims 5-10.

16. An intelligent dialogue device, characterized in that: include: The fourth acquisition module is used to obtain user input information; A reply module, configured to determine output information for replying to the user based on the input information and the machine learning model; Wherein, the machine learning model is a fine-tuned machine learning model obtained by the method described in claim 11.

17. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the electronic device to perform the method described in any one of claims 1 to 12.

18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method according to any one of claims 1 to 12 is implemented.

19. A computer program product, characterized in that The method comprises a computer program, which implements the method according to any one of claims 1 to 12 when being executed by a processor.

Citation Information

Patent Citations

  • Language model training method and device, electronic equipment and storage medium

    CN114036300A

  • Multi-task model training method and device based on artificial intelligence, equipment and medium

    CN115757777A

  • Real estate industry dialogue intention recognition method and device

    CN116050422A

  • Training method and device of user intention recognition model based on outbound robot

    CN116384411A

  • Text classification method, device and system and medium

    CN116662547A

Cited By

  • Training sample generation method of intelligent shopping guide dialogue robot and related device

    CN120562550A