PikeLPN: Mitigating Overlooked Inefficiencies of Low-Precision
Neural Networks

Marina Neseem Work done during internship at Google.Corresponding authors: [email protected] and [email protected] Brown University Conor McCullough Google Randy Hsin Google Chas Leichner Google Shan Li Google In Suk Chong Google Andrew Howard Google Lukasz Lew Google Sherief Reda Brown University Ville-Mikko Rautio Google Daniele Moro††footnotemark: Google
Abstract

Low-precision quantization is recognized for its efficacy in neural network optimization. Our analysis reveals that non-quantized elementwise operations which are prevalent in layers such as parameterized activation functions, batch normalization, and quantization scaling dominate the inference cost of low-precision models. These non-quantized elementwise operations are commonly overlooked in SOTA efficiency metrics such as Arithmetic Computation Effort (ACE) [48]. In this paper, we propose A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT - an extended version of ACE which offers a better alignment with the inference cost of quantized models and their energy consumption on ML hardware. Moreover, we introduce PikeLPN111Pike is a slim fast fish, LPN stands for Low-Precision Network., a model that addresses these efficiency issues by applying quantization to both elementwise operations and multiply-accumulate operations. In particular, we present a novel quantization technique for batch normalization layers named QuantNorm which allows for quantizing the batch normalization parameters without compromising the model performance. Additionally, we propose applying Double Quantization where the quantization scaling parameters are quantized. Furthermore, we recognize and resolve the issue of distribution mismatch in Separable Convolution layers by introducing Distribution-Heterogeneous Quantization which enables quantizing them to low-precision. PikeLPN achieves Pareto-optimality in efficiency-accuracy trade-off with up to 3Γ—3\times3 Γ— efficiency improvement compared to SOTA low-precision models.

1 Introduction

Refer to caption
Figure 1: Accuracy vs A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT of PikeLPN and SOTA low-precision neural networks. A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT is an efficiency metric that estimates the cost of arithmetic operations during inference.

Quantization has long been established as a method to decrease the precision of neural network weights and activations effectively, resulting in smaller models and accelerated processing [11]. Recent studies have shown impressive results in image classification tasks, making the use of low-precision quantization (i.e., 4 bits or fewer) increasingly popular [34, 48, 29, 35]. In these compact models, convolutional and fully connected layers are typically constrained to 4-bit precision or even less, while precision is maintained at higher levels in other layers of the network. For example, the state-of-the-art (SOTA) binary network PokeBNN [48] binarizes the convolutional layers of ResNet-50 [16], and to avoid accuracy loss, they incorporate extra skip connections, extra batch normalization layers, and parameterized activation functions (DPReLU) that are executed in high precision. As illustrated in Figure 2, while this strategy significantly reduces the cost of multiply-accumulate (MAC) operations, it shifts the energy burden to the elementwise operations within these remaining high-precision layers. Although there are fewer of these elementwise operations, they use more energy because they are still in high precision. This indicates a critical area of optimization to improve the overall efficiency of low-precision models.

Refer to caption
Figure 2: Contribution of multiply-accumulate (MAC) versus elementwise operations to the commonly used efficiency metric A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT for PikeLPN-1X and PokeBNN-0.5X [48]. PikeLPN selectively increases the precision of MAC operations which allows for effectively quantizing elementwise operations, achieving 3Γ—3\times3 Γ— more efficiency while being 2% more accurate on ImageNet.

We analyze the key efficiency bottlenecks in low-precision models uncovering a fundamental limitation of the efficiency metrics in literature, ACE [48], CPU64 [31, 29], Unit-gate model [49] and FA-count [38]. Those metrics exclude the elementwise operations in arithmetic calculations, a sentiment grounded in the belief that their contribution to the total computation cost is negligible compared to MAC operations. Optimizing for those metrics drives researchers to prioritize the reduction of computational precision in Convolutional and Dense layers, yet they overlook the quantization of elementwise operations. As a result, operations such as batch normalization, activation functions, and quantization scaling multiplications, are often performed at full precision. Moreover, SOTA low-precision models tend to rely extensively on mechanisms like branching [19] and skip connections [16], which significantly increase energy costs associated with memory reads and writes. To overcome this issue, we propose A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT which extends the efficiency metric ACE to account for all arithmetic operations in quantized neural networks including both elementwise and MAC operations. This would help guide researchers’ choices when designing low-precision models.

Guided by our A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT metric, we design PikeLPN – a novel family of efficient low-precision models. PikeLPN quantizes both elementwise and MAC operations. Remarkably, PikeLPN not only achieves a 3Γ—\timesΓ— cost reduction compared to SOTA binary models [29, 48], it also achieves competitive accuracy levels on ImageNet [10].

Our contributions can be summarized as follows:

  • β€’

    We identify and analyze the overlooked cost of non-quantized elementwise operations in SOTA low-precision models. Our analysis shows that the non-quantized elementwise operations used in parameterized activation functions, batch normalization, and quantization scaling dominate the inference cost of low-precision models.

  • β€’

    We propose A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT – an extension to the existing hardware-agnostic cost metric ACE. A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT offers a better alignment with the cost of the low-precision models and their energy consumption on ML hardware by accounting for all arithmetic operations during inference.

  • β€’

    We propose PikeLPN – a novel family of low-precision architectures, which improves the efficiency of low-precision models by quantizing both elementwise and multiply-accumulate operations. Specifically, we propose (a) QuantNorm for effective batch normalization quantization, (b) Double Quantization where quantization parameters are also quantized, and (c) Distribution-Heterogeneous Quantization for Separable Convolution layers to tackle their distribution mismatch problem.

The rest of the paper is organized as follows. We review the related work in SectionΒ 2. In SectionΒ 3, we propose A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT providing detailed analysis to the overlooked efficiency bottlenecks by previous cost metrics. Then, guided by the new cost metric, we propose our efficient PikeLPN model. Next, we compare PikeLPN to SOTA low-precision models in SectionΒ 4. Finally, we conclude in SectionΒ 5.

2 Related Work

Low-precision Quantization: A substantial body of work exists in the realm of low-precision quantization, exemplified by studies that indicate that architectures can be quantized to 4 bits with minimal impact on accuracy [5, 24, 1, 34]. Others perform logarithmic quantization methods known for their hardware efficiency [42, 13, 27]. In addition, there are attempts to push the boundaries by introducing predominantly binary models where some of the convolution layers are quantized to 1 bit while other layers are maintained at a higher precision [48, 29, 36]. Some researchers have also developed automated strategies for mixed-precision modeling to dynamically choose the optimal precision for each layer, contingent upon a predetermined efficiency metric [25]. However, existing approaches primarily focus on the quantization of multiply-accumulate (MAC) operations in convolution and dense layers. They commonly neglect elementwise operations such as those in batch normalization layers and activation functions. Our empirical findings show that this assumption becomes invalid for low-precision models, specifically 4 bits or below.

Architectural Approaches to Low-precision Models: Several studies have adopted architectural modifications to enhance the performance of low-precision models. Many such modifications involve the integration of modules consisting solely of elementwise operations, aiming to minimize computational and parameter overhead. For instance, the channelwise real-valued rescaling of binarized tensors has been proposed as an effective means to reduce quantization error [37]. This approach incorporates elementwise floating-point multiplications for each channel. Additional methods, as suggested in [9], advocate for per-vector quantization, which results in multiple elementwise multiplications per channel. Studies like FracBNN [47] and PokeBNN [48] include extra Batch Normalization layers in their predominantly binary models to expedite the training convergence. Moreover, the use of parameterized activation functions, such as PReLU [15] and DPReLU [48], has become a standard practice for improving the performance of low-precision models [29, 30]. All these modifications necessitate elementwise floating-point multiplications and additions. Moreover, the introduction of skip connections has proven beneficial in enhancing low-precision model quality. Notably, ReActNet [29] and PokeBNN [48] are designed with 4 and 3 parallel branches, respectively. Although skip connections only involve elementwise additions, they contribute to an increased memory access during inference to store multiple activations increasing the inference cost [22].

Cost Metrics for Efficiency Evaluation: MAC operations have been recognized in literature as the principal contributors to inference cost of deep learning models. As a result, efficiency metrics have predominantly focused on these specific operations. The CPU64 metric [30, 29, 28] has been used to gauge the efficiency of mixed-precision neural networks when running on CPUs. With the growing utilization of specialized machine learning hardware and accelerators, a newer metric named ACE has been introduced [48]. ACE, an acronym for Arithmetic Computation Effort, is formulated as the product of the number of MAC operations and the bitwidth of the two operands involved, which is directly proportional to the number of active hardware bit-adders required. The Unit-gate model [49] and FA-count [38] correlate very well with ACE and differ only by a small constant factor 222They do not account for carry-save format for local accumulator representations typically used in systollic arrays.. All these metrics do not consider elementwise operations. Thus, in this paper, we extend the ACE metric introducing A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT, and this extension should generalize to other metrics as well. All these metrics, including the extended ACE, are technology node independent.

3 Method

In this section, we identify previously overlooked costs in state-of-the-art (SOTA) cost metrics. Additionally, we propose extending the Arithmetic Computational Effort (ACE) metric [48] to provide a more accurate representation of the inference cost of low-precision models. Subsequently, we assess the impact of various design alternatives in low-precision models on the cost of inference. Finally, we present PikeLPN – a novel family of low-precision models.

Refer to caption
Figure 3: Arithmetic Energy on 45nm CMOS technology by multiply-accumulate operations versus non-quantized elementwise operations for MobileNetV2. Energy costs are calculated using Table 1. The figure reveals that elementwise operations are a substantial contributor to the overall cost in low-precision models.

3.1 Cost Metrics for Low Precision Models

