Paper: Hadamard Domain Training with Integers for Class  Incremental Quantized Learning (ICLR-2024)

Reviewer comment (Novelty):
Previous CL works that the paper cites were presented years ago, and the paper doesn’t address recent works.

Author response:
Authors: We chose to address fundamental continual learning techniques that are exemplary for different research directions in continual learning. More recent techniques are often at least partly reformulations of ideas presented in the investigated techniques. Therefore, these techniques are usually part of the comparison techniques in continual learning e.g. in [1] and we argue that they provide a good indication of the connectivity of CL and FQT.

[1] Zhou, Da-Wei, et al. "Deep class-incremental learning: A survey." arXiv preprint arXiv:2302.03648 (2023).

Reviewer comment (Experiments):
The paper doesn’t show experimental results that use larger and more realistic datasets, such as ImageNet.

Author response:
Authors: The target for our technique are limited computational resources scenarios for example on edge devices detecting human activity or AR/VR scenarios. Hence, the datasets we are most interested in are relatively small. We included CIFAR100 with a ResNet architecture to allow the continual learning community to compare results to previous work in the field. Quantization is usually resulting in performance degradation as information is lost in the process. In comparison with the other FQT techniques though, we achieve competitive results on the relatively large CIFAR100.

Reviewer comment (Theory):
The formula of Hadamard transform is wrong; $H_k = [H_k  \quad H_{k-1};   H_{k-1} \quad  -H_{k-1}]$ -> $H_k = \frac{1}{\sqrt{2}} [H_k    \quad H_{k-1};   H_{k-1} \quad -H_{k-1}]$.

Author response:
Authors: While the normalization factor is often omitted (note that we had mentioned the transform is orthogonal and not orthonormal) we have now included this normalization factor for clarity.

Reviewer comment (Presentation):
In Figure 2, the first three rows compare standard quantization and Hadamard quantization, and the last row is an ablation study of quantizing tensors in the backward pass and accumulator quantization. However, because they aren’t properly distinguished, it seems that the last row also shows a comparison between standard quantization and Hadamard quantization.

Author response:
Authors: We have added different coloured backgrounds to the mentioned figures 2 and 4 and now address them accordingly in the paper.

Reviewer comment (Experiments):
In Table 2, a 4-bit input and 12-bit accumulator for previous works is critical to compare the proposed method with other works. However, those results aren’t provided.

Author response:
Authors: We have added results for 12 bits LUQ in Table 2. FP134 already fails for 16 bits and also fails for 12. Therefore, our HDQT method is the only one that does not fail with 12 bits or lower for the accumulator.

Reviewer comment (Novelty):
There already is a previous work that applies the Hadamard transform to quantization. What’s different between the previous work and the proposed method?

Author response:
Authors: While previous work [1] (which was cited as (Xi et al., 2023) in our paper) has indeed used the Hadamard transform during the forward pass of a model ( to account for outliers in the forward pass activations), this is not our approach. Instead, we apply the Hadamard transform to the backward pass to better spread information across multiple quantizer levels and capture variety in gradient distributions and learning dynamics of CL. We furthermore identify pain points such as accumulator bit-width in the forward pass (note that it is not necessary in the backward pass) and demonstrate techniques to mitigate any accuracy loss owing to quantization.

Reviewer comment (Experiments):
It seems too harsh to apply FQT and CL simultaneously. Can an example of a scenario that should apply FQT and CL together be provided?

Author response:
Authors: We are not the first that are interested in applying continual learning to the edge; e.g. [1], [2], [3] or this late breaking paper [5]. Continual learning with the ability to learn new tasks over time without the need to train from scratch has been gaining more and more attention in applications with resource-constrained devices; for example, in AR/VR devices where instantaneous adaptation might be needed, or small drones or mobile robots which need to adapt to new environments in real-time while operating with limited memory and computational power. There have also been examples of using continual recalibration on brain-computer interface devices [4] where miscalibration might result in the non-detection of seizures. Quantization leverages the limited computational resources and enables continual learning where it would otherwise be impossible either due to practical or legal reasons.  Or alternatively, enables larger models on the same resource-constrained device. Additionally, note that energy and time typically do not trade off and we are reporting energy estimates rather than power estimates.
 

[1] Wang, Zifeng, et al. "SparCL: Sparse continual learning on the edge." Advances in Neural Information Processing Systems 35 (2022): 20366-20380.

