Portion-Specific Model Compression for Optimization of Machine-Learned Models

Systems and methods of the present disclosure are directed to portion-specific compression and optimization of machine-learned models. For example, a method for portion-specific compression and optimization of machine-learned models includes obtaining data descriptive of one or more respective sets of compression schemes for one or more model portions of a plurality of model portions of a machine-learned model. The method includes evaluating a cost function to respectively select one or more candidate compression schemes from the one or more sets of compression schemes. The method includes respectively applying the one or more candidate compression schemes to the one or more model portions to obtain a compressed machine-learned model comprising one or more compressed model portions that correspond to the one or more model portions.

FIELD

The present disclosure relates generally to machine-learned model optimization. More particularly, the present disclosure relates to portion-specific compression of machine-learned models.

BACKGROUND

Distributed computing service systems (e.g., cloud computing platforms, etc.) provide a variety of services to implement machine learned models for various tasks and applications. Specifically, cloud computing services may build, train, and/or compress machine-learned models based on the needs of users. However, the application of compression schemes to machine-learned models can substantially reduce the overall accuracy of the machine-learned models. As such, techniques that reduce, or eliminate, this loss in accuracy are desired.

SUMMARY

One example aspect of the present disclosure is directed to computer-implemented method for portion-specific compression and optimization of machine-learned models. The method includes obtaining, by the computing system, data descriptive of one or more respective sets of compression schemes for one or more model portions of a plurality of model portions of a machine-learned model. The method includes evaluating, by the computing system, a cost function to respectively select one or more candidate compression schemes from the one or more sets of compression schemes. The method includes respectively applying, by the computing system, the one or more candidate compression schemes to the one or more model portions to obtain a compressed machine-learned model comprising one or more compressed model portions that correspond to the one or more model portions.

Another example aspect of the present disclosure is directed to a computing system for portion-specific compression and optimization of machine-learned models. The computing system includes one or more processors. The computing system includes one or more non-transitory computer-readable media that store instructions that, when executed by the one or more processors, cause the computing system to perform operations. The operations include obtaining data descriptive of one or more respective sets of compression schemes for one or more model portions of a plurality of model portions of a machine-learned model. The operations include evaluating a cost function to respectively select one or more candidate compression schemes from the one or more sets of compression schemes. The operations include respectively applying the one or more candidate compression schemes to the one or more model portions to obtain a compressed machine-learned model comprising one or more compressed model portions that correspond to the one or more model portions.

Another example aspect of the present disclosure is directed to one or more non-transitory computer-readable media that store instructions that, when executed by one or more processors, cause the computing system to perform operations. The operations include from the user device associated with a user, data descriptive of a selection of one or more candidate compression schemes from one or more respective sets of compression schemes for compression of one or more respective model portions of a plurality of model portions of a trained machine-learned model. The operations include applying the one or more compression schemes to one or more respective model portions of the plurality of model portions of the trained machine-learned model to obtain a compressed machine-learned model.

DETAILED DESCRIPTION

Overview

Generally, the present disclosure is directed to machine-learned model optimization. More particularly, the present disclosure relates to portion-specific (e.g., specific to layers, tensors (e.g., data arrays of weight values characterizing weights between corresponding pairs nodes of the machine-learning model (i.e. the influence which the output of a first node of the pair has on the output of the second node of the pair)), groupings of layers and/or tensors, etc.) compression of machine-learned models. Specifically, as an example, a computing system can obtain data descriptive of one or more respective sets of compression schemes for one or more model portions of a machine-learned model (e.g., layer(s), tensor(s), parameter grouping(s) (e.g. the parameters of the machine learning model may include weight values as discussed above, and may include other numerical parameters, such as offset values associated with nodes (e.g. a given node may output a value which is function of the weighted input to the node plus an offset value for the node): a “parameter grouping” refers to a plurality of these parameters), etc.). For example, a user can provide data via a user device that describes set(s) of compression schemes that correspond to portion(s) of a machine-learned model. The computing system can evaluate a cost function to respectively select candidate compression schemes from the set(s) of compression scheme(s). For example, the cost function may seek to optimize an accuracy of the model while limited by a latency constraint (e.g., a limit of floating point operations per second, etc.). The computing system can determine a candidate compression scheme from each set of compression schemes that collectively optimize the cost function. The computing system can apply the candidate compression scheme(s) to the model portion(s) to obtain a compressed machine-learned model that includes the compressed model portion(s).