The prevalent notion is that multiply-accumulate operations in the convolution and dense layers are the sole substantial contributors to inference cost in deep learning models [34, 48, 29]. This viewpoint stems from the observation that for full precision models the energy cost of those layers is more than 95% of the total model operations as shown in Figure 3. Consequently, commonly used efficiency metrics for quantized neural networks, such as CPU64 [30, 29, 28] and ACE [48], are tailored to exclusively account for multiply-accumulate operations in these specified layers. Optimization in accordance with these metrics drive researchers to prioritize reducing the precision of multiply-accumulate operations in convolution and dense layers while maintaining high precision for all other elementwise operations. Moreover, they re-parameterize the models adding layers that only have elementwise operations to compensate for any accuracy losses by low-precision quantization [48, 29]. However, our analysis reveals that these non-quantized elementwise operations substantially contributes to the arithmetic cost during inference of low-precision models (i.e., 8 bits and lower), thereby challenging the prevailing assumptions.

Figure 3 illustrates the relative contributions of low-precision multiply-accumulate operations and non-quantized elementwise operations to the total energy consumption by arithmetic computations at various precisions. The data reveals a notable trend: the proportion of energy consumed by elementwise operations becomes more significant as the precision decreases. For example, in binary-quantized models, those non-quantized elementwise operations account for up to 89% of the total cost. This observation highlights the limitations of existing metrics in accurately gauging the efficiency of quantized models. Consequently, we propose A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT which extends the ACE metric [48] to account for both multiply-accumulate operations as well as elementwise operations. We anticipate that our comprehensive A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT metric will enable more informed optimization choices within the research community.

3.2 Introducing 𝑨⁒π‘ͺβ’π‘¬π’—β’πŸπ‘¨π‘ͺsubscript𝑬𝒗2\bm{ACE_{v2}}bold_italic_A bold_italic_C bold_italic_E start_POSTSUBSCRIPT bold_italic_v bold_2 end_POSTSUBSCRIPT

ACE has been used to estimate the cost of inference on idealized ML hardware implemented with CMOS methodology [48]. ACE is defined by its authors as the number of bitadders (i.e., digital circuit adding 3 bits to form a 2 bit number – carry and sum) required to perform every multiply-accumulate operation. The authors justify that definition by showing a high correlation coefficient (i.e., 0.946) between the number of bitadders and the independently measured energy consumption on 45nm CMOS technology. While ACE provides a hardware-agnostic method to evaluate the efficiency of quantized neural networks, it fails to include the elementwise operations which can be the dominating cost factor in low precision models as shown in Figure 3. Moreover, ACE does not provide a way to estimate the cost of shift operations which are required to implement non-linear base-2 logarithmic quantization [45, 46]. We propose A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT which improves ACE by extending it to include elementwise multiplication, elementwise addition, and shift operations. We establish the A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT formulas for the previously discussed operations as shown in Table 1.

Table 1: Cost under 45nm CMOS technology [46, 17] 444Energy costs for low-precision operations can be extrapolated linearly for addition and quadratically for multiplication [6].. f⁒(i,j)𝑓𝑖𝑗f(i,j)italic_f ( italic_i , italic_j ) refers to the formula used to calculate the A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost where i𝑖iitalic_i and j𝑗jitalic_j are the precisions of the two operands. ca=6subscriptπ‘π‘Ž6c_{a}=6italic_c start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT = 6 and cs=5subscript𝑐𝑠5c_{s}=5italic_c start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT = 5. The correlation coefficient between A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT and the independently measured arithmetic energy consumption is 0.991.
MULTIPLY ADD SHIFT
Energy 𝑨⁒π‘ͺβ’π‘¬π’—β’πŸπ‘¨π‘ͺsubscript𝑬𝒗2\bm{ACE_{v2}}bold_italic_A bold_italic_C bold_italic_E start_POSTSUBSCRIPT bold_italic_v bold_2 end_POSTSUBSCRIPT Energy 𝑨⁒π‘ͺβ’π‘¬π’—β’πŸπ‘¨π‘ͺsubscript𝑬𝒗2\bm{ACE_{v2}}bold_italic_A bold_italic_C bold_italic_E start_POSTSUBSCRIPT bold_italic_v bold_2 end_POSTSUBSCRIPT Energy 𝑨⁒π‘ͺβ’π‘¬π’—β’πŸπ‘¨π‘ͺsubscript𝑬𝒗2\bm{ACE_{v2}}bold_italic_A bold_italic_C bold_italic_E start_POSTSUBSCRIPT bold_italic_v bold_2 end_POSTSUBSCRIPT
(p⁒J𝑝𝐽pJitalic_p italic_J) (p⁒J𝑝𝐽pJitalic_p italic_J) (p⁒J𝑝𝐽pJitalic_p italic_J)
FP32 3.7 992 0.9 192 - -
FP16 1.1 240 0.4 96 - -
f⁒(i,j)𝑓𝑖𝑗f(i,j)italic_f ( italic_i , italic_j ) iβ‹…j⋅𝑖𝑗i\cdot jitalic_i β‹… italic_j - m⁒a⁒x⁒(i,j)π‘šπ‘Žπ‘₯𝑖𝑗max(i,j)italic_m italic_a italic_x ( italic_i , italic_j ) caβ‹…m⁒a⁒x⁒(i,j)β‹…subscriptπ‘π‘Žπ‘šπ‘Žπ‘₯𝑖𝑗c_{a}\cdot max(i,j)italic_c start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT β‹… italic_m italic_a italic_x ( italic_i , italic_j ) -
INT32 3.1 992 0.1 32 0.13 32
INT16 - 240 - 16 0.057 12.8
INT8 0.2 56 0.03 8 0.024 4.8
INT4 - 12 - 4 - 1.6
INT2 - 2 - 2 - 0.4
Binary - - - 1 - -
f⁒(i,j)𝑓𝑖𝑗f(i,j)italic_f ( italic_i , italic_j ) iβ‹…j⋅𝑖𝑗i\cdot jitalic_i β‹… italic_j - m⁒a⁒x⁒(i,j)π‘šπ‘Žπ‘₯𝑖𝑗max(i,j)italic_m italic_a italic_x ( italic_i , italic_j ) m⁒a⁒x⁒(i,j)π‘šπ‘Žπ‘₯𝑖𝑗max(i,j)italic_m italic_a italic_x ( italic_i , italic_j ) iβ‹…l⁒o⁒g2⁒(j)/csβ‹…π‘–π‘™π‘œsubscript𝑔2𝑗subscript𝑐𝑠i\cdot log_{2}(j)/c_{s}italic_i β‹… italic_l italic_o italic_g start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ( italic_j ) / italic_c start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT

Elementwise Multiplications: Using established methods for constructing multipliers, such as adder trees proposed by Wallace and Dadda [44, 8], we calculated the number of adders needed to multiply an i𝑖iitalic_i-bit number by a j𝑗jitalic_j-bit number as iβ‹…jβˆ’m⁒a⁒x⁒(i,j)β‹…π‘–π‘—π‘šπ‘Žπ‘₯𝑖𝑗i\cdot j-max(i,j)italic_i β‹… italic_j - italic_m italic_a italic_x ( italic_i , italic_j ). This formula exactly matches the optimal number of adders for 1<=i,j<=64formulae-sequence1𝑖𝑗641<=i,j<=641 < = italic_i , italic_j < = 64. See Section 6 in the Appendix for a detailed explanation.

Elementwise Additions: Fixed-point numbers added using established adders 555While there are many methods for constructing adders, such as Carry Lookahead Adder [33] and Ripple Carry Adder [3], the particular implementation has a limited effect on the energy use. activate an upper bound of m⁒a⁒x⁒(i,j)π‘šπ‘Žπ‘₯𝑖𝑗max(i,j)italic_m italic_a italic_x ( italic_i , italic_j ) bit adders to add i-bit and j-bit numbers. Floating-point adders additionally require exponent alignment, significand addition, and normalization steps [39], resulting in a much higher energy consumption compared to fixed-point adders as shown in Table 1. We analyze the operations needed in floating point adders [39] and come to an A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost of 6Γ—6\times6 Γ— the cost of a fixed-point adder. Therefore, we derive A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT for floating point adders using caβ‹…m⁒a⁒x⁒(i,j)β‹…subscriptπ‘π‘Žπ‘šπ‘Žπ‘₯𝑖𝑗c_{a}\cdot max(i,j)italic_c start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT β‹… italic_m italic_a italic_x ( italic_i , italic_j ) with ca=6subscriptπ‘π‘Ž6c_{a}=6italic_c start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT = 6. See Appendix Section 7 for a detailed explanation.

Shift Operations: A Barrel Shifter is an established method to shift and rotate i𝑖iitalic_i-bit numbers by j𝑗jitalic_j locations in modern processors [14]. The barrel shifter is implemented as a cascade of i⁒log2⁑(j)𝑖subscript2𝑗i\log_{2}(j)italic_i roman_log start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ( italic_j ) 2::::1 multiplexers. Therefore, we derive A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT for a shift operation as i⁒log2⁑(j)/cs𝑖subscript2𝑗subscript𝑐𝑠i\log_{2}(j)/c_{s}italic_i roman_log start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ( italic_j ) / italic_c start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT where cssubscript𝑐𝑠c_{s}italic_c start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT is the ratio of the cost of a 2::::1 multiplexer compared to a full adder. Since a full adder can be efficiently implemented using five 2:1 multiplexers based on [23], we assign cs=5subscript𝑐𝑠5c_{s}=5italic_c start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT = 5.

To verify the correctness of our A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT metric, Table 1 shows a 0.9910.9910.9910.991 correlation coefficient between the independently measured energy consumption of various arithmetic units on the 45nm CMOS technology and its A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost, a notable improvement compared to the 0.9460.9460.9460.946 correlation coefficient in A⁒C⁒E𝐴𝐢𝐸ACEitalic_A italic_C italic_E [48]. Using those definitions, we estimate a more accurate arithmetic cost for any quantized model.

3.3 Overlooked Efficiency Bottlenecks

Table 2: The contribution of non-quantized Batch Normalization Layers to the overall A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost.
Model BN Adds BN Mults BN A⁒C⁒Ev⁒𝟐𝐴𝐢subscript𝐸𝑣2\bm{ACE_{v2}}bold_italic_A bold_italic_C bold_italic_E start_POSTSUBSCRIPT bold_italic_v bold_2 end_POSTSUBSCRIPT
(M⁒i⁒l⁒l⁒i⁒o⁒n)π‘€π‘–π‘™π‘™π‘–π‘œπ‘›(Million)( italic_M italic_i italic_l italic_l italic_i italic_o italic_n ) (M⁒i⁒l⁒l⁒i⁒o⁒n)π‘€π‘–π‘™π‘™π‘–π‘œπ‘›(Million)( italic_M italic_i italic_l italic_l italic_i italic_o italic_n ) (%)
MobileNetV2 (4⁒W,4⁒A)4π‘Š4𝐴(4W,4A)( 4 italic_W , 4 italic_A ) 6.67 6.67 41.87
ResNet50 (1⁒W,1⁒A)1π‘Š1𝐴(1W,1A)( 1 italic_W , 1 italic_A ) 10.58 10.58 41.38

Batch Normalization: Batch normalization layers, which necessitate elementwise multiplications and additions, typically retain parameters in floating-point format during deep neural network quantization to maintain training stability and prevent accuracy loss [48, 29, 36]. Consequently, these operations are performed using floating-point (FP32) arithmetic, with a single FP32 operation consuming approximately 18Γ—\timesΓ— more energy than an INT8 multiplication, as detailed in Table 1. Assessing the impact of these non-quantized batch normalization layers in Table 2 reveals that they can account for as much as 42% of the total A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost in various low-precision models. This substantial contribution shows the importance of considering the cost of these operations and potentially quantizing its parameters.

Activation Layers: In recent literature, low-precision models have increasingly replaced ReLU [2] activation functions with parameterized activation functions such as PReLU [15] and DPReLU [48] to improve performance and training stability of quantized models [29, 35]. The dynamic parameterized rectified linear unit (DPReLU), for instance, is defined by the following piecewise function:

