WO2022022274A1 - 一种模型训练方法及装置 - Google Patents

一种模型训练方法及装置 Download PDF

Info

Publication number
WO2022022274A1
WO2022022274A1 PCT/CN2021/105962 CN2021105962W WO2022022274A1 WO 2022022274 A1 WO2022022274 A1 WO 2022022274A1 CN 2021105962 W CN2021105962 W CN 2021105962W WO 2022022274 A1 WO2022022274 A1 WO 2022022274A1
Authority
WO
WIPO (PCT)
Prior art keywords
model
sub
trained
gradient
updated
Prior art date
Application number
PCT/CN2021/105962
Other languages
English (en)
French (fr)
Inventor
廖亿
蒋欣
陈晓
钱莉
刘群
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP21849491.2A priority Critical patent/EP4181020A4/en
Publication of WO2022022274A1 publication Critical patent/WO2022022274A1/zh
Priority to US18/161,620 priority patent/US20230177410A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/0495Quantised networks; Sparse networks; Compressed networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • G06N20/20Ensemble learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/048Activation functions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/082Learning methods modifying the architecture, e.g. adding, deleting or silencing nodes or connections
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/096Transfer learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/098Distributed learning, e.g. federated learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/0464Convolutional networks [CNN, ConvNet]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/06Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
    • G06N3/063Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means

