Training methods, inference methods, devices, equipment and media for deep learning models

By constructing and training the first and second deep learning models, the problem of inefficient training and inference in the existing technology is solved, training and inference of models of different magnitudes is realized, and different scenarios and performance goals are met, and the training and inference of different magnitudes are improved. The predictive ability of the model.

CN117744732BActive Publication Date: 2025-02-18BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311766496.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-20
Publication Date
2025-02-18
Estimated Expiration
2043-12-20

AI Technical Summary

Technical Problem

Existing deep learning models are inefficient in training and inference, and are difficult to meet the needs of different scenarios, performance and effect goals.

Method used

By constructing the first deep learning model and the second deep learning model built based on its partial parameters, the target loss of both is determined, and the respective parameter values ​​are adjusted simultaneously based on the target loss, and the training and inference of models of different orders of magnitude are realized.

Benefits of technology

It realizes the output of multiple models of different orders of magnitude in one training, meets different scenarios and performance goals, accelerates model convergence and improves prediction capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117744732B_ABST
    Figure CN117744732B_ABST
Patent Text Reader

Abstract

The present disclosure provides a training method, reasoning method, device, equipment and medium for a deep learning model, which relates to the field of artificial intelligence technology, and in particular to technical fields such as machine learning and deep learning. The first model includes multiple first parameters, and the second model includes multiple second parameters, and the multiple second parameters are initialized to parameter values ​​of multiple target parameters selected from the multiple first parameters. The training method includes: determining the target loss of the first model and the second model; based on the target loss, adjusting the parameter values ​​of the multiple first parameters and the multiple second parameters, including: in response to determining that the target loss indicates that the parameter values ​​of at least a part of the target parameters included in the first model need to be adjusted, synchronously adjusting the parameter values ​​of the corresponding second parameters included in the second model; in response to determining that the target loss indicates that the parameter values ​​of at least a part of the second parameters included in the second model need to be adjusted, synchronously adjusting the parameter values ​​of the corresponding target parameters included in the first model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, in particular to technical fields such as machine learning and deep learning, and specifically to a deep learning model training method, a deep learning model reasoning method, a deep learning model training device, a deep learning model reasoning device, an electronic device, a computer-readable storage medium, and a computer program product. Background Art

[0002] Artificial intelligence is a discipline that studies how to use computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include natural language processing technology, computer vision technology, speech recognition technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.

[0003] The methods described in this section are not necessarily methods that have been previously conceived or employed. Unless otherwise indicated, it should not be assumed that any method described in this section is considered to be prior art simply because it is included in this section. Similarly, unless otherwise indicated, the issues mentioned in this section should not be considered to have been recognized in any prior art. Summary of the invention

[0004] The present disclosure provides a deep learning model training method, a deep learning model reasoning method, a deep learning model training device, a deep learning model reasoning device, an electronic device, a computer-readable storage medium, and a computer program product.

[0005] According to one aspect of the present disclosure, a training method for a deep learning model is provided, wherein a first deep learning model includes multiple first parameters, a second deep learning model includes multiple second parameters, the multiple second parameters are initialized to parameter values ​​of multiple target parameters corresponding to the multiple second parameters among the multiple first parameters, and the number of the multiple second parameters is less than the multiple first parameters. The training method includes: determining a target loss for the first deep learning model and the second deep learning model; based on the target loss, adjusting the parameter values ​​of the multiple first parameters and the multiple second parameters to obtain the trained first deep learning model and the second deep learning model, including: in response to determining that the target loss indicates that the parameter values ​​of at least a part of the multiple target parameters included in the first deep learning model need to be adjusted, synchronously adjusting the parameter values ​​of the second parameters corresponding to at least a part of the target parameters included in the second deep learning model; and in response to determining that the target loss indicates that the parameter values ​​of at least a part of the multiple second parameters included in the second deep learning model need to be adjusted, synchronously adjusting the parameter values ​​of the target parameters corresponding to at least a part of the second parameters included in the first deep learning model.

[0006] According to another aspect of the present disclosure, a method for reasoning a deep learning model is provided, wherein a first deep learning model and a second deep learning model are obtained by training using the above-mentioned training method, and the method for reasoning includes: using the second deep learning model to sequentially generate a plurality of prediction tokens; using the first deep learning model to generate a plurality of confidences of each prediction token based on the plurality of prediction tokens; and verifying the plurality of prediction tokens based on the generation order of the plurality of prediction tokens to obtain a reasoning result, including: in response to determining that the confidence of a currently verified prediction token is lower than a preset threshold, using the first deep learning model to generate a correction token at the position of the prediction token to replace the prediction token as a verified prediction token; in response to determining that a preset token generation condition is met, using the second deep learning model to sequentially regenerate prediction tokens based on the correction token from the next position of the correction token, and using the first deep learning model to generate the confidence of the regenerated prediction token for verification; and obtaining a reasoning result based on the verified prediction token.

[0007] According to another aspect of the present disclosure, a training device for a deep learning model is provided, wherein a first deep learning model includes multiple first parameters, and a second deep learning model includes multiple second parameters, and the multiple second parameters are initialized to parameter values ​​of multiple target parameters among the multiple first parameters, and the number of the multiple second parameters is less than the multiple first parameters. The training device includes: a determination unit, configured to determine a target loss of the first deep learning model and the second deep learning model; a parameter adjustment unit, configured to adjust the parameter values ​​of the multiple first parameters and the multiple second parameters based on the target loss to obtain the trained first deep learning model and the second deep learning model, including: a first parameter adjustment subunit, configured to synchronously adjust the parameter values ​​of the second parameters corresponding to the at least one part of the target parameters included in the second deep learning model in response to determining that the target loss indicates that the parameter values ​​of at least one part of the target parameters included in the multiple target parameters of the first deep learning model need to be adjusted; and a second parameter adjustment subunit, configured to synchronously adjust the parameter values ​​of the target parameters corresponding to the at least one part of the second parameters included in the first deep learning model in response to determining that the target loss indicates that the parameter values ​​of at least one part of the second parameters included in the second deep learning model need to be adjusted.