In some implementations, the compressed machine-learned model can be trained via distillation of the machine-learned model. For example, the one or more compressed portions of the machine-learned model can be trained via distillation of the corresponding one or portions of the uncompressed machine-learned model.

In such fashion, a computing system can collectively determine candidate compression scheme(s) for application to model portion(s) according to a cost function to obtain a compressed machine-learned model that retains capabilities (e.g., accuracy, etc.) substantially similar to, or greater than, the corresponding uncompressed machine-learned model.

Systems and methods of the present disclosure provide a number of technical effects and benefits. As one example technical effect and benefit, the utility of trained machine-learned models can often be limited by the size of the models (e.g., utilization of models with mobile devices, wearable devices, etc.). However, conventional compression of machine-learned models can reduce an accuracy of the to a prohibitive degree. By substantially compressing machine-learned models and retaining accuracy, implementations of the present disclosure greatly expand the utility of existing machine-learned models, leading to optimized performance and user experience across a variety of use-cases (e.g., mobile computing, wearable devices, etc.). Thus, the present methods may produce a compressed machine-learned model which is suitable for implementation on a specific data processing system (e.g. a mobile computing device or wearable device), starting from a machine-learned model which is not suitable for implementation on such a device. Here suitability is measured according to a suitability criterion, e.g. such as that the memory requirements to implement the compressed machine-learning model are below a threshold defined based on the specific data processing system, e.g. a certain proportion of the memory capacity of the specific data processing system, or that the number of computing operations required per second to implement the compressed machine-learning model (e.g. so as to complete a computing task within a specific time) is below a threshold. In another example, the compressed machine-learned model may be suitable for implementation in one processor (core) of multi-processor system in which the multiple processors operate in parallel, even though the (uncompressed) machine-learning model is not suitable for implementation in a single processor of the multi-processor system. The specific computer system typically has lower computing capacity (e.g. data storage capacity and/or computational operations per second) than the computer system which performs the present methods to produce the compressed machine-learned model. The compression is such as to ensure that the compressed machine learned model meets a suitability criterion for implementation using the specific data processing system.

As another example technical effect and benefit, large machine-learned models require a substantial quantity of computing resources to store and utilize. As such, by providing the capability to substantially compress large machine-learned models while retaining accuracy implementations of the present disclosure can greatly reduce the quantity of computing resources required for utilization of large machine-learned models (e.g., memory, power, compute cycles, storage, etc.).

Example Devices and Systems

FIG.1Adepicts a block diagram of an example computing system100that performs portion-specific compression of machine-learned models according to example embodiments of the present disclosure. The system100includes a user computing device102, a server computing system130, and a training computing system150that are communicatively coupled over a network180.

In some implementations, the user computing device102can store or include one or more models120. For example, the models120can be or can otherwise include various machine-learned models such as neural networks (e.g., deep neural networks) or other types of machine-learned models, including non-linear models and/or linear models. Neural networks can include feed-forward neural networks, recurrent neural networks (e.g., long short-term memory recurrent neural networks), convolutional neural networks or other forms of neural networks. Some example machine-learned models can leverage an attention mechanism such as self-attention. For example, some example machine-learned models can include multi-headed self-attention models (e.g., transformer models).

