CN117633162A - Machine learning task template generation method, training method, fine adjustment method and equipment - Google Patents

Machine learning task template generation method, training method, fine adjustment method and equipment Download PDF

Info

Publication number
CN117633162A
CN117633162A CN202311148338.7A CN202311148338A CN117633162A CN 117633162 A CN117633162 A CN 117633162A CN 202311148338 A CN202311148338 A CN 202311148338A CN 117633162 A CN117633162 A CN 117633162A
Authority
CN
China
Prior art keywords
training
machine learning
task
original text
learning model
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311148338.7A
Other languages
Chinese (zh)
Inventor
马文涛
武玉川
李永彬
黄非
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Alibaba Cloud Feitian Information Technology Co ltd
Original Assignee
Hangzhou Alibaba Cloud Feitian Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Alibaba Cloud Feitian Information Technology Co ltd filed Critical Hangzhou Alibaba Cloud Feitian Information Technology Co ltd
Priority to CN202311148338.7A priority Critical patent/CN117633162A/en
Publication of CN117633162A publication Critical patent/CN117633162A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • Medical Informatics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Human Computer Interaction (AREA)
  • Computational Linguistics (AREA)
  • Machine Translation (AREA)

Abstract

The application provides a machine learning task template generation method, a training method, a fine adjustment method and equipment, wherein the method comprises the following steps: obtaining an original text to be processed, and obtaining templates corresponding to all tasks by generating a model according to the original text and at least one task, wherein a target text formed by the original text and the templates is used for being input into a machine learning model for processing, and the templates are used for indicating the tasks to be executed by the machine learning model. The method and the device can generate the template which is connected with the original text naturally and accords with the actual language habit of the user, 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, the method is beneficial to increasing the final training sample scale on the basis of the original text, so that the machine learning model can better promote the performance of a downstream task under the condition of low resources such as zero samples or few samples, and the mobility and the robustness of the model are effectively improved.

Description