Definitions

  • the present application relates to the field of artificial intelligence, and in particular, to a model training method and device.
  • Artificial intelligence is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
  • artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that responds in a similar way to human intelligence.
  • Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making.
  • Federated learning systems train machine learning models based on data generated from the interactions of a large number of users with their devices (e.g., smartphones, etc.) without the need to fetch data from the devices. For example, each loop selects a subset of online devices, and the current version of the machine learning model is sent to those selected devices. Each of those selected devices is tasked with computing updates to the model using their own locally generated and locally stored data. Model updates are then sent back to the server, averaged, and applied to the server's model to produce a new version of the model for the user's next iteration (eg, the next subset of devices).
  • Federated learning is divided into two steps: model distribution and model upload.
  • the central node sends the model to the terminal device through the network; each terminal device uses the local data to calculate the gradient of the model; each distributed node encrypts the gradient and uploads it to the central node;
  • the central node summarizes the gradients of each terminal distributed node, and uses the parameter averaging algorithm to update the parameters of the central node model.
  • the existing federated learning technology requires the model of the central node and each distributed node to be isomorphic.
  • terminal devices such as mobile phones cannot operate large models of the same scale as the central node due to the limitation of data processing capabilities.
  • the present application provides a model training method, the method comprising:
  • the first sub-model is obtained by compressing the model to be trained
  • Model training is performed on the to-be-trained model based on at least the first gradient to obtain an updated to-be-trained model.
  • An embodiment of the present application provides a model training method, including: sending a first sub-model to a first device; wherein the first sub-model is obtained by compressing a model to be trained; receiving the first sub-model sent by the first device a gradient, the first gradient is obtained when the first device trains the first sub-model; at least based on the first gradient, model training is performed on the to-be-trained model to obtain an updated to-be-trained model Model.
  • the server compresses the model to be trained and sends it to the terminal device, so that the terminal device does not need to train a large model of the same scale as the server.
  • the storage resources required for storing the first sub-model are less than the storage resources required for storing the model to be trained.
  • the computing resources required for running the first sub-model are less than the computing resources required for running the model to be trained.
  • the computing resources include at least one of the following: memory resources, video memory resources or CPU resources.
  • the first sub-model is obtained by performing at least one of the following processing methods on the model to be trained: pruning, knowledge distillation or quantization.
  • performing model training on the to-be-trained model based on at least the first gradient includes:
  • the first sub-model is trained to obtain an updated first sub-model
  • At least the updated first sub-model is used as the teacher model
  • the to-be-trained model is the student model
  • knowledge distillation is performed on the to-be-trained model to obtain the updated to-be-trained model.
  • the method further includes:
  • the data processing capability includes at least one of the following: usable storage resources or usable computing resources;
  • the first sub-model corresponding to the first device is acquired; wherein, the first mapping relationship includes the corresponding relationship between the data processing capability and the sub-model, and in the first mapping relationship, The data processing capability of the first device corresponds to the first sub-model.
  • the method further includes:
  • the second sub-model is obtained by compressing the model to be trained, and the second sub-model is different from the first sub-model;
  • the performing model training on the to-be-trained model based on at least the first gradient includes:
  • model training is performed on the to-be-trained model to obtain an updated to-be-trained model.
  • the data processing capabilities of the first device and the second device are different, and the data processing capabilities include at least one of the following: usable storage resources or usable computing resources.
  • the storage resources required for storing the first sub-model and the second sub-model are of different sizes.
  • the size of computing resources required for running the first sub-model and the second sub-model are different.
  • the second sub-model is obtained by performing at least one of the following processing methods on the model to be trained: pruning, knowledge distillation or quantization.
  • performing model training on the to-be-trained model based on the first gradient and the second gradient includes:
  • the first sub-model is trained to obtain an updated first sub-model
  • the second sub-model is trained to obtain an updated second sub-model
  • the to-be-trained model is the student model, and performing knowledge distillation on the to-be-trained model to obtain the updated to-be-trained model Model.
  • the present application provides a model training device, the device comprising:
  • a sending module configured to send the first sub-model to the first device; wherein, the first sub-model is obtained by compressing the model to be trained;
  • a receiving module configured to receive a first gradient sent by the first device, where the first gradient is obtained when the first device trains the first sub-model;
  • a model training module configured to perform model training on the to-be-trained model based on at least the first gradient to obtain an updated to-be-trained model.
  • the storage resources required for storing the first sub-model are less than the storage resources required for storing the model to be trained.
  • the computing resources required for running the first sub-model are less than the computing resources required for running the model to be trained.
  • the computing resources include at least one of the following: memory resources, video memory resources or CPU resources.
  • the first sub-model is obtained by performing at least one of the following processing methods on the model to be trained: pruning, knowledge distillation or quantization.
  • the model training module is configured to train the first sub-model based on the first gradient to obtain an updated first sub-model;
  • a sub-model is used as a teacher model, the model to be trained is a student model, and knowledge distillation is performed on the model to be trained to obtain an updated model to be trained.
  • the apparatus further includes:
  • an acquiring module configured to acquire the data processing capability of the first device, where the data processing capability includes at least one of the following: usable storage resources or usable computing resources; acquiring the first device based on a first mapping relationship The first sub-model corresponding to the device; wherein, the first mapping relationship includes the corresponding relationship between the data processing capability and the sub-model, and in the first mapping relationship, the data processing capability of the first device corresponds to the first submodel.
  • the sending module is configured to send the second sub-model to the second device; wherein the second sub-model is obtained by compressing the model to be trained, and the second sub-model is the same as the the first sub-models are different;
  • the receiving module is configured to receive a second gradient sent by the second device, where the second gradient is obtained when the second device trains the second sub-model;
  • the model training module is configured to perform model training on the to-be-trained model based on the first gradient and the second gradient to obtain an updated to-be-trained model.
  • the data processing capabilities of the first device and the second device are different, and the data processing capabilities include at least one of the following: usable storage resources or usable computing resources.
  • the storage resources required for storing the first sub-model and the second sub-model are of different sizes.
  • the size of computing resources required for running the first sub-model and the second sub-model are different.
  • the second sub-model is obtained by performing at least one of the following processing methods on the model to be trained: pruning, knowledge distillation or quantization.
  • the model training module is configured to train the first sub-model based on the first gradient to obtain an updated first sub-model; based on the second gradient, The second sub-model is trained to obtain an updated second sub-model; the updated first sub-model and the updated second sub-model are used as the teacher model, and the to-be-trained model is the student model , performing knowledge distillation on the to-be-trained model to obtain an updated to-be-trained model.
  • the present application provides a system, including a first device and a server; wherein,
  • the server configured to send the first sub-model to the first device; wherein, the first sub-model is obtained by compressing the model to be trained;
  • the first device for training the first sub-model to obtain a first gradient; sending the first gradient to the server;
  • the server is configured to perform model training on the to-be-trained model based on at least the first gradient to obtain an updated to-be-trained model.
  • the storage resources required for storing the first sub-model are less than the storage resources required for storing the model to be trained.
  • the computing resources required for running the first sub-model are less than the computing resources required for running the model to be trained.
  • the computing resources include at least one of the following: memory resources, video memory resources or CPU resources.
  • the first sub-model is obtained by performing at least one of the following processing methods on the model to be trained: pruning, knowledge distillation or quantization.
  • the server is configured to train the first sub-model based on the first gradient to obtain an updated first sub-model
  • At least the updated first sub-model is used as the teacher model
  • the to-be-trained model is the student model
  • knowledge distillation is performed on the to-be-trained model to obtain the updated to-be-trained model.
  • the server is configured to acquire the data processing capability of the first device, where the data processing capability includes at least one of the following: usable storage resources or usable computing resources;
  • the first sub-model corresponding to the first device is acquired; wherein, the first mapping relationship includes the corresponding relationship between the data processing capability and the sub-model, and in the first mapping relationship, The data processing capability of the first device corresponds to the first sub-model.
  • system further includes: a second device, and the server is configured to send a second sub-model to the second device; wherein the second sub-model is obtained by compressing the model to be trained , and the second sub-model is different from the first sub-model;
  • the second device is used for training the second sub-model to obtain a second gradient; sending the second gradient to the server;
  • the server configured to perform model training on the to-be-trained model based on at least the first gradient, including:
  • model training is performed on the to-be-trained model to obtain an updated to-be-trained model.
  • the data processing capabilities of the first device and the second device are different, and the data processing capabilities include at least one of the following: usable storage resources or usable computing resources are different.
  • the storage resources required for storing the first sub-model and the second sub-model are of different sizes.
  • the size of computing resources required for running the first sub-model and the second sub-model are different.
  • the second sub-model is obtained by performing at least one of the following processing methods on the model to be trained: pruning, knowledge distillation or quantization.
  • the server is configured to train the first sub-model based on the first gradient to obtain an updated first sub-model
  • the second sub-model is trained to obtain an updated second sub-model
  • the to-be-trained model is the student model, and performing knowledge distillation on the to-be-trained model to obtain the updated to-be-trained model Model.
  • an embodiment of the present application provides a data processing apparatus, which may include a memory, a processor, and a bus system, wherein the memory is used to store a program, and the processor is used to execute the program in the memory, so as to execute the above-mentioned first aspect and any optional method of the first aspect.
  • an embodiment of the present application provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when it runs on a computer, causes the computer to execute the first aspect or any one thereof. optional method.
  • an embodiment of the present application provides a computer program, which, when run on a computer, causes the computer to execute the first aspect and any optional method thereof.
  • the present application provides a chip system
  • the chip system includes a processor for supporting an execution device to implement the functions involved in the above aspects, for example, sending or processing data involved in the above methods; or, information .
  • the chip system further includes a memory for storing program instructions and data necessary for executing the device or training the device.
  • the chip system may be composed of chips, or may include chips and other discrete devices.
  • An embodiment of the present application provides a model training method, including: sending a first sub-model to a first device; wherein the first sub-model is obtained by compressing a model to be trained; receiving the first sub-model sent by the first device a gradient, the first gradient is obtained when the first device trains the first sub-model; at least based on the first gradient, model training is performed on the to-be-trained model to obtain an updated to-be-trained model Model.
  • the server compresses the model to be trained and sends it to the terminal device, so that the terminal device does not need to train a large model of the same scale as the server.
  • Fig. 1 is a kind of structural schematic diagram of artificial intelligence main frame
  • FIG. 2 is a schematic diagram of a computing system for performing model training in an embodiment of the present application
  • FIG. 3 is a schematic diagram of a system architecture provided by an embodiment of the present application.
  • FIG. 4 is a schematic architecture diagram of a model training method provided by an embodiment of the present application.
  • FIG. 5 is a schematic flowchart of a model training method provided by an embodiment of the present application.
  • 6 and 7 are examples of a model training method provided by an embodiment of the application.
  • FIG. 8 is a schematic diagram of a data processing apparatus provided by an embodiment of the present application.
  • FIG. 9 is a schematic diagram of a system provided by an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of an execution device provided by an embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of a training device provided by an embodiment of the present application.
  • FIG. 12 is a schematic structural diagram of a chip provided by an embodiment of the present application.
  • Figure 1 shows a schematic structural diagram of the main frame of artificial intelligence.
  • the above-mentioned artificial intelligence theme framework is explained in two dimensions (vertical axis).
  • the "intelligent information chain” reflects a series of processes from data acquisition to processing. For example, it can be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output. In this process, data has gone through the process of "data-information-knowledge-wisdom".
  • the "IT value chain” reflects the value brought by artificial intelligence to the information technology industry from the underlying infrastructure of human intelligence, information (providing and processing technology implementation) to the industrial ecological process of the system.
  • the infrastructure provides computing power support for artificial intelligence systems, realizes communication with the outside world, and supports through the basic platform. Communication with the outside world through sensors; computing power is provided by smart chips (hardware acceleration chips such as CPU, NPU, GPU, ASIC, FPGA); the basic platform includes distributed computing framework and network-related platform guarantee and support, which can include cloud storage and computing, interconnection networks, etc. For example, sensors communicate with external parties to obtain data, and these data are provided to the intelligent chips in the distributed computing system provided by the basic platform for calculation.
  • smart chips hardware acceleration chips such as CPU, NPU, GPU, ASIC, FPGA
  • the basic platform includes distributed computing framework and network-related platform guarantee and support, which can include cloud storage and computing, interconnection networks, etc. For example, sensors communicate with external parties to obtain data, and these data are provided to the intelligent chips in the distributed computing system provided by the basic platform for calculation.
  • the data on the upper layer of the infrastructure is used to represent the data sources in the field of artificial intelligence.
  • the data involves graphics, images, voice, and text, as well as IoT data from traditional devices, including business data from existing systems and sensory data such as force, displacement, liquid level, temperature, and humidity.
  • Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making, etc.
  • machine learning and deep learning can perform symbolic and formalized intelligent information modeling, extraction, preprocessing, training, etc. on data.
  • Reasoning refers to the process of simulating human's intelligent reasoning method in a computer or intelligent system, using formalized information to carry out machine thinking and solving problems according to the reasoning control strategy, and the typical function is search and matching.
  • Decision-making refers to the process of making decisions after intelligent information is reasoned, usually providing functions such as classification, sorting, and prediction.
  • some general capabilities can be formed based on the results of data processing, such as algorithms or a general system, such as translation, text analysis, computer vision processing, speech recognition, image identification, etc.
  • Intelligent products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall solution of artificial intelligence, and the productization of intelligent information decision-making to achieve landing applications. Its application areas mainly include: intelligent terminals, intelligent transportation, Smart healthcare, autonomous driving, safe city, etc.
  • FIG. 2 is a schematic diagram of a computing system for performing model training in an embodiment of the present application.
  • the computing system includes a terminal device 102 (which may be referred to as a first device and a second device hereinafter) and a server 130 (which may also be referred to as a central node) communicatively coupled through a network.
  • the terminal device 102 may be any type of computing device, such as, for example, a personal computing device (eg, a laptop or desktop computer), a mobile computing device (eg, a smartphone or tablet), a game console or a controller , wearable computing device, embedded computing device or any other type of computing device.
  • Terminal device 102 may include processor 112 and memory 114 .
  • Processor 112 may be any suitable processing device (eg, processor core, microprocessor, application specific integrated circuit (ASIC), field programmable gate array (FPGA), controller , microcontroller, etc.).
  • the memory 114 may include, but is not limited to, a random access memory (Random Access Memory, RAM), a read-only memory (Read-Only Memory, ROM), an erasable programmable read-only memory (Erasable Programmable Read Only Memory, EPROM), Or portable read-only memory (Compact Disc Read-Only Memory, CD-ROM).
  • Memory 114 may store data 116 and instructions 118 that are executed by processor 112 to cause end device 102 to perform operations.
  • memory 114 may store one or more models 120 .
  • model 120 may be or may additionally include various machine learning models, such as neural networks (eg, deep neural networks) or other types of machine learning models, including nonlinear models and/or linear models.
  • Neural networks may include feedforward neural networks, recurrent neural networks (eg, long short-term memory recurrent neural networks), convolutional neural networks, or other forms of neural networks.
  • one or more models 120 may be received from server 130 over a network, stored in memory 114, and then used or otherwise implemented by one or more processors 112.
  • Terminal device 102 may also include one or more user input components 122 that receive user input.
  • user input component 122 may be a touch-sensitive component (e.g., a touch-sensitive display screen or touchpad) that is sensitive to the touch of a user input object (e.g., a finger or a stylus).
  • Touch-sensitive components can be used to implement a virtual keyboard.
  • Other example user input components include microphones, traditional keyboards, or other means by which the user may provide user input.
  • the terminal device 102 may further include a communication interface 123, the terminal device 102 may be communicatively connected to the server 130 through the communication interface 123, the server 130 may include a communication interface 133, and the terminal device 102 may be communicated and connected to the communication interface 133 of the server 130 through the communication interface 123, In this way, data interaction between the terminal device 102 and the server 130 is realized.
  • Server 130 may include processor 132 and memory 134 .
  • the processor 132 may be any suitable processing device (eg, a processor core, a microprocessor, an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), controller, microcontroller, etc.).
  • the memory 134 may include, but is not limited to, a random access memory (Random Access Memory, RAM), a read-only memory (Read-Only Memory, ROM), an erasable programmable read-only memory (Erasable Programmable Read Only Memory, EPROM), Or portable read-only memory (Compact Disc Read-Only Memory, CD-ROM).
  • Memory 134 may store data 136 and instructions 138 that are executed by processor 132 to cause server 130 to perform operations.
  • memory 134 may store one or more machine learning models 140 .
  • model 140 may be, or may otherwise include, various machine learning models.
  • Example machine learning models include neural networks or other multi-layer nonlinear models.
  • Example neural networks include feedforward neural networks, deep neural networks, recurrent neural networks, and convolutional neural networks.
  • FIG. 3 is a schematic diagram of the architecture of a system 100 provided by an embodiment of the present application.
  • the execution device 110 is configured with an input/output (I/O) interface 112, which is used for data interaction with external devices.
  • I/O input/output
  • the user may input data to the I/O interface 112 through the client device 140, and the input data may include, in this embodiment of the present application, various tasks to be scheduled, callable resources, and other parameters.
  • the execution device 110 may call the data storage system 150
  • the data, codes, etc. in the corresponding processing can also be stored in the data storage system 150 .
  • the I/O interface 112 returns the processing results to the client device 140 for provision to the user.
  • the training device 120 can generate corresponding target models/rules based on different training data for different goals or tasks, and the corresponding target models/rules can be used to achieve the above-mentioned goals or complete the above-mentioned tasks. , which provides the user with the desired result.
  • the user can manually specify input data, which can be operated through the interface provided by the I/O interface 112 .
  • the client device 140 can automatically send the input data to the I/O interface 112 . If the user's authorization is required to request the client device 140 to automatically send the input data, the user can set the corresponding permission in the client device 140 .
  • the user can view the result output by the execution device 110 on the client device 140, and the specific presentation form can be a specific manner such as display, sound, and action.
  • the client device 140 can also be used as a data collection terminal to collect the input data of the input I/O interface 112 and the output result of the output I/O interface 112 as new sample data as shown in the figure, and store them in the database 130 .
  • the I/O interface 112 directly uses the input data input into the I/O interface 112 and the output result of the output I/O interface 112 as shown in the figure as a new sample The data is stored in database 130 .
  • FIG. 3 is only a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationship among the devices, devices, modules, etc. shown in the figure does not constitute any limitation.
  • the data The storage system 150 is an external memory relative to the execution device 110 , and in other cases, the data storage system 150 may also be placed in the execution device 110 .
  • the neural network can be obtained by training according to the training device 120 .
  • An embodiment of the present application also provides a chip, where the chip includes a neural network processor NPU.
  • the chip can be set in the execution device 110 as shown in FIG. 3 to complete the calculation work of the calculation module 111 .
  • the chip can also be set in the training device 120 as shown in FIG. 3 to complete the training work of the training device 120 and output the target model/rule.
  • the neural network processor NPU is mounted on the main central processing unit (CPU) (host CPU) as a co-processor, and tasks are allocated by the main CPU.
  • the core part of the NPU is an arithmetic circuit, and the controller controls the arithmetic circuit to extract the data in the memory (weight memory or input memory) and perform operations.
  • the arithmetic circuit includes multiple processing units (process engines, PEs).
  • the arithmetic circuit is a two-dimensional systolic array.
  • the arithmetic circuit may also be a one-dimensional systolic array or other electronic circuit capable of performing mathematical operations such as multiplication and addition.
  • the arithmetic circuit is a general-purpose matrix processor.
  • the operation circuit fetches the data corresponding to the matrix B from the weight memory, and buffers it on each PE in the operation circuit.
  • the arithmetic circuit fetches the data of matrix A from the input memory and performs matrix operation on matrix B, and stores the partial result or final result of the matrix in an accumulator.
  • the vector calculation unit can further process the output of the arithmetic circuit, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison and so on.
  • the vector computing unit can be used for network computation of non-convolutional/non-FC layers in neural networks, such as pooling, batch normalization, local response normalization, etc.
  • the vector computation unit can store the processed output vector to a unified buffer.
  • the vector computing unit may apply a nonlinear function to the output of the arithmetic circuit, such as a vector of accumulated values, to generate activation values.
  • the vector computation unit generates normalized values, merged values, or both.
  • the vector of processed outputs can be used as activation input to an operational circuit, such as for use in subsequent layers in a neural network.
  • Unified memory is used to store input data as well as output data.
  • the weight data directly transfers the input data in the external memory to the input memory and/or the unified memory through the direct memory access controller (DMAC), stores the weight data in the external memory into the weight memory, and transfers the unified memory store the data in the external memory.
  • DMAC direct memory access controller
  • the bus interface unit (BIU) is used to realize the interaction between the main CPU, the DMAC and the instruction fetch memory through the bus.
  • the instruction fetch buffer connected to the controller is used to store the instructions used by the controller
  • the controller is used for invoking the instructions cached in the memory to realize and control the working process of the operation accelerator.
  • the unified memory, input memory, weight memory and instruction fetch memory are all on-chip memories
  • the external memory is the memory outside the NPU
  • the external memory can be double data rate synchronous dynamic random access memory (double data rate synchronous dynamic random access memory, DDR SDRAM), high bandwidth memory (HBM), or other readable and writable memory.
  • a neural network can be composed of neural units, and a neural unit can refer to an operation unit that takes xs and intercept 1 as inputs, and the output of the operation unit can be:
  • s 1, 2,...n, n is a natural number greater than 1
  • Ws is the weight of xs
  • b is the bias of the neural unit.
  • f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into an output signal. The output signal of this activation function can be used as the input of the next convolutional layer.
  • the activation function can be a sigmoid function.
  • a neural network is a network formed by connecting many of the above single neural units together, that is, the output of one neural unit can be the input of another neural unit.
  • the input of each neural unit can be connected with the local receptive field of the previous layer to extract the features of the local receptive field, and the local receptive field can be an area composed of several neural units.
  • the work of each layer in a neural network can be expressed mathematically To describe: from the physical level, the work of each layer in the neural network can be understood as completing the transformation from the input space to the output space (that is, the row space of the matrix to the column space) through five operations on the input space (set of input vectors). ), the five operations include: 1. Dimension raising/lowering; 2. Enlarging/reducing; 3. Rotation; 4. Translation; 5. "Bending”. Among them, the operations of 1, 2, and 3 are determined by Complete, the operation of 4 is completed by +b, and the operation of 5 is realized by a().
  • W is the weight vector, and each value in the vector represents the weight value of a neuron in the neural network of this layer.
  • the vector W determines the space transformation from the input space to the output space described above, that is, the weight W of each layer controls how the space is transformed.
  • the purpose of training the neural network is to finally obtain the weight matrix of all layers of the trained neural network (the weight matrix formed by the vectors W of many layers). Therefore, the training process of the neural network is essentially learning the way to control the spatial transformation, and more specifically, learning the weight matrix.
  • the neural network can use the error back propagation (BP) algorithm to correct the size of the parameters in the initial neural network model during the training process, so that the reconstruction error loss of the neural network model becomes smaller and smaller.
  • BP error back propagation
  • the input signal is passed forward until the output will generate error loss, and the parameters in the initial neural network model are updated by back-propagating the error loss information, so as to make the error loss converge.
  • the back-propagation algorithm is a back-propagation movement dominated by error loss, aiming to obtain the parameters of the optimal neural network model, such as the weight matrix.
  • FIG. 4 is a schematic architecture diagram of a model training method provided by an embodiment of the present application.
  • the architecture provided by an embodiment of the present application includes: a cloud-side central node, which may be, for example, a cloud-side server.
  • A1, A2, ... are distributed nodes of type A, such as mobile phone products held by users.
  • B1, B2, ... are distributed nodes of type B, such as personal computers held by users.
  • the administrators of the distributed nodes such as users of mobile phones and computers
  • the administrators of the distributed nodes voluntarily share the data generated during the daily use of the device under the condition of privacy protection, and add them to the model training plan.
  • the device becomes a distributed node in the architecture.
  • the system in this embodiment may also include more types of distributed nodes, such as smart watches and so on.
  • distributed nodes do not upload data to the central node, but only save data locally.
  • the distributed nodes are connected with the cloud server through a communication network.
  • the cloud-side central node can run large models, while each distributed node can only run small models due to hardware capabilities, and A and B can have different data processing capabilities.
  • FIG. 5 is a schematic flowchart of a model training method provided by an embodiment of the present application.
  • the model training method provided by the embodiment of the present application includes:
  • the server sends a first sub-model to a first device, wherein the first sub-model is obtained by compressing the model to be trained.
  • the server (also referred to as a central node or a cloud-side training device) may send the first sub-model to the first device, where the first sub-model is obtained by compressing the model to be trained.
  • the first device may be a terminal device, such as the distributed nodes (A1, A2, B1, B2) shown in FIG. 4 .
  • the server may obtain the model to be trained, the model to be trained may be the model training object of subsequent federated learning, and the model to be trained may include a neural network or other multi-layer nonlinear models, for example, the neural network may include a feedforward neural network Networks, Deep Neural Networks, Recurrent Neural Networks, and Convolutional Neural Networks.
  • the neural network may include a feedforward neural network Networks, Deep Neural Networks, Recurrent Neural Networks, and Convolutional Neural Networks.
  • the server may compress the to-be-trained model to obtain the first sub-model.
  • the first sub-model may be obtained by performing at least one of the following processing methods on the model to be trained: pruning, knowledge distillation or quantization.
  • pruning in the weight matrix of the neural network, setting some elements to invalid values is the pruning operation.
  • elements that require pruning can be set to zero.
  • the weight value in the weight matrix whose absolute value is less than or equal to a certain threshold is set to zero.
  • knowledge distillation and quantification knowledge distillation and quantification methods provided in the prior art can be used.
  • the first sub-model and the to-be-trained model may satisfy at least one of the following characteristics: the storage resources required for storing the first sub-model are smaller than the storage resources required for storing the to-be-trained model, and running the first sub-model
  • the computing resources required for the model are smaller than the computing resources required for running the model to be trained, wherein the computing resources may include at least one of the following: memory resources, video memory resources or CPU resources.
  • the storage resources required to store the first sub-model are less than the storage resources required to store the model to be trained, and the storage resources can be understood as the size of the storage space; for example, the terminal device stores all the first sub-models.
  • the required storage space is 200MB, and the storage space required to store the model to be trained is 1GB.
  • the computing resources required for running the first sub-model are less than the computing resources required for running the model to be trained; the computing resources may include at least one of the following: memory resources, video memory resources Or CPU resources; it should be noted that the required computing resources can refer to the peak computing resources required to run the model, such as peak memory usage, peak video memory usage, or peak CPU usage.
  • the server may select the first sub-model with reference to the data processing capability of the first device, so that the first device has sufficient resources to run the first sub-model; in one implementation, the server may obtain the The data processing capability of the first device, where the data processing capability includes at least one of the following: usable storage resources or usable computing resources, and the server can obtain the first subclass corresponding to the first device based on the first mapping relationship model; wherein the first mapping relationship includes a corresponding relationship between data processing capabilities and sub-models, and in the first mapping relationship, the data processing capabilities of the first device correspond to the first sub-model .
  • the data processing capability of the first device may be related to available computing resources. In one implementation, the data processing capability of the first device may be related to available computing resources. In one implementation, The data processing capability of the first device may be related to available computing resources and available computing resources.
  • the data processing capability of the first device may be a parameter value, and the parameter value may indicate the data processing capability of the device.
  • the terminal device may be based on a system on chip (SOC) model, a graphics processor (graphics processing unit, GPU) model, an embedded neural-network processing unit (neural-network processing unit) of the first device,
  • SOC system on chip
  • GPU graphics processor
  • NPU embedded neural-network processing unit
  • the server may maintain a data processing capability calculation function, the input is the above-mentioned SOC model, GPU model, NPU model, storage space size, etc., and the output is the calculated data processing capability.
  • the server may acquire the first sub-model corresponding to the first device based on a first mapping relationship, where the first mapping relationship may be a data processing capability interval-model mapping table, and each data processing capability interval Corresponding to a model, for example, the data processing capability range is 0 to 100 points, and the data processing capability range is 0 to 10, 10 to 20, 20 to 30, ..., 90 to 100. Each range is mapped to a model. .
  • the server may acquire the data processing capability of the first device, and determine the interval where the data processing capability of the first device is located from the first mapping relationship, where the interval where the data processing capability of the first device is located corresponds to in the first submodel.
  • the hardware capability information related to the first device such as the above-mentioned SOC model, GPU model, NPU model, storage space size, etc.
  • the first device may send a device registration request to the server. , and carry the above hardware capability information.
  • the server may also send a second sub-model to the second device; wherein, the second sub-model is obtained by compressing the model to be trained, and the second sub-model is different from the first sub-model; specifically Yes, the storage resources required for storing the first sub-model and the second sub-model are of different sizes and/or the computing resources required for running the first sub-model and the second sub-model are different in size.
  • the second sub-model is obtained by performing at least one of the following processing methods on the model to be trained: pruning, knowledge distillation or quantization.
  • the server may deliver different models for devices with different data processing capabilities.
  • the data processing capabilities of the second device and the first device are different, and the data processing capabilities include at least one of the following: Available storage resources or available computing resources, correspondingly, the server can deliver the first sub-model to the first device, and deliver the second sub-model to the second device.
  • the second sub-model and the first sub-model For example, the storage resources required for storing the first sub-model and the second sub-model are different in size and/or the computing resources required for running the first sub-model and the second sub-model are different in size.
  • the terminal device on the user side can send a device registration request to the server, and carry hardware capability information (such as the SOC model, GPU model, NPU model, storage model in the above embodiment) space size and other hardware capability information).
  • hardware capability information such as the SOC model, GPU model, NPU model, storage model in the above embodiment
  • the server can obtain the hardware capability information of the terminal device, and map the terminal device to a specific group based on the hardware capability information of the terminal device.
  • Different terminal groups correspond to different terminal hardware capabilities, and each group corresponds to a compressed model (for example, In the above-mentioned embodiment, the first device corresponds to the first sub-model, and the second device corresponds to the second sub-model).
  • the server may establish an association relationship between the ID of the terminal device and the corresponding group ID (for example, in the above-mentioned embodiment) The association relationship between the ID of the terminal device and the corresponding group ID is established in the first mapping relationship in ).
  • the terminal device After the user generates enough data for training in the daily use of the terminal device, the terminal device sends a model download request (carrying the ID of the terminal device) to the server on the cloud side.
  • the server can send the model corresponding to the group ID to the terminal device through the network.
  • the server may distribute the compressed model TinyBERTi with a specific size for the original model BERT stored in the central server to the terminal device through the network.
  • the first device after receiving the first sub-model sent by the server, the first device can use local data to train the first sub-model, obtain the first gradient during the training process, and then upload the first gradient To the server, optionally, in order to protect information privacy during the transmission process, the first device may upload the encrypted first gradient to the server.
  • the second device can use local data to train the second sub-model, obtain the second gradient during the training process, and then upload the second gradient to the server,
  • the second device may upload the encrypted second gradient to the server.
  • the server may receive the first gradient sent by the first device. Similarly, the server may also receive the second gradient sent by the second device.
  • the server may perform model training on the to-be-trained model based on at least the first gradient, so as to obtain an updated to-be-trained model.
  • the server may train the first sub-model based on the first gradient to obtain an updated first sub-model; at least the updated first sub-model is used as the teacher model, and the to-be-trained
  • the model is a student model, and knowledge distillation is performed on the to-be-trained model to obtain an updated to-be-trained model.
  • the server may further train the second sub-model based on the second gradient to obtain an updated second sub-model;
  • the second sub-model is used as a teacher model, the model to be trained is a student model, and knowledge distillation is performed on the model to be trained to obtain an updated model to be trained.
  • the server may summarize the gradients uploaded by each type of terminal device by group, and update the corresponding small model by using the federated gradient averaging algorithm.
  • FIG. 6 and FIG. 7 are examples of a model training method provided by the embodiment of the application, wherein the model compression module of the server can compress the to-be-trained model into a first sub-model and a second sub-model , and then the server can deliver the first sub-model to node A1, node A2 and node A3, and deliver the second sub-model to node B1, node B2 and node B3.
  • the gradients uploaded by node A1, node A2 and node A3 are updated by the federated gradient averaging method to update the parameters of the first sub-model
  • the gradients uploaded by node B1, node B2 and node B3 are updated by the federated gradient averaging method of the second sub-model. parameters, and adopts the method of multi-model fusion.
  • the server uses various types of small models to fuse and update the large model of the central node. For example, the first sub-model and the second sub-model are merged into a model to be trained. The way of fusion can be multi-teacher distillation.
  • the server may aggregate multiple updated compressed models ⁇ TinyBERTi_update ⁇ , adopt a multi-teacher distillation method, treat ⁇ TinyBERTi_update ⁇ as multiple teacher models, and obtain the student model BERT_update by distillation. Because the distillation process cannot use the user's end-side data, the data-free distillation method (Datafree Distillation) is used, or synthetic data is used for distillation, or general public data is used for distillation.
  • Datafree Distillation Datafree Distillation
  • An embodiment of the present application provides a model training method, including: sending a first sub-model to a first device; wherein the first sub-model is obtained by compressing a model to be trained; receiving the first sub-model sent by the first device a gradient, the first gradient is obtained when the first device trains the first sub-model; at least based on the first gradient, model training is performed on the to-be-trained model to obtain an updated to-be-trained model Model.
  • the server compresses the model to be trained and sends it to the terminal device, so that the terminal device does not need to train a large model of the same scale as the server.
  • the server may also send a second sub-model to the second device; wherein, the second sub-model is obtained by compressing the model to be trained, and the second sub-model is the same as the first sub-model different; receiving a second gradient sent by the second device, where the second gradient is obtained when the second device trains the second sub-model; and based on the first gradient and the second gradient, Perform model training on the to-be-trained model to obtain an updated to-be-trained model.
  • the server can select different models for different terminal devices and deliver them to the terminal devices.
  • FIG. 8 is a schematic diagram of a data processing device provided by the embodiment of the present application.
  • the data processing apparatus 800 provided by the embodiment includes:
  • a sending module 801 configured to send a first sub-model to a first device; wherein, the first sub-model is obtained by compressing the model to be trained;
  • a receiving module 802 configured to receive a first gradient sent by the first device, where the first gradient is obtained when the first device trains the first sub-model;
  • a model training module 803, configured to perform model training on the to-be-trained model based on at least the first gradient to obtain an updated to-be-trained model.
  • the storage resources required for storing the first sub-model are less than the storage resources required for storing the model to be trained.
  • the computing resources required for running the first sub-model are less than the computing resources required for running the model to be trained.
  • the computing resources include at least one of the following: memory resources, video memory resources or CPU resources.
  • the first sub-model is obtained by performing at least one of the following processing methods on the model to be trained: pruning, knowledge distillation or quantization.
  • the model training module is configured to train the first sub-model based on the first gradient to obtain an updated first sub-model;
  • a sub-model is used as a teacher model, the model to be trained is a student model, and knowledge distillation is performed on the model to be trained to obtain an updated model to be trained.
  • the apparatus further includes:
  • an acquiring module configured to acquire the data processing capability of the first device, where the data processing capability includes at least one of the following: usable storage resources or usable computing resources; acquiring the first device based on a first mapping relationship The first sub-model corresponding to the device; wherein, the first mapping relationship includes the corresponding relationship between the data processing capability and the sub-model, and in the first mapping relationship, the data processing capability of the first device corresponds to the first submodel.
  • the sending module is configured to send the second sub-model to the second device; wherein the second sub-model is obtained by compressing the model to be trained, and the second sub-model is the same as the the first sub-models are different;
  • the receiving module is configured to receive a second gradient sent by the second device, where the second gradient is obtained when the second device trains the second sub-model;
  • the model training module is configured to perform model training on the to-be-trained model based on the first gradient and the second gradient to obtain an updated to-be-trained model.
  • the data processing capabilities of the first device and the second device are different, and the data processing capabilities include at least one of the following: usable storage resources or usable computing resources.
  • the storage resources required for storing the first sub-model and the second sub-model are of different sizes.
  • the size of computing resources required for running the first sub-model and the second sub-model are different.
  • the second sub-model is obtained by performing at least one of the following processing methods on the model to be trained: pruning, knowledge distillation or quantization.
  • the model training module is configured to train the first sub-model based on the first gradient to obtain an updated first sub-model; based on the second gradient, The second sub-model is trained to obtain an updated second sub-model; the updated first sub-model and the updated second sub-model are used as the teacher model, and the to-be-trained model is the student model , performing knowledge distillation on the to-be-trained model to obtain an updated to-be-trained model.
  • FIG. 9 is a schematic diagram of a system provided by an embodiment of the present application.
  • a system 900 provided by an embodiment of the present application includes:
  • the first device 901 is configured to train the first sub-model to obtain a first gradient; send the first gradient to the server 902;
  • the server 902 is configured to perform model training on the to-be-trained model based on at least the first gradient, so as to obtain an updated to-be-trained model.
  • the storage resources required for storing the first sub-model are less than the storage resources required for storing the model to be trained.
  • the computing resources required for running the first sub-model are less than the computing resources required for running the model to be trained.
  • the computing resources include at least one of the following: memory resources, video memory resources or CPU resources.
  • the first sub-model is obtained by performing at least one of the following processing methods on the model to be trained: pruning, knowledge distillation or quantization.
  • the server 902 is configured to train the first sub-model based on the first gradient to obtain an updated first sub-model
  • At least the updated first sub-model is used as the teacher model
  • the to-be-trained model is the student model
  • knowledge distillation is performed on the to-be-trained model to obtain the updated to-be-trained model.
  • the server 902 is configured to acquire the data processing capability of the first device 901, where the data processing capability includes at least one of the following: usable storage resources or usable computing resources;
  • the first sub-model corresponding to the first device 901 is acquired; wherein, the first mapping relationship includes the corresponding relationship between the data processing capability and the sub-model, and in the first mapping relationship , the data processing capability of the first device 901 corresponds to the first sub-model.
  • the system further includes: a second device 903, and the server 902 is configured to send the second sub-model to the second device 903; wherein, the second sub-model is a model to be trained. obtained by compression, and the second sub-model is different from the first sub-model;
  • the second device 903 is configured to train the second sub-model to obtain a second gradient; send the second gradient to the server 902;
  • the server 902 configured to perform model training on the to-be-trained model based on at least the first gradient, includes:
  • model training is performed on the to-be-trained model to obtain an updated to-be-trained model.
  • the data processing capabilities of the first device 901 and the second device 903 are different, and the data processing capabilities include at least one of the following: usable storage resources or usable computing resources are different .
  • the storage resources required for storing the first sub-model and the second sub-model are of different sizes.
  • the size of computing resources required for running the first sub-model and the second sub-model are different.
  • the second sub-model is obtained by performing at least one of the following processing methods on the model to be trained: pruning, knowledge distillation or quantization.
  • the server 902 is configured to train the first sub-model based on the first gradient to obtain an updated first sub-model
  • the second sub-model is trained to obtain an updated second sub-model
  • the to-be-trained model is the student model, and performing knowledge distillation on the to-be-trained model to obtain the updated to-be-trained model Model.
  • FIG. 10 is a schematic structural diagram of the execution device provided by the embodiment of the present application. Smart wearable devices, servers, etc., are not limited here.
  • the data processing apparatus described in the embodiment corresponding to FIG. 10 may be deployed on the execution device 1000 to implement the data processing function in the embodiment corresponding to FIG. 10 .
  • the execution device 1000 includes: a receiver 1001, a transmitter 1002, a processor 1003, and a memory 1004 (wherein the number of processors 1003 in the execution device 1000 may be one or more, and one processor is taken as an example in FIG. 10 ) , wherein the processor 1003 may include an application processor 10031 and a communication processor 10032 .
  • the receiver 1001, the transmitter 1002, the processor 1003, and the memory 1004 may be connected by a bus or otherwise.
  • Memory 1004 may include read-only memory and random access memory, and provides instructions and data to processor 1003 .
  • a portion of memory 1004 may also include non-volatile random access memory (NVRAM).
  • NVRAM non-volatile random access memory
  • the memory 1004 stores processors and operation instructions, executable modules or data structures, or a subset thereof, or an extended set thereof, wherein the operation instructions may include various operation instructions for implementing various operations.
  • the processor 1003 controls the operation of the execution device.
  • various components of the execution device are coupled together through a bus system, where the bus system may include a power bus, a control bus, a status signal bus, and the like in addition to a data bus.
  • the various buses are referred to as bus systems in the figures.
  • the methods disclosed in the above embodiments of the present application may be applied to the processor 1003 or implemented by the processor 1003 .
  • the processor 1003 may be an integrated circuit chip, which has signal processing capability. In the implementation process, each step of the above-mentioned method can be completed by an integrated logic circuit of hardware in the processor 1003 or an instruction in the form of software.
  • the above-mentioned processor 1003 may be a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, and may further include an application specific integrated circuit (ASIC), a field programmable Field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • DSP digital signal processor
  • ASIC application specific integrated circuit
  • FPGA field programmable Field-programmable gate array
  • the processor 1003 may implement or execute the methods, steps, and logical block diagrams disclosed in the embodiments of this application.
  • a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the steps of the method disclosed in conjunction with the embodiments of the present application may be directly embodied as executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor.
  • the software modules may be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other storage media mature in the art.
  • the storage medium is located in the memory 1004, and the processor 1003 reads the information in the memory 1004, and completes the steps of the above method in combination with its hardware.
  • the receiver 1001 can be used to receive input numerical or character information, and generate signal input related to the relevant setting and function control of the execution device.
  • the transmitter 1002 can be used to output digital or character information through the first interface; the transmitter 1002 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 1002 can also include a display device such as a display screen .
  • the processor 1003 is configured to execute the method executed by the execution device in the embodiment corresponding to FIG. 5 .
  • FIG. 11 is a schematic structural diagram of the training device provided by the embodiment of the present application.
  • the training device 1100 may be deployed with the neural network described in the corresponding embodiment of FIG. 10
  • the network training device is used to realize the function of the neural network training device in the embodiment corresponding to FIG. 10 .
  • the training device 1100 is implemented by one or more servers, and the training device 1100 may vary greatly due to different configurations or performances.
  • CPUs central processing units
  • storage media 1130 eg, one or more
  • the memory 1132 and the storage medium 1130 may be short-term storage or persistent storage.
  • the program stored in the storage medium 1130 may include one or more modules (not shown in the figure), and each module may include a series of instructions to operate on the training device.
  • the central processing unit 1111 may be configured to communicate with the storage medium 1130 to execute a series of instruction operations in the storage medium 1130 on the training device 1100 .
  • the training device 1100 may also include one or more power supplies 1126, one or more wired or wireless network interfaces 1150, one or more input and output interfaces 1158; or, one or more operating systems 1141, such as Windows ServerTM, Mac OS XTM , UnixTM, LinuxTM, FreeBSDTM and so on.
  • operating systems 1141 such as Windows ServerTM, Mac OS XTM , UnixTM, LinuxTM, FreeBSDTM and so on.
  • the central processing unit 1111 is configured to execute the steps related to the training method in the foregoing embodiment.
  • Embodiments of the present application also provide a computer program product that, when running on a computer, causes the computer to perform the steps performed by the aforementioned execution device, or causes the computer to perform the steps performed by the aforementioned training device.
  • Embodiments of the present application further provide a computer-readable storage medium, where a program for performing signal processing is stored in the computer-readable storage medium, and when it runs on a computer, the computer executes the steps performed by the aforementioned execution device. , or, causing the computer to perform the steps as performed by the aforementioned training device.
  • the execution device, training device, or terminal device provided in this embodiment of the present application may specifically be a chip, and the chip includes: a processing unit and a communication unit, the processing unit may be, for example, a processor, and the communication unit may be, for example, an input/output interface, pins or circuits, etc.
  • the processing unit can execute the computer executable instructions stored in the storage unit, so that the chip in the execution device executes the data processing method described in the above embodiments, or the chip in the training device executes the data processing method described in the above embodiment.
  • the storage unit is a storage unit in the chip, such as a register, a cache, etc.
  • the storage unit may also be a storage unit located outside the chip in the wireless access device, such as only Read-only memory (ROM) or other types of static storage devices that can store static information and instructions, random access memory (RAM), etc.
  • ROM Read-only memory
  • RAM random access memory
  • FIG. 12 is a schematic structural diagram of a chip provided by an embodiment of the application.
  • the chip may be represented as a neural network processor NPU 1200, and the NPU 1200 is mounted as a co-processor to the main CPU (Host CPU), tasks are allocated by the Host CPU.
  • the core part of the NPU is the arithmetic circuit 1203, which is controlled by the controller 1204 to extract the matrix data in the memory and perform multiplication operations.
  • the arithmetic circuit 1203 includes multiple processing units (Process Engine, PE). In some implementations, arithmetic circuit 1203 is a two-dimensional systolic array. The arithmetic circuit 1203 may also be a one-dimensional systolic array or other electronic circuitry capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit 1203 is a general-purpose matrix processor.
  • the operation circuit fetches the data corresponding to the matrix B from the weight memory 1202 and buffers it on each PE in the operation circuit.
  • the arithmetic circuit fetches the data of matrix A and matrix B from the input memory 1201 to perform matrix operation, and stores the partial result or final result of the matrix in the accumulator 1208 .
  • Unified memory 1206 is used to store input data and output data.
  • the weight data is directly passed through the storage unit access controller (Direct Memory Access Controller, DMAC) 1205, and the DMAC is transferred to the weight memory 1202.
  • Input data is also moved to unified memory 1206 via the DMAC.
  • DMAC Direct Memory Access Controller
  • the BIU is the Bus Interface Unit, that is, the bus interface unit 1210, which is used for the interaction between the AXI bus and the DMAC and the instruction fetch buffer (Instruction Fetch Buffer, IFB) 1209.
  • IFB Instruction Fetch Buffer
  • the bus interface unit 1210 (Bus Interface Unit, BIU for short) is used for the instruction fetch memory 1209 to obtain instructions from the external memory, and also for the storage unit access controller 1205 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
  • the DMAC is mainly used to transfer the input data in the external memory DDR to the unified memory 1206 , the weight data to the weight memory 1202 , or the input data to the input memory 1201 .
  • the vector calculation unit 1207 includes a plurality of operation processing units, and further processes the output of the operation circuit 1203, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc., if necessary. It is mainly used for non-convolutional/fully connected layer network computation in neural networks, such as Batch Normalization, pixel-level summation, and upsampling of feature planes.
  • the vector computation unit 1207 can store the vector of the processed output to the unified memory 1206 .
  • the vector calculation unit 1207 can apply a linear function; or a nonlinear function to the output of the operation circuit 1203, such as performing linear interpolation on the feature plane extracted by the convolution layer, such as a vector of accumulated values, to generate activation values.
  • the vector computation unit 1207 generates normalized values, pixel-level summed values, or both.
  • the vector of processed outputs can be used as activation input to arithmetic circuitry 1203, eg, for use in subsequent layers in a neural network.
  • the instruction fetch memory (instruction fetch buffer) 1209 connected to the controller 1204 is used to store the instructions used by the controller 1204;
  • the unified memory 1206, the input memory 1201, the weight memory 1202 and the instruction fetch memory 1209 are all On-Chip memories. External memory is private to the NPU hardware architecture.
  • the processor mentioned in any one of the above may be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the above program.
  • the device embodiments described above are only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be A physical unit, which can be located in one place or distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general purpose computer, special purpose computer, computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be retrieved from a website, computer, training device, or data Transmission from the center to another website site, computer, training facility or data center via wired (eg coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (eg infrared, wireless, microwave, etc.) means.
  • wired eg coaxial cable, fiber optic, digital subscriber line (DSL)
  • wireless eg infrared, wireless, microwave, etc.
  • the computer-readable storage medium may be any available medium that can be stored by a computer, or a data storage device such as a training device, a data center, or the like that includes an integration of one or more available media.
  • the usable media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVD), or semiconductor media (e.g., Solid State Disk (SSD)), and the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • Biomedical Technology (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Medical Informatics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Machine Translation (AREA)
  • Image Analysis (AREA)

Abstract

一种模型训练方法,应用于人工智能领域,包括:向第一设备发送第一子模型(501),所述第一子模型为对待训练模型进行压缩得到的;接收所述第一设备发送的第一梯度(502),所述第一梯度为所述第一设备训练所述第一子模型时得到的;至少基于所述第一梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型(503)。所述方法中服务器将待训练模型进行压缩后下发至终端设备,使得终端设备不需要训练和服务器同等规模的大模型。

Description

一种模型训练方法及装置
本申请要求于2020年07月31日提交中国专利局、申请号为202010762709.0、发明名称为“一种模型训练方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及人工智能领域,尤其涉及一种模型训练方法及装置。
背景技术
人工智能(artificial intelligence,AI)是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。换句话说,人工智能是计算机科学的一个分支,它企图了解智能的实质,并生产出一种新的能以人类智能相似的方式作出反应的智能机器。人工智能也就是研究各种智能机器的设计原理与实现方法,使机器具有感知、推理与决策的功能。
联合学习(federated learning)系统基于从大量用户与其设备(例如,智能电话等)交互生成的数据来训练机器学习模型,而不需要从设备中取出数据。例如,每个循环都选择在线设备的子集,并且机器学习模型的当前版本被发送到那些选定的设备。那些选定的设备中的每一个被赋予使用它们自己本地生成并本地存储的数据来计算模型的更新的任务。然后,模型更新被发送回服务器、进行平均、并应用于服务器的模型,以便为用户的下一次迭代(例如,设备的下一个子集)产生模型的新版本。
联邦学习分为模型下发和模型上传两个步骤,中心节点将模型通过网络下发至终端设备;各终端设备利用本地数据计算模型的梯度;各分布式节点将梯度加密后上传至中心节点;中心节点汇总各终端分布式节点的梯度,并采用参数平均算法更新中心节点模型的参数。
现有的联邦学习技术要求中心节点和各分布式节点的模型同构,但是在一些场景中,终端设备如手机等等因为数据处理能力的限制,无法运算与中心节点同等规模的大模型。
发明内容
第一方面,本申请提供了一种模型训练方法,所述方法包括:
向第一设备发送第一子模型;其中,所述第一子模型为对待训练模型进行压缩得到的;
接收所述第一设备发送的第一梯度,所述第一梯度为所述第一设备训练所述第一子模型时得到的;
至少基于所述第一梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。
本申请实施例提供了一种模型训练方法,包括:向第一设备发送第一子模型;其中,所述第一子模型为对待训练模型进行压缩得到的;接收所述第一设备发送的第一梯度,所述第一梯度为所述第一设备训练所述第一子模型时得到的;至少基于所述第一梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。通过上述方式,服务器将待训练模型进行压缩后下发至终端设备,使得终端设备不需要训练和服务器同等规模的大模型。
在一种可能的实现中,存储所述第一子模型所需的存储资源小于存储所述待训练模型所需的存储资源。
在一种可能的实现中,运行所述第一子模型时所需的计算资源小于运行所述待训练模型时所需的计算资源。
在一种可能的实现中,所述计算资源至少包括如下的一种:内存资源、显存资源或CPU资源。
在一种可能的实现中,所述第一子模型为对待训练模型进行如下至少一种处理方式得到的:剪枝、知识蒸馏或量化。
在一种可能的实现中,所述至少基于所述第一梯度,对所述待训练模型进行模型训练,包括:
基于所述第一梯度,对所述第一子模型进行训练,得到更新后的第一子模型;
至少以所述更新后的第一子模型作为老师模型,所述待训练模型为学生模型,对所述待训练模型进行知识蒸馏,以得到更新后的待训练模型。
在一种可能的实现中,所述方法还包括:
获取所述第一设备的数据处理能力,所述数据处理能力包括以下至少一种:可使用的存储资源或可使用的计算资源;
基于第一映射关系,获取所述第一设备对应的第一子模型;其中,所述第一映射关系包括数据处理能力与子模型之间的对应关系,且在所述第一映射关系中,所述第一设备的数据处理能力对应于所述第一子模型。
在一种可能的实现中,所述方法还包括:
向第二设备发送第二子模型;其中,所述第二子模型为对待训练模型进行压缩得到的,且所述第二子模型与所述第一子模型不同;
接收所述第二设备发送的第二梯度,所述第二梯度为所述第二设备训练所述第二子模型时得到的;
所述至少基于所述第一梯度,对所述待训练模型进行模型训练,包括:
基于所述第一梯度和所述第二梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。
在一种可能的实现中,所述第一设备与所述第二设备的数据处理能力不同,所述数据处理能力包括以下至少一种:可使用的存储资源或可使用的计算资源。
在一种可能的实现中,存储所述第一子模型和所述第二子模型所需的存储资源大小不同。
在一种可能的实现中,运行所述第一子模型和所述第二子模型时所需的计算资源大小不同。
在一种可能的实现中,所述第二子模型为对待训练模型进行如下至少一种处理方式得到的:剪枝、知识蒸馏或量化。
在一种可能的实现中,所述基于所述第一梯度和所述第二梯度,对所述待训练模型进行模型训练,包括:
基于所述第一梯度,对所述第一子模型进行训练,得到更新后的第一子模型;
基于所述第二梯度,对所述第二子模型进行训练,得到更新后的第二子模型;
以所述更新后的第一子模型和所述更新后的第二子模型作为老师模型,所述待训练模型为学生模型,对所述待训练模型进行知识蒸馏,以得到更新后的待训练模型。
第二方面,本申请提供了一种模型训练装置,所述装置包括:
发送模块,用于向第一设备发送第一子模型;其中,所述第一子模型为对待训练模型进行压缩得到的;
接收模块,用于接收所述第一设备发送的第一梯度,所述第一梯度为所述第一设备训练所述第一子模型时得到的;
模型训练模块,用于至少基于所述第一梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。
在一种可能的实现中,存储所述第一子模型所需的存储资源小于存储所述待训练模型所需的存储资源。
在一种可能的实现中,运行所述第一子模型时所需的计算资源小于运行所述待训练模型时所需的计算资源。
在一种可能的实现中,所述计算资源至少包括如下的一种:内存资源、显存资源或CPU资源。
在一种可能的实现中,所述第一子模型为对待训练模型进行如下至少一种处理方式得到的:剪枝、知识蒸馏或量化。
在一种可能的实现中,所述模型训练模块,用于基于所述第一梯度,对所述第一子模 型进行训练,得到更新后的第一子模型;至少以所述更新后的第一子模型作为老师模型,所述待训练模型为学生模型,对所述待训练模型进行知识蒸馏,以得到更新后的待训练模型。
在一种可能的实现中,所述装置还包括:
获取模块,用于获取所述第一设备的数据处理能力,所述数据处理能力包括以下至少一种:可使用的存储资源或可使用的计算资源;基于第一映射关系,获取所述第一设备对应的第一子模型;其中,所述第一映射关系包括数据处理能力与子模型之间的对应关系,且在所述第一映射关系中,所述第一设备的数据处理能力对应于所述第一子模型。
在一种可能的实现中,所述发送模块,用于向第二设备发送第二子模型;其中,所述第二子模型为对待训练模型进行压缩得到的,且所述第二子模型与所述第一子模型不同;
所述接收模块,用于接收所述第二设备发送的第二梯度,所述第二梯度为所述第二设备训练所述第二子模型时得到的;
所述模型训练模块,用于基于所述第一梯度和所述第二梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。
在一种可能的实现中,所述第一设备与所述第二设备的数据处理能力不同,所述数据处理能力包括以下至少一种:可使用的存储资源或可使用的计算资源。
在一种可能的实现中,存储所述第一子模型和所述第二子模型所需的存储资源大小不同。
在一种可能的实现中,运行所述第一子模型和所述第二子模型时所需的计算资源大小不同。
在一种可能的实现中,所述第二子模型为对待训练模型进行如下至少一种处理方式得到的:剪枝、知识蒸馏或量化。
在一种可能的实现中,所述模型训练模块,用于基于所述第一梯度,对所述第一子模型进行训练,得到更新后的第一子模型;基于所述第二梯度,对所述第二子模型进行训练,得到更新后的第二子模型;以所述更新后的第一子模型和所述更新后的第二子模型作为老师模型,所述待训练模型为学生模型,对所述待训练模型进行知识蒸馏,以得到更新后的待训练模型。
第三方面,本申请提供了一种系统,包括第一设备和服务器;其中,
所述服务器,用于向所述第一设备发送第一子模型;其中,所述第一子模型为对待训练模型进行压缩得到的;
所述第一设备,用于训练所述第一子模型,以得到第一梯度;向所述服务器发送所述第一梯度;
所述服务器,用于至少基于所述第一梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。
在一种可能的实现中,存储所述第一子模型所需的存储资源小于存储所述待训练模型所需的存储资源。
在一种可能的实现中,运行所述第一子模型时所需的计算资源小于运行所述待训练模型时所需的计算资源。
在一种可能的实现中,所述计算资源至少包括如下的一种:内存资源、显存资源或CPU资源。
在一种可能的实现中,所述第一子模型为对待训练模型进行如下至少一种处理方式得到的:剪枝、知识蒸馏或量化。
在一种可能的实现中,所述服务器,用于基于所述第一梯度,对所述第一子模型进行训练,得到更新后的第一子模型;
至少以所述更新后的第一子模型作为老师模型,所述待训练模型为学生模型,对所述待训练模型进行知识蒸馏,以得到更新后的待训练模型。
在一种可能的实现中,所述服务器,用于获取所述第一设备的数据处理能力,所述数据处理能力包括以下至少一种:可使用的存储资源或可使用的计算资源;
基于第一映射关系,获取所述第一设备对应的第一子模型;其中,所述第一映射关系包括数据处理能力与子模型之间的对应关系,且在所述第一映射关系中,所述第一设备的数据处理能力对应于所述第一子模型。
在一种可能的实现中,所述系统还包括:第二设备,所述服务器,用于向第二设备发送第二子模型;其中,所述第二子模型为对待训练模型进行压缩得到的,且所述第二子模型与所述第一子模型不同;
所述第二设备用于训练所述第二子模型,以得到第二梯度;向所述服务器发送所述第二梯度;
所述服务器,用于所述至少基于所述第一梯度,对所述待训练模型进行模型训练,包括:
基于所述第一梯度和所述第二梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。
在一种可能的实现中,所述第一设备与所述第二设备的数据处理能力不同,所述数据处理能力包括以下至少一种:可使用的存储资源或可使用的计算资源不同。
在一种可能的实现中,存储所述第一子模型和所述第二子模型所需的存储资源大小不同。
在一种可能的实现中,运行所述第一子模型和所述第二子模型时所需的计算资源大小不同。
在一种可能的实现中,所述第二子模型为对待训练模型进行如下至少一种处理方式得到的:剪枝、知识蒸馏或量化。
在一种可能的实现中,所述服务器,用于基于所述第一梯度,对所述第一子模型进行训练,得到更新后的第一子模型;
基于所述第二梯度,对所述第二子模型进行训练,得到更新后的第二子模型;
以所述更新后的第一子模型和所述更新后的第二子模型作为老师模型,所述待训练模型为学生模型,对所述待训练模型进行知识蒸馏,以得到更新后的待训练模型。
第四方面,本申请实施例提供了一种数据处理装置,可以包括存储器、处理器以及总线系统,其中,存储器用于存储程序,处理器用于执行存储器中的程序,以执行如上述第一方面及第一方面任一可选的方法。
第五方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,当其在计算机上运行时,使得计算机执行上述第一方面或其任一可选的方法。
第六方面,本申请实施例提供了一种计算机程序,当其在计算机上运行时,使得计算机执行上述第一方面及其任一可选的方法。
第七方面,本申请提供了一种芯片系统,该芯片系统包括处理器,用于支持执行设备实现上述方面中所涉及的功能,例如,发送或处理上述方法中所涉及的数据;或,信息。在一种可能的设计中,所述芯片系统还包括存储器,所述存储器,用于保存执行设备或训练设备必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包括芯片和其他分立器件。
本申请实施例提供了一种模型训练方法,包括:向第一设备发送第一子模型;其中,所述第一子模型为对待训练模型进行压缩得到的;接收所述第一设备发送的第一梯度,所述第一梯度为所述第一设备训练所述第一子模型时得到的;至少基于所述第一梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。通过上述方式,服务器将待训练模型进行压缩后下发至终端设备,使得终端设备不需要训练和服务器同等规模的大模型。
附图说明
图1为人工智能主体框架的一种结构示意图;
图2为本申请实施例中执行模型训练的计算系统的示意;
图3是本申请实施例提供的一种系统架构的示意图;
图4为本申请实施例提供的一种模型训练方法的架构示意;
图5为本申请实施例提供的一种模型训练方法的流程示意;
图6和图7为本申请实施例提供的一种模型训练方法的示例;
图8为本申请实施例提供的一种数据处理装置的示意;
图9为本申请实施例提供的一种系统的示意;
图10为本申请实施例提供的执行设备的一种结构示意图;
图11是本申请实施例提供的训练设备一种结构示意图;
图12为本申请实施例提供的芯片的一种结构示意图。
具体实施方式
下面结合本发明实施例中的附图对本发明实施例进行描述。本发明的实施方式部分使用的术语仅用于对本发明的具体实施例进行解释,而非旨在限定本发明。
下面结合附图,对本申请的实施例进行描述。本领域普通技术人员可知,随着技术的发展和新场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的术语在适当情况下可以互换,这仅仅是描述本申请的实施例中对相同属性的对象在描述时所采用的区分方式。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,以便包含一系列单元的过程、方法、系统、产品或设备不必限于那些单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它单元。
首先对人工智能系统总体工作流程进行描述,请参见图1,图1示出的为人工智能主体框架的一种结构示意图,下面从“智能信息链”(水平轴)和“IT价值链”(垂直轴)两个维度对上述人工智能主题框架进行阐述。其中,“智能信息链”反映从数据的获取到处理的一列过程。举例来说,可以是智能信息感知、智能信息表示与形成、智能推理、智能决策、智能执行与输出的一般过程。在这个过程中,数据经历了“数据—信息—知识—智慧”的凝练过程。“IT价值链”从人智能的底层基础设施、信息(提供和处理技术实现)到系统的产业生态过程,反映人工智能为信息技术产业带来的价值。
(1)基础设施
基础设施为人工智能系统提供计算能力支持,实现与外部世界的沟通,并通过基础平台实现支撑。通过传感器与外部沟通;计算能力由智能芯片(CPU、NPU、GPU、ASIC、FPGA等硬件加速芯片)提供;基础平台包括分布式计算框架及网络等相关的平台保障和支持,可以包括云存储和计算、互联互通网络等。举例来说,传感器和外部沟通获取数据,这些数据提供给基础平台提供的分布式计算系统中的智能芯片进行计算。
(2)数据
基础设施的上一层的数据用于表示人工智能领域的数据来源。数据涉及到图形、图像、语音、文本,还涉及到传统设备的物联网数据,包括已有系统的业务数据以及力、位移、液位、温度、湿度等感知数据。
(3)数据处理
数据处理通常包括数据训练,机器学习,深度学习,搜索,推理,决策等方式。
其中,机器学习和深度学习可以对数据进行符号化和形式化的智能信息建模、抽取、预处理、训练等。
推理是指在计算机或智能系统中,模拟人类的智能推理方式,依据推理控制策略,利用形式化的信息进行机器思维和求解问题的过程,典型的功能是搜索与匹配。
决策是指智能信息经过推理后进行决策的过程,通常提供分类、排序、预测等功能。
(4)通用能力
对数据经过上面提到的数据处理后,进一步基于数据处理的结果可以形成一些通用的能力,比如可以是算法或者一个通用系统,例如,翻译,文本的分析,计算机视觉的处理,语音识别,图像的识别等等。
(5)智能产品及行业应用
智能产品及行业应用指人工智能系统在各领域的产品和应用,是对人工智能整体解决方案的封装,将智能信息决策产品化、实现落地应用,其应用领域主要包括:智能终端、智能交通、智能医疗、自动驾驶、平安城市等。
图2为本申请实施例中执行模型训练的计算系统的示意。计算系统包括通过网络通信地耦合的终端设备102(下文中可以称之为第一设备和第二设备)和服务器130(也可以称之为中心节点)。其中,终端设备102可以是任何类型的计算设备,诸如,例如个人计算设备(例如,膝上型计算机或台式计算机)、移动计算设备(例如,智能电话或平板计算机)、游戏控制台或控制器、可穿戴计算设备、嵌入式计算设备或任何其他类型的计算设备。
终端设备102可以包括处理器112和存储器114。处理器112可以是任何合适的处理设备(例如,处理器核、微处理器、特殊应用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)、控制器、微控制器等)。存储器114可以包括但不限于是随机存储记忆体(Random Access Memory,RAM)、只读存储器(Read-Only Memory,ROM)、可擦除可编程只读存储器(Erasable Programmable Read Only Memory,EPROM)、或便携式只读存储器(Compact Disc Read-Only Memory,CD-ROM)。存储器114可以存储由处理器112执行的数据116和指令118,以使得终端设备102执行操作。
在一些实施方式中,存储器114可以存储一个或多个模型120。例如,模型120可以是或可以另外包括各种机器学习模型,诸如神经网络(例如,深层神经网络)或其他类型的机器学习模型,包括非线性模型和/或线性模型。神经网络可以包括前馈神经网络、递归神经网络(例如,长短期记忆递归神经网络)、卷积神经网络或其他形式的神经网络。
在一些实施方式中,一个或多个模型120可以通过网络从服务器130接收,存储在存储器114中,然后由一个或多个处理器112使用或另外实施。
终端设备102还可以包括接收用户输入的一个或多个用户输入组件122。例如,用户输 入组件122可以是对用户输入对象(例如,手指或触笔)的触摸敏感的触敏组件(例如,触敏显示屏或触摸板)。触敏组件可以用来实施虚拟键盘。其他示例用户输入组件包括麦克风、传统键盘或用户可以提供用户输入的其他装置。
终端设备102还可以包括通信接口123,终端设备102可以通过通信接口123和服务器130通信连接,服务器130可以包括通信接口133,终端设备102可以通过通信接口123和服务器130的通信接口133通信连接,以此实现终端设备102和服务器130之间的数据交互。
服务器130可以包括处理器132和存储器134。处理器132可以是可以是任何合适的处理设备(例如,处理器核、微处理器、特殊应用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)、控制器、微控制器等)。存储器134可以包括但不限于是随机存储记忆体(Random Access Memory,RAM)、只读存储器(Read-Only Memory,ROM)、可擦除可编程只读存储器(Erasable Programmable Read Only Memory,EPROM)、或便携式只读存储器(Compact Disc Read-Only Memory,CD-ROM)。存储器134可以存储由处理器132执行的数据136和指令138,以使得服务器130执行操作。
如上所述,存储器134可以存储一个或多个机器学习模型140。例如,模型140可以是或者可以另外包括各种机器学习模型。示例机器学习模型包括神经网络或其他多层非线性模型。示例神经网络包括前馈神经网络、深层神经网络、递归神经网络和卷积神经网络。
图3是本申请实施例提供的一种系统100架构的示意图,在图3中,执行设备110配置输入/输出(input/output,I/O)接口112,用于与外部设备进行数据交互,用户可以通过客户设备140向I/O接口112输入数据,所述输入数据在本申请实施例中可以包括:各个待调度任务,可调用资源以及其他参数。
在执行设备110对输入数据进行预处理,或者在执行设备110的计算模块111执行计算等相关的处理(比如进行本申请中神经网络的功能实现)过程中,执行设备110可以调用数据存储系统150中的数据、代码等以用于相应的处理,也可以将相应处理得到的数据、指令等存入数据存储系统150中。
最后,I/O接口112将处理结果返回给客户设备140,从而提供给用户。
值得说明的是,训练设备120可以针对不同的目标或称不同的任务,基于不同的训练数据生成相应的目标模型/规则,该相应的目标模型/规则即可以用于实现上述目标或完成上述任务,从而为用户提供所需的结果。
在图3中所示情况下,用户可以手动给定输入数据,该手动给定可以通过I/O接口112提供的界面进行操作。另一种情况下,客户设备140可以自动地向I/O接口112发送输入数据,如果要求客户设备140自动发送输入数据需要获得用户的授权,则用户可以在客户设备140中设置相应权限。用户可以在客户设备140查看执行设备110输出的结果,具体的呈现形式可以是显示、声音、动作等具体方式。客户设备140也可以作为数据采集端,采集如图所示输入I/O接口112的输入数据及输出I/O接口112的输出结果作为新的样本数据,并存入数据库130。当然,也可以不经过客户设备140进行采集,而是由I/O接口112直接将如图所示输入I/O接口112的输入数据及输出I/O接口112的输出结果,作为新的样本数据存入数据库130。
值得注意的是,图3仅是本申请实施例提供的一种系统架构的示意图,图中所示设备、器件、模块等之间的位置关系不构成任何限制,例如,在图3中,数据存储系统150相对执行设备110是外部存储器,在其它情况下,也可以将数据存储系统150置于执行设备110中。如图3所示,可以根据训练设备120训练得到神经网络。
本申请实施例还提供的一种芯片,该芯片包括神经网络处理器NPU。该芯片可以被设置在如图3所示的执行设备110中,用以完成计算模块111的计算工作。该芯片也可以被设置在如图3所示的训练设备120中,用以完成训练设备120的训练工作并输出目标模型/规则。
神经网络处理器NPU,NPU作为协处理器挂载到主中央处理器(central processing unit,CPU)(host CPU)上,由主CPU分配任务。NPU的核心部分为运算电路,控制器控制运算电路提取存储器(权重存储器或输入存储器)中的数据并进行运算。
在一些实现中,运算电路内部包括多个处理单元(process engine,PE)。在一些实现中,运算电路是二维脉动阵列。运算电路还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路是通用的矩阵处理器。
举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器(accumulator)中。
向量计算单元可以对运算电路的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。例如,向量计算单元可以用于神经网络中非卷积/非FC层的网络计算,如池化(pooling),批归一化(batch normalization),局部响应归一化(local response normalization)等。
在一些实现种,向量计算单元能将经处理的输出的向量存储到统一缓存器。例如,向量计算单元可以将非线性函数应用到运算电路的输出,例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元生成归一化的值、合并值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路的激活输入,例如用于在神经网络中的后续层中的使用。
统一存储器用于存放输入数据以及输出数据。
权重数据直接通过存储单元访问控制器(direct memory access controller,DMAC)将外部存储器中的输入数据搬运到输入存储器和/或统一存储器、将外部存储器中的权重数据存入权重存储器,以及将统一存储器中的数据存入外部存储器。
总线接口单元(bus interface unit,BIU),用于通过总线实现主CPU、DMAC和取指存储器之间进行交互。
与控制器连接的取指存储器(instruction fetch buffer),用于存储控制器使用的指令;
控制器,用于调用指存储器中缓存的指令,实现控制该运算加速器的工作过程。
一般地,统一存储器,输入存储器,权重存储器以及取指存储器均为片上(On-Chip)存储器,外部存储器为该NPU外部的存储器,该外部存储器可以为双倍数据率同步动态随机存储器(double data rate synchronous dynamic random access memory,DDR SDRAM)、高带宽 存储器(high bandwidth memory,HBM)或其他可读可写的存储器。
由于本申请实施例涉及大量神经网络的应用,为了便于理解,下面先对本申请实施例涉及的相关术语及神经网络等相关概念进行介绍。
(1)神经网络
神经网络可以是由神经单元组成的,神经单元可以是指以xs和截距1为输入的运算单元,该运算单元的输出可以为:
Figure PCTCN2021105962-appb-000001
其中,s=1、2、……n,n为大于1的自然数,Ws为xs的权重,b为神经单元的偏置。f为神经单元的激活函数(activation functions),用于将非线性特性引入神经网络中,来将神经单元中的输入信号转换为输出信号。该激活函数的输出信号可以作为下一层卷积层的输入。激活函数可以是sigmoid函数。神经网络是将许多个上述单一的神经单元联结在一起形成的网络,即一个神经单元的输出可以是另一个神经单元的输入。每个神经单元的输入可以与前一层的局部接受域相连,来提取局部接受域的特征,局部接受域可以是由若干个神经单元组成的区域。
神经网络中的每一层的工作可以用数学表达式
Figure PCTCN2021105962-appb-000002
来描述:从物理层面神经网络中的每一层的工作可以理解为通过五种对输入空间(输入向量的集合)的操作,完成输入空间到输出空间的变换(即矩阵的行空间到列空间),这五种操作包括:1、升维/降维;2、放大/缩小;3、旋转;4、平移;5、“弯曲”。其中1、2、3的操作由
Figure PCTCN2021105962-appb-000003
完成,4的操作由+b完成,5的操作则由a()来实现。这里之所以用“空间”二字来表述是因为被分类的对象并不是单个事物,而是一类事物,空间是指这类事物所有个体的集合。其中,W是权重向量,该向量中的每一个值表示该层神经网络中的一个神经元的权重值。该向量W决定着上文所述的输入空间到输出空间的空间变换,即每一层的权重W控制着如何变换空间。训练神经网络的目的,也就是最终得到训练好的神经网络的所有层的权重矩阵(由很多层的向量W形成的权重矩阵)。因此,神经网络的训练过程本质上就是学习控制空间变换的方式,更具体的就是学习权重矩阵。
因为希望神经网络的输出尽可能的接近真正想要预测的值,所以可以通过比较当前网络的预测值和真正想要的目标值,再根据两者之间的差异情况来更新每一层神经网络的权重向量(当然,在第一次更新之前通常会有初始化的过程,即为神经网络中的各层预先配置参数),比如,如果网络的预测值高了,就调整权重向量让它预测低一些,不断的调整,直到神经网络能够预测出真正想要的目标值。因此,就需要预先定义“如何比较预测值和目标值之间的差异”,这便是损失函数(loss function)或目标函数(objective function),它们是用于衡量预测值和目标值的差异的重要方程。其中,以损失函数举例,损失函数的输出值(loss)越高表示差异越大,那么神经网络的训练就变成了尽可能缩小这个loss的过程。
(2)反向传播算法
神经网络可以采用误差反向传播(back propagation,BP)算法在训练过程中修正初始的神经网络模型中参数的大小,使得神经网络模型的重建误差损失越来越小。具体地,前向 传递输入信号直至输出会产生误差损失,通过反向传播误差损失信息来更新初始的神经网络模型中参数,从而使误差损失收敛。反向传播算法是以误差损失为主导的反向传播运动,旨在得到最优的神经网络模型的参数,例如权重矩阵。
参见图4,图4为本申请实施例提供的一种模型训练方法的架构示意,如图4所示,本申请实施例提供的架构包括:云侧中心节点,例如可以是云侧的服务器。A1、A2、…为类型为A的分布式节点,如用户持有的手机产品。B1、B2、…为类型为B的分布式节点,如用户持有的个人电脑。在经过分布式节点的管理员(如手机、电脑的用户)同意后,分布式节点的管理员自愿在隐私得到保护的情况下共享其日常使用设备的过程中产生的数据,加入到模型训练计划,设备成为架构中的分布式节点。本实施例中的系统也可以包含更多类型的分布式节点,如智能手表等等。为保护数据隐私,分布式节点不会将数据上传至中心节点,仅在本地保存数据。分布式节点通过通信网络与云服务器连接。云侧中心节点可以运行大模型,而各分布式节点受硬件能力限制只能运行小模型,且A和B可以拥有不同的数据处理能力。
参见图5,图5为本申请实施例提供的一种模型训练方法的流程示意,如图5所示,本申请实施例提供的模型训练方法包括:
501、服务器向第一设备发送第一子模型;其中,所述第一子模型为对待训练模型进行压缩得到的。
本申请实施例中,服务器(也可以称之为中心节点或云侧的训练设备)可以向第一设备发送第一子模型;其中,所述第一子模型为对待训练模型进行压缩得到的。其中,第一设备可以为终端设备,例如图4中示出的分布式节点(A1、A2、B1、B2)。
本申请实施例中,服务器可以获取待训练模型,待训练模型可以为后续联邦学习的模型训练对象,待训练模型可以包括神经网络或其他多层非线性模型,例如,神经网络可以包括前馈神经网络、深层神经网络、递归神经网络和卷积神经网络。
本申请实施例中,服务器可以对待训练模型进行压缩,得到第一子模型。具体的,所述第一子模型可以为对待训练模型进行如下至少一种处理方式得到的:剪枝、知识蒸馏或量化。其中,在神经网络的权重矩阵中,将一部分元素置为无效的值,即为剪枝操作。在一种实现方式中,可以将需要剪枝的元素设置为零。比如,将权重矩阵中绝对值小于或者等于一定门限的权重值设置为零。关于知识蒸馏以及量化,可以使用现有技术中提供的知识蒸馏以及量化方法。
其中,第一子模型和待训练模型可以满足如下特点的至少一种:存储所述第一子模型所需的存储资源小于存储所述待训练模型所需的存储资源、运行所述第一子模型时所需的计算资源小于运行所述待训练模型时所需的计算资源,其中,所述计算资源可以至少包括如下的一种:内存资源、显存资源或CPU资源。
在一种实现中,存储所述第一子模型所需的存储资源小于存储所述待训练模型所需的存储资源,存储资源可以理解为存储空间大小;例如,终端设备存储第一子模型所需的存 储空间为200MB,而存储待训练模型所需的存储空间为1GB。
在一种实现中,运行所述第一子模型时所需的计算资源小于运行所述待训练模型时所需的计算资源;所述计算资源可以至少包括如下的一种:内存资源、显存资源或CPU资源;需要说明的是,所需的计算资源可以指运行模型时所需的计算资源峰值,例如内存占用峰值,显存占用峰值或CPU占用峰值。
本申请实施例中,服务器可以参考第一设备的数据处理能力来选择第一子模型,进而使得第一设备有足够的资源来运行第一子模型;在一种实现中,服务器可以获取所述第一设备的数据处理能力,所述数据处理能力包括以下至少一种:可使用的存储资源或可使用的计算资源,服务器可以基于第一映射关系,获取所述第一设备对应的第一子模型;其中,所述第一映射关系包括数据处理能力与子模型之间的对应关系,且在所述第一映射关系中,所述第一设备的数据处理能力对应于所述第一子模型。
在一种实现中,第一设备的数据处理能力可以与可使用的计算资源有关,在一种实现中,第一设备的数据处理能力可以与可使用的计算资源有关,在一种实现中,第一设备的数据处理能力可以与可使用的计算资源和可使用的计算资源有关。
具体的,第一设备的数据处理能力可以是一个参数值,该参数值可以指示设备的数据处理能力。在一种实现中,终端设备可以基于第一设备的片上系统(system on chip,SOC)型号、图形处理器(graphics processing unit,GPU)型号、嵌入式神经网络处理器(neural-network processing unit,NPU)型号、存储空间大小等等硬件能力信息来确定第一设备的数据处理能力。可选的,服务器可以维护了一个数据处理能力的计算函数,输入为上述SOC型号、GPU型号、NPU型号、存储空间大小等等,输出为计算得到的数据处理能力。
本申请实施例中,服务器可以基于第一映射关系,获取所述第一设备对应的第一子模型,其中,第一映射关系可以是数据处理能力区间-模型映射表,每个数据处理能力区间对应于一种模型,例如数据处理能力的区间为0~100分,数据处理能力区间为0~10,10~20,20~30,…,90~100,每个区间分别会映射到一个模型。本申请实施例中,服务器可以获取到第一设备的数据处理能力,并从第一映射关系中确定第一设备的数据处理能力所在的区间,其中,第一设备的数据处理能力所在的区间对应于第一子模型。
应理解,上述SOC型号、GPU型号、NPU型号、存储空间大小等等与第一设备相关的硬件能力信息可以是第一设备上传到服务器,可选的,第一设备可以向服务器发送设备注册请求,并携带上述硬件能力信息。
类似的,服务器还可以向第二设备发送第二子模型;其中,所述第二子模型为对待训练模型进行压缩得到的,且所述第二子模型与所述第一子模型不同;具体的,存储所述第一子模型和所述第二子模型所需的存储资源大小不同和/或运行所述第一子模型和所述第二子模型时所需的计算资源大小不同。所述第二子模型为对待训练模型进行如下至少一种处理方式得到的:剪枝、知识蒸馏或量化。
本申请实施例中,服务器针对于具有不同数据处理能力的设备,可以下发不同的模型,例如,第二设备和第一设备的数据处理能力不同,所述数据处理能力包括以下至少一种: 可使用的存储资源或可使用的计算资源,相应的,服务器可以向第一设备下发第一子模型,向第二设备下发第二子模型,第二子模型与所述第一子模型不同,例如存储所述第一子模型和所述第二子模型所需的存储资源大小不同和/或运行所述第一子模型和所述第二子模型时所需的计算资源大小不同。
接下来,给出一个服务器下发模型到终端设备的应用实例:
首先,用户自愿将其持有的终端设备注册到大规模预训练语言模型的训练框架,让用户知悉该训练会对其日常使用设备造成的影响,且训练过程需要严格执行用户数据隐私保护的策略。用户可以选择其设备中可以参加到训练计划中的数据来源,例如:指定其在使用一些特定应用(如微博)时产生的文本数据可参与训练计划。用户侧的终端设备(例如上述实施例中的第一设备和第二设备)可以向服务器发送设备注册请求,并携带硬件能力信息(例如上述实施例中的SOC型号、GPU型号、NPU型号、存储空间大小等等硬件能力信息)。可选的:如果一个用户持有多个个人设备,且多个个人设备之间数据共享,该用户可以仅将一台设备注册为分布式节点。服务器可以获取终端设备的硬件能力信息,基于终端设备的硬件能力信息将该终端设备映射到特定组,不同的终端组对应着不同的终端硬件能力,每个组对应于一个压缩后的模型(例如上述实施例中,第一设备对应于第一子模型,第二设备对应于第二子模型),具体的,服务器可以将终端设备的ID与对应的分组ID建立关联关系(例如在上述实施例中的第一映射关系中建立上述终端设备的ID与对应的分组ID的关联关系)。
用户在终端设备的日常使用过程中产生了足够用于训练的数据后,终端设备向云侧的服务器发送模型下载请求(携带终端设备的ID),云侧服务器根据终端设备的ID,索引到对应的分组ID,服务器可以将该分组ID对应的模型通过网络发送至终端设备。示例性的,服务器可以将提供针对中心服务器存储的原模型BERT的特定大小的压缩模型TinyBERTi,通过网络分发给终端设备。
502、接收所述第一设备发送的第一梯度,所述第一梯度为所述第一设备训练所述第一子模型时得到的。
本申请实施例中,第一设备在接收到服务器发送的第一子模型之后,可以利用本地数据对第一子模型进行训练,并在训练过程中得到第一梯度,之后可以将第一梯度上传至服务器,可选的,为了传输过程的信息隐私保护,第一设备可以将加密后的第一梯度上传至服务器。
类似的,第二设备在接收到服务器发送的第二子模型之后,可以利用本地数据对第二子模型进行训练,并在训练过程中得到第二梯度,之后可以将第二梯度上传至服务器,可选的,为了传输过程的信息隐私保护,第二设备可以将加密后的第二梯度上传至服务器。
本申请实施例中,服务器可以接收所述第一设备发送的第一梯度。类似的,服务器还可以接收所述第二设备发送的第二梯度。
503、至少基于所述第一梯度,对所述待训练模型进行模型训练,以得到更新后的待训 练模型。
本申请实施例中,服务器可以至少基于所述第一梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。具体的,服务器可以基于所述第一梯度,对所述第一子模型进行训练,得到更新后的第一子模型;至少以所述更新后的第一子模型作为老师模型,所述待训练模型为学生模型,对所述待训练模型进行知识蒸馏,以得到更新后的待训练模型。
本申请实施例中,服务器还可以基于所述第二梯度,对所述第二子模型进行训练,得到更新后的第二子模型;以所述更新后的第一子模型和所述更新后的第二子模型作为老师模型,所述待训练模型为学生模型,对所述待训练模型进行知识蒸馏,以得到更新后的待训练模型。
本申请实施例中,服务器可以按组分别汇总每一类型的终端设备上传的梯度,采用联邦梯度平均的算法更新对应的小模型。参照图6和图7,图6和图7为本申请实施例提供的一种模型训练方法的示例,其中,服务器的模型压缩模块可以将待训练模型压缩为第一子模型和第二子模型,之后服务器可以将第一子模型下发到节点A1,节点A2和节点A3,将第二子模型下发到节点B1,节点B2和节点B3。
之后,节点A1,节点A2和节点A3上传的梯度采用联邦梯度平均的方式更新第一子模型的参数,节点B1,节点B2和节点B3上传的梯度采用联邦梯度平均的方式更新第二子模型的参数,并采用多模型融合的方式,服务器利用各个类型的小模型,融合更新中心节点大模型。如第一子模型和第二子模型融合成待训练模型。融合的方式可以是多老师蒸馏。
示例性的,服务器可以汇总多个更新的压缩模型{TinyBERTi_update},采用多老师蒸馏的方式,将{TinyBERTi_update}当做多个老师模型,蒸馏得到学生模型BERT_update。因为蒸馏过程不能使用用户的端侧数据,因此采用无数据蒸馏方式(Datafree Distillation)、或者采用合成的数据进行蒸馏、或者使用通用的公开数据进行蒸馏。
本申请实施例提供了一种模型训练方法,包括:向第一设备发送第一子模型;其中,所述第一子模型为对待训练模型进行压缩得到的;接收所述第一设备发送的第一梯度,所述第一梯度为所述第一设备训练所述第一子模型时得到的;至少基于所述第一梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。通过上述方式,服务器将待训练模型进行压缩后下发至终端设备,使得终端设备不需要训练和服务器同等规模的大模型。
本申请实施例中,服务器还可以向第二设备发送第二子模型;其中,所述第二子模型为对待训练模型进行压缩得到的,且所述第二子模型与所述第一子模型不同;接收所述第二设备发送的第二梯度,所述第二梯度为所述第二设备训练所述第二子模型时得到的;并基于所述第一梯度和所述第二梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。通过上述方式,服务器可以针对于终端设备的不同,选择不同的模型下发到终端设备。
接下来从装置的角度对本申请实施例提供的数据处理装置进行描述,参照图8,图8为本申请实施例提供的一种数据处理装置的示意,如图8中示出的那样,本申请实施例提供的 数据处理装置800,包括:
发送模块801,用于向第一设备发送第一子模型;其中,所述第一子模型为对待训练模型进行压缩得到的;
接收模块802,用于接收所述第一设备发送的第一梯度,所述第一梯度为所述第一设备训练所述第一子模型时得到的;
模型训练模块803,用于至少基于所述第一梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。
在一种可能的实现中,存储所述第一子模型所需的存储资源小于存储所述待训练模型所需的存储资源。
在一种可能的实现中,运行所述第一子模型时所需的计算资源小于运行所述待训练模型时所需的计算资源。
在一种可能的实现中,所述计算资源至少包括如下的一种:内存资源、显存资源或CPU资源。
在一种可能的实现中,所述第一子模型为对待训练模型进行如下至少一种处理方式得到的:剪枝、知识蒸馏或量化。
在一种可能的实现中,所述模型训练模块,用于基于所述第一梯度,对所述第一子模型进行训练,得到更新后的第一子模型;至少以所述更新后的第一子模型作为老师模型,所述待训练模型为学生模型,对所述待训练模型进行知识蒸馏,以得到更新后的待训练模型。
在一种可能的实现中,所述装置还包括:
获取模块,用于获取所述第一设备的数据处理能力,所述数据处理能力包括以下至少一种:可使用的存储资源或可使用的计算资源;基于第一映射关系,获取所述第一设备对应的第一子模型;其中,所述第一映射关系包括数据处理能力与子模型之间的对应关系,且在所述第一映射关系中,所述第一设备的数据处理能力对应于所述第一子模型。
在一种可能的实现中,所述发送模块,用于向第二设备发送第二子模型;其中,所述第二子模型为对待训练模型进行压缩得到的,且所述第二子模型与所述第一子模型不同;
所述接收模块,用于接收所述第二设备发送的第二梯度,所述第二梯度为所述第二设备训练所述第二子模型时得到的;
所述模型训练模块,用于基于所述第一梯度和所述第二梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。
在一种可能的实现中,所述第一设备与所述第二设备的数据处理能力不同,所述数据处理能力包括以下至少一种:可使用的存储资源或可使用的计算资源。
在一种可能的实现中,存储所述第一子模型和所述第二子模型所需的存储资源大小不同。
在一种可能的实现中,运行所述第一子模型和所述第二子模型时所需的计算资源大小不同。
在一种可能的实现中,所述第二子模型为对待训练模型进行如下至少一种处理方式得 到的:剪枝、知识蒸馏或量化。
在一种可能的实现中,所述模型训练模块,用于基于所述第一梯度,对所述第一子模型进行训练,得到更新后的第一子模型;基于所述第二梯度,对所述第二子模型进行训练,得到更新后的第二子模型;以所述更新后的第一子模型和所述更新后的第二子模型作为老师模型,所述待训练模型为学生模型,对所述待训练模型进行知识蒸馏,以得到更新后的待训练模型。
参照图9,图9为本申请实施例提供的一种系统的示意,如图9中示出的那样,本申请实施例提供的系统900,包括:
第一设备901和服务器902;其中,所述服务器902,用于向所述第一设备901发送第一子模型;其中,所述第一子模型为对待训练模型进行压缩得到的;
所述第一设备901,用于训练所述第一子模型,以得到第一梯度;向所述服务器902发送所述第一梯度;
所述服务器902,用于至少基于所述第一梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。
在一种可能的实现中,存储所述第一子模型所需的存储资源小于存储所述待训练模型所需的存储资源。
在一种可能的实现中,运行所述第一子模型时所需的计算资源小于运行所述待训练模型时所需的计算资源。
在一种可能的实现中,所述计算资源至少包括如下的一种:内存资源、显存资源或CPU资源。
在一种可能的实现中,所述第一子模型为对待训练模型进行如下至少一种处理方式得到的:剪枝、知识蒸馏或量化。
在一种可能的实现中,所述服务器902,用于基于所述第一梯度,对所述第一子模型进行训练,得到更新后的第一子模型;
至少以所述更新后的第一子模型作为老师模型,所述待训练模型为学生模型,对所述待训练模型进行知识蒸馏,以得到更新后的待训练模型。
在一种可能的实现中,所述服务器902,用于获取所述第一设备901的数据处理能力,所述数据处理能力包括以下至少一种:可使用的存储资源或可使用的计算资源;
基于第一映射关系,获取所述第一设备901对应的第一子模型;其中,所述第一映射关系包括数据处理能力与子模型之间的对应关系,且在所述第一映射关系中,所述第一设备901的数据处理能力对应于所述第一子模型。
在一种可能的实现中,所述系统还包括:第二设备903,所述服务器902,用于向第二设备903发送第二子模型;其中,所述第二子模型为对待训练模型进行压缩得到的,且所述第二子模型与所述第一子模型不同;
所述第二设备903用于训练所述第二子模型,以得到第二梯度;向所述服务器902发送所述第二梯度;
所述服务器902,用于所述至少基于所述第一梯度,对所述待训练模型进行模型训练,包括:
基于所述第一梯度和所述第二梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。
在一种可能的实现中,所述第一设备901与所述第二设备903的数据处理能力不同,所述数据处理能力包括以下至少一种:可使用的存储资源或可使用的计算资源不同。
在一种可能的实现中,存储所述第一子模型和所述第二子模型所需的存储资源大小不同。
在一种可能的实现中,运行所述第一子模型和所述第二子模型时所需的计算资源大小不同。
在一种可能的实现中,所述第二子模型为对待训练模型进行如下至少一种处理方式得到的:剪枝、知识蒸馏或量化。
在一种可能的实现中,所述服务器902,用于基于所述第一梯度,对所述第一子模型进行训练,得到更新后的第一子模型;
基于所述第二梯度,对所述第二子模型进行训练,得到更新后的第二子模型;
以所述更新后的第一子模型和所述更新后的第二子模型作为老师模型,所述待训练模型为学生模型,对所述待训练模型进行知识蒸馏,以得到更新后的待训练模型。
接下来介绍本申请实施例提供的一种执行设备,请参阅图10,图10为本申请实施例提供的执行设备的一种结构示意图,执行设备1000具体可以表现为手机、平板、笔记本电脑、智能穿戴设备、服务器等,此处不做限定。其中,执行设备1000上可以部署有图10对应实施例中所描述的数据处理装置,用于实现图10对应实施例中数据处理的功能。具体的,执行设备1000包括:接收器1001、发射器1002、处理器1003和存储器1004(其中执行设备1000中的处理器1003的数量可以一个或多个,图10中以一个处理器为例),其中,处理器1003可以包括应用处理器10031和通信处理器10032。在本申请的一些实施例中,接收器1001、发射器1002、处理器1003和存储器1004可通过总线或其它方式连接。
存储器1004可以包括只读存储器和随机存取存储器,并向处理器1003提供指令和数据。存储器1004的一部分还可以包括非易失性随机存取存储器(non-volatile random access memory,NVRAM)。存储器1004存储有处理器和操作指令、可执行模块或者数据结构,或者它们的子集,或者它们的扩展集,其中,操作指令可包括各种操作指令,用于实现各种操作。
处理器1003控制执行设备的操作。具体的应用中,执行设备的各个组件通过总线系统耦合在一起,其中总线系统除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都称为总线系统。
上述本申请实施例揭示的方法可以应用于处理器1003中,或者由处理器1003实现。处理器1003可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器1003中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处 理器1003可以是通用处理器、数字信号处理器(digital signal processing,DSP)、微处理器或微控制器,还可进一步包括专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。该处理器1003可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器1004,处理器1003读取存储器1004中的信息,结合其硬件完成上述方法的步骤。
接收器1001可用于接收输入的数字或字符信息,以及产生与执行设备的相关设置以及功能控制有关的信号输入。发射器1002可用于通过第一接口输出数字或字符信息;发射器1002还可用于通过第一接口向磁盘组发送指令,以修改磁盘组中的数据;发射器1002还可以包括显示屏等显示设备。
本申请实施例中,在一种情况下,处理器1003,用于执行图5对应实施例中的执行设备执行的方法。
本申请实施例还提供了一种训练设备,请参阅图11,图11是本申请实施例提供的训练设备一种结构示意图,训练设备1100上可以部署有图10对应实施例中所描述的神经网络训练装置,用于实现图10对应实施例中神经网络训练装置的功能,具体的,训练设备1100由一个或多个服务器实现,训练设备1100可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上中央处理器(central processing units,CPU)1111(例如,一个或一个以上处理器)和存储器1132,一个或一个以上存储应用程序1142或数据1144的存储介质1130(例如一个或一个以上海量存储设备)。其中,存储器1132和存储介质1130可以是短暂存储或持久存储。存储在存储介质1130的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对训练设备中的一系列指令操作。更进一步地,中央处理器1111可以设置为与存储介质1130通信,在训练设备1100上执行存储介质1130中的一系列指令操作。
训练设备1100还可以包括一个或一个以上电源1126,一个或一个以上有线或无线网络接口1150,一个或一个以上输入输出接口1158;或,一个或一个以上操作系统1141,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等等。
本申请实施例中,中央处理器1111,用于执行上述实施例中的训练方法相关的步骤。
本申请实施例中还提供一种包括计算机程序产品,当其在计算机上运行时,使得计算机执行如前述执行设备所执行的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。
本申请实施例中还提供一种计算机可读存储介质,该计算机可读存储介质中存储有用于进行信号处理的程序,当其在计算机上运行时,使得计算机执行如前述执行设备所执行 的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。
本申请实施例提供的执行设备、训练设备或终端设备具体可以为芯片,芯片包括:处理单元和通信单元,所述处理单元例如可以是处理器,所述通信单元例如可以是输入/输出接口、管脚或电路等。该处理单元可执行存储单元存储的计算机执行指令,以使执行设备内的芯片执行上述实施例描述的数据处理方法,或者,以使训练设备内的芯片执行上述实施例描述的数据处理方法。可选地,所述存储单元为所述芯片内的存储单元,如寄存器、缓存等,所述存储单元还可以是所述无线接入设备端内的位于所述芯片外部的存储单元,如只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)等。
具体的,请参阅图12,图12为本申请实施例提供的芯片的一种结构示意图,所述芯片可以表现为神经网络处理器NPU 1200,NPU 1200作为协处理器挂载到主CPU(Host CPU)上,由Host CPU分配任务。NPU的核心部分为运算电路1203,通过控制器1204控制运算电路1203提取存储器中的矩阵数据并进行乘法运算。
在一些实现中,运算电路1203内部包括多个处理单元(Process Engine,PE)。在一些实现中,运算电路1203是二维脉动阵列。运算电路1203还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路1203是通用的矩阵处理器。
举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器1202中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器1201中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器(accumulator)1208中。
统一存储器1206用于存放输入数据以及输出数据。权重数据直接通过存储单元访问控制器(Direct Memory Access Controller,DMAC)1205,DMAC被搬运到权重存储器1202中。输入数据也通过DMAC被搬运到统一存储器1206中。
BIU为Bus Interface Unit即,总线接口单元1210,用于AXI总线与DMAC和取指存储器(Instruction Fetch Buffer,IFB)1209的交互。
总线接口单元1210(Bus Interface Unit,简称BIU),用于取指存储器1209从外部存储器获取指令,还用于存储单元访问控制器1205从外部存储器获取输入矩阵A或者权重矩阵B的原数据。
DMAC主要用于将外部存储器DDR中的输入数据搬运到统一存储器1206或将权重数据搬运到权重存储器1202中或将输入数据数据搬运到输入存储器1201中。
向量计算单元1207包括多个运算处理单元,在需要的情况下,对运算电路1203的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。主要用于神经网络中非卷积/全连接层网络计算,如Batch Normalization(批归一化),像素级求和,对特征平面进行上采样等。
在一些实现中,向量计算单元1207能将经处理的输出的向量存储到统一存储器1206。例如,向量计算单元1207可以将线性函数;或,非线性函数应用到运算电路1203的输出, 例如对卷积层提取的特征平面进行线性插值,再例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元1207生成归一化的值、像素级求和的值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路1203的激活输入,例如用于在神经网络中的后续层中的使用。
控制器1204连接的取指存储器(instruction fetch buffer)1209,用于存储控制器1204使用的指令;
统一存储器1206,输入存储器1201,权重存储器1202以及取指存储器1209均为On-Chip存储器。外部存储器私有于该NPU硬件架构。
其中,上述任一处提到的处理器,可以是一个通用中央处理器,微处理器,ASIC,或一个或多个用于控制上述程序执行的集成电路。
另外需说明的是,以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。另外,本申请提供的装置实施例附图中,模块之间的连接关系表示它们之间具有通信连接,具体可以实现为一条或多条通信总线或信号线。
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到本申请可借助软件加必需的通用硬件的方式来实现,当然也可以通过专用硬件包括专用集成电路、专用CPU、专用存储器、专用元器件等来实现。一般情况下,凡由计算机程序完成的功能都可以很容易地用相应的硬件来实现,而且,用来实现同一功能的具体硬件结构也可以是多种多样的,例如模拟电路、数字电路或专用电路等。但是,对本申请而言更多情况下软件程序实现是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在可读取的存储介质中,如计算机的软盘、U盘、移动硬盘、ROM、RAM、磁碟或者光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,训练设备,或者网络设备等)执行本申请各个实施例所述的方法。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、训练设备或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、训练设备或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的训练设备、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介 质(例如,DVD)、或者半导体介质(例如固态硬盘(Solid State Disk,SSD))等。