Specifically, the user computing device102can store compressed and/or uncompressed machine-learned models120. For example, the user computing device102can transmit an uncompressed machine-learned model120to a computing system of a computing service provider (e.g., the server computing system130, the training computing system150, etc.). The computing system can compress the model using techniques discussed herein to obtain a compressed machine-learned model120. The user computing device can receive the compressed machine-learned model120from the computing system (e.g., via the network180, etc.).

In some implementations, the one or more models120can be received from the server computing system130over network180, stored in the user computing device memory114, and then used or otherwise implemented by the one or more processors112. For example, the machine-learned model(s)120may be trained to perform a variety of task(s) (e.g., task(s) specified by a user, etc.) In some implementations, the user computing device102can implement multiple parallel instances of a single model120(e.g., to perform parallel user-specified tasks across multiple instances of the machine-learned model(s)).

Additionally, or alternatively, one or more models140can be included in or otherwise stored and implemented by the server computing system130that communicates with the user computing device102according to a client-server relationship. For example, the models140can be implemented by the server computing system130as a portion of a web service (e.g., a machine-learned task service). Thus, one or more models120can be stored and implemented at the user computing device102and/or one or more models140can be stored and implemented at the server computing system130.

The user computing device102can also include one or more user input components122that receives user input. For example, the user input component122can be a touch-sensitive component (e.g., a touch-sensitive display screen or a touch pad) that is sensitive to the touch of a user input object (e.g., a finger or a stylus). The touch-sensitive component can serve to implement a virtual keyboard. Other example user input components include a microphone, a traditional keyboard, or other means by which a user can provide user input.

As described above, the server computing system130can store or otherwise include one or more models140. For example, the models140can be or can otherwise include various machine-learned models. Example machine-learned models include neural networks or other multi-layer non-linear models. Example neural networks include feed forward neural networks, deep neural networks, recurrent neural networks, and convolutional neural networks. Some example machine-learned models can leverage an attention mechanism such as self-attention. For example, some example machine-learned models can include multi-headed self-attention models (e.g., transformer models).

The user computing device102and/or the server computing system130can train the models120and/or140via interaction with the training computing system150that is communicatively coupled over the network180. Specifically, in some implementations, the training computing system150may train the models120and/or140and provide the trained models to the user computing device and/or the server computing system130for inference. The training computing system150can be separate from the server computing system130or can be a portion of the server computing system130. Specifically, as mentioned the server computing system may receive uncompressed machine-learned models (e.g., uncompressed machine-learned models120) and compress the uncompressed machine-learned models120using techniques described herein to obtain compressed machine-learned models140.

The training computing system150can include a model trainer160that trains the machine-learned models120and/or140stored at the user computing device102and/or the server computing system130using various training or learning techniques, such as, for example, backwards propagation of errors. For example, a loss function can be backpropagated through the model(s) to update one or more parameters of the model(s) (e.g., based on a gradient of the loss function). Various loss functions can be used such as mean squared error, likelihood loss, cross entropy loss, hinge loss, and/or various other loss functions. Gradient descent techniques can be used to iteratively update the parameters over a number of training iterations.

In particular, the model trainer160can train the models120and/or140based on a set of training data162. Specifically, in some implementations, the model trainer160can train the machine-learned model(s)120/140via distillation. For example, the machine-learned models140may include an uncompressed machine-learned model and a corresponding machine-learned model. The training computing system150can train compressed model portion(s) of the compressed machine-learned model via distillation of the corresponding model portion(s) of the uncompressed machine-learned model.

In some implementations, if the user has provided consent, the training examples can be provided by the user computing device102. Thus, in such implementations, the model120provided to the user computing device102can be trained by the training computing system150on user-specific data received from the user computing device102. In some instances, this process can be referred to as personalizing the model.

The machine-learned models described in this specification may be used in a variety of tasks, applications, and/or use cases.