Machine learning task template generation method, training method, fine adjustment method and equipment
Technical Field
The present disclosure relates to artificial intelligence, and more particularly, to a machine learning task template generating method, training method, fine tuning method, and apparatus.
Background
With the continuous development of artificial intelligence, various machine learning models are increasingly widely applied. In order to improve the training effect of the machine learning model, the pre-trained machine learning model can be used for fine tuning training, and the training performance of the machine learning model can be guaranteed on the basis of improving the overall training efficiency.
When the model is pre-trained using only data from a particular domain, there may be problems with poor results. For example, after pre-training the model based on domain-specific data, the model is only suitable for use on downstream tasks in the specific domain, limiting the applicability of the machine learning model.
To solve this problem, it is considered to pretrain the machine learning model in a multitasking manner, but how to ensure the effect of multitasking pretraining becomes a problem to be solved.
Disclosure of Invention
The application provides a machine learning task template generation method, a training method, a fine tuning method and equipment, which are used for obtaining a task template which is naturally connected with an original text and accords with the language habit of a user, so as to further improve the effect of multi-task pre-training of a machine learning model.
In a first aspect, an embodiment of the present application provides a method for generating a machine learning task template, including:
acquiring an original text to be processed;
according to the original text and at least one task, obtaining templates corresponding to the tasks by generating a model; the target text formed by the original text and the template is used for being input into the machine learning model for processing, and the template is used for indicating tasks to be executed by the machine learning model.
In a second aspect, an embodiment of the present application provides a method for pre-training a machine learning model, including:
obtaining a training sample, wherein the training sample is a target text formed by a template and an original text, which are obtained by the method in the first aspect;
and pre-training the machine learning model according to the acquired training sample.
In a third aspect, an embodiment of the present application provides a method for fine tuning a machine learning model, including:
obtaining a fine-tuning sample set, wherein the fine-tuning sample set is constructed through a dialogue between a user and customer service, and the tasks corresponding to the fine-tuning sample set comprise at least one of the following: intent recognition, dialog state tracking, and reply generation;
performing 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 of the second aspect. In a fourth aspect, an embodiment of the present application provides an intelligent dialogue method, including:
acquiring input information of a user;
determining output information for replying to a user based on a machine learning model according to the input information;
wherein the machine learning model is a trimmed machine learning model obtained by the method of the third aspect. In a fifth aspect, embodiments of the present application provide an electronic device, including:
at least one processor; and
a memory communicatively coupled to the at least one processor;
wherein the memory stores instructions executable by the at least one processor to cause the electronic device to perform the method of any of the above aspects.
In a sixth aspect, embodiments of the present application provide a computer-readable storage medium having stored therein computer-executable instructions that, when executed by a processor, implement a method as in any one of the above aspects.
In a seventh aspect, embodiments of the present application provide a computer program product comprising a computer program which, when executed by a processor, implements a method as described in any of the above aspects.
According to the machine learning task template generation method, training method, fine tuning method and equipment provided by the embodiment of the application, an original text to be processed can be obtained, and templates corresponding to all tasks are obtained through generating a model according to the original text and at least one task, wherein the target text formed by the original text and the templates is used for being input into a machine learning model for processing, and the templates are used for indicating the tasks to be executed by the machine learning model, so that templates which are connected with the original text naturally and accord with actual language habits of users can be generated according to different tasks, and the machine learning model is pre-trained or otherwise operated under the assistance of the templates, so that the machine learning model has a more natural input form and can respond to the input forms corresponding to all the tasks in all fields; in addition, the method is beneficial to increasing the final training sample scale on the basis of the original text, so that the machine learning model can better promote the performance of a downstream task under the condition of low resources such as zero samples or few samples, and the performance of the machine learning model on the task which is not seen is improved, the machine learning model can show better migration and robustness, and the overall training effect of the machine learning model is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
FIG. 1 is a schematic diagram of a multitasking pre-training method;
fig. 2 is a schematic diagram of a multi-task and multi-template pre-training method according to an embodiment of the present application;
fig. 3 is an application scenario diagram provided in an embodiment of the present application;
fig. 4 is a flowchart of a machine learning task template generating method according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a template generation provided in an embodiment of the present application;
FIG. 6 is a schematic diagram of a machine learning model according to an embodiment of the present disclosure;
FIG. 7 is a schematic diagram of an interactive interface according to an embodiment of the present disclosure;
FIG. 8 is a schematic diagram of another interactive interface provided in an embodiment of the present application;
FIG. 9 is a flowchart of a method for fine tuning a machine learning model according to an embodiment of the present disclosure;
fig. 10 is a flow chart of an intelligent dialogue method according to an embodiment of the present application;
fig. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Specific embodiments thereof have been shown by way of example in the drawings and will herein be described in more detail. These drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application.
It should be noted that, the user information (including but not limited to user equipment information, user attribute information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or fully authorized by each party, and the collection, use and processing of the related data need to comply with related laws and regulations and standards, and provide corresponding operation entries for the user to select authorization or rejection.
The terms referred to in this application are explained first:
and (3) a template: in natural language processing, a mode of organizing input and output is referred to as a template, and the input and output are connected through the template, so that the result obtained by the mode of direct splicing is more general, a pre-trained sample can be more similar to the input of a user in actual use, and the prediction performance of a language model can be improved in a downstream task.
Multitasking pre-training: the training is performed by combining samples of various tasks in the process of pre-training one language model, so that the trained language model has the capability of executing various tasks.
Conversational language model: the corpus in the pre-training process is mainly aimed at dialogue related tasks and is mainly applied to language models of the dialogue related tasks.
Large language models refer to deep learning language models with large scale language model parameters, typically including hundreds of millions, billions, trillions, and even more than billions of language model parameters. The large language Model can be called as a basic language Model/basic language Model (Foundation Model), the large language Model is pre-trained through large-scale unlabeled corpus, the pre-trained language Model with more than one hundred million parameters is produced, the language Model can adapt to a wide downstream task, and the language Model has better generalization capability, such as a large-scale language Model (Large Language Model, LLM), a multi-mode pre-training language Model (multi-mode pre-training Model) and the like.
When the large language model is actually applied, the pretrained language model can be applied to different tasks by only carrying out fine adjustment on a small number of samples, the large language model can be widely applied to the fields of natural language processing (Natural Language Processing, NLP for short), computer vision and the like, and particularly can be applied to the tasks of the computer vision fields such as visual question-answering (Visual Question Answering, VQA for short), image description (IC for short), image generation and the like, and the tasks of the natural language processing fields such as emotion classification based on texts, text abstract generation, machine translation and the like, and main application scenes of the large language model comprise digital assistants, intelligent robots, searching, online education, office software, electronic commerce, intelligent design and the like.
With the development of pretraining techniques, the performance of language models pretrained in a particular domain (e.g., dialog domain) in downstream tasks can be improved. However, the pre-trained language model is limited to a specific field, and is often only used on the downstream tasks in the specific field, so that the tasks of all downstream requirements are difficult to cover, and the wide applicability of the language model is limited.
To improve the language model performance, a multitasking pre-training approach may be considered. In order to distinguish between multiple tasks during the pre-training process, the original text may be spliced with the tasks and input into the language model.
FIG. 1 is a schematic diagram of a multitasking pre-training method. As shown in fig. 1, the original text is "please reserve an 8-person table" at the time of pre-training. On the basis of the original text, different task names can be spliced and input into a language model to obtain outputs aiming at different tasks, for example, the tasks can comprise: dialog state tracking (slot recognition), intention recognition, emotion classification, reply generation and the like, and after the task of intention recognition is spliced with the original text and input into a language model, corresponding output (namely intention obtained by recognition) can be obtained as follows: the seats are reserved, so that the multitasking unification can be performed in a mode of splicing tasks.
Although the training mode can realize the pretraining of multiple tasks, the input and output modes are not natural enough, the language model obtained by pretraining can only respond to the input of a specific mode and is not matched with the real input of a user in practical application, the response of the language model to the natural language of the user is difficult to realize, in the pretraining method, the number of training samples often depends on the number of original samples, the scale of the training samples is limited, serious negative migration phenomenon can occur when the multitasking training is carried out, the training performance of the final language model is influenced, and the training effect of the language model is poor. In order to solve the problem, the embodiment of the application provides a multi-template training mode which is more in line with natural language habit, can enable input of a language model to be closer to real input of a user, effectively enlarges the training sample scale and improves the performance of the language model.
Fig. 2 is a schematic diagram of a multi-task and multi-template pre-training method according to an embodiment of the present application. As shown in fig. 2, the original text is "please reserve an 8-person dining table. On the basis of the original text, a template conforming to natural language habit can be obtained through a generating model with text generating capability, training samples are obtained after the original text and the template are spliced, the training samples corresponding to different tasks are input into the language model, output aiming at different tasks can be obtained, for example, aiming at the task of intention recognition, and the corresponding template can be generated as follows: "is the intent of this sentence? ". Therefore, a template which is connected with the original text naturally and accords with the language habit of the user can be obtained, and the auxiliary language model realizes multitasking training. In addition, by utilizing the generating capability of the generating model, a plurality of templates corresponding to the original text can be generated for each task, the templates are respectively spliced with the original text, a plurality of training samples can be obtained, for example, aiming at the task of intention recognition, and further templates can be generated, such as 'what is the purpose of analyzing the sentence', so that the scale of the training samples is improved. Fig. 3 is an application scenario diagram provided in an embodiment of the present application. As shown in fig. 3, a plurality of tasks to be trained may be set for the language model, and the plurality of tasks may include tasks related to dialog, for example, intention recognition, emotion classification, and the like, and may also include tasks other than the dialog domain, for example, abstract generation, text-to-SQL (Structured Query Language ), and the like. And obtaining a corresponding template by utilizing the generated model according to the task and the original text, inputting the original text and the template into the language model, and pre-training the language model.
After the pre-training is completed, the language model can be applied to a fine-tuning stage, specifically, the language model can be fine-tuned by utilizing a downstream task in a specific field, for example, an input text of the downstream task is input into the language model to obtain a corresponding output text, and parameters of the language model are adjusted according to the output text. After the fine-tuning is completed, the language model may be applied to specific downstream tasks, such as intent recognition, emotion classification, and the like.
According to the method provided by the embodiment of the invention, templates which are naturally connected with the original text and accord with the actual language habit of the user can be generated according to different tasks, the language model is pretrained with the assistance of the templates, so that the language model has more natural input and output modes, the input modes corresponding to the tasks in each field can be responded, the quantity of the generated templates is more, the scale of pretrained samples is effectively improved, the language model can better promote the performance of downstream tasks under the condition of low resources such as zero samples or few samples, the performance of the language model on the tasks which are not seen is improved, the language model can show better migration and robustness, and the overall training effect of the language model is improved.
Some embodiments of the present application are described in detail below with reference to the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and features in the embodiments may be combined with each other. In addition, the sequence of steps in the method embodiments described below is only an example and is not strictly limited.
Fig. 4 is a flowchart of a machine learning task template generating method according to an embodiment of the present application. The execution subject of the method in the present embodiment may be applied to any device having a data processing function, such as a terminal device or a server. In practical applications, the method in this embodiment may be implemented on the cloud, deployed locally, implemented by a client, implemented by IOT (Internet of Things ) devices, and so on. As shown in fig. 4, the method may include: step 401, obtaining an original text to be processed.
Alternatively, the original text may be obtained in a variety of ways, e.g., from other devices, or entered by a user, etc. The original text may be acquired separately, or a plurality of original texts may be acquired simultaneously, and an original text to be processed may be selected therefrom.
Illustratively, the templates obtained by the present embodiment may be applied to pre-training of machine learning models. In this step, a training corpus can be obtained, from which the original text to be processed is selected.
Alternatively, the training corpus may be obtained in a variety of ways, for example, the training corpus may be obtained from a dialogue platform or other platform, or the training corpus may be input by a pre-training user. The number of the training corpus can be one or more, and the embodiment of the application is not limited.
In a supervised training scenario, the set of training corpora may include a plurality of training corpora, which may include raw text and labels.
The original text may be, for example, "please reserve an 8-person table. ". When the task of training is intent recognition, the corresponding label may be "predetermined seat".
Alternatively, in other scenarios, the labels are not required, e.g., the labels may be omitted, i.e., the language model may be trained without labeling.
Step 402, according to the original text and at least one task, obtaining templates corresponding to the tasks by generating a model; the target text formed by the original text and the template is used for being input into the machine learning model for processing, and the template is used for indicating tasks to be executed by the machine learning model. The original text may be, for example, "please reserve an 8-person table. The template may be "is the intent of this sentence? ".
The target text formed by the original text and the template can be used as a training sample to process a machine learning model, wherein the machine learning model can be a language model or any other model capable of processing the target text, such as a multi-mode processing model. For convenience of description, the following describes the scheme of the present embodiment in detail, taking the target text as a training sample.
Alternatively, the generating model may be a model with natural language processing capability, and may be capable of generating text conforming to natural language habits according to requirements. For each task, one or more templates can be generated by generating a model, and a training sample can be obtained after the original text is spliced with one template.
Illustratively, the at least one task may include: dialog state tracking, intent recognition, emotion classification, reply generation, etc. Given a task and an original text, a corresponding template or templates may be constructed using the generative model. Optionally, the pre-training stage of the machine learning model corresponds to a plurality of tasks, i.e. the machine learning model is pre-trained specifically by the plurality of tasks.
The obtaining the original text to be processed comprises the following steps: acquiring a training corpus, wherein the training corpus comprises 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 text obtained according to the plurality of original texts in the training corpus is specifically used for training the machine learning model in a plurality of tasks.
Optionally, each original text in the training corpus may be processed separately, for each original text, the original text may be used as an original text to be processed, and according to the method provided in this embodiment, a corresponding template is generated, where the original text and the template form a training sample, so that a plurality of training samples may be obtained based on a plurality of original texts in the training corpus, and pretraining of the machine learning model is implemented. Each original text to be processed can be recorded as a target original text, and target tasks corresponding to the target original texts can be the same or different. Templates under one task can be generated for one target original text, and templates under at least two tasks can also be generated.
For example, the machine learning model performs pre-training through the four tasks, that is, the pre-training stage covers the four tasks, and for each target original text, at least part of the four tasks may be utilized to generate a template corresponding to the target original text.
For example, some target original texts are applicable to four tasks, corresponding templates can be generated according to the four tasks respectively, some target original texts are only applicable to part of the tasks in the four tasks, for example, the target original texts do not contain slot information, tasks which are possibly not applicable to dialogue state tracking are not applicable, and corresponding templates can be generated according to other tasks only. When there are multiple training corpuses, the whole task division can be performed on the original texts in the training corpuses according to the characteristics of the training corpuses, for example, if a certain training corpus is characterized by not containing slot information, when the training corpus is processed, no template corresponding to the dialogue state tracking task is constructed on the multiple original texts contained in the training corpus, and each original text in the training corpus is not required to be confirmed respectively.
In an alternative implementation, if the collected training corpus contains only the original text, the corresponding label may be determined according to the task to be trained. The task to be trained can be set according to actual needs, for example, can be configured by a user. For any task, determining the label of the target original text according to the task can be realized by the following steps: and inputting the target original text into a task processing model corresponding to the task to obtain a corresponding label. For example, if the task to be trained includes intention recognition, an intention recognition model may be obtained, the target original text may be input into the intention recognition model, and the intention recognition model may recognize the intention corresponding to the target original text as a tag corresponding to the target original text. In addition, the corresponding label can be obtained through manual labeling or other modes.
For example, "please reserve an 8-person table for the target original text". And when the target task is the intention recognition, determining the corresponding label as a preset seat, and generating a template corresponding to the intention recognition according to the generation model, so that training samples under different tasks can be obtained according to actual requirements.
In another alternative implementation, the collected training corpus itself includes the original text and the labels, and then the target task may be determined according to the labels corresponding to the target original text. For example, "please reserve an 8-person table" for the target original text. The corresponding labels are reserved seats, so that the target task can be confirmed to be the intention recognition, and then the template corresponding to the intention recognition task can be generated according to the generation model, and the labeled corpus can be utilized for pre-training, so that the labeling workload is reduced, and the efficiency is improved.
Through the mode, the machine learning model is subjected to multi-task training, corresponding tasks can be selected in a targeted manner according to the condition of the original text to generate a template, the tasks are matched with the labels, a plurality of tasks are covered by training samples corresponding to a plurality of original texts, a plurality of training samples are obtained on the basis of ensuring certain accuracy, and the requirement of pre-training is met. When the machine learning model is pre-trained in a non-labeling mode, target tasks corresponding to the original samples can be set according to actual needs, for example, a task of completing filling blank can be set for a certain original text.
When the template is generated, the template can be directly obtained according to the target task, or a plurality of keywords can be set for each task, and the template can be generated according to each keyword.
Optionally, the target task corresponds to a plurality of keywords; generating a corresponding template through a generation model according to the original text to be processed and the target task, wherein the template comprises the following steps: and 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.
Wherein, the keywords can be words capable of characterizing tasks. For example, the keywords intended to identify this task correspondence may include: intent, purpose, etc. At least one template may be generated separately from each keyword. For example, one template may be generated based on the keyword "intent" and another template may be generated based on the keyword "purpose". The templates corresponding to the original texts are generated through the keywords corresponding to the tasks, so that the diversity of training samples can be effectively improved, different inputs of users under various conditions in practical application can be simulated, the scale of the training samples can be improved, and the pre-training effect is improved.
Optionally, inputting the original text to be processed and any keyword corresponding to the target task into the generating 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 sequentially comprises: at least one masking character, a keyword, at least one masking character;
and inputting the original text to be processed and the added content into the generation model, and filling mask characters by using the generation model to obtain a corresponding target text.
Fig. 5 is a schematic diagram of a template generation according to an embodiment of the present application. As shown in fig. 5, the use of boxes to represent spaces may be understood as masking characters. The content containing the mask characters can be added before or after the target original text (the original text to be processed), the target original text, the keywords and the mask characters are spliced together and then input into the generation model, and the generation model has the function of filling the mask characters and can complement the mask characters to obtain the corresponding templates. Wherein the template may be placed before or after the target original text, and correspondingly, keywords and mask characters may be added before or after the target original text as inputs to the generated model. The number of mask characters is not limited and may be fixed or non-fixed. Furthermore, the mask character may be set only before the keyword or only after the keyword. The generative model may fill all of the mask characters or may fill only a portion. For example, five mask characters are set after the keyword, and the generated model may end after filling only three characters, without having to complement 5 mask characters.
By the method, the template which meets the task requirements and the natural language habits can be obtained by utilizing the natural language processing capability of the generated model, so that the machine learning model can be pre-trained by utilizing more natural texts. In addition to the above manner, the generation of the template may be implemented in other manners, for example, the target task and the target original text may be directly input into the generation model without distinguishing a plurality of keywords, so as to obtain a training sample containing the target original text and the template. Or, the name or the keyword of the task can be directly input into the generation model, the corresponding template is output through the generation model, and then the template is spliced with the target original text, so that a training sample is obtained.
Alternatively, the obtained template can be directly spliced with the original text to obtain a corresponding training sample, or can be spliced with the original sample after manual screening to obtain the training sample.
After the training samples are obtained, the machine learning model may be trained using the training samples, e.g., pre-training or fine-tuning training.
In addition to training the machine learning model, the target text formed by the original text and the template can be used in other scenes, for example, the target text can be applied to the actual use process of the machine learning model.
Specifically, the original text may be text input by a user, and for the original text, the method provided by the embodiment may be used to add a template to obtain a target text, and input the target text into a machine learning model to obtain an output text for the original text and display the output text to the user. Because the template can indicate the task to be executed by the machine learning model, the machine learning model can better process the input of the user, and the user experience is improved.
The corresponding task when the template is generated can be set according to actual needs, for example, in a dialogue scene, the corresponding task can be set as intention recognition and the like, or the task can be input by a user, so that the actual needs of different scenes are met. In the embodiment of the application, an original text to be processed can be obtained, and a template corresponding to each task is obtained by generating a model according to the original text and at least one task, wherein a target text formed by the original text and the template is used for being input into a machine learning model for processing, and the template is used for indicating the task to be executed by the machine learning model, so that templates which are natural to link with the original text and accord with actual language habits of users can be generated according to different tasks, and the machine learning model is pre-trained or otherwise operated under the assistance of the templates, 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, the method is beneficial to increasing the final training sample scale on the basis of the original text, so that the machine learning model can better promote the performance of a downstream task under the condition of low resources such as zero samples or few samples, and the performance of the machine learning model on the task which is not seen is improved, the machine learning model can show better migration and robustness, and the overall training effect of the machine learning model is improved.
The application implementation also provides a pre-training method of the machine learning model, which comprises the following steps:
obtaining a training sample, wherein the training sample is a target text formed by a template and an original text, which are obtained by the method in any embodiment;
and pre-training the machine learning model according to the acquired training sample.
The machine learning model can be a dialogue language model or any other machine learning model.
Optionally, the training sample may be input into a machine learning model to obtain a corresponding output text, and parameters of the machine learning model are updated according to the output text and the label corresponding to the training sample. After a stopping condition is met, for example, the performance of the machine learning model meets the requirement, or a certain number of iterations, a pre-trained machine learning model can be obtained. In the embodiment of the application, the forms of training samples of various tasks can be unified through templates. Assuming that the original text is X, a corresponding template P can be generated through the task t, the template P is used for helping the inference of the task, a training sample is obtained after the template P is spliced with the original text X, the training sample is input into a machine learning model, and an output text Y can be obtained. For modeling purposes, it may be assumed that template P contains only information related to task t, while original text X contains other input information. In particular, it can be characterized by the following formula:
p(t|X,P)≈p(t|P)(1)
P (Y|X, P, t) ≡p (Y|X, t) (2) where, as can be seen from equation (1), task t is obtained from the original text X and template P, which is equivalent to task t from template P, since the original text X and task t are decoupled, it can be considered that the original text X is substantially independent of task t. From formula (2), it can be seen that obtaining the output text Y through the original text X, the template P and the task t is equivalent to obtaining the output text Y through the original text X and the task t, because the template P is constrained by the task t, and the template P can be replaced by information of the task t.
According to this idea, a corresponding machine learning model structure can be constructed. Alternatively, the machine learning model may be used to: and determining a corresponding task according to the template in the training sample, and determining a corresponding output text according to the task and the original text in the training sample.
Fig. 6 is a schematic diagram of a machine learning model according to an embodiment of the present application. As shown in fig. 6, the machine learning model may include: the system comprises an encoding module, a task analysis module and a decoding module. After the training sample is input into the machine learning model, the machine learning model obtains an output text by the following method:
Extracting coding features of an original text in the training sample and coding features of a template in the training sample based on the coding module;
based on the task analysis module, determining the coding characteristics of the corresponding task according to the coding characteristics of the template; and based on the decoding module, performing decoding operation according to the coding features of the original text and the coding features of the task to obtain a corresponding output text.
The original text X and the template P are input to an encoding module, and the encoding features of the original text X and the encoding features of the template P are obtained, and optionally, the encoding features may be specifically embedding features. Referring to formula (1), the original text X and task t are decoupled, and an 8-person table is ordered by the original text X ". The intent of the sentence "and template P" is? "get task t" intent recognition, "is the intent equivalent to the sentence through template P"? The task t is obtained by "intention recognition", so that the coding features of the template P can be input into a task analysis module inside the machine learning model to obtain the coding features of the corresponding task t.
Referring to equation (2), the template P "is the intent of this sentence? Constrained by task t intent recognition, please reserve an 8-person table with the original text X. The intent of the phrase "? The "and task t" task identification "obtains the output text Y" reserve seats ", which is equivalent to requesting reservation of an 8-person dining table by the original text X". "and task t" intend to recognize "get Y" a predetermined seat ". Therefore, after the coding feature of the task t is obtained, the coding feature of the task t and the coding feature of the original text X can be input to the decoding module to obtain the corresponding output text Y. Optionally, special characters or separators and the like can be added in the training samples to realize the distinction between the template and the original text, so that the machine learning model can process the template and the original text respectively.
By the method, the task t and the original text X can be decoupled, and the template P is constrained by the task t, so that the corresponding task t can be obtained in the machine learning model through the template P, and the output text Y can be obtained according to the task t and the original text X, thereby simplifying the structure of the model, improving the accuracy of output and improving the interpretability of the machine learning model.
In addition to the above manner, other machine learning model structures may be adopted, for example, the machine learning model obtains the final output text through unified encoding and decoding operations without distinguishing the original text from the template. In addition, the modules can be added or subtracted according to actual needs, and the method is not limited herein.
Alternatively, embodiments of the present application may employ a multi-template pre-training approach, i.e., each task may correspond to multiple templates. Specifically, the plurality of acquired training samples, and the pre-training of the machine learning model according to the acquired training samples may include:
respectively inputting each training sample into the machine learning model, and determining a loss value according to the output text of the machine learning model and the labels corresponding to each training sample; and updating parameters of the machine learning model according to the loss value.
Wherein the loss value is determined by:
for any original text, adding loss values corresponding to training samples obtained after the original text is spliced with each template to obtain loss values corresponding to the original text; 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, adding the loss values corresponding to the original texts under the task to obtain the loss values corresponding to the task;
and adding the loss values corresponding to the tasks to obtain a final loss value, wherein the final loss value is used for updating the parameters of the machine learning model.
Illustratively, assuming a total of K tasks in the training sample, task t corresponds to M t Templates and N t The loss function in pre-training can be expressed by the following formula:
in the above-mentioned loss function, the part related to the multiple templates is specifically expressed as:wherein (1)>For the j-th template corresponding to task t, < ->For the i-th original text corresponding to task t, < >>Is->Corresponding label, p denotes thatAnd->After being input into the machine learning model, the output text is +.>Is a probability of (2).
In the above formula, for the original text M is used t And (3) templates. The accuracy of processing the machine learning model on the unseen test templates can be improved by using the multi-template training, because as the number of the training templates increases, the distance between the closest pair of the training templates and the test templates in the plurality of training templates and the plurality of test templates in the task space is continuously reduced, namely: />Wherein N is the number of training samples, P i The ith training template is the template used in the pre-training process, and has the same meaning as the template P in the previous step test For testing templates, i.e. templates used in the testing process, emb is the training module or embedded feature corresponding to the test template, when the training sample is sufficiently large, the closestThe expected approach to the difference between the embedded features of a pair of training templates and test templates is 0, which can prove the target distribution of the test templates in this case: />Distribution with training templates: />The test template is sufficiently close to the test template, which is equivalent to directly optimizing the test template in training, so that the performance of the machine learning model on the unseen test template can be greatly improved.
Therefore, in practical application, the accuracy of the machine learning model can be effectively improved by pre-training the machine learning model through multiple templates, and because one task can correspond to multiple templates, the weights of different tasks or training corpuses can be adjusted by adjusting the number of the templates corresponding to different tasks or training corpuses, so that important tasks or training corpuses can be used for pre-training more, and the use requirements under different scenes are met.
Other alternatives to the above approach may be used to implement the pre-training of the machine learning model. For example, a plurality of templates may be set, wherein some tasks each correspond to a plurality of templates, and the remaining tasks each correspond to only one template; in addition to the foregoing loss functions, the machine learning model may also be pre-trained by other loss functions; different weights may also be added for different tasks when determining the loss value.
The pre-training method for the machine learning model can generate templates which are connected with the original text naturally and accord with actual language habits of users according to different tasks, pre-train the machine learning model with the aid of the templates, enable the machine learning model to have a more natural input form, and can respond to the input forms corresponding to the tasks in each field; by introducing templates related to tasks, integrating each task better and adopting a multi-template training mode, the final training sample scale can be increased, the performance of a downstream task can be improved better under the condition of low resources such as zero samples or few samples and the like of a machine learning model, the performance of the machine learning model on the task which is not seen is improved, the machine learning model can show better migration and robustness, and the integral training effect of the machine learning model is improved.
On the basis of the technical solutions provided in the above embodiments, optionally, the original text is an original text in a plurality of training corpus; the plurality of training corpus encompasses a plurality of tasks; the method further comprises the steps of: outputting indication information, wherein the indication information is used for indicating a plurality of training corpus and a plurality of tasks used for pre-training on an interactive interface of a pre-training platform; and obtaining classification information input by the pre-training user through the interactive interface, wherein the classification information is used for determining at least one corresponding task for each training corpus.
Optionally, the indication information may be sent to the terminal device by the server, and the terminal device may display relevant information, such as multiple training corpuses and multiple tasks, on the interactive interface displayed to the pre-training user according to the indication information. The pre-training user may be a user using a pre-training platform, and specifically may be a developer or designer who performs a pre-training operation on the machine learning model, which is different from the user described above. In the embodiment of the application, the pre-training user is a person performing a pre-training operation on the machine learning model, and the user is a person using the machine learning model. The pre-training platform may be any platform capable of providing pre-training functionality.
Fig. 7 is a schematic diagram of an interactive interface provided in an embodiment of the present application, where, as shown in fig. 7, a plurality of corpus sets, for example, a corpus set AAA, a corpus set BBB, a corpus set CCC, etc., may be displayed on the interactive interface. Optionally, the relevant information of each training corpus may be further displayed on the interactive interface, for example, the profile, the label type, the number of the included original texts, etc. of the training corpus, or after the pre-training user clicks the name of the training corpus, the relevant information may be further displayed, so that the pre-training user can conveniently select a corresponding task for the training corpus according to the relevant information. In addition, a plurality of tasks such as intention recognition, emotion classification, abstract generation, and the like can be displayed on the interactive interface. The pre-training user can determine at least one corresponding task for each training corpus according to the displayed plurality of tasks and the plurality of training corpuses, wherein the at least one task can comprise a task selected from the plurality of tasks or a task newly added by the pre-training user. Specifically, the pre-training user can interact with the terminal device in a clicking, connecting line, text input mode and the like, the terminal device can acquire corresponding classification information, and the classification information is fed back to the server, wherein the classification information can comprise at least one task selected by the pre-training user for each training corpus.
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, so that training samples are obtained to complete the pre-training operation.
Optionally, on the basis of the technical solutions provided in the foregoing embodiments, the following may further be:
acquiring attribute information input by a pre-training user through an interactive interface of a pre-training platform; the attribute information includes: importance degree of each task and/or labeling quality corresponding to each training corpus;
determining the number of unit templates corresponding to each task according to the importance degree, and/or determining the number of unit templates corresponding to each training corpus according to the labeling quality;
the unit template number corresponding to the task comprises the template number corresponding to any original text under the task; the number of unit templates corresponding to the training corpus comprises the number of templates corresponding to any original text in the training corpus, and specifically, the number of templates corresponding to any original text under any task can be the number of templates corresponding to any original text, or the number of templates corresponding to any original text under all tasks can be the number of templates corresponding to any original text.
Fig. 8 is a schematic diagram of another interactive interface provided in the embodiment of the present application, where, as shown in fig. 8, on the interactive interface, a pre-training user may be allowed to select an importance degree corresponding to each task, where the more the number of asterisks, the more important the task is represented, and the pre-training user may be allowed to select labeling quality of each training corpus, for example, high, medium, low, etc., where the labeling quality is quality of a manual labeling label. There are many ways of selecting, for example, by way of a drop down tab, direct input, etc., and this is not limiting.
After the importance degree or the labeling quality is obtained, the number of corresponding unit templates, that is, how many templates an original text corresponds to, is determined according to the importance degree and the labeling quality, and usually a training sample is obtained after an original text is spliced with one template, so that the number of unit templates also determines the number of training samples that can be generated by an original text. In other alternative implementations, the number of unit templates may also be selected directly by the pre-training user.
Through the mode, a pre-training user can be allowed to set a pre-training related strategy through the interactive interface, for example, the original text in some training corpuses contains more slot information, compared with other training corpuses, the training corpuses are more suitable for task training for dialog state tracking, the task for dialog state tracking can be allocated to the training corpuses, the information provided by the training corpuses is fully used, and the training effect of a machine learning model is improved. Some training corpus sets have higher labeling quality, and some tasks are important, so that the number of unit templates corresponding to the training corpus sets or the tasks can be properly increased, the important training corpus sets and tasks can be better utilized, the training effect of a machine learning model is further improved, and the pre-training requirements under different scenes are met.
In practical application, based on the method provided by the embodiment of the application, hundreds of training corpus covering tens of tasks are constructed for the pre-training of the machine learning model, the scale of the training corpus is far more than that of the existing pre-training machine learning model, and task-type dialogue-related tasks (intention recognition, dialogue state tracking and task dialogue), open-domain chat and other dialogue-related tasks (emotion classification, natural language generation, abstract, text-to-SQL, question-answer and multiple choice) and the like are mainly covered, so that the pre-training effect of the machine learning model is effectively improved in a multi-training corpus, multi-task and multi-template mode.
The machine learning model obtained based on the method provided by the embodiment of the application shows stronger capability in various downstream tasks, and particularly, the performance under a low-resource environment (zero samples and few samples) is greatly improved. In addition, the range of downstream tasks which can be covered by the machine learning model trained by the embodiment of the application is wider, and the machine learning model can be covered from task dialogue to boring and the like.
After the pre-training is completed, the machine learning model may be fine-tuned for the particular downstream task. After fine tuning, the machine learning model may be applied to specific downstream tasks. The fine tuning and the use process are respectively described below. Fig. 9 is a flowchart of a method for fine tuning a machine learning model according to an embodiment of the present application. As shown in fig. 9, the method includes:
Step 901, obtaining a fine adjustment sample set, wherein the fine adjustment sample set is constructed through a dialogue between a user and customer service, and the tasks corresponding to the fine adjustment sample set comprise at least one of the following: intent recognition, dialog state tracking, and reply generation. 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, and is close to input information when the user actually uses the input text. The fine tuning sample set can be obtained in various modes, and optionally, in the intelligent customer service field, dialogues of a user and customer service can be collected, and the fine tuning sample set is constructed according to the dialogues. The dialogue can be specifically a dialogue collected by each platform, and particularly can be a dialogue between a user of the cloud platform and customer service. The cloud platform is any platform for providing cloud services, and the platform can provide an interactive interface for a user through web pages, application programs and the like, so that the user can perform related operations of the cloud services on the interactive interface, such as purchasing the cloud services, configuring related parameters of the cloud services and the like, and meanwhile, can also perform a dialogue with customer service through the interactive interface, consult the customer service for knowledge of the cloud services or feed back the problems in the use process, thereby being beneficial to the user to better use the cloud services.
The corresponding tasks in the fine tuning process may include intent recognition, dialogue state tracking, and reply generation, which are used to recognize intent, slot information, and reply to sentences, respectively.
And 902, performing 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 of any one of the above.
By the method provided by the embodiment, after pre-training, the corresponding fine-tuning sample set is utilized for fine-tuning training by the downstream task, and as the pre-trained machine learning model has stronger learning capacity of zero samples and few samples, better performance can be achieved in the fine-tuning process of the downstream task only by less labeling data. In addition, even if templates which are not found in the pre-training are used in the fine tuning process, the machine learning model still has better performance and is remarkably higher than other pre-training machine learning models at present.
Fig. 10 is a flow chart of an intelligent dialogue method according to an embodiment of the present application. As shown in fig. 10, the method may include:
step 1001, obtaining input information of a user.
Step 1002, determining output information for replying to the user based on the machine learning model according to the input information. The machine learning model is a fine-tuned machine learning model obtained by the fine-tuning method according to any one of the foregoing embodiments. The machine learning model can obtain corresponding output information according to the input information and display the output information to a user.
Optionally, the user may be a user of the cloud platform, and the machine learning model is used to assist in implementing an intelligent customer service function of the cloud platform.
According to the method provided by the embodiment, the machine learning model which is subjected to pre-training and fine-tuning is used for processing the input information of the user, wherein the multi-task multi-template is combined for training during pre-training, so that the machine learning model can have better performance in a downstream task, the replying effect is improved, and the user experience is improved.
In the process of fine tuning and using the downstream tasks, templates can be distinguished or not be distinguished in the content input into the machine learning model. For example, the user may be prompted to input a sentence to be analyzed and a task to be performed for the sentence, such that the user inputs the original text and the template, respectively, according to the prompt, the original text and the template constituting the input information, and inputs the input information to the machine learning model for processing.
Alternatively, the original text and the template may not be distinguished, and the user may directly input a section of speech, and since the pre-training process uses training samples conforming to natural language habits, the pre-training process may respond to various forms of real input. Or, the input information of the user can be used as an original text, a corresponding template is obtained by generating a model, and the target text formed by the original text and the template is input into the machine learning model to obtain corresponding output information. The corresponding task when the template is generated can be set according to actual needs, for example, in a dialogue scene, the corresponding task can be set as intention recognition and the like, or the task can be input by a user, so that the actual needs of different scenes are met.
Besides dialogue scenes, the machine learning model can also be applied to other scenes, such as abstract generation, translation, text-to-SQL and the like, and the embodiment of the application does not limit the specific application scenes of the machine learning model. Corresponding to the method, the embodiment of the application also provides a machine learning task template generating device, which comprises the following steps: the first acquisition module is used for acquiring an original text to be processed;
The processing module is used for obtaining templates corresponding to all tasks through generating a model according to the original text and at least one task;
the target text formed by the original text and the template is used for being input into the machine learning model for processing, and the template is used for indicating tasks to be executed by the machine learning model.
The embodiment of the application also provides a pre-training device of the machine learning model, which comprises:
the second acquisition module is used for acquiring a training sample, wherein the training sample is a target text formed by a template and an original text, which are obtained by the method in any embodiment;
and the training module is used for pre-training the machine learning model according to the acquired training sample.
The embodiment of the application also provides a fine tuning device of a machine learning model, which comprises:
the third acquisition module is used for acquiring a fine adjustment sample set, wherein the fine adjustment sample set is constructed through a dialogue between a user and customer service, and the tasks corresponding to the fine adjustment sample set comprise at least one of the following: intent recognition, dialog state tracking, and reply generation;
the fine tuning module is used for carrying out fine tuning training on the machine learning model according to the fine tuning sample set;
The machine learning model is a pre-trained machine learning model obtained by the method according to any embodiment.
The embodiment of the application also provides an intelligent dialogue device, which comprises:
a fourth acquisition module, configured to acquire input information of a user;
the reply module is used for determining output information for replying to a user based on a machine learning model according to the input information;
the machine learning model is a fine-tuned machine learning model obtained by the method according to any one of the embodiments.
The various devices provided in the embodiments of the present application may be used to execute the foregoing corresponding methods, and specific implementation principles and effects may be referred to the foregoing embodiments, which are not repeated herein.
Fig. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 11, the electronic device of the present embodiment may include:
at least one processor 1101; and
a memory 1102 communicatively coupled to the at least one processor;
wherein the memory 1102 stores instructions executable by the at least one processor 1101, the instructions being executable by the at least one processor 1101 to cause the electronic device to perform the method as described in any of the embodiments above. Alternatively, the memory 1102 may be separate or integrated with the processor 1101. The implementation principle and technical effects of the electronic device provided in this embodiment may be referred to the foregoing embodiments, and will not be described herein again.
The embodiment of the application further provides a computer readable storage medium, in which computer executable instructions are stored, which when executed by a processor, implement the method according to any of the previous embodiments. Embodiments of the present application also provide a computer program product comprising a computer program which, when executed by a processor, implements the method according to any of the preceding embodiments.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple modules may be combined or integrated into another system, or some features may be omitted or not performed.
The integrated modules, which are implemented in the form of software functional modules, may be stored in a computer readable storage medium. The software functional modules described above are stored in a storage medium and include instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or processor to perform some of the steps of the methods described in various embodiments of the present application.
It should be appreciated that the processor may be a processing unit (Central Processing Unit, CPU for short), but may also be other general purpose processors, digital signal processors (Digital Signal Processor DSP for short), application specific integrated circuits (Application Specific Integrated Circuit ASIC for short), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in a processor for execution. The memory may comprise a high-speed RAM memory, and may further comprise a non-volatile memory NVM, such as at least one magnetic disk memory, and may also be a U-disk, a removable hard disk, a read-only memory, a magnetic disk or optical disk, etc.
The storage medium may be implemented by any type or combination of volatile or nonvolatile memory devices 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 memory, flash memory, magnetic or optical disk. A storage media may be any available media that can be accessed by a general purpose or special purpose computer. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an application specific integrated circuit (Application Specific Integrated Circuits, ASIC for short). It is also possible that the processor and the storage medium reside as discrete components in an electronic device or a master device.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing embodiment numbers of the present application are merely for describing, and do not represent advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), comprising several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method described in the embodiments of the present application.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the claims, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application, or direct or indirect application in other related technical fields are included in the scope of the claims of the present application.

