CN115982583A - Training method, device, equipment and medium for pre-training language model - Google Patents

Training method, device, equipment and medium for pre-training language model Download PDF

Info

Publication number
CN115982583A
CN115982583A CN202211722595.2A CN202211722595A CN115982583A CN 115982583 A CN115982583 A CN 115982583A CN 202211722595 A CN202211722595 A CN 202211722595A CN 115982583 A CN115982583 A CN 115982583A
Authority
CN
China
Prior art keywords
training
language
task
model
language 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
CN202211722595.2A
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.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202211722595.2A priority Critical patent/CN115982583A/en
Publication of CN115982583A publication Critical patent/CN115982583A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Machine Translation (AREA)

Abstract

The disclosure provides a training method, a device, equipment and a medium for pre-training a language model, and relates to the field of artificial intelligence, in particular to natural language processing and deep learning technologies. The method comprises the following steps: acquiring a first pre-training language model facing a first language; and training the first pre-training language model by utilizing the training task of the first language and the training task of a second language different from the first language together to obtain a second pre-training language model facing the second language.

Description

Training method, device, equipment and medium for pre-training language model
Technical Field
The present disclosure relates to the field of artificial intelligence, and in particular, to techniques for natural language processing and deep learning, and more particularly, to a method and apparatus for pre-training a language model, an electronic device, a computer-readable storage medium, and a computer program product.
Background
Artificial intelligence is the subject of research that makes computers simulate some human mental processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.), both at the hardware level and at the software level. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing, and the like; the artificial intelligence software technology mainly comprises a computer vision technology, a voice recognition technology, a natural language processing technology, machine learning/deep learning, a big data processing technology, a knowledge map technology and the like.
With the continuous development of natural language processing technology in recent years, a pre-training language model based on a Transformer architecture has gradually become a classic framework. In order to further pursue the development of general artificial intelligence, large-scale pre-training models begin to be paid attention by researchers, and in the field of natural language processing, a batch of optimized large-scale pre-training language models such as ERNIE 3.0, GPT-3, intelligence sources, OPT and the like emerge, so that the effect of the pre-training language models on various types of downstream tasks is continuously refreshed.
The approaches described in this section are not necessarily approaches that have been previously conceived or pursued. Unless otherwise indicated, it should not be assumed that any of the approaches described in this section qualify as prior art merely by virtue of their inclusion in this section. Similarly, unless otherwise indicated, the problems mentioned in this section should not be considered as having been acknowledged in any prior art.
Disclosure of Invention
The present disclosure provides a training method of a pre-training language model, a training apparatus of a pre-training language model, an electronic device, a computer-readable storage medium, and a computer program product.
According to an aspect of the present disclosure, there is provided a training method of a pre-training language model, including: acquiring a first pre-training language model facing a first language; and training the first pre-training language model by utilizing the training task of the first language and the training task of a second language different from the first language together to obtain a second pre-training language model facing the second language.
According to an aspect of the present disclosure, there is provided a training apparatus for pre-training a language model, including: an acquisition unit configured to acquire a first pre-training language model oriented to a first language; and a training unit configured to train the first pre-training language model by using a training task of a first language and a training task of a second language different from the first language together to obtain a second pre-training language model facing the second language.
According to another aspect of the present disclosure, there is provided 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 at least one processor to perform the method described above.
According to another aspect of the present disclosure, there is provided a non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the above method.
According to another aspect of the disclosure, a computer program product is provided, comprising a computer program, wherein the computer program realizes the above method when executed by a processor.
According to one or more embodiments of the present disclosure, a first pre-training language model facing a first language is directly obtained, and the first pre-training language model is trained by using a pre-training task of the first language and a pre-training task of a second language, so that the pre-training language model facing the second language can be obtained with less cost. In addition, the pre-training task of the first language and the pre-training task of the second language are used for training the first pre-training language model together, so that the training difficulty can be reduced, and the first pre-training language model is helped to better realize the efficient migration of the second language.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate exemplary embodiments of the embodiments and, together with the description, serve to explain the exemplary implementations of the embodiments. The illustrated embodiments are for purposes of example only and do not limit the scope of the claims. Throughout the drawings, identical reference numbers designate similar, but not necessarily identical, elements.
FIG. 1 illustrates a schematic diagram of an exemplary system in which various methods described herein may be implemented, according to an embodiment of the present disclosure;
FIG. 2 illustrates a flow diagram of a training method of a pre-trained language model according to an exemplary embodiment of the present disclosure;
FIG. 3 shows a schematic diagram of a training method of a pre-trained language model according to an example embodiment of the present disclosure;
FIG. 4 shows a block diagram of a training apparatus for pre-training a language model, according to an example embodiment of the present disclosure; and
FIG. 5 illustrates a block diagram of an exemplary electronic device that can be used to implement embodiments of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, it will be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to define a positional relationship, a temporal relationship, or an importance relationship of the elements, and such terms are used only to distinguish one element from another. In some examples, a first element and a second element may refer to the same instance of the element, and in some cases, based on the context, they may also refer to different instances.
The terminology used in the description of the various described examples in this disclosure is for the purpose of describing particular examples only and is not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the elements may be one or more. Furthermore, the term "and/or" as used in this disclosure is intended to encompass any and all possible combinations of the listed items.
In the related art, the pre-training model of the low resource language is obtained by using a multi-language model or using a cross-language pre-training task. However, the effect of the multi-language model on any language cannot exceed that of a corresponding model trained in a single language, even for a language rich in resources. Moreover, multi-language joint training can lead to inefficient training, convergence is slower than for single language models, and training costs for models can be increased. In addition, multi-language models are generally cold-start training and cannot effectively utilize existing single-language models. The cross-language pre-training task needs parallel corpora, and the acquisition cost of the parallel corpora significantly exceeds that of the single-language corpora, which also increases the training cost of the model.
Furthermore, the multi-language model is more oriented to the following scenarios: meanwhile, the model has the requirement of multiple language capabilities, and the effect of the model on low-resource languages is more concerned or the cross-language effect is more concerned. However, multilingual techniques can be significantly inefficient when there is a need for only a low resource language.
In order to solve the above problem, the present disclosure directly obtains the first pre-training language model facing the first language, and trains the first pre-training language model by using the pre-training task of the first language and the pre-training task of the second language, so that the pre-training language model facing the second language can be obtained with a small cost. In addition, the pre-training task of the first language and the pre-training task of the second language are used for training the first pre-training language model together, so that the training difficulty can be reduced, and the first pre-training language model is helped to better realize the efficient migration of the second language.
Embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
Fig. 1 illustrates a schematic diagram of an example system 100 in which various methods and apparatus described herein may be implemented in accordance with embodiments of the present disclosure. Referring to fig. 1, the system 100 includes one or more client devices 101, 102, 103, 104, 105, and 106, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. Client devices 101, 102, 103, 104, 105, and 106 may be configured to execute one or more applications.
In embodiments of the present disclosure, the server 120 may run one or more services or software applications that enable execution of a training method for neural networks for natural language processing.
In some embodiments, the server 120 may also provide other services or software applications that may include non-virtual environments and virtual environments. In certain embodiments, these services may be provided as web-based services or cloud services, such as provided to users of client devices 101, 102, 103, 104, 105, and/or 106 under a software as a service (SaaS) network.
In the configuration shown in fig. 1, server 120 may include one or more components that implement the functions performed by server 120. These components may include software components, hardware components, or a combination thereof, which may be executed by one or more processors. A user operating a client device 101, 102, 103, 104, 105, and/or 106 may, in turn, utilize one or more client applications to interact with the server 120 to take advantage of the services provided by these components. It should be understood that a variety of different system configurations are possible, which may differ from system 100. Accordingly, fig. 1 is one example of a system for implementing the various methods described herein and is not intended to be limiting.
A user may use client devices 101, 102, 103, 104, 105, and/or 106 for human-computer interaction. The client device may provide an interface that enables a user of the client device to interact with the client device. The client device may also output information to the user via the interface. Although fig. 1 depicts only six client devices, those skilled in the art will appreciate that any number of client devices may be supported by the present disclosure.
Client devices 101, 102, 103, 104, 105, and/or 106 may include various types of computer devices, such as portable handheld devices, general purpose computers (such as personal computers and laptops), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, gaming systems, thin clients, various messaging devices, sensors or other sensing devices, and so forth. These computer devices may run various types and versions of software applications and operating systems, such as MICROSOFT Windows, APPLE iOS, UNIX-like operating systems, linux, or Linux-like operating systems (e.g., GOOGLE Chrome OS); or include various Mobile operating systems, such as MICROSOFT Windows Mobile OS, iOS, windows Phone, android. Portable handheld devices may include cellular telephones, smart phones, tablets, personal Digital Assistants (PDAs), and the like. Wearable devices may include head-mounted displays (such as smart glasses) and other devices. The gaming system may include a variety of handheld gaming devices, internet-enabled gaming devices, and the like. The client device is capable of executing a variety of different applications, such as various Internet-related applications, communication applications (e.g., email applications), short Message Service (SMS) applications, and may use a variety of communication protocols.
Network 110 may be any type of network known to those skilled in the art that may support data communications using any of a variety of available protocols, including but not limited to TCP/IP, SNA, IPX, etc. Merely by way of example, one or more networks 110 may be a Local Area Network (LAN), an ethernet-based network, a token ring, a Wide Area Network (WAN), the internet, a virtual network, a Virtual Private Network (VPN), an intranet, an extranet, a Public Switched Telephone Network (PSTN), an infrared network, a wireless network (e.g., bluetooth, WIFI), and/or any combination of these and/or other networks.
The server 120 may include one or more general purpose computers, special purpose server computers (e.g., PC (personal computer) servers, UNIX servers, mid-end servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and/or combination. The server 120 may include one or more virtual machines running a virtual operating system, or other computing architecture involving virtualization (e.g., one or more flexible pools of logical storage that may be virtualized to maintain virtual storage for the server). In various embodiments, the server 120 may run one or more services or software applications that provide the functionality described below.
The computing units in server 120 may run one or more operating systems including any of the operating systems described above, as well as any commercially available server operating systems. The server 120 may also run any of a variety of additional server applications and/or middle tier applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, and the like.
In some implementations, the server 120 may include one or more applications to analyze and consolidate data feeds and/or event updates received from users of the client devices 101, 102, 103, 104, 105, and 106. Server 120 may also include one or more applications to display data feeds and/or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105, and 106.
In some embodiments, the server 120 may be a server of a distributed system, or a server incorporating a blockchain. The server 120 may also be a cloud server, or a smart cloud computing server or a smart cloud host with artificial intelligence technology. The cloud Server is a host product in a cloud computing service system, and is used for solving the defects of high management difficulty and weak service expansibility in the traditional physical host and Virtual Private Server (VPS) service.
The system 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 130 may be used to store information such as audio files and video files. The database 130 may reside in various locations. For example, the data store used by the server 120 may be local to the server 120, or may be remote from the server 120 and may communicate with the server 120 via a network-based or dedicated connection. The database 130 may be of different types. In certain embodiments, the database used by the server 120 may be a database, such as a relational database. One or more of these databases may store, update, and retrieve data to and from the database in response to the command.
In some embodiments, one or more of the databases 130 may also be used by applications to store application data. The databases used by the application may be different types of databases, such as key-value stores, object stores, or regular stores supported by a file system.
The system 100 of fig. 1 may be configured and operated in various ways to enable application of the various methods and apparatus described in accordance with the present disclosure.
According to an aspect of the present disclosure, a training method of a pre-training language model is provided. As shown in fig. 2, the method includes: step S201, acquiring a first pre-training language model facing a first language; and step S202, training the first pre-training language model by utilizing the training task of the first language and the training task of the second language different from the first language together to obtain a second pre-training language model facing to the second language.
Therefore, the pre-training language model facing the second language can be obtained with lower cost by directly obtaining the first pre-training language model facing the first language and training the first pre-training language model by utilizing the pre-training task of the first language and the pre-training task of the second language. In addition, the pre-training task of the first language and the pre-training task of the second language are used for training the first pre-training language model together, so that the training difficulty can be reduced, and the first pre-training language model is helped to better realize the efficient migration of the second language.
The first language in the present disclosure may be a high resource language and the second language may be a low resource language. It should be noted that "low resource language" not only represents the absence of pre-training corpora, but also includes the absence of training resources (e.g., capital cost, equipment resources, etc.).
In some embodiments, in step S201, a single language pre-training model of a high resource language, i.e. a first pre-training language model, may be obtained. The method can be realized by downloading large-scale pre-training models (such as an English model GPT-3 and a Chinese model Ernie 3.0) which are open in the industry, or selecting a self-training mode, but the method has higher cost.
The first pre-trained language model may be trained using one or more training tasks based on a number of linguistic resources in the first language. In this disclosure, the training process for obtaining the first pre-trained language model may be referred to as a first stage of training (or a stage of training).
In some embodiments, in step S202, after the first pre-training language model facing the first language is acquired, the first pre-training language model may be trained by using a training task of the first language and a training task of a second language different from the first language together. In this disclosure, the training process of training a first pre-trained language model to obtain a second pre-trained language model oriented to a second language may be referred to as a second-stage training (or two-stage training).
FIG. 3 shows a schematic diagram of a training method of a pre-trained language model according to an exemplary embodiment of the present disclosure. In a first stage, a large-scale pre-training language model of a first language can be obtained by training corpus data of the first language; in the two phases, corpus data of a first language, corpus data of a second language, and multitask data of the second language may be used.
According to some embodiments, the same training task may be used for the first-stage training and the second-stage training, or different training tasks may be used; the training task in the first language and the training task in the second language may be the same or different, and are not limited herein. In some embodiments, the training task in the first language and the training task in the second language may both be pre-training tasks and may also be downstream tasks.
In some embodiments, the training task may include a Mask Language Model (MLM), a Language Model, a Dialogue Language Model (DLM), a Next Sentence Prediction (NSP), and so on, which are not limited herein.
According to some embodiments, the training of the first pre-trained language model with the training task of the first language and the training task of the second language different from the first language at step S202 may include: in response to determining that the preset suspension condition is not met, performing at least one round of training on a first pre-training language model by using a training task in a first language and a training task in a second language together based on a learning rate set by a hot gas (warm up) strategy to obtain a first intermediate model; and training the first intermediate model by using at least a training task of a second language to obtain a second pre-training language model. Therefore, the model can slowly adapt to the new language by adopting the hot gas strategy in the early stage of the two-stage training, so that the convergence of the model can be ensured.
According to some embodiments, the training of the first pre-trained language model with the training task of the first language and the training task of the second language different from the first language at step S202 may include: in response to determining that the preset suspension condition is not met, performing at least one round of training on the first pre-training language model by using the training task in the first language and the training task in the second language together at a learning rate not greater than a first preset value to obtain a second intermediate model; and training the second intermediate model by using at least a training task of a second language to obtain a second pre-training language model. Therefore, the model can slowly adapt to the new language by directly setting the small learning rate in the early stage of the two-stage training, so as to ensure the convergence of the model.
It should be noted that the first language and the second language may have a large difference, and therefore, in some embodiments, if the above special strategy (e.g., the arm up strategy or the direct setting of a small learning rate) is not adopted in the early stage of the two phases, the model may not be able to train convergence.
According to some embodiments, the preset abort condition may comprise at least one of: the training steps of the current training round reach a second preset value; and the loss value of the model obtained after the current training turn aiming at the training task of the second language is smaller than a third preset value. It is understood that a person skilled in the art may set one of the first preset value, the second preset value and the third preset value as required, and may also set other preset termination conditions, which are not limited herein.
In an exemplary embodiment, the learning rate in the early stage of the two-stage training may be set to 1e-6, 5e-6 directly or to other values according to actual conditions.
According to some embodiments, the first pre-trained language model may be subjected to multiple rounds of training using the training task in the first language and the training task in the second language together, and the ratio of the training task in the second language to the training task in the first language may be increased stepwise in the multiple rounds of training. Therefore, the proportion of the new language training task in the whole training task is gradually increased, the learning of the second language can be accelerated, and the time consumption of training is reduced.
In some embodiments, the second round of training employs at least the same pre-training task as the first round. In addition, on the basis of the pre-training task of the first round, other tasks may also be added, which is not limited herein.
According to some embodiments, for each training turn of the plurality of training turns, the ratio of the training tasks in the second language to the training tasks in the first language for the training turn may be determined based on a preset base ratio, the number of training steps for the training turn, the total number of training steps, and a preset growth rate. Therefore, by the mode, the ratio of different tasks can be automatically adjusted in the training process.
In one exemplary embodiment, the ratio of the training tasks in the second language to the training tasks in the first language may be expressed as:
Task_Ratio=t/T*r+base_ratio
wherein, the base _ ratio is the language training task ratio initially set, and is defined by the user according to the actual situation (for example, 0.1, 0.3, etc.), T is the total step number of the two-stage model training, T is the current training step number, r is the growth speed, and is defined by the user according to the actual situation.
In some embodiments, on the basis of the second pre-training language model for the second language, the second pre-training language model may be continuously learned by using the corpus data of the first language, the corpus data of the second language, and the corpus data of another low-resource language third language, so as to obtain a third pre-training language model for the third language. It should be noted that, when learning a new language, the corpus data of the original language needs to be retained.
In conclusion, the existing large-scale pre-training language model of the single language is effectively utilized, knowledge is migrated to the new language with low cost and low resources, and the model has better effect on the new language on the basis of keeping the effect of the previous language.
According to another aspect of the present disclosure, a training apparatus for pre-training a language model is provided. As shown in fig. 4, the apparatus 400 includes: an obtaining unit 410 configured to obtain a first pre-training language model oriented to a first language; and a training unit 420 configured to train the first pre-training language model with a training task of a first language and a training task of a second language different from the first language together to obtain a second pre-training language model oriented to the second language. It is understood that operations of the unit 410-420 in the apparatus 400 are similar to operations of the step S201-step S202 in fig. 2, and are not described herein again.
According to some embodiments, the training unit may comprise: a first training subunit configured to, in response to determining that the preset suspension condition is not satisfied, perform at least one round of training on a first pre-training language model using a training task in a first language and a training task in a second language together based on a learning rate set by a hot gas strategy to obtain a first intermediate model; and a second training subunit configured to train the first intermediate model with at least a training task in a second language to obtain a second pre-trained language model.
According to some embodiments, the training unit may comprise: a third training subunit configured to, in response to determining that the preset suspension condition is not satisfied, perform at least one round of training on the first pre-training language model with the training task in the first language and the training task in the second language together at a learning rate not greater than the first preset value to obtain a second intermediate model; and a fourth training subunit configured to train the second intermediate model with at least a training task of the second language to obtain a second pre-trained language model.
According to some embodiments, the preset abort condition may comprise at least one of: the training steps of the current training round reach a second preset value; and the loss value of the model obtained after the current training turn aiming at the training task of the second language is smaller than a third preset value.
According to some embodiments, the first pre-trained language model may be subjected to multiple rounds of training using a training task in the first language and a training task in the second language together, and the ratio of the training task in the second language to the training task in the first language may be increased stepwise in the multiple rounds of training.
According to some embodiments, for each training turn of the plurality of training turns, the ratio of the training tasks in the second language to the training tasks in the first language for the training turn may be determined based on a preset base ratio, the number of training steps for the training turn, the total number of training steps, and a preset growth rate.
According to some embodiments, the training task in the first language and the training task in the second language may both be pre-training tasks.
In the technical scheme of the disclosure, the collection, storage, use, processing, transmission, provision, disclosure and other processing of the personal information of the related user are all in accordance with the regulations of related laws and regulations and do not violate the good customs of the public order.
According to an embodiment of the present disclosure, there is also provided an electronic device, a readable storage medium, and a computer program product.
Referring to fig. 5, a block diagram of a structure of an electronic device 500, which may be a server or a client of the present disclosure, which is an example of a hardware device that may be applied to aspects of the present disclosure, will now be described. Electronic device is intended to represent various forms of digital electronic computer devices, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic devices may also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 5, the apparatus 500 comprises a computing unit 501 which may perform various appropriate actions and processes in accordance with a computer program stored in a Read Only Memory (ROM) 502 or a computer program loaded from a storage unit 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data required for the operation of the device 500 can also be stored. The calculation unit 501, the ROM 502, and the RAM503 are connected to each other by a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
A number of components in the device 500 are connected to the I/O interface 505, including: an input unit 506, an output unit 507, a storage unit 508, and a communication unit 509. The input unit 506 may be any type of device capable of inputting information to the device 500, and the input unit 506 may receive input numeric or character information and generate key signal inputs related to user settings and/or function controls of the electronic device, and may include, but is not limited to, a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone, and/or a remote controller. Output unit 507 may be any type of device capable of presenting information and may include, but is not limited to, a display, speakers, a video/audio output terminal, a vibrator, and/or a printer. The storage unit 508 may include, but is not limited to, a magnetic disk, an optical disk. Communication unit 509 allows device 500 to pass throughComputer networks such as the internet and/or various telecommunications networks exchange information/data with other devices and may include, but are not limited to, modems, network cards, infrared communication devices, wireless communication transceivers and/or chipsets, such as bluetooth TM Devices, 802.11 devices, wiFi devices, wiMax devices, cellular communication devices, and/or the like.
The computing unit 501 may be a variety of general-purpose and/or special-purpose processing components having processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning network algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The computing unit 501 performs the various methods and processes described above, such as a training method of a neural network for natural language processing. For example, in some embodiments, the training method for neural networks for natural language processing may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program may be loaded and/or installed onto device 500 via ROM 502 and/or communications unit 509. When the computer program is loaded into the RAM503 and executed by the computing unit 501, one or more steps of the training method for neural networks for natural language processing described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured by any other suitable means (e.g., by means of firmware) to perform a training method for neural networks for natural language processing.
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The Server can be a cloud Server, also called a cloud computing Server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service ("Virtual Private Server", or simply "VPS"). The server may also be a server of a distributed system, or a server incorporating a blockchain.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be performed in parallel, sequentially or in different orders, and are not limited herein as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved.
While embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it is to be understood that the above-described methods, systems and apparatus are merely illustrative embodiments or examples and that the scope of the invention is not to be limited by these embodiments or examples, but only by the claims as issued and their equivalents. Various elements in the embodiments or examples may be omitted or may be replaced with equivalents thereof. Further, the steps may be performed in an order different from that described in the present disclosure. Further, various elements in the embodiments or examples may be combined in various ways. It is important that as technology evolves, many of the elements described herein may be replaced with equivalent elements that appear after the present disclosure.

Claims (17)

1. A method of training a pre-trained language model, comprising:
acquiring a first pre-training language model facing a first language; and
and training the first pre-training language model by utilizing the training task of the first language and the training task of a second language different from the first language together to obtain a second pre-training language model facing the second language.
2. The method of claim 1, wherein training the first pre-trained language model with a training task in the first language in conjunction with a training task in a second language different from the first language comprises:
in response to determining that a preset abort condition is not met, performing at least one round of training on the first pre-training language model with the training task in the first language and the training task in the second language together based on a learning rate set by a hot gas (warm up) strategy to obtain a first intermediate model; and
and training the first intermediate model by using at least the training task of the second language to obtain the second pre-training language model.
3. The method of claim 1, wherein training the first pre-training language model with training tasks in the first language and training tasks in a second language different from the first language comprises:
in response to determining that a preset suspension condition is not met, performing at least one round of training on the first pre-training language model by using the training task of the first language and the training task of the second language together at a learning rate not greater than a first preset value to obtain a second intermediate model; and
and training the second intermediate model by using at least the training task of the second language to obtain the second pre-training language model.
4. The method of claim 3, wherein the preset abort condition comprises at least one of:
the training steps of the current training round reach a second preset value; and
and the loss value of the model obtained after the current training round aiming at the training task of the second language is smaller than a third preset value.
5. The method of claim 1, wherein the first pre-training language model is subjected to multiple rounds of training using the training task in the first language and the training task in the second language together, and wherein the ratio of the training task in the second language to the training task in the first language is increased stepwise in the multiple rounds of training.
6. The method of claim 5, wherein, for each training turn of the plurality of training turns, a ratio of the training tasks in the second language to the training tasks in the first language for the training turn is determined based on a preset base ratio, a number of training steps for the training turn, a total number of training steps, and a preset growth rate.
7. The method of claim 1, wherein the training tasks in the first language and the training tasks in the second language are both pre-training tasks.
8. A training apparatus for pre-training a language model, comprising:
an acquisition unit configured to acquire a first pre-training language model oriented to a first language; and
a training unit configured to train the first pre-training language model by using a training task of the first language and a training task of a second language different from the first language together to obtain a second pre-training language model facing the second language.
9. The apparatus of claim 8, wherein the training unit comprises:
a first training subunit configured to, in response to determining that a preset suspension condition is not satisfied, perform at least one round of training on the first pre-training language model with the training task in the first language and the training task in the second language together based on a learning rate set by a hot gas strategy to obtain a first intermediate model; and
a second training subunit configured to train the first intermediate model with at least a training task of the second language to obtain the second pre-training language model.
10. The apparatus of claim 8, wherein the training unit comprises:
a third training subunit configured to, in response to determining that a preset suspension condition is not satisfied, perform at least one round of training on the first pre-training language model with the training task in the first language and the training task in the second language together at a learning rate not greater than a first preset value to obtain a second intermediate model; and
a fourth training subunit configured to train the second intermediate model with at least a training task of the second language to obtain the second pre-training language model.
11. The apparatus of claim 10, wherein the preset abort condition comprises at least one of:
the training steps of the current training round reach a second preset value; and
and the loss value of the model obtained after the current training round aiming at the training task of the second language is smaller than a third preset value.
12. The apparatus of claim 8, wherein the first pre-trained language model is trained in multiple rounds using the training task in the first language and the training task in the second language together, and wherein a ratio of the training task in the second language to the training task in the first language is increased in steps in the multiple rounds of training.
13. The apparatus of claim 12, wherein, for each training turn of the plurality of training turns, a ratio of the training tasks in the second language to the training tasks in the first language for the training turn is determined based on a preset base ratio, a number of training steps for the training turn, a total number of training steps, and a preset growth rate.
14. The apparatus of claim 8, wherein the training tasks in the first language and the training tasks in the second language are both pre-training tasks.
15. 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 enable the at least one processor to perform the method of any one of claims 1-7.
16. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-7.
17. A computer program product comprising a computer program, wherein the computer program realizes the method of any one of claims 1-7 when executed by a processor.
CN202211722595.2A 2022-12-30 2022-12-30 Training method, device, equipment and medium for pre-training language model Pending CN115982583A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211722595.2A CN115982583A (en) 2022-12-30 2022-12-30 Training method, device, equipment and medium for pre-training language model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211722595.2A CN115982583A (en) 2022-12-30 2022-12-30 Training method, device, equipment and medium for pre-training language model

Publications (1)

Publication Number Publication Date
CN115982583A true CN115982583A (en) 2023-04-18

Family

ID=85957785

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211722595.2A Pending CN115982583A (en) 2022-12-30 2022-12-30 Training method, device, equipment and medium for pre-training language model

Country Status (1)

Country Link
CN (1) CN115982583A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111539227A (en) * 2020-07-06 2020-08-14 北京百度网讯科技有限公司 Method, apparatus, device and computer storage medium for training semantic representation model
CN112084295A (en) * 2019-05-27 2020-12-15 微软技术许可有限责任公司 Cross-language task training
CN112528669A (en) * 2020-12-01 2021-03-19 北京百度网讯科技有限公司 Multi-language model training method and device, electronic equipment and readable storage medium
CN113486160A (en) * 2021-05-26 2021-10-08 山东大学 Dialogue method and system based on cross-language knowledge
CN114386386A (en) * 2022-03-24 2022-04-22 合肥综合性国家科学中心人工智能研究院(安徽省人工智能实验室) Comment generation method, system, equipment and storage medium based on incremental learning

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112084295A (en) * 2019-05-27 2020-12-15 微软技术许可有限责任公司 Cross-language task training
CN111539227A (en) * 2020-07-06 2020-08-14 北京百度网讯科技有限公司 Method, apparatus, device and computer storage medium for training semantic representation model
CN112528669A (en) * 2020-12-01 2021-03-19 北京百度网讯科技有限公司 Multi-language model training method and device, electronic equipment and readable storage medium
CN113486160A (en) * 2021-05-26 2021-10-08 山东大学 Dialogue method and system based on cross-language knowledge
CN114386386A (en) * 2022-03-24 2022-04-22 合肥综合性国家科学中心人工智能研究院(安徽省人工智能实验室) Comment generation method, system, equipment and storage medium based on incremental learning

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
YU SUN, SHUOHUAN WANG, YUKUN LI, SHIKUN FENG, HAO TIAN, HUA WU, HAIFENG WANG: "Ernie 2.0: A continual pre-training framework for language understanding", PROCEEDINGS OF THE AAAI CONFERENCE ON ARTIFICIAL INTELLIGENCE, vol. 34, no. 5, 2 June 2020 (2020-06-02), pages 8968 - 8975 *

Similar Documents

Publication Publication Date Title
CN114743196B (en) Text recognition method and device and neural network training method
CN116821684A (en) Training method, device, equipment and medium for large language model
CN115631251B (en) Method, device, electronic equipment and medium for generating image based on text
CN116029346A (en) Method, apparatus, device and medium for deep learning model reasoning
CN114881170A (en) Training method of neural network for conversation task and conversation task processing method
CN115601555A (en) Image processing method and apparatus, device and medium
CN115982583A (en) Training method, device, equipment and medium for pre-training language model
CN114429678A (en) Model training method and device, electronic device and medium
CN114547252A (en) Text recognition method and device, electronic equipment and medium
CN114219046A (en) Model training method, matching method, device, system, electronic device and medium
CN113722594A (en) Recommendation model training method, recommendation device, electronic equipment and medium
CN114117046B (en) Data processing method, device, electronic equipment and medium
CN114048759A (en) Model training method, data processing method, device, equipment and medium
CN114494810A (en) Image processing method, neural network and training method, device and equipment thereof
CN114169440A (en) Model training method, data processing method, device, electronic device and medium
CN115564992A (en) Image classification method and training method of image classification model
CN115953771A (en) Text image processing method, device, equipment and medium
CN115578451A (en) Image processing method, and training method and device of image processing model
CN115713071A (en) Training method of neural network for processing text and method for processing text
CN114219079A (en) Feature selection method and device, model training method and device, equipment and medium
CN114611526A (en) Entity linking method and device, equipment and medium
CN115577081A (en) Dialogue method and device, equipment and medium
CN115617968A (en) Dialogue method and device, equipment and medium
CN113986355A (en) Data processing method and device, chip, electronic device and medium
CN117390445A (en) Training method, text processing method, device and equipment for large language model

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