In some implementations, the input to the machine-learned model(s) of the present disclosure can be image data (e.g. image data captured by a camera arranged to image a portion of the real-world). The machine-learned model(s) can process the image data to generate an output. As an example, the machine-learned model(s) can process the image data to generate an image recognition output (e.g., a recognition of the image data, a latent embedding of the image data, an encoded representation of the image data, a hash of the image data, etc.). As another example, the machine-learned model(s) can process the image data to generate an image segmentation output. As another example, the machine-learned model(s) can process the image data to generate an image classification output, i.e. output data indicating one of a plurality of predefined categories, so that the output data indicates that the content of the image (i.e. a subject depicted in the image) is in one of those categories, i.e. “matches” that category. As another example, the machine-learned model(s) can process the image data to generate an image data modification output (e.g., an alteration of the image data, etc.). As another example, the machine-learned model(s) can process the image data to generate an encoded image data output (e.g., an encoded and/or compressed representation of the image data, etc.). As another example, the machine-learned model(s) can process the image data to generate an upscaled image data output. As another example, the machine-learned model(s) can process the image data to generate a prediction output.

In some implementations, the input to the machine-learned model(s) of the present disclosure can be text or natural language data. The machine-learned model(s) can process the text or natural language data to generate an output. As an example, the machine-learned model(s) can process the natural language data to generate a language encoding output. As another example, the machine-learned model(s) can process the text or natural language data to generate a latent text embedding output. As another example, the machine-learned model(s) can process the text or natural language data to generate a translation output. As another example, the machine-learned model(s) can process the text or natural language data to generate a classification output, i.e. output data indicating one of a plurality of predefined categories, so that the output data indicates that the content of the text or natural language data is in one of those categories, i.e. “matches” that category. As another example, the machine-learned model(s) can process the text or natural language data to generate a textual segmentation output. As another example, the machine-learned model(s) can process the text or natural language data to generate a semantic intent output. As another example, the machine-learned model(s) can process the text or natural language data to generate an upscaled text or natural language output (e.g., text or natural language data that is higher quality than the input text or natural language, etc.). As another example, the machine-learned model(s) can process the text or natural language data to generate a prediction output.

In some implementations, the input to the machine-learned model(s) of the present disclosure can be sound data, such as speech data. For example, the sound data may be captured by a microphone, and may record a speaker speaking. The machine-learned model(s) can process the speech data to generate an output. As an example, the machine-learned model(s) can process the speech data to generate a speech recognition output. For example, the machine-learned model(s) can process the speech data to generate a classification output. i.e. output data indicating one of a plurality of predefined categories, so that the output data indicates that the content of a portion of the speech data (i.e. the semantic meaning of that portion of the speech data) is in one of those categories. i.e. “matches” that category. For example, each of the categories may correspond to one of a vocabulary of words, such that the output result indicates which word of the vocabulary is encoded by respective sections of the speech data. As another example, the machine-learned model(s) can process the speech data to generate a speech translation output (e.g. data encoding sound data recording speech data with semantic content equal to that of the speech data, but in a natural language different from the natural language of the speech data). As another example, the machine-learned model(s) can process the speech data to generate a latent embedding output. As another example, the machine-learned model(s) can process the speech data to generate an encoded speech output (e.g., an encoded and/or compressed representation of the speech data, etc.). As another example, the machine-learned model(s) can process the speech data to generate an upscaled speech output (e.g., speech data that is higher quality than the input speech data, etc.). As another example, the machine-learned model(s) can process the speech data to generate a textual representation output (e.g., a textual representation of the input speech data, etc.). As another example, the machine-learned model(s) can process the speech data to generate a prediction output.

In some implementations, the input to the machine-learned model(s) of the present disclosure can be latent encoding data (e.g., a latent space representation of an input, etc.). The machine-learned model(s) can process the latent encoding data to generate an output. As an example, the machine-learned model(s) can process the latent encoding data to generate a recognition output. As another example, the machine-learned model(s) can process the latent encoding data to generate a reconstruction output. As another example, the machine-learned model(s) can process the latent encoding data to generate a search output. As another example, the machine-learned model(s) can process the latent encoding data to generate a reclustering output. As another example, the machine-learned model(s) can process the latent encoding data to generate a prediction output.

In some implementations, the input to the machine-learned model(s) of the present disclosure can be statistical data. Statistical data can be, represent, or otherwise include data computed and/or calculated from some other data source. The machine-learned model(s) can process the statistical data to generate an output. As an example, the machine-learned model(s) can process the statistical data to generate a recognition output. As another example, the machine-learned model(s) can process the statistical data to generate a prediction output. As another example, the machine-learned model(s) can process the statistical data to generate a classification output. As another example, the machine-learned model(s) can process the statistical data to generate a segmentation output. As another example, the machine-learned model(s) can process the statistical data to generate a visualization output. As another example, the machine-learned model(s) can process the statistical data to generate a diagnostic output.

In some implementations, the input to the machine-learned model(s) of the present disclosure can be sensor data. The machine-learned model(s) can process the sensor data to generate an output. As an example, the machine-learned model(s) can process the sensor data to generate a recognition output. As another example, the machine-learned model(s) can process the sensor data to generate a prediction output. As another example, the machine-learned model(s) can process the sensor data to generate a classification output. As another example, the machine-learned model(s) can process the sensor data to generate a segmentation output. As another example, the machine-learned model(s) can process the sensor data to generate a visualization output. As another example, the machine-learned model(s) can process the sensor data to generate a diagnostic output. As another example, the machine-learned model(s) can process the sensor data to generate a detection output. In another example, the machine-learned model(s) may be configured to use the sensor data to generate control data, to control a real-world electromechanical system (e.g. a robot) in a real-world environment, e.g. to as to perform a task. For example, the electromechanical system may be configured to move (by reconfiguration and/or translation) in a real-world environment, e.g. to perform an object manipulation task or a navigation task.

In some cases, the machine-learned model(s) can be configured to perform a task that includes encoding input data (e.g. image data and/or sound data) for reliable and/or efficient transmission or storage (and/or corresponding decoding). For example, the task may be an audio compression task. The input may include audio data and the output may comprise compressed audio data. In another example, the input includes visual data (e.g., one or more images or videos), the output comprises compressed visual data, and the task is a visual data compression task. In another example, the task may comprise generating an embedding for input data (e.g., input audio or visual data).

In some cases, the input includes audio data representing a spoken utterance and the task is a speech recognition task. The output may comprise a text output which is mapped to the spoken utterance. In some cases, the task comprises encrypting or decrypting input data. In some cases, the task comprises a microprocessor performance task, such as branch prediction or memory address translation.

FIG.1Aillustrates one example computing system that can be used to implement portion-specific compression and optimization of machine-learned models the present disclosure. Other computing systems can be used as well. For example, in some implementations, the user computing device102can include the model trainer160and the training dataset162. In such implementations, the models120can be both trained and used locally at the user computing device102. In some of such implementations, the user computing device102can implement the model trainer160to personalize the models120based on user-specific data.

FIG.1Bdepicts a block diagram of an example computing device10that performs portion-specific compression and optimization of machine-learned models according to example implementations of the present disclosure. The computing device10can be a user computing device or a server computing device.

The computing device10includes a number of applications (e.g., applications1through N). Each application contains its own machine learning library and machine-learned model(s). For example, each application can include a machine-learned model. Example applications include a text messaging application, an email application, a dictation application, a virtual keyboard application, a browser application, etc.

FIG.1Cdepicts a block diagram of an example computing device50that performs distillation training for portion-specific optimization of machine-learned models according to example implementations of the present disclosure. The computing device50can be a user computing device or a server computing device.

The computing device50includes a number of applications (e.g., applications1through N). Each application is in communication with a central intelligence layer. Example applications include a text messaging application, an email application, a dictation application, a virtual keyboard application, a browser application, etc. In some implementations, each application can communicate with the central intelligence layer (and model(s) stored therein) using an API (e.g., a common API across all applications).