[0008] According to another aspect of the present disclosure, there is provided an inference device for a deep learning model, wherein a first deep learning model and a second deep learning model are obtained by training using the above-mentioned training device, and the inference device comprises: a first generation unit, configured to use the second deep learning model to sequentially generate a plurality of prediction tokens; a second generation unit, configured to use the first deep learning model to generate respective confidences of a plurality of prediction tokens based on the plurality of prediction tokens; and a verification unit, configured to verify the plurality of prediction tokens based on the generation order of the plurality of prediction tokens to obtain an inference result, comprising: a replacement subunit , configured to, in response to determining that the confidence of the currently verified prediction token is lower than a preset threshold, generate a correction token at the position of the prediction token using the first deep learning model to replace the prediction token as the verified prediction token; a generation subunit, configured to, in response to determining that the preset token generation condition is met, regenerate prediction tokens in sequence from the next position of the correction token based on the correction token using the second deep learning model, and generate the confidence of the regenerated prediction token for verification using the first deep learning model; and an inference subunit, configured to obtain an inference result based on the verified prediction token.

[0009] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the above method.

[0010] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the above method.

[0011] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program implements the above method when executed by a processor.

[0012] According to one or more embodiments of the present disclosure, the present disclosure first determines the target losses of the first deep learning model and the second deep learning model constructed based on some parameters in the first deep learning model, and determines the parameters of the parameter values ​​of the two models that need to be adjusted based on the target losses, and then synchronously adjusts the parameter values ​​of the corresponding parameters in the other model based on the correspondence between the parameters of the two models, so as to achieve a training output of multiple models of different magnitudes to meet the needs of different scenarios, different performances, and different effect targets. In addition, the first deep learning model and the second deep learning model are trained as a whole. During the training process, knowledge and information can be transmitted in both directions, which accelerates model convergence and enables both models to obtain better prediction capabilities.

[0013] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0015] Figure 1 A schematic diagram showing an exemplary system in which the various methods described herein may be implemented according to an embodiment of the present disclosure;

[0016] Figure 2 A flowchart of a method for training a deep learning model according to an embodiment of the present disclosure is shown;

[0017] Figure 3 A schematic diagram showing a first deep learning model and a second deep learning model according to an embodiment of the present disclosure is shown;

[0018] Figure 4 A flowchart showing a process of determining target losses of a first deep learning model and a second deep learning model according to an embodiment of the present disclosure is shown;

[0019] Figure 5 A flowchart of a method for reasoning a deep learning model according to an embodiment of the present disclosure is shown;

[0020] Figure 6 A structural block diagram of a deep learning model training device according to an embodiment of the present disclosure is shown;

[0021] Figure 7 A structural block diagram of an inference device for a deep learning model according to an embodiment of the present disclosure is shown; and

[0022] Figure 8 A structural block diagram of an exemplary electronic device that can be used to implement the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0023] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should 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. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0024] In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, temporal relationship, or importance relationship of these elements, and such terms are only used to distinguish one element from another element. In some examples, the first element and the second element may refer to the same instance of the element, and in some cases, based on the description of the context, they may also refer to different instances.

[0025] The terms used in the description of various examples in this disclosure are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element can be one or more. In addition, the term "and / or" used in this disclosure covers any one of the listed items and all possible combinations.

[0026] In related technologies, different deep learning models are trained independently, resulting in low training efficiency.

[0027] To solve the above problems, the present disclosure targets a first deep learning model and a second deep learning model constructed based on some parameters in the first deep learning model. First, the target losses of the two are determined, and the parameters of the parameter values ​​of the two models that need to be adjusted are determined based on the target losses. Then, based on the correspondence between the parameters of the two models, the parameter values ​​of the corresponding parameters in the other model are synchronously adjusted, so that multiple models of different magnitudes can be produced in one training to meet the needs of different scenarios, different performances, and different effect targets. In addition, the first deep learning model and the second deep learning model are trained as a whole. During the training process, knowledge and information can be transmitted in both directions, which accelerates model convergence and enables both models to obtain better prediction capabilities.

[0028] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.

[0029] Figure 1 FIG. 1 is a schematic diagram of an exemplary system 100 in which various methods and apparatuses described herein may be implemented according to an embodiment of the present disclosure. Figure 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. The client devices 101, 102, 103, 104, 105, and 106 may be configured to execute one or more applications.

[0030] In an embodiment of the present disclosure, the server 120 may run one or more services or software applications that enable execution of the methods of the present disclosure.

[0031] In some embodiments, server 120 may also provide other services or software applications, which may include non-virtualized environments and virtualized environments. In some 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) model.

[0032] exist Figure 1 In the configuration shown, the server 120 may include one or more components that implement the functions performed by the server 120. These components may include software components, hardware components, or a combination thereof that can be executed by one or more processors. Users operating client devices 101, 102, 103, 104, 105, and / or 106 may in turn utilize one or more client applications to interact with the server 120 to utilize the services provided by these components. It should be understood that a variety of different system configurations are possible, which may differ from the system 100. Therefore, Figure 1is one example of a system for implementing the various methods described herein and is not intended to be limiting.

[0033] The user can use client devices 101, 102, 103, 104, 105 and / or 106 to perform human-computer interaction. The client device can provide an interface that enables the user of the client device to interact with the client device. The client device can also output information to the user via the interface. Figure 1 Only six client devices are depicted, but one skilled in the art will appreciate that the present disclosure may support any number of client devices.