Claims (28)

  1. 一种模型训练方法,其特征在于,所述方法包括:
    向第一设备发送第一子模型;其中,所述第一子模型为对待训练模型进行压缩得到的;
    接收所述第一设备发送的第一梯度,所述第一梯度为所述第一设备训练所述第一子模型时得到的;
    至少基于所述第一梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。
  2. 根据权利要求1所述的方法,其特征在于,存储所述第一子模型所需的存储资源小于存储所述待训练模型所需的存储资源。
  3. 根据权利要求1或2所述的方法,其特征在于,运行所述第一子模型时所需的计算资源小于运行所述待训练模型时所需的计算资源。
  4. 根据权利要求3所述的方法,其特征在于,所述计算资源至少包括如下的一种:内存资源、显存资源或CPU资源。
  5. 根据权利要求1至4任一所述的方法,其特征在于,所述第一子模型为对待训练模型进行如下至少一种处理方式得到的:剪枝、知识蒸馏或量化。
  6. 根据权利要求1至5任一所述的方法,其特征在于,所述至少基于所述第一梯度,对所述待训练模型进行模型训练,包括:
    基于所述第一梯度,对所述第一子模型进行训练,得到更新后的第一子模型;
    至少以所述更新后的第一子模型作为老师模型,所述待训练模型为学生模型,对所述待训练模型进行知识蒸馏,以得到更新后的待训练模型。
  7. 根据权利要求1至6任一所述的方法,其特征在于,所述方法还包括:
    获取所述第一设备的数据处理能力,所述数据处理能力包括以下至少一种:可使用的存储资源或可使用的计算资源;
    基于第一映射关系,获取所述第一设备对应的第一子模型;其中,所述第一映射关系包括数据处理能力与子模型之间的对应关系,且在所述第一映射关系中,所述第一设备的数据处理能力对应于所述第一子模型。
  8. 根据权利要求1至7任一所述的方法,其特征在于,所述方法还包括:
    向第二设备发送第二子模型;其中,所述第二子模型为对待训练模型进行压缩得到的,且所述第二子模型与所述第一子模型不同;
    接收所述第二设备发送的第二梯度,所述第二梯度为所述第二设备训练所述第二子模 型时得到的;
    所述至少基于所述第一梯度,对所述待训练模型进行模型训练,包括:
    基于所述第一梯度和所述第二梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。
  9. 根据权利要求8所述的方法,其特征在于,所述第一设备与所述第二设备的数据处理能力不同,所述数据处理能力包括以下至少一种:可使用的存储资源或可使用的计算资源。
  10. 根据权利要求8或9所述的方法,其特征在于,存储所述第一子模型和所述第二子模型所需的存储资源大小不同。
  11. 根据权利要求8至10任一所述的方法,其特征在于,运行所述第一子模型和所述第二子模型时所需的计算资源大小不同。
  12. 根据权利要求8至11任一所述的方法,其特征在于,所述第二子模型为对待训练模型进行如下至少一种处理方式得到的:剪枝、知识蒸馏或量化。
  13. 根据权利要求8至12任一所述的方法,其特征在于,所述基于所述第一梯度和所述第二梯度,对所述待训练模型进行模型训练,包括:
    基于所述第一梯度,对所述第一子模型进行训练,得到更新后的第一子模型;
    基于所述第二梯度,对所述第二子模型进行训练,得到更新后的第二子模型;
    以所述更新后的第一子模型和所述更新后的第二子模型作为老师模型,所述待训练模型为学生模型,对所述待训练模型进行知识蒸馏,以得到更新后的待训练模型。
  14. 一种模型训练装置,其特征在于,所述装置包括:
    发送模块,用于向第一设备发送第一子模型;其中,所述第一子模型为对待训练模型进行压缩得到的;
    接收模块,用于接收所述第一设备发送的第一梯度,所述第一梯度为所述第一设备训练所述第一子模型时得到的;
    模型训练模块,用于至少基于所述第一梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。
  15. 根据权利要求14所述的装置,其特征在于,存储所述第一子模型所需的存储资源小于存储所述待训练模型所需的存储资源。
  16. 根据权利要求14或15所述的装置,其特征在于,运行所述第一子模型时所需的计 算资源小于运行所述待训练模型时所需的计算资源。
  17. 根据权利要求16所述的装置,其特征在于,所述计算资源至少包括如下的一种:内存资源、显存资源或CPU资源。
  18. 根据权利要求14至17任一所述的装置,其特征在于,所述第一子模型为对待训练模型进行如下至少一种处理方式得到的:剪枝、知识蒸馏或量化。
  19. 根据权利要求14至18任一所述的装置,其特征在于,所述模型训练模块,用于基于所述第一梯度,对所述第一子模型进行训练,得到更新后的第一子模型;至少以所述更新后的第一子模型作为老师模型,所述待训练模型为学生模型,对所述待训练模型进行知识蒸馏,以得到更新后的待训练模型。
  20. 根据权利要求14至19任一所述的装置,其特征在于,所述装置还包括:
    获取模块,用于获取所述第一设备的数据处理能力,所述数据处理能力包括以下至少一种:可使用的存储资源或可使用的计算资源;基于第一映射关系,获取所述第一设备对应的第一子模型;其中,所述第一映射关系包括数据处理能力与子模型之间的对应关系,且在所述第一映射关系中,所述第一设备的数据处理能力对应于所述第一子模型。
  21. 根据权利要求14至20任一所述的装置,其特征在于,所述发送模块,用于向第二设备发送第二子模型;其中,所述第二子模型为对待训练模型进行压缩得到的,且所述第二子模型与所述第一子模型不同;
    所述接收模块,用于接收所述第二设备发送的第二梯度,所述第二梯度为所述第二设备训练所述第二子模型时得到的;
    所述模型训练模块,用于基于所述第一梯度和所述第二梯度,对所述待训练模型进行模型训练,以得到更新后的待训练模型。
  22. 根据权利要求21所述的装置,其特征在于,所述第一设备与所述第二设备的数据处理能力不同,所述数据处理能力包括以下至少一种:可使用的存储资源或可使用的计算资源。
  23. 根据权利要求21或22所述的装置,其特征在于,存储所述第一子模型和所述第二子模型所需的存储资源大小不同。
  24. 根据权利要求21至23任一所述的装置,其特征在于,运行所述第一子模型和所述第二子模型时所需的计算资源大小不同。
  25. 根据权利要求21至24任一所述的装置,其特征在于,所述第二子模型为对待训练模型进行如下至少一种处理方式得到的:剪枝、知识蒸馏或量化。
  26. 根据权利要求21至25任一所述的装置,其特征在于,所述模型训练模块,用于基于所述第一梯度,对所述第一子模型进行训练,得到更新后的第一子模型;基于所述第二梯度,对所述第二子模型进行训练,得到更新后的第二子模型;以所述更新后的第一子模型和所述更新后的第二子模型作为老师模型,所述待训练模型为学生模型,对所述待训练模型进行知识蒸馏,以得到更新后的待训练模型。
  27. 一种模型训练装置,其特征在于,所述装置包括存储器和处理器;所述存储器存储有代码,所述处理器被配置为执行所述代码,并实现如权利要求1至13任一所述的方法。
  28. 一种计算机存储介质,其特征在于,所述计算机存储介质存储有一个或多个指令,所述指令在由一个或多个计算机执行时使得所述一个或多个计算机实施权利要求1至13任一所述的方法。