Claims (14)

1. A machine learning task template generation method, comprising:
acquiring an original text to be processed;
according to the original text and at least one task, obtaining templates corresponding to the tasks by generating a model;
the target text formed by the original text and the template is used for being input into the machine learning model for processing, and the template is used for indicating tasks to be executed by the machine learning model.
2. The method of claim 1, wherein the obtaining the original text to be processed comprises:
acquiring a training corpus, wherein the training corpus comprises 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 text is obtained according to a plurality of original texts in the training corpus, and is particularly used for training a plurality of tasks on the machine learning model;
And obtaining templates corresponding to each task by generating a model according to the original text and at least one task, wherein the templates comprise:
generating a corresponding template through a generation model according to the original text to be processed and the target task;
the target task is a task matched with a label corresponding to the original text to be processed in the plurality of tasks.
3. The method of claim 2, wherein the target task corresponds to a plurality of keywords; generating a corresponding template through a generation model according to the original text to be processed and the target task, wherein the template comprises the following steps:
and 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.
4. A method according to claim 3, wherein inputting the original text to be processed and any keyword corresponding to the target task into the generation model to obtain the target text including the template comprises:
adding content before or after the original text to be processed, wherein the added content sequentially comprises: at least one masking character, a keyword, at least one masking character;
And inputting the original text to be processed and the added content into the generation model, and filling mask characters by using the generation model to obtain a corresponding target text.
5. A method of pre-training a machine learning model, comprising:
obtaining a training sample, wherein the training sample is a target text formed by a template and an original text, which are obtained by the method of any one of claims 1 to 4;
and pre-training the machine learning model according to the acquired training sample.
6. The method of claim 5, wherein the machine learning model is used to determine corresponding tasks from templates in training samples and corresponding output text from the tasks and raw text in training samples.
7. The method of claim 6, wherein the machine learning model comprises: the system comprises an encoding module, a task analysis module and a decoding module;
after the training sample is input into the machine learning model, the machine learning model obtains an output text by the following method:
extracting coding features of an original text in the training sample and coding features of a template in the training sample based on the coding module;
Based on the task analysis module, determining the coding characteristics of the corresponding task according to the coding characteristics of the template;
and based on the decoding module, performing decoding operation according to the coding features of the original text and the coding features of the task to obtain a corresponding output text.
8. The method of any one of claims 5-7, wherein there are a plurality of training samples obtained; pre-training the machine learning model according to the acquired training sample, including:
respectively inputting each training sample into the machine learning model, and determining a loss value according to the output text of the machine learning model and the labels corresponding to each training sample;
updating parameters of the machine learning model according to the loss value;
wherein, any task corresponds a plurality of templates, and the loss value is determined by the following way:
for any original text, adding loss values corresponding to training samples obtained after the original text is spliced with each template to obtain loss values corresponding to the original text; 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, adding the loss values corresponding to the original texts under the task to obtain the loss values corresponding to the task;
and adding the loss values corresponding to the tasks to obtain a final loss value, wherein the final loss value is used for updating the parameters of the machine learning model.
9. The method of any of claims 5-7, wherein the original text is an original text in a plurality of training corpus; the plurality of training corpus encompasses a plurality of tasks; the method further comprises the steps of:
outputting indication information, wherein the indication information is used for indicating a plurality of training corpus and a plurality of tasks used for pre-training on an interactive interface of a pre-training platform;
and obtaining classification information input by the pre-training user through the interactive interface, wherein the classification information is used for determining at least one corresponding task for each training corpus.
10. The method of any of claims 5-7, wherein the original text is an original text in a plurality of training corpus; the method further comprises the steps of:
acquiring attribute information input by a pre-training user through an interactive interface of a pre-training platform; the attribute information includes: importance degree of each task and/or labeling quality corresponding to each training corpus;
Determining the number of unit templates corresponding to each task according to the importance degree, and/or determining the number of unit templates corresponding to each training corpus according to the labeling quality;
the unit template number corresponding to the task comprises the template number corresponding to any original text under the task; the number of unit templates corresponding to the training corpus comprises the number of templates corresponding to any original text in the training corpus.
11. A method for fine tuning a machine learning model, comprising:
obtaining a fine-tuning sample set, wherein the fine-tuning sample set is constructed through a dialogue between a user and customer service, and the tasks corresponding to the fine-tuning sample set comprise at least one of the following: intent recognition, dialog state tracking, and reply generation;
performing 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 of any one of claims 5-10.
12. An intelligent dialog method, comprising:
acquiring input information of a user;
determining output information for replying to a user based on a machine learning model according to the input information;
Wherein the machine learning model is a trimmed model obtained by the method of claim 11.
13. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor;
wherein the memory stores instructions executable by the at least one processor to cause the electronic device to perform the method of any one of claims 1-12.
14. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor implement the method of any of claims 1-12.
CN202311148338.7A 2023-09-06 2023-09-06 Machine learning task template generation method, training method, fine adjustment method and equipment Pending CN117633162A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311148338.7A CN117633162A (en) 2023-09-06 2023-09-06 Machine learning task template generation method, training method, fine adjustment method and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311148338.7A CN117633162A (en) 2023-09-06 2023-09-06 Machine learning task template generation method, training method, fine adjustment method and equipment