[2] Hayes, Tyler L., and Christopher Kanan. "Online continual learning for embedded devices." arXiv preprint arXiv:2203.10681 (2022).

[3] Pietroń, Marcin, et al. "Ada-QPacknet--adaptive pruning with bit width reduction as an efficient continual learning method without forgetting." arXiv preprint arXiv:2308.07939 (2023).

[4] Fan, Chaofei, et al. "Plug-and-Play Stability for Intracortical Brain-Computer Interfaces: A One-Year Demonstration of Seamless Brain-to-Text Communication." arXiv preprint arXiv:2311.03611 (2023).

[5] Verwimp et al. "Continual Learning: Applications and the Road Forward" arXiv preprint arXiv:2311.11908 (2023)

Reviewer comment (Experiments):
It helps understand how effective the proposed method is if results about FQT under CL scenarios without Hadamard transform are provided. Can the results be provided?

Author response:
Authors: We have added results for FQT without the Hadamard transform in Appendix A4. We see a significant performance reduction without it e.g. in the case of iCaRL on HAPT the average accuracy drops from 82.56 to 48.11 and the standard deviation increases from 4.51 to 21.4. Therefore, without the Hadamard transform FQT is severely compromised in terms of accuracy and stability.

Reviewer comment (Reproducibility):
Introducing extrac matrix H brings in more parameters for training. Besides, how to determine the parameter H (trainable or pre-calculated) is not mentioned.

Author response:
H is not a trainable parameter but a predefined block diagonal matrix (consisting of +1, -1, and 0 entries), with the size of the matrix determined by the dimensionality of the tensor to be quantized. If we understand this concern correctly, the question is how we determine the composition of the H matrix. H is a block diagonal matrix composed of several sylvestre matrices which we determine the individual sizes by choosing the minimum amount of individual sylvestre matrices that fit. This is done only once for hidden layers and for output layers every time new classes are encountered which changes the dimensionality of the output.

Reviewer comment (Novelty):
The proposed algorithm is not connected to Class Incremental Learning (CIL).

Author response:
We respectfully disagree and would like to highlight that our technique is reciprocally advantageous together with continual learning for the following reasons:
1) In Figure 2, we show that the gradient distributions encountered during the CL learning process are not favourable for uniform integer quantization. We empirically demonstrate that this is mitigated through the use of the spreading properties of the Hadamard transform.
2) We use an adaptive batch-dependent quantization range to deal with the changing data distributions from CL.
3) Our simplicity is an advantage for CL because we have no need for data samples or other parameter storage. This allows us to preserve resources for the often intensive CL techniques[1,2].

[1] Hayes, Tyler L., and Christopher Kanan. "Online continual learning for embedded devices." arXiv preprint arXiv:2203.10681 (2022).

[2] Verwimp et al. "Continual Learning: Applications and the Road Forward" arXiv preprint arXiv:2311.11908 (2023)

Reviewer comment (Novelty):
It is difficult to understand the motivation for connecting continual learning with integer valued training. While edge devices have fewer resources for training, they would not be expected to perform much training or have it completed quickly. Therefore, it would be difficult to justify the additional expense in both software and hardware when the same result can be obtained simply by waiting for a few more hours.

Author response:
Authors: We are not the first that are interested in applying continual learning to the edge; e.g. [1], [2], [3] or this late breaking paper [5]. Continual learning with the ability to learn new tasks over time without the need to train from scratch has been gaining more and more attention in applications with resource-constrained devices; for example, small drones or mobile robotics need to adapt to new environments fast in real-time while with limited memory and computational power. Or the recent example of continual recalibration on brain-computer interface devices [4] also opens opportunities. Quantization leverages the limited computational resources and enables continual learning where it would otherwise be impossible either due to practical or legal reasons. Or alternatively, enables larger models on the same resource-constrained device. Additionally, note that energy and time typically do not trade off and we are reporting energy estimates rather than power estimates.


[1] Wang, Zifeng, et al. "SparCL: Sparse continual learning on the edge." Advances in Neural Information Processing Systems 35 (2022): 20366-20380.

[2] Hayes, Tyler L., and Christopher Kanan. "Online continual learning for embedded devices." arXiv preprint arXiv:2203.10681 (2022).

[3] Pietroń, Marcin, et al. "Ada-QPacknet--adaptive pruning with bit width reduction as an efficient continual learning method without forgetting." arXiv preprint arXiv:2308.07939 (2023).

[4] Fan, Chaofei, et al. "Plug-and-Play Stability for Intracortical Brain-Computer Interfaces: A One-Year Demonstration of Seamless Brain-to-Text Communication." arXiv preprint arXiv:2311.03611 (2023).

[5] Verwimp et al. "Continual Learning: Applications and the Road Forward" arXiv preprint arXiv:2311.11908 (2023)

Reviewer comment (Experiments):
More experiments on different domains are necessary to support the claims of the efficacy of Hadamard domain quantization. For a fairer comparison, there should be a comparison using other methods used in fully quantized training when applied to continual learning. Moreover, there should be a comparison with previous methods when training from scratch, not just during continual learning.

Author response:
Authors: We have shown the efficacy of our method on three datasets recorded using different devices including accelerometers and gyroscopes in the human activity recognition domain, which are representative tasks for energy-constraint edge domains where adaptation is necessary (e.g. AR/VR). Additionally, we provide results on CIFAR100 for a better comparison to related work in CL. While more datasets can definitely strengthen our case, we believe that for our target use case we have shown sufficient datasets and techniques to demonstrate the efficacy of our method.  Table 2 shows the performance of two state-of-the-art FQT methods LUQ and FP134  applied to the CIL scenario. Note that those do not use integer quantization and instead resort to custom floating point formats.  To further address your concern, we have added NoCL results for LUQ and FP134 in Table 2, which show that they are incapable of learning with the same our low bit-width setting.

Reviewer comment (Reproducibility):
The method proposed in the paper would be difficult to implement due to the requirement for stochastic rounding, which cannot be easily implemented in hardware, integer-based or otherwise. Even if such hardware could be implemented, this would require custom circuitry solely for that purpose.

Author response:
Authors: Stochastic rounding is used in other FQT e.g. [1,2] and we are possibly facing a chicken-and-egg problem where hardware designers won’t put support in accelerators due to its being unproven and software designers can’t use it due to no hardware support. We believe, however, that our method shows promise and might over time garner similar widespread appeal similar to how earlier papers had fp8 and int4 software demonstrations which were only after multiple efforts supported natively within accelerators.

Reviewer comment (Experiments):
When examining the results for CIFAR100 in Table 1, the accuracy degradation appears to be relatively higher compared to other datasets. It seems that the trend may vary depending on the dataset or network architecture. Have there been results applying the method to more complex network architectures or larger datasets?

Author response:
Authors: The target for our technique are edge devices with limited computational resources in scenarios such as human activity recognition. Hence, the datasets we are most interested in are relatively small. We included CIFAR100 with a ResNet architecture to allow the continual learning community to compare results to previous work in the field. Quantization usually results in performance degradation as information is lost in the process. In comparison with the other FQT techniques though, we achieve competitive results on the relatively large CIFAR100 specifically when fewer bits are used for accumulators where the other FQT methods, despite our best efforts, are unable to deliver results.

Reviewer comment (Evaluation):
While there are advantages to performing matrix multiplication as integer-arithmetic units through HDQT, it is likely that the overhead for Quantization and Stochastic Quantization cannot be ignored, especially as the batch size increases. I am curious about the energy efficiency, including the overhead for Quantization and Stochastic Quantization, as the batch size becomes larger.

Author response:
Authors: Since our problem domain focused on resource-constrained edge devices, under a class incremental learning setting, we did not study how this would be applied to large batch training. In our studies, the optimal data movement/data flow changes with different batch sizes due to changes in data locality and reuse characteristics.  Disentangling these different hardware impacts while maintaining the focus of this paper on HDQT applied to class incremental learning might not be possible in the space we have available. However, we do provide some answers to the reviewer’s questions after making some simplifying assumptions:

1) Under a fixed weight-stationary dataflow, then the overhead of implementing the Hadamard transform on the weights is amortized over larger and larger amounts of computation. Because, the Hadamard transform is of the order of N log(N) additions which can be implemented very efficiently, especially in a batched fashion since memory access gets amortized over multiple operations.
2) Requantization does not incur any hardware overhead and can be achieved by simply dropping the LSB (least significant bit) during computation. This should not impact the scalability of our approach.
3) We note that stochastic quantization has been employed for at large-scale training of e.g. imagenet-scale models [1]. Indeed, stochastic rounding is also included by Qualcomm in their efficient deployment framework: https://quic.github.io/aimet-pages/AimetDocs/api_docs/torch_quantsim.html . It is true that stochastic rounding might require custom hardware to be implemented. Here, we make the case for the development and inclusion of such operations in hardware by demonstrating accuracy improvements.