FIG.2Adepicts a block diagram of an example computing system130that evaluates a cost function to determine candidate compression scheme(s) according to some embodiments of the present disclosure. Specifically, the computing system130(e.g., server computing system130ofFIG.1A, etc.) can include processor(s)132and memory134, which includes data136and instructions138, as described previously with regards toFIG.1A. The computing system130can receive data descriptive of set(s) of compression scheme(s)202. In some implementations, the computing system130may receive the data202from a computing device of a user of a cloud computing service. For example, the data202may be or otherwise indicate a selection by a user of sets of compression scheme(s) for utilization in a cloud-based machine-learned model compression service.

In some implementations, the computing system130can include set(s) of compression schemes204. The set(s) of compression schemes204can include compression scheme set204A, compression scheme set204B, and compression scheme set204C. It should be noted that, although the set(s) of compression schemes204is illustrated with three sets of compression schemes, embodiments of the present disclosure are not limited to three sets of compression schemes. Rather, the set(s) of compression schemes204can include any number of compression scheme(s) (e.g., one set, ten sets, etc.). For example, the computing system130may include a large variety of compression schemes that can be utilized to compress machine-learned models. The set(s) of compression schemes204can be selected from the variety of compression schemes included in the computing system130(e.g., based on the data202, etc.). Additionally, or alternatively, in some implementations, the data202may include the set(s) of compression schemes204.

The set of compression schemes204can include one or more compression schemes that can be utilized for compression of machine-learned models. For example, as illustrated, compressions scheme set204A can include one compression scheme and compression scheme set204C can include 10 compression schemes. Each of the compression scheme(s) included in the set of compression scheme(s)204can be any type of compression scheme sufficient to compress or otherwise encode a model portion of a machine-learned model.

Each of the sets of compression schemes204can be selected for compression of a corresponding model portion of an uncompressed machine-learned model214. A model portion of a machine-learned model can refer to any component, element, segment of data, feature, grouping of feature(s), etc. of a machine-learned model (e.g., layer(s), tensor(s), a grouping of layer(s) and tensor(s), etc.). For example, compression scheme set204A may include one compression scheme for compression of a model portion214A of the machine-learned model214that is or otherwise includes a convolutional layer. For another example, the compression scheme set204B may include a number of compression schemes for compression of a model portion214B that is or otherwise includes a tensor. For yet another example, the compression scheme set204C may include a number of compression schemes for compression of a model portion214C that includes a recurrent layer and one or more associated tensors.

The computing system130can include a cost function evaluator206. The cost function evaluator206can evaluate a cost function208to determine candidate compression scheme(s)210from the set(s) of compression schemes204. For example, the cost function evaluator206can evaluate the cost function208to select candidate compression scheme210A from compression scheme set204A, candidate compression scheme210B from compression scheme set204B, and candidate compression scheme210C from compression scheme set204C.

In some implementations, the cost function208, when evaluated by the cost function evaluator206, can evaluate changes in an accuracy metric and a performance metric (e.g., as measured in floating-point operations per second (FLOPS)) associated with compression of a model portion214A-N. For example, the cost function evaluator206can evaluate the cost function208to determine changes in the accuracy metric and the performance metric associated with compression of a model portion214C of the uncompressed machine-learned model214with each compression scheme in the compression scheme set204C. Based on the changes in the accuracy and performance metric, the cost function evaluator206can select the candidate compression scheme210C from the compression scheme set204C. The performance metric may be selected to provide a constraint to ensure that the compressed machine-learned model meets a suitability criterion with respect to a specific data processing system. For example, it may provide a high contribution to the cost function if the suitability criterion is not met.

In some implementations, the cost function can evaluate the changes in the accuracy metric and the performance metric using a combinatorial search space. Turning toFIG.3,FIG.3is a data flow diagram that illustrates selection of compression schemes using a combinatorial search space302according to some implementations of the present disclosure. As illustrated, the search space302can be evaluated (e.g., by the cost function evaluator206ofFIG.2A, etc.) to determine candidate compression schemes312(e.g., candidate compression schemes210ofFIG.2A, etc.) for compression of a machine-learned model314(e.g., machine-learned model214ofFIG.2A, etc.).