[0034] 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 laptop computers), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, game systems, thin clients, various messaging devices, sensors or other sensing devices, etc. 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 (such as 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 phones, smart phones, tablet computers, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays (such as smart glasses) and other devices. Game systems may include various handheld game devices, Internet-enabled game devices, etc. Client devices are capable of executing various different applications, such as various Internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and may use various communication protocols.

[0035] The 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. By way of example only, the 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 blockchain network, 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.

[0036] Server 120 may include one or more general purpose computers, dedicated server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running virtual operating systems, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that may be virtualized to maintain a server's virtual storage device). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.

[0037] The computing units in the server 120 may run one or more operating systems including any of the above operating systems and 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, etc.

[0038] In some implementations, server 120 may include one or more applications to analyze and consolidate data feeds and / or event updates received from users of client devices 101, 102, 103, 104, 105, and / or 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 / or 106.

[0039] In some embodiments, the server 120 may be a server of a distributed system, or a server combined with a blockchain. The server 120 may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in a cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services.

[0040] 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 databases 130 may reside in various locations. For example, the database 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 databases 130 may be of different types. In some embodiments, the databases used by the server 120 may be, for example, relational databases. One or more of these databases may store, update, and retrieve data to and from the databases in response to commands.

[0041] 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 applications may be different types of databases, such as a key-value store, an object store, or a conventional store backed by a file system.

[0042] Figure 1 The system 100 may be configured and operated in various ways to enable the application of various methods and apparatuses described in the present disclosure.

[0043] According to one aspect of the present disclosure, a training method for a deep learning model is provided. A first deep learning model includes a plurality of first parameters, a second deep learning model includes a plurality of second parameters, and the plurality of second parameters are initialized to parameter values ​​of a plurality of target parameters corresponding to the plurality of second parameters in the plurality of first parameters. The number of the plurality of second parameters is less than the plurality of first parameters.

[0044] Figure 2 A flowchart of a deep learning model training method 200 according to an embodiment of the present disclosure is shown. The method 200 includes: step S201, determining the target loss of the first deep learning model and the second deep learning model; step S202, adjusting the parameter values ​​of multiple first parameters and multiple second parameters based on the target loss to obtain the trained first deep learning model and the second deep learning model, including: step S2021, in response to determining that the target loss indicates that the parameter values ​​of at least a part of the multiple target parameters included in the first deep learning model need to be adjusted, synchronously adjusting the parameter values ​​of the second parameters included in the second deep learning model corresponding to at least a part of the target parameters; and step S2022, in response to determining that the target loss indicates that the parameter values ​​of at least a part of the multiple second parameters included in the second deep learning model need to be adjusted, synchronously adjusting the parameter values ​​of the target parameters included in the first deep learning model corresponding to at least a part of the second parameters.

[0045] Therefore, by targeting the first deep learning model and the second deep learning model constructed based on some parameters in the first deep learning model, the target losses of the two are first determined, and the parameters of the parameter values ​​of the two models that need to be adjusted are determined based on the target losses, and then based on the corresponding relationship between the parameters of the two models, the parameter values ​​of the corresponding parameters in the other model are synchronously adjusted, so that multiple models of different magnitudes can be produced in one training to meet the needs of different scenarios, different performances, and different effect targets. In addition, the first deep learning model and the second deep learning model are trained as a whole. During the training process, knowledge and information can be transmitted in both directions, which accelerates model convergence and enables both models to obtain better prediction capabilities.

[0046] In some embodiments, the first deep learning model and the second deep learning model can be based on various types of deep learning models, such as convolutional neural networks, recurrent neural networks, multi-layer perceptrons, fully connected networks, Transformer structures or Transformer-like structures (various types of extended structures of Transformer structures) or other types of deep learning models. The first deep learning model and the second deep learning model can be complete end-to-end models or a part of a model for a specific task, which is not limited here. It should be noted that the first deep learning model and the second deep learning model belong to the same type of model.

[0047] In some embodiments, the first model architecture and the second model architecture can be used to describe the model architecture and model configuration information of the first deep learning model and the second deep learning model, for example, the number of layers included in the model, the number of intermediate dimensions of the layers of the model, etc. The scale of the second model architecture is smaller than the first model architecture, that is, the model scale / size / parameter quantity of the second deep learning model is smaller than that of the first deep learning model.

[0048] In some embodiments, a portion of the parameters (i.e., multiple target parameters) can be selected from the multiple first parameters based on the number of multiple second parameters for constructing the second deep learning model. Multiple target parameters of the same number as the multiple second parameters can be selected from the multiple first parameters, and the multiple second parameters can be initialized to the parameter values ​​of the multiple target parameters. In other words, the parameter value of each second parameter in the initialized second deep learning model is the same as the parameter value of the target parameter corresponding to the second parameter in the first deep learning model. In the subsequent training process of the first deep learning model and the second deep learning model, the parameter values ​​of the multiple target parameters in the first deep learning model and the parameter values ​​of the multiple second parameters of the second deep learning model are always consistent, as will be described below.

[0049] In some embodiments, multiple target parameters can be obtained by randomly selecting from multiple first parameters based on the number of multiple second parameters; they can also be combined with some heuristic strategies, such as uniform distribution, or feature selection / feature engineering methods to select from multiple first parameters to obtain multiple target parameters that can achieve better training effects.

[0050] According to some embodiments, the first deep learning model may include a first number of first layers, and each of the first number of first layers may include a first number of first intermediate dimensions. The second deep learning model may include a second number of second layers, and each of the plurality of second layers may include a second number of second intermediate dimensions. The second number of layers of the second deep learning model may be less than the first number of layers of the first deep learning model, and the second number of intermediate dimensions of the second layer in the second deep learning model may be less than the first number of intermediate dimensions of the first layer in the first deep learning model.

[0051] The plurality of target parameters may include a first parameter in at least one target intermediate dimension of each of the at least one target layer. The at least one target layer may be selected from a first layer of the first number of layers based on the second number of layers, and the at least one target intermediate dimension may be selected from a first intermediate dimension of the first number of intermediate dimensions based on the second number of intermediate dimensions.

[0052] Therefore, through the above method, while selecting multiple target parameters that meet the parameter quantity of the second deep learning model from the multiple first parameters included in the first deep learning model, the overall model architecture of the first deep learning model can be maintained as much as possible, avoiding excessive concentration of selected parameters, and improving the prediction ability of the second deep learning model.

[0053] According to some embodiments, the first deep learning model and the second deep learning model may be based on a Transformer structure or a Transformer-like structure. The first deep learning model may include a first hidden dimension of the first number of hidden dimensions, and the first layer of the first number of layers may each include a first attention head of the first number of attention heads. The second deep learning model may include a second hidden dimension of the second number of hidden dimensions, and the second layer of the second number of layers may each include a second attention head of the second number of attention heads.

[0054] The plurality of target parameters may include a first parameter corresponding to the plurality of target hidden dimensions, and may include a first parameter in at least one target attention head. The plurality of target hidden dimensions may be selected from a first hidden dimension of the first number of hidden dimensions based on the number of second hidden dimensions, and the at least one target attention head may be selected from a first attention head of the first number of attention heads based on the number of second attention heads.

[0055] Therefore, through the above method, while selecting multiple target parameters that meet the parameter quantity of the second deep learning model from the multiple first parameters included in the first deep learning model, the overall model architecture of the first deep learning model based on the Transformer structure can be maintained as much as possible, avoiding excessive concentration of selected parameters, and improving the prediction ability of the second deep learning model.

[0056] In some embodiments, the first layer may be, for example, a Transformer layer, and the first intermediate dimension may be, for example, an intermediate dimension in a Feed Forward Networks (FFN) in the Transformer layer.

[0057] Figure 3 FIG. 1 shows a schematic diagram of a first deep learning model and a second deep learning model according to an embodiment of the present disclosure. Figure 3 As shown, the first deep learning model 300 includes an embedding vector input 302, the number of hidden dimensions is 6, and includes three Transformer layers, each Transformer layer includes a group of 4 attention heads 304 and a feedforward neural network 306, and the number of intermediate dimensions of the feedforward neural network is 8. The second deep learning model 310 includes an embedding vector input 312, the number of hidden dimensions is 3, and includes two Transformer layers, each Transformer layer includes a group of 2 attention heads 314 and a feedforward neural network 316, and the number of intermediate dimensions of the feedforward neural network is 4.

[0058] As can be seen from the figure, the multiple target parameters selected from the multiple first parameters include the first parameters in the four intermediate dimensions of the first Transformer layer, 1, 2, 4, and 5, and the first parameters in the four intermediate dimensions of the third Transformer layer, 3, 5, 7, and 8. In addition, the multiple target parameters include the first parameters corresponding to the three hidden dimensions, 1, 4, and 6, including the first parameters in the two attention heads, 2 and 4, of the first Transformer layer, and including the first parameters in the two attention heads, 1 and 2, of the third Transformer layer. Based on these target parameters, a second deep learning model can be constructed.

[0059] In some embodiments, the second model architecture (i.e., the number of layers, the number of intermediate dimensions, etc. included in the second deep learning model) can be determined based on the first model architecture and a preset ratio. In an exemplary embodiment, the preset ratio can be 50%, then the second number of layers of the second deep learning model can be half of the first number of layers of the first deep learning model, and the second number of intermediate dimensions of the second deep learning model can be half of the first number of intermediate dimensions of the first deep learning model. It is understandable that the second model architecture can also be determined based on a plurality of preset hyperparameter values, which is not limited here.

[0060] According to some embodiments, at least one target layer, at least one target intermediate dimension, multiple target hidden dimensions and / or at least one target attention head may be obtained by random selection.

[0061] According to some embodiments, the first deep learning model and the second deep learning model may be configured to perform at least one of the following tasks: a text processing task, an image processing task, and a speech processing task. The first deep learning model and the second deep learning model may be configured to perform the same task. Although the two models perform the same task, due to the different number of parameters of the two models, the inference speed and accuracy of the two models are different, so they can meet the needs of different scenarios, different performance, and different effect targets.

[0062] According to some embodiments, the first deep learning model may be a pre-trained large model. The pre-trained large model performs well in processing various text processing tasks, image processing tasks, and speech processing tasks, but its inference cost is high and its deployment is difficult. If another "small" model is trained independently, the knowledge that the large model has learned cannot be utilized, and the training process of the "small" model cannot further enhance the capabilities of the large model. Therefore, multiple target parameters are obtained by selection in the pre-trained large model, and then a "small" model is constructed based on the multiple target parameters, and the large model and the "small" model are trained as a whole, so that knowledge and information can be transmitted in both directions, accelerating model convergence, and enabling both models to obtain better prediction capabilities.

[0063] In some embodiments, one or more fixed mask matrices can be initialized to select multiple target parameters from multiple first parameters. The mask matrix only includes 0 and 1, 0 represents that only the first deep learning model is trained, and 1 represents that both the first deep learning model and the second deep learning model are trained. For a deep learning model based on a Transformer structure, the mask matrix may include a mask matrix of a hidden dimension, a mask matrix of a feedforward neural network, a mask matrix of an attention head, and a mask matrix of a Transformer layer. It is understandable that for different types of deep learning models, the mask matrix may include mask matrices corresponding to different model structures, which are not limited here.

[0064] In some embodiments, in step S201, the target loss of the first deep learning model and the second deep learning model in the training phase may be determined. It is understandable that various types of samples, various types of loss functions, and various types of training strategies may be used to calculate the target loss, which is not limited here.

[0065] According to some embodiments, Figure 4 A flowchart of a process 400 for determining target losses of a first deep learning model and a second deep learning model according to an embodiment of the present disclosure is shown. The process 400 may be used to implement step S201 in method 200. The process 400 may include: step S401, determining a first loss of a first deep learning model for a first sample; step S402, determining a second loss of a second deep learning model for a second sample; and step S403, determining a target loss based on the first loss and the second loss.

[0066] Therefore, by determining the first loss and the second loss of the first deep learning model and the second deep learning model for the first sample and the second sample respectively, and then obtaining the target loss based on the two, it is possible to simultaneously adjust the parameters of the first deep learning model and the second deep learning model in one training, thereby achieving synchronous training of the two models.

[0067] In some embodiments, the first deep learning model and the second deep learning model can be trained in a batch training manner, and the first sample and the second sample can both be batch data. In an exemplary embodiment, the first deep learning model can be trained with a batch of data (first sample), and then the second deep learning model can be trained with a batch of data (second sample), and the total target loss is obtained based on the two losses, thereby achieving joint training of the first deep learning model and the second deep learning model.

[0068] According to some embodiments, the first sample may be the same as the second sample. By making the first deep learning model and the second deep learning model use exactly the same training samples, the second deep learning model can learn the attention matrix and probability distribution of the top layer of the first deep learning model, so that the training results of the second deep learning model and the first deep learning model are more closely matched, the collaborative training of the two is accelerated, and the prediction capabilities of the two models after training are improved.

[0069] In some embodiments, in step S401 and step S402, corresponding loss functions may be selected according to requirements to obtain a first loss and a second loss. In step S403, the first loss and the second loss may be added to obtain a target loss. In addition to the above method, the target loss may also be obtained based on the first loss and the second loss in other ways, which are not limited here.

[0070] In some embodiments, in step S202, the parameters of the multiple first parameters and the multiple second parameters that need to be adjusted can be determined based on the target loss through back propagation, and the corresponding adjustment amount can be determined. Then, in step S2021, in response to determining that the target loss indicates that the parameter values ​​of at least a part of the multiple target parameters included in the first deep learning model need to be adjusted, based on the adjustment amount determined for this part of the target parameters, the parameter values ​​of this part of the target parameters in the first deep learning model are adjusted, and based on the same adjustment amount, the parameter values ​​of the second parameters corresponding to this part of the target parameters in the second deep learning model are synchronously adjusted. If the target loss indicates that the parameter value of a first parameter other than the multiple target parameters in the first deep learning model needs to be adjusted, the parameter value of the first parameter in the first deep learning model can be adjusted only based on the adjustment amount determined for the first parameter, without adjusting the parameters of the second deep learning model.

[0071] Similarly, in step S2022, in response to determining that the target loss indicates that the parameter values ​​of at least a portion of the multiple second parameters included in the second deep learning model need to be adjusted, based on the adjustment amount determined for this portion of the second parameters, the parameter values ​​of this portion of the second parameters in the second deep learning model are adjusted, and based on the same adjustment amount, the parameter values ​​of the target parameters (i.e., the first parameters) corresponding to this portion of the second parameters in the first deep learning model are synchronously adjusted.

[0072] In some embodiments, two adjustment amounts may be determined for the same parameter in the same training (in the scheme to be introduced below, there may be more adjustment amounts), and one of the adjustment amounts can be used to synchronously adjust the parameter values ​​of the corresponding parameters in the two models, or two adjustment amounts can be used to synchronously adjust the parameter values ​​of the corresponding parameters in the two models, which is not limited here.

[0073] In some embodiments, method 200 can be extended to train more models. The model to be trained may also include a third deep learning model. The third deep learning model includes multiple third parameters, and the multiple third parameters are initialized to parameter values ​​of multiple shared parameters corresponding to the multiple third parameters in the multiple target parameters, wherein the number of the multiple third parameters is less than the multiple second parameters. In other words, the multiple target parameters corresponding to the multiple second parameters are a subset of the multiple first parameters, and the multiple shared parameters corresponding to the multiple third parameters are a subset of the multiple target parameters. Regarding the structure and operation of the third model, reference may be made to the description of the second model above.

[0074] In the training phase, the target losses of the three models can be determined first, and the parameter values ​​of the parameters of each model can be adjusted based on the target losses. Specifically, in response to determining that the target loss indicates that the parameter value of one of the parameters of one of the models needs to be adjusted, if the parameter includes a parameter corresponding to the parameter in the other two models, the parameter value of the corresponding parameter is adjusted synchronously. In this way, three models of different magnitudes can be obtained.

[0075] It is understandable that, referring to the above description, method 200 can also be extended to train 4 or more models, which will not be described in detail here. The method disclosed in the present invention can expand the number of trained models without increasing the training cost, because each round of training will train each model, so expanding the number of models does not increase the number of training rounds.

[0076] According to another aspect of the present disclosure, a method for reasoning about a deep learning model is provided. Figure 5A flowchart of a deep learning model reasoning method 500 according to an embodiment of the present disclosure is shown. The first deep learning model and the second deep learning model involved in the method 500 may be obtained by training using the method 200 described above. Method 500 includes: step S501, using the second deep learning model to generate multiple prediction tokens in sequence; step S502, using the first deep learning model to generate multiple confidence levels of each prediction token based on the multiple prediction tokens; and step S503, based on the generation order of the multiple prediction tokens, verifying the multiple prediction tokens to obtain inference results, including: step S5031, in response to determining that the confidence level of the currently verified prediction token is lower than a preset threshold, using the first deep learning model to generate a correction token at the position of the prediction token to replace the prediction token as a verified prediction token; step S5032, in response to determining that the preset token generation condition is met, using the second deep learning model, based on the correction token, to regenerate prediction tokens in sequence from the next position of the correction token, and using the first deep learning model to generate the confidence level of the regenerated prediction token for verification; and step S5033, obtaining an inference result based on the verified prediction token.

[0077] Deep learning model prediction usually includes two modes, one is the decoding mode, which requires token prediction one by one, and takes longer time. The other is the verification mode, that is, given multiple generated tokens, the confidence of each token in the result (i.e., the top-level probability distribution) is obtained. Since the verification mode can process the entire generated sequence at once, the time required is significantly less than the decoding mode. The present disclosure combines the decoding process of the smaller second deep learning model with the verification process of the larger first deep learning model, which can quickly obtain high-quality results and further improve performance and reasoning effects.

[0078] In some embodiments, in step S501, the second deep learning model may be used in a decoding mode to sequentially generate multiple prediction tokens. Since the second deep learning model is relatively small in size, a prediction result sequence, i.e., multiple prediction tokens, can be quickly obtained even in the decoding mode.

[0079] In an exemplary embodiment, the input token sequence can be input into the second deep learning model to obtain the first prediction token output by the model, and then the input token sequence and the first prediction token are input into the model again to obtain the second prediction token output by the model, and so on, until the model outputs the [End] token indicating the end or the tokens output have reached a preset number. It is understandable that in addition to the above method, the second deep learning model can also be used in other ways to generate multiple prediction tokens in sequence, which is not limited here.

[0080] In some embodiments, in step S502, the first deep learning model can be used in a verification mode to directly generate the confidence of each of the multiple prediction tokens based on the multiple prediction tokens. Since the first deep learning model is large in scale, if the decoding mode is used, it takes a long time to obtain the prediction result sequence; using the verification mode can quickly obtain the top-level probability distribution corresponding to the multiple prediction tokens generated by the second deep learning model.

[0081] In some embodiments, in step S503, multiple prediction tokens may be verified based on the generation order of the multiple prediction tokens, and corresponding operations may be performed according to the verification result.

[0082] In some embodiments, in step S5031, in response to determining that the confidence of the currently verified prediction token is lower than a preset threshold, it indicates that the larger first deep learning model believes that the currently verified prediction token is inaccurate. Therefore, the first deep learning model can be used in a decoding mode to generate a correction token at the location of the prediction token and replace the prediction token generated by the second deep learning model. The correction token can be used as a verified prediction token for finally generating an inference result.

[0083] In an exemplary embodiment, in response to determining that the confidence of the currently verified prediction token is lower than a preset threshold, all prediction tokens before the currently verified prediction token can be input into the first deep learning model to obtain the token of the current position generated by the first deep learning model, that is, the correction token.

[0084] In some embodiments, in step S5032, in response to determining that the preset token generation condition is met, the second deep learning model is used in the decoding mode to regenerate at least one prediction token in sequence from the next position of the correction token based on the correction token. Then, after the at least one prediction token is generated or other generation termination conditions are met, the first deep learning model is used in the verification mode to generate the confidence of at least one prediction token based on the regenerated at least one prediction token, and then verify the at least one prediction token. The above process can be repeated until all prediction tokens are verified.

[0085] According to some embodiments, the preset token generation condition may include that the number of tokens generated is less than a preset number. In other words, a preset number may be set, and the generation and verification of prediction tokens may be performed in units of the preset number, and after the verification is completed, the preset tokens may continue to be generated and verified in units of the preset number until the generation process ends, for example, a high-confidence [End] token is generated.

[0086] Therefore, through the above method, the upper limit of the length of the prediction token sequence generated and verified can be controlled to avoid the generation and verification of too long prediction token sequences and thus avoid performance degradation.

[0087] According to some embodiments, the preset token generation condition may include a correction token indicating that token generation is not finished. In an exemplary embodiment, if the correction token is not an [End] token, the preset generation condition is not met, and the prediction tokens need to be re-generated in sequence using the second deep learning.

[0088] According to some embodiments, step S503, based on the generation order of the multiple prediction tokens, verifying the multiple prediction tokens to obtain the inference result may also include: in response to determining that the confidence of the currently verified prediction token is not lower than a preset threshold, retaining the prediction token as a verified prediction token.

[0089] Therefore, through the above method, the verified prediction symbols finally retained can have a higher confidence level, thereby ensuring the quality of the generated reasoning results.

[0090] In some embodiments, in step S5033, the content corresponding to each verified prediction token, such as characters, images, voice, etc., can be determined, and then these contents can be integrated to obtain corresponding inference results.

[0091] Therefore, a smaller-scale second deep learning model is used to generate a prediction token sequence based on a decoding mode, and a larger-scale first deep learning model is used to verify each generated prediction token based on a verification mode. If the verification fails (for example, less than the confidence level), the second deep learning model is used to generate a correction token for the current position based on the decoding mode, and the second deep learning model is used to regenerate prediction tokens one by one from the next position, so that high-quality inference results can be obtained quickly.

[0092] In some embodiments, the model used for reasoning also includes a target deep learning model that is larger in scale than the first deep learning model, that is, the multiple first parameters included in the first deep learning model are a subset of the multiple parameters included in the target deep learning model. In step S5033, after obtaining multiple verification tokens verified by the first deep learning model, the target deep learning model can be used to generate confidences for multiple verification tokens, and these confidences can be used to further verify the multiple verification tokens. If a verification token fails to pass the verification of the target deep learning model, the target deep learning model can generate a new token at this position to replace the verification token, and the second deep learning model can regenerate subsequent tokens after the token, and then the first deep learning model can re-verify it, and then the target deep learning model can re-verify the results of the verification of the first deep school model.

[0093] In some embodiments, the second deep learning model generates N 1The generated results are verified and regenerated by the second deep learning model. The results generated and verified by the first deep learning model and the second deep learning model can be regarded as a whole. Whenever the first deep learning model and the second deep learning model complete N 2 After rounds of generation and verification, the obtained N 1 ×N 2 The verified prediction tokens are then sent to the target deep learning model for verification and regeneration.

[0094] It is understandable that the above generation and verification method can also be extended to 4 or more models, which will not be elaborated here.

[0095] According to another aspect of the present disclosure, a training device for a deep learning model is provided. A first deep learning model includes a plurality of first parameters, a second deep learning model includes a plurality of second parameters, the plurality of second parameters are initialized to parameter values ​​of a plurality of target parameters in the plurality of first parameters, and the number of the plurality of second parameters is less than the plurality of first parameters.

[0096] Figure 6 The structural block diagram of a deep learning model training device 600 according to an embodiment of the present disclosure is shown. The device 600 includes: a determination unit 610, configured to determine the target loss of the first deep learning model and the second deep learning model; a parameter adjustment unit 620, configured to adjust the parameter values ​​of multiple first parameters and multiple second parameters based on the target loss to obtain the trained first deep learning model and the second deep learning model, including: a first parameter adjustment subunit 622, configured to synchronously adjust the parameter value of the second parameter corresponding to the at least one part of the target parameter included in the second deep learning model in response to determining that the target loss indicates that the parameter value of at least one part of the multiple target parameters included in the first deep learning model needs to be adjusted; and a second parameter adjustment subunit 624, configured to synchronously adjust the parameter value of the target parameter corresponding to the at least one part of the second parameter included in the first deep learning model in response to determining that the target loss indicates that the parameter value of at least one part of the multiple second parameters included in the second deep learning model needs to be adjusted.

[0097] It can be understood that the operations of the units 610 to 620 and their sub-units in the device 600 can refer to the above description of steps S201 to S202 and their sub-steps in the method 200, and are not described in detail here.

[0098] According to some embodiments, the first deep learning model may include a first number of first layers, and the first number of first layers may each include a first number of first intermediate dimensions.

[0099] The second deep learning model may include a second number of layers, and each of the plurality of second layers may include a second number of intermediate dimensions. The second number of layers may be less than the first number of layers, and the second number of intermediate dimensions may be less than the first number of intermediate dimensions.

[0100] The plurality of target parameters may include a first parameter in at least one target intermediate dimension of each of the at least one target layer. The at least one target layer may be selected from a first layer of the first number of layers based on the second number of layers, and the at least one target intermediate dimension may be selected from a first intermediate dimension of the first number of intermediate dimensions based on the second number of intermediate dimensions.

[0101] According to some embodiments, the first deep learning model and the second deep learning model may be based on a Transformer structure or a Transformer-like structure.

[0102] The first deep learning model may include a first number of hidden dimensions, and the first layers indicating a first number of layers may each include a first number of attention heads.

[0103] The second deep learning model may include a second hidden dimension of a second number of hidden dimensions, and the second layers indicating the second number of layers may each include a second attention head of a second number of attention heads.

[0104] The plurality of target parameters may include a first parameter corresponding to the plurality of target hidden dimensions, and may include a first parameter in at least one target attention head. The plurality of target hidden dimensions may be selected from a first hidden dimension of the first number of hidden dimensions based on the number of second hidden dimensions, and the at least one target attention head may be selected from a first attention head of the first number of attention heads based on the number of second attention heads.

[0105] According to some embodiments, at least one target layer, at least one target intermediate dimension, multiple target hidden dimensions and / or at least one target attention head may be obtained by random selection.

[0106] According to some embodiments, the first deep learning model and the second deep learning model may each be configured to perform at least one of the following tasks: a text processing task, an image processing task, and a speech processing task.

[0107] According to some embodiments, the first deep learning model may be a pre-trained large model.

[0108] According to some embodiments, the determination unit may include: a first determination subunit, configured to determine a first loss of the first deep learning model for the first sample; a second determination subunit, configured to determine a second loss of the second deep learning model for the second sample; and a third determination subunit, configured to determine a target loss based on the first loss and the second loss.

[0109] According to some embodiments, the first sample may be identical to the second sample.

[0110] According to another aspect of the present disclosure, a deep learning model inference device is provided. The first deep learning model and the second deep learning model can be obtained by training using the device 600.

[0111] Figure 7 A structural block diagram of an inference device 700 for a deep learning model according to an embodiment of the present disclosure is shown. The apparatus 700 includes: a first generation unit 710, configured to use a second deep learning model to sequentially generate a plurality of prediction tokens; a second generation unit 720, configured to use the first deep learning model to generate respective confidences of a plurality of prediction tokens based on the plurality of prediction tokens; and a verification unit 730, configured to verify the plurality of prediction tokens based on the generation order of the plurality of prediction tokens to obtain an inference result, including: a replacement subunit 732, configured to generate a correction token at the position of the prediction token using the first deep learning model in response to determining that the confidence of the currently verified prediction token is lower than a preset threshold value, so as to replace the prediction token as a verified prediction token; a generation subunit 734, configured to regenerate prediction tokens in sequence from the next position of the correction token based on the correction token using the second deep learning model in response to determining that the preset token generation condition is met, and generate the confidence of the regenerated prediction tokens using the first deep learning model for verification; and an inference subunit 736, configured to obtain an inference result based on the verified prediction token.

[0112] It can be understood that the operations of the units 710 to 730 and their sub-units in the device 700 can refer to the above description of steps S501 to S503 and their sub-steps in the method 500, and are not described in detail here.

[0113] According to some embodiments, the preset token generation condition may include that the number of generated tokens is less than a preset number.

[0114] According to some embodiments, the preset token generation condition may include a correction token indicating that token generation is not completed.

[0115] According to some embodiments, the verification unit 730 may include (not shown in the figure): a retaining subunit configured to retain the prediction token as a verified prediction token in response to determining that the confidence of the currently verified prediction token is not lower than a preset threshold.

[0116] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0117] According to an embodiment of the present disclosure, an electronic device, a readable storage medium and a computer program product are also provided.