[1] Wang, Naigang, et al. "Training deep neural networks with 8-bit floating point numbers." Advances in neural information processing systems 31 (2018).
[2] Chmiel, Brian, et al. "Logarithmic unbiased quantization: Practical 4-bit training in deep learning." (2021).

Reviewer comment (Novelty):
This paper lacks novelty. While it introduces FQT to CIL, it is unclear whether the proposed method offers something significantly new compared to the existing FQT with Hadamard transform [1]. Also, the explanation regarding one of the paper's contributions, tiled matrix multiplication, does not provide sufficient details such as hyperparameters like tile size, which are essential for both accuracy and hardware cost. Additionally, the paper does not explain any distinctive aspects compared to chunk-based accumulation proposed in other existing FQT methods [2].

Author response:
We respectfully disagree with the reviewer that our paper lacks novelty and we would like to highlight that to the best of our knowledge, we are the first to apply fully quantized training to continual learning and to develop a quantization method which outperforms SOTA FQT methods in the CL setting. Our method is novel and different from the previous method [1] in that we apply Hadamard transform to backward pass to accommodate for gradient distributions and learning dynamics of CL. In [1],  Hadamard transform was applied to account for outliers in the forward pass activations. [1] does not explicitly use Hadamards transform in the backward pass, while they propose an alternative method for the backward pass using bit-splitting which leverages sparsity. We furthermore identify pain points such as accumulator bit-width in the forward pass (note that it is not necessary in the backward pass) and present remedies to recover substantial amounts of accuracy. We have updated the manuscript to include the results of a hyper-parameter study of tiled size in Table 4 in appendix A6 to demonstrate how we picked the tile size in the paper. We find that tile size 32 is the sweetspot as any larger shows performance degradation and increases in terms of standard deviation. Additionally, we have added a reference to [2] in the paper and we would like to highlight that [2] is proposing a blanket chunk based method applied to all matmuls in the network, we however provide an analysis and refinement that determines that for our type of workloads we only need a chunk/tile based accumulator matmul in the forward pass.

Reviewer comment (Evaluation):
There is a lack of detailed analysis regarding the overhead incurred by Hadamard transformations in the training process. Furthermore, in [1], Hadamard transformation was used effectively to manage outliers occurring in specific channels of the Transformer model. However, this paper lacks a clear explanation of why the Hadamard transformation is particularly necessary for CIL. In Section 3, the direct relevance of being 'more efficient in using available quantization levels' to performance is not well-established.

Author response:
The Hadamard transform has a theoretical time complexity of O(m log m) and we also include the Hadamard transform in the energy numbers we provide when we use our quantization scheme. We can see that given our energy numbers we still materialize substantial gains compared to floating point baseline. We have modified our text to reflect the overhead of Hadamard transform better now. Additionally, we would like to point out that the choice for Hadamard transform is based on our observation of the gradient distribution during continual learning (see Fig. 2 which was derived from our logs during experiments) and previous literature analyzing general gradient distributions [3,4]. Due to its spreading properties and efficient implementation, hardware computation of Hadamard transforms have seen widespread use in spread-spectrum receivers such as those used in cellphones (code division multiple access CDMA) [6]. Building on this insight and the work shown in [4] we apply the Hadamard transform in the backward pass rather than the forward pass to more evenly spread information across quantizer levels (sometimes to the degree of using completely unused quantizer levels, see Fig. 2). Additionally, both intuitively and empirically increasung the number of quantizer levels used does improve performance, e.g. LUQ performance improved when using 17 vs 16 quantizer levels (Table 2 LUQ (17 levels) vs corrected LUQ (16 levels)). We have updated the text to reflect this and give a clearer explanation.

Reviewer comment (Theory):
The rationale behind using stochastic rounding is unclear. In Figure 2 (right), the sensitivity of activation and gradient quantization in the backward pass to unbiased quantizers lacks a clear bridge of explanation. There is a lack of description regarding which factors among bias and variance make gradient and activation quantization in the backward pass challenging.