For example, at operation304, the search space302can be evaluated to determine whether to select compression scheme A, compression scheme B, or no compression scheme for a corresponding model portion (e.g., a model portion of the model214ofFIG.2A, etc.). Based on the changes in the accuracy metric (e.g., −0.02 acc) and the performance metric (e.g., −15 k flop), compression scheme A can be selected as a candidate compression scheme312A for compression of model portion314A of the uncompressed machine-learned model314. At operation306, the search space302can be evaluated to select compression scheme B as candidate compression scheme312B for compression of model portion314B. At operation308, the search space302can be evaluated to select no compression scheme as a candidate compression scheme312C for compression of model portion314C. In other words, the search space302can be evaluated to determine not to compress model portion314C. Similarly, at operation310, the search space302can be evaluated to select no compression scheme as a candidate compression scheme312D for compression of model portion314D.

In such fashion, the search space302can be evaluated iteratively to select a set of candidate compression schemes312that collectively optimize the search space, or the cost function that evaluates the search space (e.g., cost function208ofFIG.2A). As such, it should be noted that the search space302, and the cost function, do not necessarily select (or determine not to select) a compression scheme for a model portion without accounting for the effect of the selection on selection of compression schemes for other model portions. Rather, when evaluated, the search space302and the cost function can select a set of candidate compression schemes312that collectively optimize the accuracy metric and the performance metric. For example, the cost function may evaluate the search space302with the following parameters:

It should be noted that, in some implementations, other forms of search spaces may be utilized to evaluate changes in the accuracy metric and the performance metric. Turning toFIG.4,FIG.4is a block diagram that illustrates an example layer-wise search space that can be utilized by a cost function according to some implementations of the present disclosure. Specifically, in some implementations, the search space may be a portion-wise or layer-wise search space/size search space400. As illustrated, the search space400can be evaluated to determine, for each layer402of a machine-learned model, whether the layer of the model should be compressed to obtain a corresponding compressed layer404, and if so, to what degree the layer should be compressed. For example, as depicted, the layer-wise search space400may be evaluated to select a set of candidate compression schemes that maximize an accuracy of the compressed model while minimizing a cost (e.g., a performance cost). The set of candidate compression schemes can include schemes for compressing model portions402A,402C, and404E. The compression schemes can be applied to obtain compressed model portions402A,404C, and404E. As depicted, each of the compressed model portions402A,404C, and404E can be a different size due to the different compression schemes utilized to generate them.

Returning toFIG.2A, as described previously, the candidate compression schemes210can be selected with the cost function evaluator206. The candidate compression schemes210can be provided to the model compressor212for compression of the model portions214A-N of the uncompressed machine-learned model214.

It should be noted that, in some implementations, the cost function208may not be evaluated to select the candidate compression schemes210. Specifically, in some implementations, the compression scheme sets204A-204C may each include one compression scheme. As each of the sets of the compression schemes204would only include a single compression scheme, it would not be necessary to evaluate a cost function to select candidate compression schemes. Rather, the sets of compression scheme(s)204would include the candidate compression schemes210A-210C, and could be provided directly to the model compressor212.

FIG.2Bdepicts a block diagram of an example computing system130that compresses portions of an uncompressed machine-learned model to obtain a compressed machine-learned model according to some implementations of the present disclosure. The model compressor212can apply the candidate compression schemes210to model portions214A-N of the uncompressed machine-learned model214to obtain a compressed machine-learned model216. Specifically, the model compressor can respectively apply candidate compression schemes210A,210B, and210C to the model portions214A,214B, and214C to obtain compressed model portions216A,216B, and216C. The compressed model portions216A-216C can be included in the compressed machine-learned model216alongside the model portions214D,214E, and214F of the uncompressed machine-learned model214.