Publications (1)

Publication Number Publication Date
CN117633162A true CN117633162A (en) 2024-03-01

Family

ID=90034528

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311148338.7A Pending CN117633162A (en) 2023-09-06 2023-09-06 Machine learning task template generation method, training method, fine adjustment method and equipment

Country Status (1)

Country Link
CN (1) CN117633162A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118171111A (en) * 2024-05-15 2024-06-11 杭州逸琨科技有限公司 Multitasking model training method and device and multitasking method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118171111A (en) * 2024-05-15 2024-06-11 杭州逸琨科技有限公司 Multitasking model training method and device and multitasking method

Similar Documents

Publication Publication Date Title
CN111026842B (en) Natural language processing method, natural language processing device and intelligent question-answering system
CN111488931B (en) Article quality evaluation method, article recommendation method and corresponding devices
CN111507099A (en) Text classification method and device, computer equipment and storage medium
CN110032623B (en) Method and device for matching question of user with title of knowledge point
CN117521675A (en) Information processing method, device, equipment and storage medium based on large language model
CN112905795A (en) Text intention classification method, device and readable medium
CN111739520B (en) Speech recognition model training method, speech recognition method and device
US11868714B2 (en) Facilitating generation of fillable document templates
CN113011186A (en) Named entity recognition method, device, equipment and computer readable storage medium
CN111274822A (en) Semantic matching method, device, equipment and storage medium
CN112101042A (en) Text emotion recognition method and device, terminal device and storage medium
CN117633162A (en) Machine learning task template generation method, training method, fine adjustment method and equipment
CN114818729A (en) Method, device and medium for training semantic recognition model and searching sentence
CN116881470A (en) Method and device for generating question-answer pairs
CN117453885A (en) Question information processing method, device, equipment, storage medium and product
CN112183106A (en) Semantic understanding method and device based on phoneme association and deep learning
CN114078468A (en) Voice multi-language recognition method, device, terminal and storage medium
CN117369796A (en) Code construction method, model fine tuning method, device and storage medium
CN113704508A (en) Multimedia information identification method and device, electronic equipment and storage medium
CN115617974B (en) Dialogue processing method, device, equipment and storage medium
CN116680387A (en) Dialogue reply method, device, equipment and storage medium based on retrieval enhancement
CN114443916B (en) Supply and demand matching method and system for test data
CN111126066B (en) Method and device for determining Chinese congratulation technique based on neural network
CN111626059B (en) Information processing method and device
CN114138929A (en) Question answering method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination