# US 2022/0284293 A1 · Combining compression, partitioning and quantization of dl models for fitment in hardware processors

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2022/0284293 A1
- Document ID: US20220284293A1
- Status: Published application
- Kind: A1
- Application number: 17/447,625
- Filed: 2021-09-14
- Published: 2022-09-08
- Earliest claimed: 2021-01-29
- Assignees: Tata Consultancy Services Limited
- Applicants: Tata Consultancy Services Limited
- Inventors: Swarnava DEY; Arpan PAL; Gitesh KULKARNI; Chirabrata BHAUMIK; Arijit UKIL; Jayeeta MONDAL; Ishan SAHU; Aakash TYAGI; Amit SWAIN; Arijit MUKHERJEE
- Web page: https://patentgrep.com/patent/US20220284293A1

## CPC

- G06N 3/082: modifying the architecture, e.g. adding, deleting or silencing nodes or connections
- G06F 1/3206: Monitoring of events, devices or parameters that trigger a change in power modality
- G06F 18/2148: {characterised by the process organisation or structure, e.g. boosting cascade}
- G06N 3/063: using electronic means
- G06N 3/088: Non-supervised learning, e.g. competitive learning
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Small and compact Deep Learning models are required for embedded Al in several domains. In many industrial use-cases, there are requirements to transform already trained models to ensemble embedded systems or re-train those for a given deployment scenario, with limited data for transfer learning. Moreover, the hardware platforms used in embedded application include FPGAs, AI hardware accelerators, System-on-Chips and on-premises computing elements (Fog/Network Edge). These are interconnected through heterogenous bus/network with different capacities. Method of the present disclosure finds how to automatically partition a given DNN into ensemble devices, considering the effect of accuracy—latency power—tradeoff, due to intermediate compression and effect of quantization due to conversion to AI accelerator SDKs. Method of the present disclosure is an iterative approach to obtain a set of partitions by repeatedly refining the partitions and generating a cascaded model for inference and training on ensemble hardware.

## Claims

### Claim 1

A processor implemented method, comprising:
obtaining, via one or more hardware processors, a deep learning (DL) model specific to an application scenario and partitioning the DL model into a plurality of layers;
partitioning, via the one or more hardware processors, the plurality of layers into k subsequences of layers based on k processing elements, wherein the k processing elements (PE) comprise a first processing element type;
generating, for each layer in the plurality of layers of the DL model, via the one or more hardware processors, a transformed layer based on a selection of one or more compression configurations and one or more quantization configurations, wherein each of the one or more compression configurations and the one or more quantization configurations comprise a corresponding inference accuracy, a corresponding inference latency, and an inference power consumption, and wherein the corresponding inference accuracy, the corresponding inference latency, and the inference power consumption are obtained by executing a cascaded DL model inference program;
iteratively selecting, via the one or more hardware processors, at least one compression configuration and at least one quantization configuration for each of the transformed layer of the k subsequences of transformed layers, until each of the corresponding inference accuracy, the corresponding inference latency, and the inference power consumption reach a corresponding predefined threshold by: iteratively performing:
assigning, via the one or more hardware processors, a first subsequence of transformed layers from the k subsequence of transformed layers to a first processing element (PE) such that the first subsequences of transformed layers has a maximum inference accuracy, a minimum inference latency and a minimum power consumption on the first processing element (PE);
partitioning, via the one or more hardware processors, a second subsequence of transformed layers from the k subsequences of transformed layers into a first set of transformed layers and a second set of transformed layers, and assigning the first set of transformed layers to the first PE and the second set of layers to a second PE, such that each of the first set of transformed layers and the second set of transformed layers has the maximum inference accuracy, the minimum inference latency and the minimum power consumption on the first PE and the second PE respectively, wherein the step of iteratively assigning and partitioning are performed to obtain a mapping of the first subsequence of transformed layers and the second subsequence of layers on the first PE and the second PE;
partitioning, via the one or more hardware processors, the second subsequence of transformed layers of the DL model into two different partitions comprising of a set of transformed layers, and assigning the set of transformed layers from the two different partitions to the first PE and the second PE respectively, such that the second subsequences of layers has the maximum inference accuracy and the minimum inference latency, and the minimum power consumption on the first PE and the second PE; and
continually partitioning, via the one or more hardware processors, subsequent subsequence of transformed layers into two partitions, each of the two partitions comprises a set of transformed layers, and assigning the set of transformed layers to an earlier processing element and a current processing element respectively, to obtain a mapping of k subsequences of transformed layers on the k processing elements (208d), until the k subsequences of transformed layers have a maximum inference accuracy, a minimum inference latency and a minimum power consumption on the k processing elements (PE);
generating, via the one or more hardware processors, a DL model based on the mapped k subsequences of transformed layers on the k processing elements;
executing, via the cascaded DL model inference program executed by the one or more hardware processors, the DL model and determining an overall inference accuracy and an overall inference latency, and an overall inference power consumption;
rewarding or penalizing, via the one or more hardware processors, a sequence learning network based on a comparison of the overall inference accuracy and the overall inference latency, and the overall inference power consumption of (i) a current iteration of the cascaded DL model inference program generated by a selection of sequence of transformed layers and (ii) a previous iteration of the cascaded DL model inference program generated by a selection of sequence of transformed layers; and
identifying, the generated DL model as a final DL model based on the mapped k subsequences of transformed layers on the k processing elements for the application scenario.

### Claim 2 (depends on 1)

The processor implemented method of claim 1, wherein when (i) a pth processing element from the k processing elements is a second processing element type and (ii) the one or more compression configurations and the one or more quantization configurations are unavailable, the one or more compression configurations and the one or more quantization configurations are generated by:
freezing and converting a pth subsequence of transformed layers from k subsequences of transformed layers for executing in a pth processing element serving as the second PE type;
determining an inference accuracy, an inference latency, and an inference power consumption for the pth subsequence transformed layers on pth PE, at run-time based on (i) an intermediate output from a preceding subsequence of transformed layers and (ii) an intermediate output to a next subsequence of transformed layers; and
generating the one or more quantization configurations and the one or more compression configurations based on the determined inference accuracy, the inference latency, and the inference power consumption for the pth subsequence of transformed layers.

### Claim 3 (depends on 1)

The processor implemented method of claim 1, wherein when (i) a pth processing element from the k processing elements is a second processing element type, (ii) the one or more compression configurations and the one or more quantization configurations are unavailable and (iii) training data is available for re-training of the obtained DL model, the one or more compression configurations and the one or more quantization configurations are generated by:
freezing and converting a pth subsequence of transformed layers from k subsequences of transformed layers for executing in a pth processing element serving as the second PE type;
re-training remaining transformed layers of the DL model without training the pth subsequence of transformed layers deployed on the pth processing element serving as the second PE type, wherein the remaining transformed layers of the DL model are retrained using an intermediate output of (i) a preceding subsequence of transformed layers of the pth subsequence of transformed layers and (ii) a next subsequence of transformed layers of the pth subsequence of transformed layers;
determining a partition point between the pth subsequence of transformed layers and the next subsequence of transformed layers; and
modifying an index of transformed layers in the obtained mapping based on the determined partition point between the pth subsequence of transformed layers and the next subsequence of transformed layers.

### Claim 4 (depends on 2)

The processor implemented method of claim 2, wherein the first processing element type and the second processing element type are distinct from each other.

### Claim 5

A system, comprising:
a memory storing instructions;
one or more communication interfaces; and
one or more hardware processors coupled to the memory via the one or more communication interfaces, wherein the one or more hardware processors are configured by the instructions to:
obtain a deep learning (DL) model specific to an application scenario and partition the DL model into a plurality of layers;
partition the plurality of layers into k subsequences of layers based on k processing elements, wherein the k processing elements (PE) comprise a first processing element type;
generate, for each layer in the plurality of layers of the DL model, a transformed layer based on a one or more compression configurations and one or more quantization configurations, each of the one or more compression configurations and the one or more quantization configurations comprise a corresponding inference accuracy, a corresponding inference latency, and a inference power consumption, and wherein the corresponding inference accuracy, the corresponding inference latency, and the inference power consumption are obtained by executing a cascaded DL model inference program;
iteratively select at least one compression configuration and at least one quantization configuration for each of the transformed layer of the k subsequences of transformed layers, until each of the corresponding inference accuracy, the corresponding inference latency, and the inference power consumption reach a corresponding predefined threshold by:
iteratively performing:
assigning, via the one or more hardware processors, a first subsequence of transformed layers from the k subsequences of transformed layers to a first processing element (PE) such that the first subsequences of transformed layers has a maximum inference accuracy, a minimum inference latency and a minimum power consumption on the first processing element (PE);
partitioning, via the one or more hardware processors, a second subsequence of transformed layers from the k subsequences of transformed layers into a first set of transformed layers and a second set of transformed layers, and assigning the first set of transformed layers to the first PE and the second set of transformed layers to a second PE, such that each of the first subsequence of transformed layers and the second subsequences of transformed layers has the maximum inference accuracy, the minimum inference latency and the minimum power consumption on the first PE and the second PE respectively, wherein the step of iteratively assigning and splitting are performed to obtain a mapping of the first set of transformed layers and the second set of transformed layers on the first PE and the second PE;
partitioning, via the one or more hardware processors, the second subsequence of transformed layers of the DL model into two different partitions comprising of a set of transformed layers and assigning the set of transformed layers from the two different partitions to the first PE and the second PE respectively, such that the second subsequences of layers has the maximum inference accuracy and the minimum inference latency, and the minimum power consumption on the first PE and the second PE; and
continually partitioning, via the one or more hardware processors, subsequent subsequence of transformed layers into two partitions, each of the two partitions comprises a set of transformed layers and assigning the set of layers from the two partitions to an earlier processing element and a current processing element respectively, to obtain a mapping of k subsequences of layers on the k processing elements, until the k subsequences of transformed layers have a maximum inference accuracy, a minimum inference latency and a minimum power consumption on the k processing elements (PE);
generate a DL model based on the mapped k subsequences of layers on the k processing elements; executing, via a cascaded DL model inference program executed by the one or more hardware processors, the DL model and determining an overall inference accuracy and an overall inference latency, and an overall inference power consumption;
reward or penalize, via the one or more hardware processors, a sequence learning network based on a comparison of the overall inference accuracy, the overall inference latency, and the overall inference power consumption of (i) a current iteration of the cascaded DL model inference program generated by a selection of sequence of transformed layers and (ii) a previous iteration of the cascaded DL model inference program generated by a selection of sequence of transformed layers; and
identify, the generated DL model as a final DL model based on the mapped k subsequences of transformed layers on the k processing elements for the application scenario.

### Claim 6 (depends on 5)

The system of claim 5, wherein when (i) a pth processing element from the k processing elements is a second processing element type and (ii) the one or more compression configurations and the one or more quantization configurations are unavailable, the one or more compression configurations and the one or more quantization configurations are generated by by:
freezing and converting a pth subsequence of transformed layers from k subsequences of transformed layers for executing in a pth processing element serving as the second PE type;
determining an inference accuracy, an inference latency, and an inference power consumption for the pth subsequence transformed layers on pth PE, at run-time based on (i) an intermediate output from a preceding subsequence of transformed layers and (ii) an intermediate output to a next subsequence of transformed layers; and
generating the one or more quantization configurations and the one or more compression configurations based on the determined inference accuracy, the inference latency, and the inference power consumption for the pth subsequence of transformed layers.

### Claim 7 (depends on 5)

The system of claim 5, wherein when (i) a pth processing element from the k processing elements is a second processing element type, (ii) the one or more compression configurations and the one or more quantization configurations are unavailable and (iii) training data is available for re-training of the obtained DL model, the one or more compression configurations and the one or more quantization configurations are generated by:
freezing and converting a pth subsequence of transformed layers from k subsequences of transformed layers for executing in a pth processing element serving as the second PE type;
re-training remaining transformed layers of the DL model without training the pth subsequence of layers deployed on the pth processing element serving as the second PE type, wherein the remaining transformed layers of the DL model are retrained using an intermediate output of (i) a preceding subsequence of the pth subsequence of transformed layers and (ii) a next subsequence of the pth subsequence of transformed layers;
determining a partition point between the pth subsequence of transformed layers and the next subsequence of transformed layers; and
modifying an index of layers in the obtained mapping based on the determined partition point between the pth subsequence of transformed layers and the next subsequence transformed layers.

### Claim 8 (depends on 6)

The system of claim 6, wherein the first processing element type and the second processing element type are distinct from each other.

### Claim 9

One or more non-transitory machine readable information storage mediums comprising one or more instructions which when executed by one or more hardware processors causes a method, the method comprising:
obtaining a deep learning DL model specific to an application scenario and partitioning the DL model into a plurality of layers;
partitioning, via the one or more hardware processors, the plurality of layers into k subsequences of layers based on k processing elements, wherein the k processing elements (PE) comprise a first processing element type;
generating, for each layer of the DL model, a transformed layer based on a selection of one or more compression configurations and one or more quantization configurations, wherein each of the one or more compression configurations and the one or more quantization configurations comprise a corresponding inference accuracy, a corresponding inference latency, and a corresponding inference power consumption, wherein the corresponding inference accuracy, the corresponding inference latency, and the inference power consumption are obtained by executing a cascaded DL model inference program;
iteratively selecting at least one compression configuration and at least one quantization configuration for each transformed layer of the k subsequences of transformed layers, until each of the corresponding inference accuracy, the corresponding inference latency, and the inference power consumption reach a corresponding predefined threshold by:
iteratively performing:
assigning a first subsequence of transformed layers from the k subsequences of transformed layers to a first processing element (PE) such that the first subsequence of transformed layers has a maximum inference accuracy and a minimum inference latency and a minimum power consumption on the first processing element (PE);
partitioning a second subsequence of transformed layers from the k subsequences of transformed layers into a first set of transformed layers and a second set of transformed layers and assigning the first set of transformed layers to the first PE and the second set of transformed layers to a second PE, such that each of the first subsequence of transformed layers and the second subsequence of transformed layers has the maximum inference accuracy, the minimum inference latency and the minimum power consumption on the first PE and the second PE respectively, wherein the steps of iteratively assigning and partitioning are performed to obtain a mapping of the first subsequence of transformed layers and the second subsequence of layers on the first PE and the second PE;
partitioning the second subsequence of transformed layers of the DL model into two different partitions comprising of a set of layers, assigning the corresponding set of layers from each of the two different partitions to the first PE and the second PE respectively, such that each of the first subsequence of transformed layers and the second subsequence of transformed layers has a maximum inference accuracy, a minimum inference latency and a minimum power consumption on the first PE and the second PE; and
continually partitioning subsequent subsequence of layers into two partitions, each of the two partitions comprises a set of layers, and assigning a first set of layers from the set of layers to an earlier processing element and a second set of layers from the set of layers to a current processing element to obtain a mapping of k subsequences of layers on the k processing elements;
generating a DL model based on the mapped k subsequences of layers on the k processing elements;
executing, via a cascaded DL model inference program, the DL model and determining an overall inference accuracy, an overall inference latency, and an overall inference power consumption;
rewarding or penalizing a sequence learning network based on a comparison of the overall inference accuracy, the overall inference latency, and the overall inference power consumption of (i) a current iteration of the cascaded DL model inference program generated by a selection of sequence of transformed layers and (ii) a previous iteration of the cascaded DL model inference program generated by a selection of sequence of transformed layers; and
identifying, the generated DL model as a final DL model based on the mapped k subsequences of transformed layers on the k processing elements for the application scenario.

### Claim 10 (depends on 9)

The one or more non-transitory machine readable information storage mediums of claim 9, wherein when (i) a pth processing element from the k processing elements is a second processing element type and (ii) the one or more compression configurations and the one or more quantization configurations are unavailable, the one or more compression configurations and the one or more quantization configurations are generated by:
freezing and converting a pth subsequence of transformed layers from k subsequences of transformed layers for executing in a pth processing element serving as the second PE type;
determining an inference accuracy, an inference latency, and an inference power consumption for the pth subsequence transformed layers on pth PE, at run-time based on (i) an intermediate output from a preceding subsequence of transformed layers and (ii) an intermediate output to a next subsequence of transformed layers; and
generating the one or more quantization configurations and the one or more compression configurations based on the determined inference accuracy, the inference latency, and the inference power consumption for the pth subsequence of transformed layers.

### Claim 11 (depends on 9)

The one or more non-transitory machine readable information storage mediums of claim 9, wherein when (i) a pth processing element from the k processing elements is a second processing element type, (ii) the one or more compression configurations and the one or more quantization configurations are unavailable and (iii) training data is available for re-training of the obtained DL model, the one or more compression configurations and the one or more quantization configurations are generated by:
freezing and converting a pth subsequence of transformed layers from k subsequences of transformed layers for executing in a pth processing element serving as the second PE type;
re-training remaining transformed layers of the DL model without training the pth subsequence of transformed layers deployed on the pth processing element serving as the second PE type, wherein the remaining transformed layers of the DL model are retrained using an intermediate output of (i) a preceding subsequence of transformed layers of the pth subsequence of transformed layers and (ii) a next subsequence of transformed layers of the pth subsequence of transformed layers;
determining a partition point between the pth subsequence of transformed layers and the next subsequence of transformed layers; and
modifying an index of transformed layers in the obtained mapping based on the determined partition point between the pth subsequence of transformed layers and the next subsequence of transformed layers.

### Claim 12 (depends on 10)

The one or more non-transitory machine readable information storage mediums of claim 10, wherein the first processing element type and the second processing element type are distinct from each other.