In such fashion, a subset of model portions214A-214F of the uncompressed machine-learned model214can be compressed to obtain the compressed machine-learned model216. It should be noted that, although the compressed machine-learned model216is only partially compressed (i.e., model portions214D-214F remain uncompressed), implementations of the present disclosure are not limited to partial compression of machine-learned models. Rather, the sets of compression schemes204ofFIG.2Amay instead include compression scheme sets204A-204F, which can provide candidate compression schemes210A-210F for compression of model portions214A-214F, therefore fully compressing the uncompressed machine-learned model214.

In some implementations, the compressed machine-learned model216can be provided to a second computing device. For example, the computing system130may be a cloud computing system that provides model compression services for users. The uncompressed machine-learned model214may be a model provided alongside the data descriptive of set(s) of compression scheme(s)202ofFIG.2Afor compression services. The computing system130can provide the compressed machine-learned model216to a computing device associated with the user. Alternatively, in some implementations, the compressed machine-learned model216can be provided to the model distillation trainer218for distillation training of the compressed machine-learned model216.

FIG.2Cdepicts a block diagram of an example computing system130that trains compressed portions of a compressed machine-learned model via distillation training from corresponding uncompressed portions of a corresponding uncompressed model according to some implementations of the present disclosure. Specifically, the model distillation trainer can perform portion-wise distillation from the uncompressed machine-learned model214to the compressed machine-learned model216. For example, the model distillation trainer218can train the compressed model portion216A via distillation of the model portion214A, the compressed model portion216B via distillation of the model portion214B, and the compressed model portion216C via distillation of the model portion214C.

For a specific example, to train the compressed model portion216A via distillation, the model distillation trainer218may load weights of parameters from the model portion214A to the compressed model portion216A. The model distillation trainer218can only train the compressed model portion216A for a series of training iterations (e.g., 10,000 iterations, etc.) by evaluating a loss function that evaluates a difference between an intermediate output of the model portion214A and an intermediate output of the compressed model portion216A. The model distillation trainer218may then concurrently train the first and second compressed model portions216A/216B for a number of iterations in the same manner as previously described.

In some implementations, to train compressed model portions216A-216C via distillation, the model distillation trainer218can map values of parameters from portions of the uncompressed machine-learned model214to the portions of the compressed machine-learned model216. For example, to train uncompressed model portion216A via distillation, the model distillation trainer218can map values from a set of parameters of the model portion214A to a corresponding set of parameters of the compressed model portion216A. The compressed model portion216A can be trained via distillation of the model portion214A. In some implementations, the compressed model portion216A can be trained concurrently with all other portions of the model216as the model is trained end-to-end. Alternatively, in some implementations, the parameters of the other portions may be frozen while distillation training is initially performed on the compressed model portion216A alone.

Example Methods

FIG.5depicts a flow chart diagram of an example method500to perform portion-specific compression of machine-learned models according to example implementations of the present disclosure. AlthoughFIG.5depicts steps performed in a particular order for purposes of illustration and discussion, the methods of the present disclosure are not limited to the particularly illustrated order or arrangement. The various steps of the method500can be omitted, rearranged, combined, and/or adapted in various ways without deviating from the scope of the present disclosure.

At502, a computing system obtains data descriptive of one or more respective sets of compression schemes for one or more model portions of a plurality of model portions of a machine-learned model.

At504, the computing system evaluates a cost function to respectively select one or more candidate compression schemes from the one or more sets of compression schemes. Specifically, to evaluate the cost function, the computing system can perform a search within a search space to evaluate model quality and cost after application of candidate compression schemes to respectively select the candidate compression scheme(s)

At506, the computing system respectively applies the one or more candidate compression schemes to the one or more model portions to obtain a compressed machine-learned model comprising one or more compressed model portions that correspond to the one or more model portions.

Additional Disclosure