D⁒P⁒R⁒e⁒L⁒U⁒(x)={η⁒(xβˆ’Ξ±)βˆ’Ξ²if ⁒xβˆ’Ξ±>0γ⁒(xβˆ’Ξ±)βˆ’Ξ²otherwiseπ·π‘ƒπ‘…π‘’πΏπ‘ˆπ‘₯casesπœ‚π‘₯𝛼𝛽ifΒ π‘₯𝛼0𝛾π‘₯𝛼𝛽otherwiseDPReLU(x)=\begin{cases}\eta(x-\alpha)-\beta&\text{if }x-\alpha>0\\ \gamma(x-\alpha)-\beta&\text{otherwise}\end{cases}\vspace{-5pt}italic_D italic_P italic_R italic_e italic_L italic_U ( italic_x ) = { start_ROW start_CELL italic_Ξ· ( italic_x - italic_Ξ± ) - italic_Ξ² end_CELL start_CELL if italic_x - italic_Ξ± > 0 end_CELL end_ROW start_ROW start_CELL italic_Ξ³ ( italic_x - italic_Ξ± ) - italic_Ξ² end_CELL start_CELL otherwise end_CELL end_ROW (1)

Here, the parameters Ξ·πœ‚\etaitalic_Ξ·, α𝛼\alphaitalic_Ξ±, β𝛽\betaitalic_Ξ², and γ𝛾\gammaitalic_Ξ³ are represented in floating-point format. Consequently, the computation of DPReLU necessitates both elementwise floating-point multiplications and additions. Our study, detailed in Table 3, assesses the impact of these elementwise operations on the A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost. We find that in a 4-bit MobileNetV2 model, the incorporation of different activation functions β€” namely ReLU, PReLU, and DPReLU β€” significantly influences the cost. Specifically, the use of PReLU and DPReLU, despite their benefits on accuracy, introduces up to 35% increase in the overall inference cost. This finding highlights the need to balance the benefits of parameterized activation functions with their computational demands.

Table 3: The contribution of non-quantized parameterized activation functions to the overall A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost. Analysis performed by applying different activation functions to a 4-bit MobileNetv2.
Activation Adds Mults 𝑨⁒π‘ͺβ’π‘¬π’—β’πŸπ‘¨π‘ͺsubscript𝑬𝒗2\bm{ACE_{v2}}bold_italic_A bold_italic_C bold_italic_E start_POSTSUBSCRIPT bold_italic_v bold_2 end_POSTSUBSCRIPT Overhead
(M⁒i⁒l⁒l⁒i⁒o⁒n)π‘€π‘–π‘™π‘™π‘–π‘œπ‘›(Million)( italic_M italic_i italic_l italic_l italic_i italic_o italic_n ) (M⁒i⁒l⁒l⁒i⁒o⁒n)π‘€π‘–π‘™π‘™π‘–π‘œπ‘›(Million)( italic_M italic_i italic_l italic_l italic_i italic_o italic_n ) (Γ—109)(\times 10^{9})( Γ— 10 start_POSTSUPERSCRIPT 9 end_POSTSUPERSCRIPT ) (%)(\%)( % )
ReLU [2] 0 0 20.44 -
PReLU [15] 0 6.1 26.5 +29.6%
DPReLU [48] 6.1 6.1 27.67 +35.3%

Skip Connections: Skip connections are regarded as zero-cost operations in terms of arithmetic computation. Consequently, previous work overused them to improve the model performance without having any measurable effect on the cost [48, 29, 36]. For instance, ReActNet [29] incorporated four parallel branches, quadrupling its memory footprint compared to a single-path model. PokeBNN [48] followed a similar design, incorporating three parallel branches. However, such branching necessitates the concatenation of feature maps from previous layers, leading to an increase in the amount of data concurrently stored in memory. That increase the required memory reads and writes which have significant costs. As an example, in a processor with a 32KB cache designed using 45nm CMOS technology, moving an 8-bit element from the cache consumes approximately 2.5⁒p⁒J2.5𝑝𝐽2.5pJ2.5 italic_p italic_J of energy. This is about 12Γ—12\times12 Γ— the energy needed for an INT8 multiplication operation, which requires only around 0.2⁒p⁒J0.2𝑝𝐽0.2pJ0.2 italic_p italic_J as shown in Table 1. This disparity becomes even more profound when data must be transfered from DRAM, where the energy requirement balloon to 162.5⁒p⁒J162.5𝑝𝐽162.5pJ162.5 italic_p italic_J – 810Γ—810\times810 Γ— higher than the INT8 multiplication [17]. Quantifying this overhead in a hardware-agnostic manner is challenging since it is influenced by a multitude of factors including the underlying hardware architecture, memory location, and model size. Yet, understanding its impact remains crucial to design efficient models. We advocate for the adoption of Arithmetic Intensity as a practical metric to measure memory reads and writes during inference [22]. Arithmetic Intensity (A⁒Ic𝐴subscript𝐼𝑐AI_{c}italic_A italic_I start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT) is defined as the ratio of the arithmetic operations (Mcsubscript𝑀𝑐M_{c}italic_M start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT) to the amount of data, including both Weights (Wπ‘ŠWitalic_W) and Activations (A𝐴Aitalic_A), required to execute these operations as shown in Equation 2.

A⁒Ic=McW+A𝐴subscript𝐼𝑐subscriptπ‘€π‘π‘Šπ΄AI_{c}=\frac{M_{c}}{W+A}italic_A italic_I start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT = divide start_ARG italic_M start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT end_ARG start_ARG italic_W + italic_A end_ARG (2)

Consequently, Arithmetic Intensity serves as an indicator of the amount of memory reads and writes to perform computational operations. Adding branches lead to a substantial increase in the amount of data that must be loaded to execute a relatively small number of operations; hence decreasing the arithmetic intensity as shown in Table 4.

Table 4: Arithmetic Intensity computed according to Equation (3) for a ResNet-50 model with various number of branches.
Arithmetic Intensity (Ops/Element ↑↑\uparrow↑)
2 Branches 3 Branches 4 Branches
73.5 49.66 36.75
Table 5: A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT of a 4-bit MobileNetV2 and a binary ResNet50 model with various quantization granularities. The Overhead represents the percentage of cost required by the extra FP operations due to quantization (i.e. quantization scaling).
Quantization Mults 𝑨⁒π‘ͺβ’π‘¬π’—β’πŸπ‘¨π‘ͺsubscript𝑬𝒗2\bm{ACE_{v2}}bold_italic_A bold_italic_C bold_italic_E start_POSTSUBSCRIPT bold_italic_v bold_2 end_POSTSUBSCRIPT (Γ—109)↓(\times 10^{9})\downarrow( Γ— 10 start_POSTSUPERSCRIPT 9 end_POSTSUPERSCRIPT ) ↓
Granularity (M⁒i⁒l⁒l⁒i⁒o⁒n)π‘€π‘–π‘™π‘™π‘–π‘œπ‘›(Million)( italic_M italic_i italic_l italic_l italic_i italic_o italic_n ) Total Overhead (%)
MobileNetV2 - <4W,4A><4W,4A>< 4 italic_W , 4 italic_A >
Layerwise [11] 6.67 20.44 32.52%
Channelwise [11] 6.67 20.44 32.52%
Sub-Channelwise [9] 13.35 27.06 48.97%
ResNet50 - <1W,1A><1W,1A>< 1 italic_W , 1 italic_A >
Layerwise [11] 10.63 28.13 32.03%
Channelwise [11] 10.63 28.13 32.03%
Sub-Channelwise [9] 32.75 50.08 63.55%

Quantization Granularity Overhead: Uniform quantization, a widely adopted technique in SOTA low-precision models [36, 34, 48], transforms discrete integer values, qπ‘žqitalic_q, into continuous real values, rπ‘Ÿritalic_r through the affine relation

r=S⁒(qβˆ’Z)π‘Ÿπ‘†π‘žπ‘r=S(q-Z)\vspace{-5pt}italic_r = italic_S ( italic_q - italic_Z ) (3)

where S𝑆Sitalic_S is a scale factor. S𝑆Sitalic_S is a critical component of quantization which is typically learned as an arbitrary floating-point value during training. In the inference phase, this necessitates an elementwise multiplication by S𝑆Sitalic_S, contributing to computational overhead [21]. Proper scaling is crucial in quantization to mitigate quantization error enabling quantized models to maintain high accuracy. Quantization granularity dictates the level at which scaling factors are applied in a model [11]. For example, Layerwise quantization assigns a single scale factor based on all weights within a layer. Channelwise quantization, widely adopted in state-of-the-art low-precision models, allocates a unique scaling factor to each channel, catering to the varying distributions of weights and potentially enhancing model accuracy. Sub-Channelwise quantization takes this further by assigning several scaling factors within each channel, allowing for even finer adjustments at the expense of increased computational cost [9]. All quantization granularities add one or more elementwise multiplications per channel. Table 5 compares the A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost of such quantization granularities. In the popular Channelwise quantization, the overhead from elementwise multiplications is 32% of the total cost.

Refer to caption
Figure 4: PikeLPN building block architecture.

3.4 PikeLPN Architecture

Based on our comprehensive analysis, we introduce PikeLPN, a novel architecture engineered to mitigate the inefficiencies of SOTA low-precision models. This section introduces the basic block of our proposed PikeLPN model, explores quantization strategies for the different layers, and proposes a novel method for quantizing batch normalization layers without compromising the model’s accuracy.

PikeLPN Basic Block: To engineer an effective low-precision model, we first design the baseline architecture with building blocks that are inherently efficient. With this principle in mind, our architecture adopts separable convolutional layers, subdivided into depthwise and pointwise convolutions, in line with the framework established by MobileNetV1 [18]. Those layers are widely recognized for their computational efficiency and have been integrated into SOTA efficient ConvNets [41, 43]. Figure 4 illustrates the building block for PikeLPN. To maximize computational efficiency, the used architecture deliberately avoids parameterized activation functions and skip connections that are likely to increase computational cost as explained in Subsection 3.3. Finally, our model uses the first and last blocks from the MobileNetV1 architecture due to their proven effectiveness and reliability.

Table 6: Top-1 Accuracy on ImageNet vs A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost of PikeLPN using various quantizers for the Depthwise and Pointwise Layers. PW-Convolution layers contribute to 95% of the number of multiply-accumulate operations in the model, that is why we lower the precision of the PW Conv layers to 4 bits while we keep the DW Conv layers at 8-bits.
Pointwise Conv. Depthwise Convs Top-1 𝑨⁒π‘ͺβ’π‘¬π’—β’πŸπ‘¨π‘ͺsubscript𝑬𝒗2\bm{ACE_{v2}}bold_italic_A bold_italic_C bold_italic_E start_POSTSUBSCRIPT bold_italic_v bold_2 end_POSTSUBSCRIPT
Weights Q-Params Weights Q-Params (%) (Γ—109absentsuperscript109\times 10^{9}Γ— 10 start_POSTSUPERSCRIPT 9 end_POSTSUPERSCRIPT)
Linear-4 Arbitrary Linear-8 Arbitrary 68.50 20.91
Linear-4 PoT Linear-8 PoT 68.41 15.93
PoT-4 - PoT-8 - 64.50 10.05
PoT-4 - Linear-8 Arbitrary 67.60 12.86
PoT-4 - Linear-8 PoT 67.55 10.95
Refer to caption
(a)
Refer to caption
(b)
Figure 5: Weights distribution of pre-trained PW and DW Convolution layers in PikeLPN where (a) Sample Pointwise layer weights (b) Sample Depthwise layer weights.

Quantizing Separable Convolution Layers: Linear quantizers results in a set of equally spaced values since they use affine map** as shown in Equation 3. Non-uniform quantizers have different constraints. For example, Power-of-two (PoT) [32] restrict quantization levels to be powers-of-two values. They can be used to increase the representational density of small values, furthermore, they have the benefit of replacing the multiplication operations during inference with shifts which are significantly cheaper as shown in Table 1. However, using PoT quantizers for both pointwise (PW) and depthwise (DW) convolution operations in the separable convolution block leads to significant accuracy degradation as shown in the third row of Table 6. To get some insights, we analyze the distribution of the full-precision weights of PikeLPN when pre-trained on ImageNet. Figures 5(a) and 5(b) visualize the distributions of a sample PW and DW weights respectively. Interestingly, the majority of the weights of the PW layer lie around Β±0.1plus-or-minus0.1\pm 0.1Β± 0.1, while the weights in the DW layer are distributed around Β±2plus-or-minus2\pm 2Β± 2. This mismatch in weights distribution across different layers makes low-precision quantization for the separable convolution blocks challenging because the used values fail to capture both distributions. To address this problem, we propose using Distribution Heterogeneous Quantization where the pointwise weights use the more efficient PoT quantizer while the depthwise weights use a linear quantizer. It is important to note that pointwise convolutions contribute to 95% of the number of multiply-accumulate operations in PikeLPN; hence using the PoT quantizer in pointwise layers only improves the model’s efficiency by 50% as shown in Table 6.

Double Quantization: Quantization requires extra elementwise multiplications by a floating-point scaling factor which add significant overhead as shown in Table 5. While we can not completely remove the scale factor, we can reduce the overhead from quantization scale multiplications by quantizing those quantization parameters. We refer to quantizing the quantization parameters as Double Quantization. We consider using a PoT scale for the linear depthwise quantizer in PikeLPN which can potentially reduce the elementwise operation from 3.7⁒m⁒J3.7π‘šπ½3.7mJ3.7 italic_m italic_J to 0.13⁒m⁒J0.13π‘šπ½0.13mJ0.13 italic_m italic_J based on Table 1. Our experiments indicates negligible effect on accuracy when applying Double Quantization as shown in Table 6.

Quantizing Batch Norm Layers: Batch normalization layers are used in most modern deep learning models to stabilize the training and improve their performance [20]. Batch normalization is computed as follows:

b⁒a⁒t⁒c⁒h⁒n⁒o⁒r⁒m⁒(x)=(xβˆ’ΞΌ)βˆ—Ξ³Οƒ2+Ο΅+Ξ²π‘π‘Žπ‘‘π‘β„Žπ‘›π‘œπ‘Ÿπ‘šπ‘₯π‘₯πœ‡π›Ύsuperscript𝜎2italic-ϡ𝛽batchnorm(x)=\frac{(x-\mu)*\gamma}{\sqrt{\sigma^{2}+\epsilon}}+\beta\vspace{-5pt}italic_b italic_a italic_t italic_c italic_h italic_n italic_o italic_r italic_m ( italic_x ) = divide start_ARG ( italic_x - italic_ΞΌ ) βˆ— italic_Ξ³ end_ARG start_ARG square-root start_ARG italic_Οƒ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + italic_Ο΅ end_ARG end_ARG + italic_Ξ² (4)

Where xπ‘₯xitalic_x is the input feature map and the batch norm parameters ΞΌπœ‡\muitalic_ΞΌ, γ𝛾\gammaitalic_Ξ³, ΟƒπœŽ\sigmaitalic_Οƒ, β𝛽\betaitalic_Ξ² are represented as floating-point values. To avoid performing floating point multiplications and additions, those parameters need to be quantized as follows:

Q⁒b⁒a⁒t⁒c⁒h⁒n⁒o⁒r⁒m⁒(x)=(xβˆ’Q⁒(ΞΌ))βˆ—Q⁒(Ξ³)Q⁒(Οƒ)2+Ο΅+Q⁒(Ξ²)π‘„π‘π‘Žπ‘‘π‘β„Žπ‘›π‘œπ‘Ÿπ‘šπ‘₯π‘₯π‘„πœ‡π‘„π›Ύπ‘„superscript𝜎2italic-ϡ𝑄𝛽Qbatchnorm(x)=\frac{(x-Q(\mu))*Q(\gamma)}{\sqrt{Q(\sigma)^{2}+\epsilon}}+Q(% \beta)\vspace{-5pt}italic_Q italic_b italic_a italic_t italic_c italic_h italic_n italic_o italic_r italic_m ( italic_x ) = divide start_ARG ( italic_x - italic_Q ( italic_ΞΌ ) ) βˆ— italic_Q ( italic_Ξ³ ) end_ARG start_ARG square-root start_ARG italic_Q ( italic_Οƒ ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + italic_Ο΅ end_ARG end_ARG + italic_Q ( italic_Ξ² ) (5)

Computation folding is a commonly used approach to reduce the overhead of batch normalization operations in quantized models (i.e., mainly in 8 bit models) [21]. However, the batch normalization parameters (i.e., ΞΌπœ‡\muitalic_ΞΌ, γ𝛾\gammaitalic_Ξ³, ΟƒπœŽ\sigmaitalic_Οƒ, and β𝛽\betaitalic_Ξ²) have to be quantized to the same precision of the preceding convolution layers to enable folding. Doing that in low-precision models (i.e., 4 bits or lower) leads to a significant loss in accuracy as shown in Figure 6. That is why previous low-precision model research [48, 34, 36] excluded batch normalization layers from the quantization process, where they keep the batch norm parameters as floating point numbers. However, as we showed earlier in Table 2, the non-quantized batch normalization operations can add up to 40% overhead to the model’s A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost.

Another solution is to quantize the batch normalization parameters at a higher precision. Figure 6 shows the validation accuracy curve during training when batch normalization parameters are represented as INT8 values (denoted as 8-bit Vanilla BN). Although the accuracy is better than the folded batch norm, we can still notice some degradation in accuracy compared to non-quantized batch norm layers. To minimize the accuracy loss, we propose a novel QuantNorm layer. In our QuantNorm layer, we re-write the batch norm quantization operation as shown in Equation 6 where we first multiply by a quantized scale s𝑠sitalic_s, then add a quantized bias b𝑏bitalic_b. s𝑠sitalic_s is represented as the quantized division between the γ𝛾\gammaitalic_Ξ³ and ΟƒπœŽ\sigmaitalic_Οƒ parameters as shown in Equation 7. Using QuantNorm helps reduce quantization error by allowing high precision division in the scale s𝑠sitalic_s computation during training. As shown in Figure 6, our QuantNorm layer maintains close-to-FP accuracy without any extra costs compared to vanilla quantization for batch norm layer. After training, we pre-compute s𝑠sitalic_s to avoid high precision division during inference.

Q⁒b⁒a⁒t⁒c⁒h⁒n⁒o⁒r⁒m⁒(x)i⁒m⁒p⁒r⁒o⁒v⁒e⁒d=xβˆ—sβˆ’bπ‘„π‘π‘Žπ‘‘π‘β„Žπ‘›π‘œπ‘Ÿπ‘šsubscriptπ‘₯π‘–π‘šπ‘π‘Ÿπ‘œπ‘£π‘’π‘‘π‘₯𝑠𝑏Qbatchnorm(x)_{improved}=x*s-bitalic_Q italic_b italic_a italic_t italic_c italic_h italic_n italic_o italic_r italic_m ( italic_x ) start_POSTSUBSCRIPT italic_i italic_m italic_p italic_r italic_o italic_v italic_e italic_d end_POSTSUBSCRIPT = italic_x βˆ— italic_s - italic_b (6)
s=Q⁒(Ξ³Οƒ2+Ο΅)𝑠𝑄𝛾superscript𝜎2italic-Ο΅s=Q(\frac{\gamma}{\sqrt{\sigma^{2}+\epsilon}})italic_s = italic_Q ( divide start_ARG italic_Ξ³ end_ARG start_ARG square-root start_ARG italic_Οƒ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + italic_Ο΅ end_ARG end_ARG ) (7)
b=Q⁒(Ξ²)βˆ’Q⁒(ΞΌ)βˆ—sπ‘π‘„π›½π‘„πœ‡π‘ b=Q(\beta)-Q(\mu)*sitalic_b = italic_Q ( italic_Ξ² ) - italic_Q ( italic_ΞΌ ) βˆ— italic_s (8)
Refer to caption
Figure 6: Validation Top-1 Accuracy during QAT on ImageNet for different Batch Norm Quantization techniques.

Model Scaling: To generate a Pareto family of models, we scale the number of output channels as practiced in the MobileNetV1 model [18]. We also scale the precision of the input activation to the pointwise convolution layers in the PikeLPN block. We show more details about scaling PikeLPN in Appendix Section 8.

4 Experiments

Table 7: Results – PikeLPN versus SOTA low-precision models in terms of Accuracy and Efficiency Metrics. A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT is measured according to the definition in Section 3.2. The fourth and fifth columns show the contribution to the overall A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost by multiply-accumulate and elementwise operations respectively. Energy represents the arithmetic energy according to 45⁒n⁒m45π‘›π‘š45nm45 italic_n italic_m CMOS technology according to table 1. Arithmetic Intensity is an indication for the memory reads and writes required by the model as explained in Section 3.3. Used Precisions represent the the precision of the various operations in the mixed-precision models.
Model Accuracy Arithmetic Computational Effort (A⁒C⁒Ev⁒𝟐𝐴𝐢subscript𝐸𝑣2\bm{ACE_{v2}}bold_italic_A bold_italic_C bold_italic_E start_POSTSUBSCRIPT bold_italic_v bold_2 end_POSTSUBSCRIPT) Energy Arithmetic Intensity Used
(%) Total (Γ—109↓\times 10^{9}\downarrowΓ— 10 start_POSTSUPERSCRIPT 9 end_POSTSUPERSCRIPT ↓) MAC (%) Elementwise (%percent\%%) (m⁒Jβ†“β†“π‘šπ½absentmJ\downarrowitalic_m italic_J ↓) (Ops/Element ↑↑\uparrow↑) Precisions
XNOR-Net [37] 51.2 143.78 - - 587.69 - 32, 1
MobiNet [35] 54.4 12.64 13.17 86.83 50.66 28 -
Bi-RealNet-18 [28] 56.4 166.26 - - 678.75 - 32, 1
Bi-RealNet-34 [28] 62.2 168.11 - - 691.47 - 32, 1
MobileNet (8W, 4A) [26] 64.0 33.8 68.96 31.04 118.54 39.57 32, 8, 4
MobileNet (4W, 8A) [26] 65.0 33.8 68.96 31.04 118.54 39.57 32, 8, 4
Real-to-Binary Net [31] 65.4 186.85 - - 762.24 - 32, 1
MeliusNet-29 [4] 65.8 158.21 - - 656.81 - 32, 1
PokeBNN-0.5x [48] 65.2 33.58 4.18 95.81 143.78 24.5 32, 8, 4, 1
PikeLPN-1Γ—\timesΓ— (Ours) 67.55 8.50 96.38 3.62 34.98 39.57 8, 4
PROFIT [34] 69.05 20.91 47.51 52.49 82.70 39.57 32, 4
MeliusNet-42 [4] 69.20 215.71 - - 901.82 - 32, 1
PikeLPN-2Γ—\timesΓ— (Ours) 69.23 15.56 97.87 2.13 64.20 39.57 16, 8, 4
ReActNet [29] 69.4 83.24 26.78 73.22 361.63 36.75 32, 1
PokeBNN-0.75x [48] 70.5 50.61 5.11 94.88 218.51 40.48 32, 8, 4, 1
MobileNet (8bit) [26] 70.7 51.44 79.61 20.39 173.68 39.57 32, 8
PikeLPN-3Γ—\timesΓ— (Ours) 71.95 33.70 98.52 1.48 139.59 52.66 16, 8, 4
PokeBNN-1x [48] 73.4 68.56 6.16 93.83 298.44 40.48 32, 8, 4, 1
PikeLPN-6Γ—\timesΓ— (Ours) 73.59 58.74 98.87 1.13 243.85 63.38 16, 8, 4

4.1 Implementation and Training

All models are implemented using QKeras [7], then we performed Quantization-aware training (QAT) [21]. We train and evaluate the PikeLPN family of models on the ILSVRC12 ImageNet classification dataset [10]. To train our low-precision models, we follow a multi-phase training approach. We first train the full-precision model, then we quantize the model as explained previously in Subsection 3.4, and train for another 500500500500 epochs. All Models are trained with an effective batch size of 256256256256 using an AdamW optimizer and a Cosine Decay schedule. We use label smoothing regularization with cross-entropy loss and a smoothing factor of 0.10.10.10.1 for all models. The initial learning rate is 1⁒eβˆ’41𝑒41e-41 italic_e - 4 and annealed using a cosine schedule to 1⁒eβˆ’121𝑒121e-121 italic_e - 12. An interesting observation was that training for the final 100100100100 epochs at a constant low learning-rate (i.e., 1⁒eβˆ’121𝑒121e-121 italic_e - 12) help the weights of the low-precision models stabilize and significantly boost the accuracy. More details and visualization about this behaviour in added in the Appendix. We use standard augmentation techniques like resizing, crop**, and flip**. At test time, all PikeLPN models are evaluated on images of resolution 224Γ—224224224224\times 224224 Γ— 224.

Refer to caption
Figure 7: Accuracy and Energy Consumption by the arithmetic operations of our PikeLPN vs SOTA low-precision neural networks.

4.2 Results

To evaluate the accuracy-efficiency trade-off by PikeLPN, we compare its performance to state-of-the-art low-precision models. Figures 7 and 1 show that PikeLPN establishes the SOTA Pareto frontier for low-precision and binary models in terms of arithmetic energy consumption and A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost respectively. Table 7 compares PikeLPN to SOTA low-precision models in terms of Top-1 Accuracy on ImageNet, Energy consumption in m⁒i⁒l⁒l⁒i⁒j⁒o⁒u⁒l⁒e⁒sπ‘šπ‘–π‘™π‘™π‘–π‘—π‘œπ‘’π‘™π‘’π‘ millijoulesitalic_m italic_i italic_l italic_l italic_i italic_j italic_o italic_u italic_l italic_e italic_s, A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT, and Arithmetic Intensity. We clearly see how the elementwise operations dominate (i.e., Β 31-93%) the A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost for other low-precision models. On the other hand, PikeLPN carefully quantizes the elementwise operations reducing their contribution to the total energy consumption to less than 5%. Additionally, PikeLPN-1Γ—1\times1 Γ— is 1.5Γ—1.5\times1.5 Γ— more efficient in terms of both A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT and arithmetic energy consumption compared to MobiNet [36] (i.e., A binary version of MobileNetV1 with added skip connections) while achieving 13.2% higher Top-1 Accuracy on ImageNet. Moreover, PikeLPN-3Γ—3\times3 Γ— achieves 1.5%percent1.51.5\%1.5 % higher Top-1 accuracy than PokeBNN-0.75Γ—0.75\times0.75 Γ— [48] (i.e., A binary ResNet-50 with parameterized activation functions) while being 35%percent3535\%35 % more efficient. In terms of arithmetic intensity, PikeLPN shows a much higher arithmetic intensity when compared to other low-precision models, this is mainly due to the absence of any skip connections. As mentioned earlier in Section 3.3, high arithmetic intensity is advantageous as it suggests a greater proportion of computational operations per data element, which can lead to reducing the memory reads and writes by the model; hence reducing the overall energy consumption during inference.

5 Conclusion

Our investigation into SOTA low-precision models uncovered overlooked efficiency bottlenecks, particularly noting that operations traditionally considered negligibleβ€”such as elementwise operations in activation functions, batch normalization, and quantization scaling can contribute up to 90% of the inference cost. Addressing these challenges, we proposed A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT which extends the efficiency metric ACE to better reflect the inference cost of low-precision models. Moreover, we introduced PikeLPN, a novel family of models that quantizes both elementwise and multiply-accumulate operations. Specifically, we propose (a) a novel QuantNorm layer for effective batch normalization quantization, (b) Double Quantization where quantization parameters are also quantized, and (c) Distribution-Heterogeneous Quantization for Separable Convolution layers to tackle their distribution mismatch problem. PikeLPN achieves up to a threefold reduction in inference cost over existing low-precision models while improving the Top-1 accuracy in ImageNet dataset.

References

  • Abdolrashidi etΒ al. [2021] AmirAli Abdolrashidi, Lisa Wang, Shivani Agrawal, Jonathan Malmaud, Oleg Rybakov, Chas Leichner, and Lukasz Lew. Pareto-optimal quantized resnet is mostly 4-bit. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3091–3099, 2021.
  • Agarap [2018] AbienΒ Fred Agarap. Deep learning using rectified linear units (relu). 2018.
  • Archana and Durga [2014] S. Archana and G. Durga. Design of low power and high speed ripple carry adder. In 2014 International Conference on Communication and Signal Processing, pages 939–943, 2014.
  • Bethge etΒ al. [2020] Joseph Bethge, Christian Bartz, Hao** Yang, Ying Chen, and Christoph Meinel. Meliusnet: Can binary neural networks achieve mobilenet-level accuracy? arXiv preprint arXiv:2001.05936, 2020.
  • Choukroun etΒ al. [2019] Yoni Choukroun, Eli Kravchik, Fan Yang, and Pavel Kisilev. Low-bit quantization of neural networks for efficient inference. In 2019 IEEE/CVF International Conference on Computer Vision Workshop (ICCVW), pages 3009–3018. IEEE, 2019.
  • Chu [2013] WesleyΒ Donald Chu. Wallace and dadda multipliers implemented using carry lookahead adders. 2013.
  • CoelhoΒ Jr etΒ al. [2021] ClaudionorΒ N CoelhoΒ Jr, Aki Kuusela, Shan Li, Hao Zhuang, Jennifer Ngadiuba, TheaΒ Klaeboe Aarrestad, Vladimir Loncar, Maurizio Pierini, AdrianΒ Alan Pol, and Sioni Summers. Automatic heterogeneous quantization of deep neural networks for low-latency inference on the edge for particle detectors. Nature Machine Intelligence, 3(8):675–686, 2021.
  • Dadda [1983] Luigi Dadda. Some schemes for fast serial input multipliers. In 1983 IEEE 6th Symposium on Computer Arithmetic (ARITH), pages 52–59, 1983.
  • Dai etΒ al. [2021] Steve Dai, Rangha Venkatesan, Mark Ren, Brian Zimmer, William Dally, and Brucek Khailany. Vs-quant: Per-vector scaled quantization for accurate low-precision neural network inference. Proceedings of Machine Learning and Systems, 3:873–884, 2021.
  • Deng etΒ al. [2009] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE Conference on Computer Vision and Pattern Recognition, pages 248–255, 2009.
  • Gholami etΒ al. [2022] Amir Gholami, Sehoon Kim, Zhen Dong, Zhewei Yao, MichaelΒ W Mahoney, and Kurt Keutzer. A survey of quantization methods for efficient neural network inference. In Low-Power Computer Vision, pages 291–326. Chapman and Hall/CRC, 2022.
  • Gysel etΒ al. [2018] Philipp Gysel, Jon Pimentel, Mohammad Motamedi, and Soheil Ghiasi. Ristretto: A framework for empirical study of resource-efficient inference in convolutional neural networks. IEEE transactions on neural networks and learning systems, 29(11):5784–5789, 2018.
  • Hashemi etΒ al. [2017] Soheil Hashemi, Nicholas Anthony, Hokchhay Tann, RΒ Iris Bahar, and Sherief Reda. Understanding the impact of precision quantization on the accuracy and energy of neural networks. In Design, Automation & Test in Europe Conference & Exhibition (DATE), 2017, pages 1474–1479. IEEE, 2017.
  • Hashmi and Babu [2010] Irina Hashmi and Hafiz Md.Β Hasan Babu. An efficient design of a reversible barrel shifter. In 2010 23rd International Conference on VLSI Design, pages 93–98, 2010.
  • He etΒ al. [2015] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, pages 1026–1034, 2015.
  • He etΒ al. [2016] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
  • Horowitz [2014] Mark Horowitz. 1.1 computing’s energy problem (and what we can do about it). In 2014 IEEE International Solid-State Circuits Conference Digest of Technical Papers (ISSCC), pages 10–14, 2014.
  • Howard etΒ al. [2017] AndrewΒ G Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017.
  • Huang etΒ al. [2017] Gao Huang, Zhuang Liu, Laurens Van DerΒ Maaten, and KilianΒ Q Weinberger. Densely connected convolutional networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4700–4708, 2017.
  • Ioffe and Szegedy [2015] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. pages 448–456, 2015.
  • Jacob etΒ al. [2018] Benoit Jacob, Skirmantas Kligys, Bo Chen, Menglong Zhu, Matthew Tang, Andrew Howard, Hartwig Adam, and Dmitry Kalenichenko. Quantization and training of neural networks for efficient integer-arithmetic-only inference. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2704–2713, 2018.
  • Jha and Mittal [2020] NandanΒ Kumar Jha and Sparsh Mittal. Modeling data reuse in deep neural networks by taking data-types into cognizance. IEEE Transactions on Computers, 70(9):1526–1538, 2020.
  • Journals etΒ al. [2015] Iosr Journals, B.Β Ananda Babu, JamshidΒ M. Basheer, and AbdelmotyΒ .M. Abdeen. Power optimized multiplexer based 1 bit full adder cell using .18 Β΅m cmos technology. 2015.
  • Jung etΒ al. [2019] Sangil Jung, Changyong Son, Seohyung Lee, **woo Son, Jae-Joon Han, Youngjun Kwak, SungΒ Ju Hwang, and Changkyu Choi. Learning to quantize deep networks by optimizing quantization intervals with task loss. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4350–4359, 2019.
  • Koryakovskiy etΒ al. [2023] I. Koryakovskiy, A. Yakovleva, V. Buchnev, T. Isaev, and G. Odinokikh. One-shot model for mixed-precision quantization. In 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 7939–7949, Los Alamitos, CA, USA, 2023. IEEE Computer Society.
  • Krishnamoorthi [2018] Raghuraman Krishnamoorthi. Quantizing deep convolutional networks for efficient inference: A whitepaper. arXiv preprint arXiv:1806.08342, 2018.
  • Li etΒ al. [2019] Yuhang Li, Xin Dong, and Wei Wang. Additive powers-of-two quantization: An efficient non-uniform discretization for neural networks. arXiv preprint arXiv:1909.13144, 2019.
  • Liu etΒ al. [2018] Zechun Liu, Baoyuan Wu, Wenhan Luo, Xin Yang, Wei Liu, and Kwang-Ting Cheng. Bi-real net: Enhancing the performance of 1-bit cnns with improved representational capability and advanced training algorithm. In Proceedings of the European conference on computer vision (ECCV), pages 722–737, 2018.
  • Liu etΒ al. [2020] Zechun Liu, Zhiqiang Shen, Marios Savvides, and Kwang-Ting Cheng. Reactnet: Towards precise binary neural network with generalized activation functions. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part XIV 16, pages 143–159. Springer, 2020.
  • Liu etΒ al. [2021] Zechun Liu, Zhiqiang Shen, Shichao Li, Koen Helwegen, Dong Huang, and Kwang-Ting Cheng. How do adam and training strategies help bnns optimization. In International conference on machine learning, pages 6936–6946. PMLR, 2021.
  • Martinez etΒ al. [2020] Brais Martinez, **g Yang, Adrian Bulat, and Georgios Tzimiropoulos. Training binary neural networks with real-to-binary convolutions. arXiv preprint arXiv:2003.11535, 2020.
  • Miyashita etΒ al. [2016] Daisuke Miyashita, EdwardΒ H Lee, and Boris Murmann. Convolutional neural networks using logarithmic data representation. arXiv preprint arXiv:1603.01025, 2016.
  • Pai and Chen [2004] Yu-Ting Pai and Yu-Kumg Chen. The fastest carry lookahead adder. In Proceedings. DELTA 2004. Second IEEE International Workshop on Electronic Design, Test and Applications, pages 434–436, 2004.
  • Park and Yoo [2020] Eunhyeok Park and Sungjoo Yoo. Profit: A novel training method for sub-4-bit mobilenet models. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part VI 16, pages 430–446. Springer, 2020.
  • Phan etΒ al. [2020a] Hai Phan, Yihui He, Marios Savvides, Zhiqiang Shen, etΒ al. Mobinet: A mobile binary network for image classification. In Proceedings of the IEEE/CVF winter conference on applications of computer vision, pages 3453–3462, 2020a.
  • Phan etΒ al. [2020b] Hai Phan, Zechun Liu, Dang Huynh, Marios Savvides, Kwang-Ting Cheng, and Zhiqiang Shen. Binarizing mobilenet via evolution-based searching. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 13417–13426, 2020b.
  • Rastegari etΒ al. [2016] Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, and Ali Farhadi. Xnor-net: Imagenet classification using binary convolutional neural networks. In European conference on computer vision, pages 525–542. Springer, 2016.
  • Sakr etΒ al. [2017] Charbel Sakr, Yongjune Kim, and Naresh Shanbhag. Analytical guarantees on numerical precision of deep neural networks. In International Conference on Machine Learning, pages 3007–3016. PMLR, 2017.
  • Seidel and Even [2001] P.-M. Seidel and G. Even. On the design of fast ieee floating-point adders. In Proceedings 15th IEEE Symposium on Computer Arithmetic. ARITH-15 2001, pages 184–194, 2001.
  • Sutherland etΒ al. [1999] Ivan Sutherland, RobertΒ F Sproull, and David Harris. Logical effort: designing fast CMOS circuits. Morgan Kaufmann, 1999.
  • Tan and Le [2019] Mingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In International conference on machine learning, pages 6105–6114. PMLR, 2019.
  • Tann etΒ al. [2017] Hokchhay Tann, Soheil Hashemi, R.Β Iris Bahar, and Sherief Reda. Hardware-software codesign of accurate, multiplier-free deep neural networks. In 2017 54th ACM/EDAC/IEEE Design Automation Conference (DAC), pages 1–6, 2017.
  • Vasu etΒ al. [2023] Pavan KumarΒ Anasosalu Vasu, James Gabriel, Jeff Zhu, Oncel Tuzel, and Anurag Ranjan. Mobileone: An improved one millisecond mobile backbone. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 7907–7917, 2023.
  • Wallace [1964] C.Β S. Wallace. A suggestion for a fast multiplier. IEEE Transactions on Electronic Computers, EC-13(1):14–17, 1964.
  • You etΒ al. [2020] Haoran You, Xiaohan Chen, Yongan Zhang, Chaojian Li, Sicheng Li, Zihao Liu, Zhangyang Wang, and Yingyan Lin. Shiftaddnet: A hardware-inspired deep network. Advances in Neural Information Processing Systems, 33:2771–2783, 2020.
  • You etΒ al. [2023] Haoran You, Huihong Shi, Yipin Guo, etΒ al. Shiftaddvit: Mixture of multiplication primitives towards efficient vision transformer. arXiv preprint arXiv:2306.06446, 2023.
  • Zhang etΒ al. [2021] Yichi Zhang, Junhao Pan, Xinheng Liu, Hongzheng Chen, Deming Chen, and Zhiru Zhang. Fracbnn: Accurate and fpga-efficient binary neural networks with fractional activations. In The 2021 ACM/SIGDA International Symposium on Field-Programmable Gate Arrays, pages 171–182, 2021.
  • Zhang etΒ al. [2022] Yichi Zhang, Zhiru Zhang, and Lukasz Lew. Pokebnn: A binary pursuit of lightweight accuracy. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 12475–12485, 2022.
  • Zimmermann [1999] Reto Zimmermann. Computer arithmetic: Principles, architectures, and vlsi design. Personal publication (Available at http://www. iis. ee. ethz. ch/Β  zimmi/-publications/comp arith notes. ps. gz), 1999.
\thetitle

Supplementary Material

6 Elementwise Multiplications

In Section 3.2, we propose A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT which extends ACE to account for elementwise multiplications. We derived the number of adders required for multiplying an i𝑖iitalic_i-bit number by a j𝑗jitalic_j-bit number as iβ‹…jβˆ’max⁑(i,j)⋅𝑖𝑗𝑖𝑗i\cdot j-\max(i,j)italic_i β‹… italic_j - roman_max ( italic_i , italic_j ). Here we provide a more detailed justification for the derived formula. For simplicity, we assume both operands have the same number of bits (i.e., i𝑖iitalic_i = j𝑗jitalic_j) in this derivation. Elementwise multiplications requires a multiplier as well as an adder to account for the dot pattern at the completion of the multiplication [6]. We base our derivation on the established implementation of Dadda multiplier [6] and Ripple-Carry Adder (RCA) [3] to estimate the cost of elementwise multiplications. To multiply two i𝑖iitalic_i-bit numbers, the Dadda multiplier requires i2βˆ’3⁒i+2superscript𝑖23𝑖2i^{2}-3i+2italic_i start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT - 3 italic_i + 2 adders [6], while the RCA adds another 2⁒iβˆ’22𝑖22i-22 italic_i - 2 adders. This leads to a total number of adders equal to i2βˆ’isuperscript𝑖2𝑖i^{2}-iitalic_i start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT - italic_i. To generalize to operands with different precisions, the cost for elementwise multiplications between an i𝑖iitalic_i-bit number and a j𝑗jitalic_j-bit number can be derived as iβ‹…jβˆ’max⁑(i,j)⋅𝑖𝑗𝑖𝑗i\cdot j-\max(i,j)italic_i β‹… italic_j - roman_max ( italic_i , italic_j ), with iβ‹…j⋅𝑖𝑗i\cdot jitalic_i β‹… italic_j reflecting the cost of the multiplier and max⁑(i,j)𝑖𝑗\max(i,j)roman_max ( italic_i , italic_j ) representing the final addition. Independently, we performed an empirical verification for 1≀i,j≀64formulae-sequence1𝑖𝑗641\leq i,j\leq 641 ≀ italic_i , italic_j ≀ 64 which confirmed the correctness of this formula, showing zero error in predicted adder counts. This refinement in A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost calculation enhances our understanding of multiplier complexity.

7 Floating Point Elementwise Additions

In Section 3.2, we improve ACE by extending it to include the cost of floating-point elementwise addition. We derive the cost of adding an i𝑖iitalic_i-bit and a j𝑗jitalic_j-bit floating point numbers, using the formula

A⁒C⁒Ef⁒pβˆ’a⁒d⁒d=caβ‹…max⁑(i,j)𝐴𝐢subscriptπΈπ‘“π‘π‘Žπ‘‘π‘‘β‹…subscriptπ‘π‘Žπ‘–π‘—ACE_{fp-add}=c_{a}\cdot\max(i,j)italic_A italic_C italic_E start_POSTSUBSCRIPT italic_f italic_p - italic_a italic_d italic_d end_POSTSUBSCRIPT = italic_c start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT β‹… roman_max ( italic_i , italic_j ) (9)

For simplicity, we assume both operands have the same number of bits (i.e., i𝑖iitalic_i = j𝑗jitalic_j) in this derivation. casubscriptπ‘π‘Žc_{a}italic_c start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT reflects the added complexity of floating point operations compared to fixed-point addition. To derive casubscriptπ‘π‘Žc_{a}italic_c start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT, we look into the components of floating-point adders [39] and analyze the A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost for each component. Assuming e𝑒eitalic_e bits for the exponent and mπ‘šmitalic_m bits for the mantissa, the main components of the floating-point adder and their corresponding A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT costs are as follows:

  1. 1.

    Exponent Subtraction: Involves subtracting the exponent bits resulting in an A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost of 𝐞𝐞\mathbf{e}bold_e.

  2. 2.

    Operand Swap**: Requires a single multiplexer with negligible A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost.

  3. 3.

    Limitation of Alignment Shift Amount: Involves adding the mantissa bits resulting in an A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost of 𝐦𝐦\mathbf{m}bold_m.

  4. 4.

    Alignment Shift: Involves shifting by the mantissa bits adding an A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost of 𝐦⋅π₯𝐨𝐠𝟐⁒(𝐦)/πŸ“β‹…π¦subscriptπ₯𝐨𝐠2𝐦5\mathbf{m\cdot log_{2}(m)/5}bold_m β‹… bold_log start_POSTSUBSCRIPT bold_2 end_POSTSUBSCRIPT ( bold_m ) / bold_5666A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost for shift operation is derived as iβ‹…log2⁑(j)/5⋅𝑖subscript2𝑗5i\cdot\log_{2}(j)/5italic_i β‹… roman_log start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ( italic_j ) / 5 in Subsection 3.23.23.23.2.

  5. 5.

    Significand Negation: Involves one bit subtraction resulting in an A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost of 1.

  6. 6.

    Significand Addition: Requires mantissa bits addition resulting in an A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost of 𝐦𝐦\mathbf{m}bold_m.

  7. 7.

    Significand Conversion: Requires two additions adding an A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost of 𝟐⁒𝐦2𝐦\mathbf{2m}bold_2 bold_m.

  8. 8.

    Normalization: Requires shifting e𝑒eitalic_e bits resulting in an A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost of πžβ‹…π₯𝐨𝐠𝟐⁒(𝐞)/πŸ“β‹…πžsubscriptπ₯𝐨𝐠2𝐞5\mathbf{e\cdot log_{2}(e)/5}bold_e β‹… bold_log start_POSTSUBSCRIPT bold_2 end_POSTSUBSCRIPT ( bold_e ) / bold_5.

  9. 9.

    Rounding and Post-normalization: Requires adding mπ‘šmitalic_m bits with an A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost of 𝐦𝐦\mathbf{m}bold_m.

Summing the costs for all the components, we get a total cost of m⁒(5+log2⁑(m)/5)+e+eβ‹…log2⁑(e)/5+1π‘š5subscript2π‘š5𝑒⋅𝑒subscript2𝑒51m(5+\log_{2}(m)/5)+e+e\cdot\log_{2}(e)/5+1italic_m ( 5 + roman_log start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ( italic_m ) / 5 ) + italic_e + italic_e β‹… roman_log start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ( italic_e ) / 5 + 1. Considering the dominant role of mantissa operations, we approximate the total cost to i⁒(5+l⁒o⁒g2⁒(i)/5)𝑖5π‘™π‘œsubscript𝑔2𝑖5i(5+log_{2}(i)/5)italic_i ( 5 + italic_l italic_o italic_g start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ( italic_i ) / 5 ) where i𝑖iitalic_i is the number of bits of the added floating point number. The upper bound for log2⁑(i)/5subscript2𝑖5\log_{2}(i)/5roman_log start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ( italic_i ) / 5 is 1111 when m is 32323232. Therefore, we can derive the cost as 6⁒iΛ™6˙𝑖6\dot{i}6 overΛ™ start_ARG italic_i end_ARG resulting in ca=6subscriptπ‘π‘Ž6c_{a}=6italic_c start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT = 6 in Equation 9. This approximation streamlines A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT calculation for floating-point additions. To verify its correctness, we show that it aligns well with the independently measured energy consumption observed in 45nm CMOS technology in Table 1.

8 Model Scaling

To scale PikeLPN-1Γ—\timesΓ— to the 2Γ—\timesΓ—, 3Γ—\timesΓ—, and 6Γ—\timesΓ— sizes, we employ a series of scaling techniques including multiplying the output channels of the convolution layers by a scaling factor and increasing the precision of the feature maps at the point-wise convolution layers. These techniques increase both the A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost and the representational capacity of the model, allowing us to generate a Pareto family of models. The details for each model are described in Table 8. For nomenclature, the scale factor represents the A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost of the scaled model compared to that of the smallest model. For example, PikeLPN-3Γ—3\times3 Γ— has approximately 3 times the A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost of PikeLPN-1Γ—1\times1 Γ—.

Table 8: Comparison of PikeLPN variants’ training parameters, with dropout rates calibrated to mitigate overfitting. Each model’s training duration and learning rate strategy are customized according to its complexity. They are initialized with weights from an floating point PikeLPN model, employing a consistent learning rate of 10βˆ’12superscript101210^{-12}10 start_POSTSUPERSCRIPT - 12 end_POSTSUPERSCRIPT during the tail period to enhance stability and validation accuracy, crucial for smaller models.
PikeLPN Size 1Γ—\timesΓ— 2Γ—\timesΓ— 3Γ—\timesΓ— 6Γ—\timesΓ—
𝑨⁒π‘ͺβ’π‘¬π’—β’πŸπ‘¨π‘ͺsubscript𝑬𝒗2\bm{ACE_{v2}}bold_italic_A bold_italic_C bold_italic_E start_POSTSUBSCRIPT bold_italic_v bold_2 end_POSTSUBSCRIPT (Γ—109absentsuperscript109\times 10^{9}Γ— 10 start_POSTSUPERSCRIPT 9 end_POSTSUPERSCRIPT) 8.68 15.74 33.97 59.10
Channel Multiplier 1.0 1.0 1.5 2.0
Activation precision (6, 1, 1) (8, 7, 1) (8, 7, 1) (8, 7, 1)
(int bits, frac bits, sign bit)
Removal of BN layers Yes No No No
between depthwise and
pointwise convolutions
Constant learning rate 300 300 20 50
tail period (epochs)
Training epochs 500 1500 1000 1000
Dropout rate 1e-3 1e-3 0.5 0.7
Refer to caption
Figure 8: Training Top-1 Accuracy during QAT on ImageNet at different Batch Norm Quantization techniques for PikeLPN-1Γ—1\times1 Γ—.
Refer to caption
(a) Training Accuracy (%)
Refer to caption
(b) Validation Accuracy (%)
Figure 9: Top-1 Accuracy during QAT on ImageNet at different Batch Norm Quantization techniques for PikeLPN-2Γ—2\times2 Γ—.

9 QuantNorm Layer

As shown in Subsection 3.3, QuantNorm reduces quantization error during training improving the performance of our PikeLPN models on ImageNet image classification dataset [10]. As shown in Figure 6666, QuantNorm maintains close-to-FP validation accuracy when using it during PikeLPN-1Γ—1\times1 Γ— training. Figure 8 shows the top-1 training accuracy while training the same model using different batch normalization quantization techniques. Moreover, to ensure that the same behaviour persists at different PikeLPN scales, Figures 9(b) and 9(b) shows the top-1 training and validation accuracies respectively of PikeLPN-2Γ—2\times2 Γ— when using our proposed QuantNorm layer versus the vanilla batch norm quantization shown in Equation 5.

Refer to caption
Figure 10: Validation Top-1 Accuracy for PikeLPN-1Γ—\timesΓ— model with various learning rate decay schedules. All the training sessions match exactly except for the number of decay steps which ranges between 200 and 500 epochs.

10 Early LR Decay

As mentioned in Subsection 4.1, our PikeLPN models are trained using an AdamW optimizer and a Cosine Decay Schedule. The initial learning rate is 1⁒eβˆ’41𝑒41e-41 italic_e - 4 and annealed using a cosine schedule to 1⁒eβˆ’121𝑒121e-121 italic_e - 12. Figure 10 summarizes the training behaviour with various learning rate schedules. The x-axis represents the training iterations which we limit to 500 epochs. The y-axis in the top graph represents the validation top-1 accuracy on ImageNet, while the y-axis in the bottom graph represents the learning rate. All the training sessions match exactly except for the number of decay steps which ranges between 200 and 500 epochs. The figure highlights two main observations. First, training for the final few epochs at a constant low learning-rate (i.e., 1⁒eβˆ’121𝑒121e-121 italic_e - 12) help the weights of the low-precision models stabilize and significantly boost the accuracy (i.e., 1βˆ’2%1percent21-2\%1 - 2 %). Second, the number of decay steps is an important hyper-parameter when training low-precision models. For example, we noticed that for PikeLPN-1Γ—\timesΓ—, setting the number of decay steps to 300 gives an extra 0.5βˆ’1%0.5percent10.5-1\%0.5 - 1 % improvement in validation accuracy.

Table 9: PikeLPN versus baselines - detailed analysis for contribution of elementwise operations to A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT. Total represents the total percentage of elementwise operations from A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT. BN, ACT and QP represents the detailed contribution of batch norm layers, activation layers and quantization overhead respectively.
Model MAC A⁒C⁒Ev⁒𝟐𝐴𝐢subscript𝐸𝑣2\bm{ACE_{v2}}bold_italic_A bold_italic_C bold_italic_E start_POSTSUBSCRIPT bold_italic_v bold_2 end_POSTSUBSCRIPT Elementwise A⁒C⁒Ev⁒𝟐𝐴𝐢subscript𝐸𝑣2\bm{ACE_{v2}}bold_italic_A bold_italic_C bold_italic_E start_POSTSUBSCRIPT bold_italic_v bold_2 end_POSTSUBSCRIPT
Total BN Act QP
PokeBNN-0.5x 4.2 95.8% 43.4% 29.2% 21.5%
PikeLPN-1Γ—\timesΓ— 96.4 3.9% 3.7% 0% 0.2%
PROFIT 48% 52% 19% 17% 16%
PikeLPN-2Γ—\timesΓ— 97.9 2.1% 2% 0% 0.1%
PokeBNN-1x 6.2 93.8% 42.2% 28.4% 20.9%
PikeLPN-6Γ—\timesΓ— 98.9 1.13% 0.98% 0% 0.2%

11 Detailed Analysis for Contribution of Elementwise operations to 𝑨⁒π‘ͺβ’π‘¬π’—β’πŸπ‘¨π‘ͺsubscript𝑬𝒗2\bm{ACE_{v2}}bold_italic_A bold_italic_C bold_italic_E start_POSTSUBSCRIPT bold_italic_v bold_2 end_POSTSUBSCRIPT

Table 9 shows the detailed contributions of different elementwise computation sources to the overall A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT cost.

12 Comparing ACE to similar metrics

In Section 3.2, we propose an extension to ACE, but our proposed extension could in principle generalize to other metrics similar to ACE. All previous metrics similar to ACE known by the authors only account for accumulate/dot-product operations and not elementwise operations, making our proposed extension generally valuable. Even so, we chose to specifically extend the ACE metric as opposed to other metrics due to ACE’s simplicity and efficacy in predicting energy costs. We extend ACE because it was built with ML researchers in mind, creating balance between complexity and abstraction of hardware energy which - from a physics perspective in CMOS - is likely to limit future ML hardware. We would like to compare ACE to four other metrics that are often brought up when trying to predict hardware costs: (1) Fanout-of-4 inverter delay (FO4) [40] is a constraint in hardware design, but not necessarily a target for ML researchers. (2) Ristretto [12] measures power cost through a labor-intensive synthesis, inaccessible to ML researchers. (3, 4) The Unit-gate model [49] and full-adder count [38] correlate very well with ACE and differ only by a small constant factor 777Unlike A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT, their application to DNNs does not take the cost elementwise operations into account nor does it account for carry-save format for local accumulator representations typically used in systollic arrays.. Therefore our A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT extension would generalize to these metrics. Moreover, all those metrics, including A⁒C⁒Ev⁒2𝐴𝐢subscript𝐸𝑣2ACE_{v2}italic_A italic_C italic_E start_POSTSUBSCRIPT italic_v 2 end_POSTSUBSCRIPT, are technology independent.