[0118] refer to Figure 8 , a block diagram of an electronic device 800 that can be used as a server or client of the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0119] like Figure 8 As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0120] Multiple components in the electronic device 800 are connected to the I / O interface 805, including: an input unit 806, an output unit 807, a storage unit 808, and a communication unit 809. The input unit 806 can be any type of device that can input information to the electronic device 800. The input unit 806 can receive input digital or character information and generate key signal input related to user settings and / or function control of the electronic device, and can 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. The output unit 807 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 808 can include but is not limited to a disk, an optical disk. The communication unit 809 allows the electronic device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and can include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth device, an 802.11 device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.

[0121] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 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 model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods, processes, and / or processes described above. For example, in some embodiments, these methods, processes, and / or processes may be implemented as computer software programs, which are tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the methods, processes, and / or processes described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform these methods, processes, and / or processes in any other appropriate manner (e.g., by means of firmware).

[0122] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0123] The program code for implementing the method 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, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0124] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A 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, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, 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 portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0125] To provide interaction with a user, the systems and techniques described herein 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 the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the 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 can be received in any form (including acoustic input, voice input, or tactile input).

[0126] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend 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: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.

[0127] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0128] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0129] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples, but only by the claims after authorization and their equivalent scope. Various elements in the embodiments or examples can be omitted or replaced by their equivalent elements. In addition, each step can be performed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples can be combined in various ways. It is important that with the evolution of technology, many elements described herein can be replaced by equivalent elements that appear after the present disclosure.