PCT/CN2021/105962 2020-07-31 2021-07-13 一种模型训练方法及装置 WO2022022274A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP21849491.2A EP4181020A4 (en) 2020-07-31 2021-07-13 MODEL TRAINING METHOD AND APPARATUS
US18/161,620 US20230177410A1 (en) 2020-07-31 2023-01-30 Model training method and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010762709.0A CN112070207A (zh) 2020-07-31 2020-07-31 一种模型训练方法及装置
CN202010762709.0 2020-07-31

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/161,620 Continuation US20230177410A1 (en) 2020-07-31 2023-01-30 Model training method and apparatus

Publications (1)

Publication Number Publication Date
WO2022022274A1 true WO2022022274A1 (zh) 2022-02-03

Family

ID=73656915

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/105962 WO2022022274A1 (zh) 2020-07-31 2021-07-13 一种模型训练方法及装置

Country Status (4)

Country Link
US (1) US20230177410A1 (zh)
EP (1) EP4181020A4 (zh)
CN (1) CN112070207A (zh)
WO (1) WO2022022274A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114548255A (zh) * 2022-02-17 2022-05-27 支付宝(杭州)信息技术有限公司 一种模型的训练方法、装置及设备
CN114610500A (zh) * 2022-03-22 2022-06-10 重庆邮电大学 一种基于模型蒸馏的边缘缓存方法
CN114881227A (zh) * 2022-05-13 2022-08-09 北京百度网讯科技有限公司 模型压缩方法、图像处理方法、装置和电子设备
WO2024065709A1 (zh) * 2022-09-30 2024-04-04 华为技术有限公司 一种通信方法及相关设备

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112070207A (zh) * 2020-07-31 2020-12-11 华为技术有限公司 一种模型训练方法及装置
CN114648092A (zh) * 2020-12-19 2022-06-21 中国科学院深圳先进技术研究院 一种个性化联邦学习加速方法、装置
CN112733114B (zh) * 2021-01-14 2022-03-29 天津大学 一种面向智能家居的隐私保护人脸识别系统及方法
CN113099175B (zh) * 2021-03-29 2022-11-04 苏州华云视创智能科技有限公司 一种基于5g的多模型手持云端检测传输系统及检测方法
CN113837308B (zh) * 2021-09-29 2022-08-05 北京百度网讯科技有限公司 基于知识蒸馏的模型训练方法、装置、电子设备
CN114492831B (zh) * 2021-12-23 2023-04-07 北京百度网讯科技有限公司 联邦学习模型的生成方法及其装置
CN114077755B (zh) * 2022-01-19 2022-05-31 南京邮电大学 保护隐私的可控轻量化联邦学习方法、系统和检测方法
CN114330673A (zh) * 2022-03-15 2022-04-12 支付宝(杭州)信息技术有限公司 一种对业务预测模型进行多方联合训练的方法及装置
CN117993436A (zh) * 2022-10-31 2024-05-07 华为技术有限公司 一种模型训练方法和相关设备
CN115907041A (zh) * 2022-11-02 2023-04-04 华为技术有限公司 一种模型训练方法及装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10152676B1 (en) * 2013-11-22 2018-12-11 Amazon Technologies, Inc. Distributed training of models using stochastic gradient descent
CN110196735A (zh) * 2018-02-27 2019-09-03 上海寒武纪信息科技有限公司 一种计算装置及相关产品
CN111382863A (zh) * 2018-12-28 2020-07-07 上海欧菲智能车联科技有限公司 一种神经网络压缩方法及装置
CN111401552A (zh) * 2020-03-11 2020-07-10 浙江大学 一种基于调整批量大小与梯度压缩率的联邦学习方法和系统
CN112070207A (zh) * 2020-07-31 2020-12-11 华为技术有限公司 一种模型训练方法及装置

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111340243B (zh) * 2020-05-15 2020-09-08 支付宝(杭州)信息技术有限公司 用于联盟学习的方法、装置及联盟学习系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10152676B1 (en) * 2013-11-22 2018-12-11 Amazon Technologies, Inc. Distributed training of models using stochastic gradient descent
CN110196735A (zh) * 2018-02-27 2019-09-03 上海寒武纪信息科技有限公司 一种计算装置及相关产品
CN111382863A (zh) * 2018-12-28 2020-07-07 上海欧菲智能车联科技有限公司 一种神经网络压缩方法及装置
CN111401552A (zh) * 2020-03-11 2020-07-10 浙江大学 一种基于调整批量大小与梯度压缩率的联邦学习方法和系统
CN112070207A (zh) * 2020-07-31 2020-12-11 华为技术有限公司 一种模型训练方法及装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4181020A4

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114548255A (zh) * 2022-02-17 2022-05-27 支付宝(杭州)信息技术有限公司 一种模型的训练方法、装置及设备
CN114610500A (zh) * 2022-03-22 2022-06-10 重庆邮电大学 一种基于模型蒸馏的边缘缓存方法
CN114610500B (zh) * 2022-03-22 2024-04-30 重庆邮电大学 一种基于模型蒸馏的边缘缓存方法
CN114881227A (zh) * 2022-05-13 2022-08-09 北京百度网讯科技有限公司 模型压缩方法、图像处理方法、装置和电子设备
CN114881227B (zh) * 2022-05-13 2023-07-04 北京百度网讯科技有限公司 模型压缩方法、图像处理方法、装置和电子设备
WO2024065709A1 (zh) * 2022-09-30 2024-04-04 华为技术有限公司 一种通信方法及相关设备