Author response:
Stochastic rounding is an established method to combat gradient bias in several previous works [4, 5, 7]. We additionally added figure 8 in appendix A13 to show the bias and variance development w/wo stochastic rounding in comparison to no quantization, highlighting the importance of stochastic rounding which is selectively applied (see Fig. 1 where we apply it and Fig. 2 that motivates our choice). This provides further evidence in addition to prior work [11] that stochastic rounding for FQT in CL results in bias and variance in gradient estimation closer to the unquatized version.

Reviewer comment (Evaluation):
The hardware comparison is unfair. While this paper emphasizes the retention of performance with fewer accumulation bits compared to other FQT methods, the hardware evaluation is conducted against hardware using 16-bit activation/accumulation. This makes it difficult to intuitively understand how reducing the accumulation of bits benefits the hardware.

Author response:
We have added energy estimation for 12-bit and 16-bits accumulator bit width with and without Hadamard overhead to demonstrate a fairer hardware comparison. As expected the scaling behaves as shown in previous works [8,9]. In our case the progression gives increasing energy savings 3.3x (INT16) -> 3.4x (INT12) -> 4.5x (INT8) to for the hidden layer. Therefore, we can see significant benefits due to the usage of 8-bit accumulators.

Reviewer comment (Novelty):
What are particular characteristics of CIL (distinct from NoCL) that require innovation for existing FQT?

Author response:
Our technique is advantageous for continual learning for the following reasons:
- In Figure 2, we show that the gradient distributions encountered during the CL learning process are not favourable for uniform integer quantization. We empirically demonstrate that this is mitigated through the use of the spreading properties of the Hadamard transform. 
- In the new figures 9 and 10 we highlight that HDQT is better at approximating gradient distributions at lower bit widths.
- We use an adaptive batch dependant quantization range to deal with the changing data distributions from CL. Our simplicity is an advantage for CL because we have no need for data samples or other parameter storage. This allows us to preserve resources for the often intensive CL techniques[1,2].

[1] Hayes and Kanan “Online Continual Learning for Embedded Devices” (2022)

[2] Verwimp et al. "Continual Learning: Applications and the Road Forward" arXiv preprint arXiv:2311.11908 (2023)

Reviewer comment (Evaluation):
Is it possible to achieve a practical speed-up through the proposed method? Additionally, I'm curious about the overhead incurred by Hadamard transformation.

Author response:
We have added additional numbers in Table X for estimates without the Hadamard transform and we see roughly a 17.7x decrease in energy for using the transform. We want to highlight that we use an unoptimised worst-case implementation of the Hadamard transform (n^2 multiplies rather than n log n adds) due to the limitations of the architectural performance estimations software. In practice, we anticipate custom implementations that could dramatically improve these results. Our efforts towards implementing these techniques using reconfigurable hardware could not be included in the current manuscript due to time and space constraints.

Reviewer comment (Experiments):
I'm curious about the hardware benefits of using 8-bit or 12-bit accumulation with 4-bit input compared to 16-bit accumulation.

Author response:
We have added energy estimation for 12-bit and 16-bits accumulator bit width with and without Hadamard overhead to demonstrate a fairer hardware comparison. As expected the scaling behaves as shown in previous works [8,9]. In our case the progression of gives increasing energy savings 3.3x (INT16) -> 3.4x (INT12) -> 4.5x (INT8) to for the hidden layer. Therefore, we can see significant benefits due to the usage of 8-bit accumulators.

Reviewer comment (Evaluation):
In Table 2, HDQT in BiC exhibits both high accuracy and a high forget score. I'm curious if this is simply a result of overtraining the model or if it has achieved better performance than other methods.

Author response:
The reason for a high accuracy together with a high forgetting score is that the forgetting score is simply the average difference of the class accuracy to their best-achieved performance so far. From this, we can infer that in the case of BIC, our method is more susceptible to incorporating new data and achieving higher intermittent class accuracies.

Reviewer comment (Experiments):
As depicted in Figure 1, it seems that the input and weight undergo a process of quantization-transformation-quantization when used in the backward pass. I wonder about the impact of double quantization like this.

Author response:
We have added section 7 in the appendix where we include a quality study without the second re-quantization. We find that there is no significant difference with and without the re-quantization but want to highlight that the Hadamard transform might result in values requiring a higher precision representation hence it is necessary to re-quantize to guarantee our desired input bit-precision for the matrix multiplication. Further, this re-quantization can be directly embedded in the hardware calculating the Hadamard transform with negligible overhead.