Claims

1. A method for training a deep learning model, wherein: The first deep learning model includes a plurality of first parameters, the second deep learning model includes a plurality of second parameters, the plurality of second parameters are initialized to parameter values ​​of a plurality of target parameters corresponding to the plurality of second parameters among the plurality of first parameters, the number of the plurality of second parameters is less than the plurality of first parameters, the first deep learning model and the second deep learning model are both configured to perform at least one of the following tasks: a text processing task, an image processing task, and a speech processing task, the method comprising: Determining target losses of the first deep learning model and the second deep learning model; Based on the target loss, adjusting the parameter values ​​of the plurality of first parameters and the plurality of second parameters to obtain the trained first deep learning model and the second deep learning model includes: In response to determining that the target loss indicates that parameter values ​​of at least a portion of the plurality of target parameters included in the first deep learning model need to be adjusted, synchronously adjusting parameter values ​​of second parameters included in the second deep learning model corresponding to the at least a portion of the target parameters; and In response to determining that the target loss indicates that the parameter values ​​of at least a portion of the multiple second parameters included in the second deep learning model need to be adjusted, the parameter values ​​of the target parameters corresponding to the at least a portion of the second parameters included in the first deep learning model are synchronously adjusted.

2. The method according to claim 1, wherein: Determining target losses of the first deep learning model and the second deep learning model includes: Determine a first loss of the first deep learning model for a first sample; Determining a second loss of the second deep learning model for a second sample; and The target loss is determined based on the first loss and the second loss.