Also Published As

Publication number Publication date
EP4181020A4 (en) 2023-12-13
CN112070207A (zh) 2020-12-11
US20230177410A1 (en) 2023-06-08
EP4181020A1 (en) 2023-05-17

Similar Documents

Publication Publication Date Title
WO2022022274A1 (zh) 一种模型训练方法及装置
WO2022068623A1 (zh) 一种模型训练方法及相关设备
CN112651511A (zh) 一种训练模型的方法、数据处理的方法以及装置
WO2022179492A1 (zh) 一种卷积神经网络的剪枝处理方法、数据处理方法及设备
WO2022179586A1 (zh) 一种模型训练方法及其相关联设备
WO2022228425A1 (zh) 一种模型训练方法及装置
WO2022179603A1 (zh) 一种增强现实方法及其相关设备
WO2024001806A1 (zh) 一种基于联邦学习的数据价值评估方法及其相关设备
WO2023083030A1 (zh) 一种姿态识别方法及其相关设备
WO2022111387A1 (zh) 一种数据处理方法及相关装置
WO2024160186A1 (zh) 一种模型训练方法及其相关设备
WO2024094094A1 (zh) 一种模型训练方法及装置
CN114169393A (zh) 一种图像分类方法及其相关设备
WO2024046144A1 (zh) 一种视频处理方法及其相关设备
WO2023185541A1 (zh) 一种模型训练方法及其相关设备
WO2024017282A1 (zh) 一种数据处理方法及其装置
WO2023246735A1 (zh) 一种项目推荐方法及其相关设备
WO2023197857A1 (zh) 一种模型切分方法及其相关设备
WO2023045949A1 (zh) 一种模型训练方法及其相关设备
WO2023143080A1 (zh) 一种数据处理方法以及相关设备
CN116739154A (zh) 一种故障预测方法及其相关设备
WO2023020185A1 (zh) 一种图像分类方法及其相关设备
CN115795025A (zh) 一种摘要生成方法及其相关设备
WO2024061123A1 (zh) 一种图像处理方法及其相关设备
WO2024140630A1 (zh) 一种模型训练方法及其相关设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21849491

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2021849491

Country of ref document: EP

Effective date: 20230210

NENP Non-entry into the national phase

Ref country code: DE