3. The method according to claim 2, wherein: The first sample and the second sample are the same.

4. The method according to claim 1, wherein: The first deep learning model includes a first number of first layers, each of the first number of first layers includes a first number of first intermediate dimensions, The second deep learning model includes a second number of second layers, and each of the plurality of second layers includes a second number of second intermediate dimensions, wherein the second number of layers is less than the first number of layers, and the second number of intermediate dimensions is less than the first number of intermediate dimensions, The multiple target parameters include a first parameter in at least one target intermediate dimension of each of the at least one target layers, wherein the at least one target layer is selected from the first layer of the first number of layers based on the second number of layers, and the at least one target intermediate dimension is selected from the first intermediate dimension of the first number of intermediate dimensions based on the second number of intermediate dimensions.

5. The method according to claim 4, wherein: The first deep learning model and the second deep learning model are based on a Transformer structure or a Transformer-like structure, The first deep learning model includes a first number of hidden dimensions, first layers of the first number of layers each include a first number of attention heads, The second deep learning model includes a second number of hidden dimensions, second layers of the second number of layers each include a second number of attention heads, The multiple target parameters include a first parameter corresponding to multiple target hidden dimensions, and include a first parameter in at least one target attention head, wherein the multiple target hidden dimensions are selected from a first hidden dimension of the first number of hidden dimensions based on the second number of hidden dimensions, and the at least one target attention head is selected from a first attention head of the first number of attention heads based on the second number of attention heads.

6. The method according to claim 5, wherein: The at least one target layer, the at least one target intermediate dimension, the multiple target hidden dimensions and / or the at least one target attention head are obtained by random selection.

7. The method according to any one of claims 1 to 6, wherein: The first deep learning model is a pre-trained large model.

8. A method for reasoning of a deep learning model, wherein: The first deep learning model and the second deep learning model are obtained by training using the method according to any one of claims 1 to 7, the method comprising: Using the second deep learning model, sequentially generate a plurality of prediction tokens; generating, using the first deep learning model, confidence scores for each of the plurality of prediction tokens based on the plurality of prediction tokens; and Based on the generation order of the multiple prediction tokens, verifying the multiple prediction tokens to obtain an inference result includes: In response to determining that the confidence of the currently verified prediction token is lower than a preset threshold, generating a correction token at the position of the prediction token using the first deep learning model to replace the prediction token as the verified prediction token; In response to determining that a preset token generation condition is satisfied, using the second deep learning model, based on the correction token, sequentially regenerates prediction tokens from the next position of the correction token, and using the first deep learning model to generate confidence of the regenerated prediction tokens for verification; and Based on the verified prediction symbol, the inference result is obtained.

9. The method according to claim 8, wherein: Based on the generation order of the multiple prediction tokens, verifying the multiple prediction tokens to obtain the inference result includes: In response to determining that the confidence level of the currently verified prediction token is not lower than a preset threshold, the prediction token is retained as a verified prediction token.

10. The method according to claim 8 or 9, wherein: The preset token generation condition includes that the number of generated tokens is less than a preset number.

11. The method according to claim 8 or 9, wherein: The preset token generation condition includes that the correction token indicates that token generation is not completed.

12. A training device for a deep learning model, wherein: The first deep learning model includes a plurality of first parameters, the second deep learning model includes a plurality of second parameters, the plurality of second parameters are initialized to parameter values ​​of a plurality of target parameters among the plurality of first parameters, the number of the plurality of second parameters is less than the plurality of first parameters, the first deep learning model and the second deep learning model are both configured to perform at least one of the following tasks: a text processing task, an image processing task, and a speech processing task, the apparatus includes: A determining unit, configured to determine target losses of the first deep learning model and the second deep learning model; A parameter adjustment unit is configured to adjust the parameter values ​​of the plurality of first parameters and the plurality of second parameters based on the target loss to obtain the trained first deep learning model and the second deep learning model, including: A first parameter adjustment subunit is configured to, in response to determining that the target loss indicates that the parameter values ​​of at least a portion of the multiple target parameters included in the first deep learning model need to be adjusted, synchronously adjust the parameter value of a second parameter included in the second deep learning model corresponding to the at least a portion of the target parameters; and The second parameter adjustment subunit is configured to synchronously adjust the parameter value of the target parameter corresponding to the at least part of the second parameters included in the first deep learning model in response to determining that the target loss indicates that the parameter value of at least part of the multiple second parameters included in the second deep learning model needs to be adjusted.

13. The device according to claim 12, wherein: The determining unit comprises: A first determining subunit is configured to determine a first loss of the first deep learning model for a first sample; A second determining subunit is configured to determine a second loss of the second deep learning model for a second sample; and The third determining subunit is configured to determine the target loss based on the first loss and the second loss.

14. The device according to claim 13, wherein: The first sample and the second sample are the same.

15. The device according to claim 12, wherein: The first deep learning model includes a first number of first layers, each of the first number of first layers includes a first number of first intermediate dimensions, The second deep learning model includes a second number of second layers, and each of the plurality of second layers includes a second number of second intermediate dimensions, wherein the second number of layers is less than the first number of layers, and the second number of intermediate dimensions is less than the first number of intermediate dimensions, The multiple target parameters include a first parameter in at least one target intermediate dimension of each of the at least one target layers, wherein the at least one target layer is selected from the first layer of the first number of layers based on the second number of layers, and the at least one target intermediate dimension is selected from the first intermediate dimension of the first number of intermediate dimensions based on the second number of intermediate dimensions.

16. The device according to claim 15, wherein: The first deep learning model and the second deep learning model are based on a Transformer structure or a Transformer-like structure, The first deep learning model includes a first number of hidden dimensions, first layers of the first number of layers each include a first number of attention heads, The second deep learning model includes a second number of hidden dimensions, second layers of the second number of layers each include a second number of attention heads, The multiple target parameters include a first parameter corresponding to multiple target hidden dimensions, and include a first parameter in at least one target attention head, wherein the multiple target hidden dimensions are selected from a first hidden dimension of the first number of hidden dimensions based on the second number of hidden dimensions, and the at least one target attention head is selected from a first attention head of the first number of attention heads based on the second number of attention heads.

17. The device according to claim 16, wherein: The at least one target layer, the at least one target intermediate dimension, the multiple target hidden dimensions and / or the at least one target attention head are obtained by random selection.

18. The device according to any one of claims 12 to 17, wherein: The first deep learning model is a pre-trained large model.

19. An inference device for a deep learning model, wherein: The first deep learning model and the second deep learning model are obtained by training using the apparatus according to any one of claims 12 to 18, wherein the apparatus comprises: A first generating unit is configured to sequentially generate a plurality of prediction tokens using the second deep learning model; A second generating unit is configured to generate confidences of the plurality of prediction tokens based on the plurality of prediction tokens by using the first deep learning model; and A verification unit is configured to verify the multiple prediction tokens based on the generation order of the multiple prediction tokens to obtain an inference result, including: a replacement subunit, configured to generate a correction token at the position of the prediction token using the first deep learning model in response to determining that the confidence of the currently verified prediction token is lower than a preset threshold, so as to replace the prediction token as the verified prediction token; a generating subunit configured to, in response to determining that a preset token generation condition is satisfied, regenerate prediction tokens in sequence from the next position of the correction token based on the correction token using the second deep learning model, and generate confidences of the regenerated prediction tokens using the first deep learning model for verification; and The reasoning subunit is configured to obtain the reasoning result based on the verified prediction token.

20. The device according to claim 19, wherein The verification unit comprises: The retaining subunit is configured to retain the prediction token as a verified prediction token in response to determining that the confidence of the currently verified prediction token is not lower than a preset threshold.

21. The device according to claim 19 or 20, wherein: The preset token generation condition includes that the number of generated tokens is less than a preset number.

22. The device according to claim 19 or 20, wherein: The preset token generation condition includes that the correction token indicates that token generation is not completed.

23. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; wherein The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 11.

24. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-11.

25. A computer program product comprising a computer program, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.

Citation Information

Patent Citations

  • Data processing method and training method and device of data processing model

    CN114707591A

  • Target detection model training method and device, target detection method and device and electronic equipment

    CN115082740A