Title: Stepping Forward on the Last Mile
Venue: NeurIPS 2024
Accepted: yes
Keywords: On-device model adaptation

Fixed-point forward gradient learning

Low memory

Edge devices
Abstract: Continuously adapting pre-trained models to local data on resource constrained edge devices is the \emph{last mile} for model deployment. However, as models increase in size and depth, backpropagation requires a large amount of memory, which becomes prohibitive for edge devices. In addition, most existing low power neural processing engines (e.g., NPUs, DSPs, MCUs, etc.) are designed as fixed-point inference accelerators, without training capabilities. Forward gradients, solely based on directional derivatives computed from two forward calls, have been recently used for model training, with substantial savings in computation and memory. However, the performance of quantized training with fixed-point forward gradients remains unclear. In this paper, we investigate the feasibility of on-device training using fixed-point forward gradients, by conducting comprehensive experiments across a variety of deep learning benchmark tasks in both vision and audio domains. We propose a series of algorithm enhancements that further reduce the memory footprint, and the accuracy gap compared to backpropagation. An empirical study on how training with forward gradients navigates in the loss landscape is further explored. Our results demonstrate that on the last mile of model customization on edge devices, training with fixed-point forward gradients is a feasible and practical approach.

Stepping Forward on the Last Mile

Abstract

Continuously adapting pre-trained models to local data on resource constrained edge devices is the last mile for model deployment. However, as models increase in size and depth, backpropagation requires a large amount of memory, which becomes prohibitive for edge devices. In addition, most existing low power neural processing engines (e.g., NPUs, DSPs, MCUs, etc.) are designed as fixed-point inference accelerators, without training capabilities. Forward gradients, solely based on directional derivatives computed from two forward calls, have been recently used for model training, with substantial savings in computation and memory. However, the performance of quantized training with fixed-point forward gradients remains unclear. In this paper, we investigate the feasibility of ondevice training using fixed-point forward gradients, by conducting comprehensive experiments across a variety of deep learning benchmark tasks in both vision and audio domains. We propose a series of algorithm enhancements that further reduce the memory footprint, and the accuracy gap compared to backpropagation. An empirical study on how training with forward gradients navigates in the loss landscape is further explored. Our results demonstrate that on the last mile of model customization on edge devices, training with fixed-point forward gradients is a feasible and practical approach.

1 Introduction

On-device training allows pre-trained models to be continuously adapted to newly collected personal data after deployment. Moving model training from the cloud to local devices is essential for model customization and protecting users' privacy (Moon et al. [2024]). However, the constraint on power and memory makes training on edge devices extremely challenging (Dhar et al. [2019]). Traditional backpropagation involves a forward step, which computes activations given an input, and a backward step which computes the gradients. Intermediate activation values must be stored in memory prior to

RandomPerturbationVector(z)

Input x

Model

Forward exec.1

QuantizedWeights

m

Loss 1

QuantizedForward

Perturbation (e)

Quantized

GradientsCalculation

Weights

Forward exec.2

Loss 2

learningrate

QuantizedWeightsUpdate

the gradient of a certain layer is computed (Baldi and Sadowski [2016]). As models increase in size and depth, this process requires a prohibitive amount of memory for most existing edge devices.

To avoid large memory consumption, recent studies have re-examined the procedure of computing Forward Gradients as an alternative to standard backpropagation (Fournier et al. [2023]). As introduced by Baydin et al. [2022], a forward gradient, computed through a random, isotropic directional derivative, is an unbiased approximation of a weight gradient. Forward gradients can be further estimated solely with two forward calls of a neural network (Liu et al. [2020]), which saves computation and memory substantially. The work of MeZO (Malladi et al. [2023]) applies forward gradients on fine-tuning Large Lanugage Models (LLMs), and shows a success on diverse downstream tasks, with the same memory footprint as inference.

Despite the aforementioned benefits, forward gradients may encounter the curse of dimensionality as the size of trainable parameters increases. Gradient approaximations from two forward calls may be noisy and with large variance (Ren et al. [2023]), resulting in less effective training of large networks. Moreover, most existing low power neural processing engines (e.g., NPUs, DSPs, MCUs, etc.) are designed as efficient fixed-point inference accelerators. The feasibility of utilizing fixed-point forward gradients for quantized training remains uncertain. Our goal is to gain deeper insights into whether training with fixed-point forward gradients can still result in competitive models while preserving the memory and computation benefits. To answer the question, we conduct comprehensive experiments across a variety of deep learning benchmark tasks in both vision and audio domains. A series of algorithm enhancements are proposed to further reduce the memory footprint, and accuracy gap compared to backpropagation. We believe our study to be of high interest in making model personalization happen locally on edge devices.

Contributions. (a) We formulate the computation of forward gradients in the quantized space. Weight perturbations and gradient calculations are all in fixed-point precision during model training or adaptation (see Figure 1 and Section 3). (b) We demonstrate the feasibility of on-device training with fixed-point forward gradients, through comprehensive experiments across a variety of deep learning benchmark tasks in both vision and audio domains. Although the method is model architecture agnostic, the experiments cover most typical model types (e.g., CNN, RNN, ViT-based) and parameter sizes ( 100 K to 80 M). (c) We propose a series of algorithm enhancements that further reduce the memory footprint and accuracy gap compared to backpropagation, leading to a practical solution for model adaptation on edge devices. (d) Finally, we visualize the neural loss landscape and trajectories of training with forward gradients, and show its dynamics and characteristics.

2 Related Work

2.1 Memory Efficient Training through Backpropagation

With an increasing number of applications using large neural networks on device, there is a demand of moving model training from the cloud to local devices. However, the key bottleneck for efficient ondevice training is the limitation of memory resources. For example, training a simple Convolutional Recurrent model (CRNN, Keren and Schuller [2017]) with a parameter size of 250 kB, requires 11 . 5 MB( 46 × ) memory to store activations. Training memory is primarily attributed to activations

rather than parameters. Studies on algorithms to reduce resource consumption during training have been published, with a trade-off between memory usage and model accuracy. Parameter-efficient fine-tuning techniques such as LoRA (Hu et al. [2021]) and prefix tuning (Li and Liang [2021]) are proposed to train a model with reduced parameters. Dynamic sparse representation (Mostafa and Wang [2019]) is proposed to reduce memory requirements by making the weight and activation values sparse during training. Low precision training (Micikevicius et al. [2018]) reduces model sizes and computation requirements by adopting 16 -bit float precision instead of 32 -bit. The work of Lin et al. [2022] pushes conventional convolutional neural network training on devices with only 256 kB by pruning the training graph during compilation time. These methods mainly focus on reducing the trainable parameters or activation sizes, thus reduce the peak memory required for training a neural network. However, due to the inherent nature of backpropagation, intermediate activations across all layers must be retained until loss is backpropagated and gradients are calculated. Therefore, as models increase in size and depth, parameter-efficient techniques do not fundamentally resolve the training memory problem.

2.2 Forward Gradients through Zeroth-order Optimization

Forward gradient has been recently brought to attention by Baydin et al. [2022] and Silver et al. [2022], which showed that gradients can be computed solely based on the directional derivatives using the forward mode of auto-differentiation only. The forward gradients can be estimated via two forward calls using zeroth-order optimization (Liu et al. [2020]) by incorporating random perturbations on weights, entirely eliminating the need for backpropagation in gradient descent. The work of Ren et al. [2023] shows that it is possible to substantially reduce the variance of the forward gradient estimation by applying perturbations to activations rather than weights. Considering the memory required for storage of intermediate activations, only weight-perturbed forward gradient estimator can be deployed on low resource constrained devices. While research by Belouze [2022] claimed shortcomings of forward gradients in high dimensions, the work of MeZO (Malladi et al. [2023]) proposes a contradictory perspective by showing the lower bounds of such zeroth-order optimization is conditioned on loss landscape instead of number of trainable parameters. MeZO further applies forward gradients on fine-tuning LLMs, and shows a success on diverse downstream tasks.

2.3 Quantized Training and Quantized Gradients

There is limited literature on gradient computation in the quantized space. Quantization-aware training (QAT Nagel et al. [2021]) has been widely used to simulate the potential quantization loss in the training stage. However, most existing low power neural processors (e.g., NPUs, DSPs, MCUs, etc.) are designed and optimized for fixed-point inference. Direct training in the quantized space will fundamentally bridge the gap between training and inference, thus being essential for model adaptation on edge devices. However, the work of Lin et al. [2022] observed that the quantization process distorts backward gradients, resulting in significantly lower accuracy in model training through backpropagation. Quantization-aware scaling (QAS) is proposed to address this problem. It remains uncertain whether training with quantized forward gradients through zeroth-order optimization can still lead to competitive models on device, while preserving the memory and computation benefits.

3 Quantized Forward Gradient Learning

Forward gradients utilize directional derivatives to bypass backpropagation, while retaining unbiased estimations of true gradients. In the following, we first review the technique of forward-mode autodifferentiation (AD Baydin et al. [2022]), alongside a practical implementation known as Simultaneous Perturbation Stochastic Approximation (SPSA) for zeroth-order gradient estimation (Spall [1992]). We then propose sign-m-SPSA, a variant of SPSA to alleviate the noisy component of forward gradients estimated by SPSA, which leads to stable performance in many use cases. Once the gradients are estimated, optimizers such as SGD, Adam etc. can be applied to update the weights. Finally, we formulate the Quantized Zeroth-order Forward Gradient (QZO-FF) estimator, mapping the processes of weights perturbation, gradients estimation and weights update in the fixed-point space. An overview of the QZO-FF algorithm is illustrated in Algorithm 1.

3.1 Forward Gradients

Definition 1 (Forward Gradients). Consider a machine learning function f ( w ) : R n → R , where w ∈ R n is the trainable parameters that the gradients are evaluated. Forward gradients g : R n → R n is defined as:

where z ∈ R n is a perturbation vector taken as multivariate random variable z ∼ p ( z ) such that z ′ s scalar components z i are independent and have zero-mean and unit variance for all i . ∇ f ( w ) · z ∈ R , the Jacobian matrix-vector product, defines the directional derivative of f at point w in direction z .

3.2 Zeroth-order Optimization

In order to have runtime advantage over backpropagation, a classical zeroth-order estimator, SPSA can be used to estimate the forward gradients by evaluating f in forward path m times, where m ≪ n .

Definition 2 (SPSA). Given a model f with parameters w ∈ R n and a loss function L ( w ) , SPSA estimates the gradient as:

where z ∼ N (0 , I n ) is a weighted vector over all parameter dimensions, randomly sampled from normal distribution with zero-mean and standard deviation. The perturbation scale ϵ is a small constant value (e.g., 1 e -3 ). For each sampled z , SPSA only requires two forward calls through the model, with positive and negative perturbed weights respectively, to estimate the gradients.

Gradient maganitude defined in (2) is determined by loss difference of two forward calls based on a random perturbation applied on weights, which easily becomes noisy. Inspired by many popular optimizers, such as sign-SGD and RMSProp (Bernstein et al. [2018]), updating weights through a sign-based method achieves good practical performance for many gradient compression use cases. In order to mitigate the noisy component of forward gradients estimated by SPSA, we propose sign-m-SPSA by only taking the direction of loss difference under a certain perturbation, while disregarding the magnitude component. The estimation can be improved by averaging ˆ g ( w ) over m randomly sampled z ( m ≪ n ), with an increased number of training iterations.

Definition 3 (Sign-m-SPSA).

The intuition behind sign-m-SPSA is that during the training, the estimator samples a random perturbation direction z i , i ∈ { 1 , .., m } , and tests how it aligns with the true gradient by examining the loss change, and then multiplies the alignment direction with the perturbation direction. Weights will be updated along the sampled direction that leads to a decrease in loss. This design is also quantization-friendly, constraining the range of gradient values to be the same as perturbation for static quantization. Our later experiments show that 8 -bit quantization of perturbation and forward gradient is sufficient for preserving the model accuracy across many use cases.

Definition 4 (Sign-m-SPSA-SGD). With ˆ g ( w ) as the forward gradients estimated through sign-mSPSA, similar to backpropagation, an optimizer such as SGD with learning rate η can be used to update model parameters:

3.3 Quantized Weights Perturbation and Forward Gradients

Sign-m-SPSA in (3) estimates forward gradients through a minimum of two forward calls, with positive and negative perturbed weights in float precision, respectively. For low power devices with fixed-point computation engines, model weights are quantized in low bit precision. Therefore, the random perturbation needs to be quantized prior to apply on weights.

For a given model, consider w as the floating point weights of a certain layer. Assume model is per-tensor quantized with symmetric quantization in b -bit, the quantized weights can be represented by:

where ∆ w , denoted as the quantization scaling factor, is calculated by ∆ w = w max / (2 b -1 -1) , where w max is the maximum absolute value in w found by a quantization method (i.e., TF, MSE, AdaRound, etc., Nagel et al. [2021]). ⌊·⌉ represents for the rounding operation.

Quantized Perturbation. With the given quantization method in 5, the quantized weights perturbation can be defined and calculated as:

Since weights w and perturbation z have different quantization scaling factors and possibly different bit-width used, we quantize 1 . 0 with the scaling factor of z , and quantize ϵ with the scaling factor of w , prior to direct adding the quantized values in accumulator. 1 q = ⌊ 1 . 0 ∆ z ⌉ , represents for the quantized value of floating point 1 . 0 with ∆ z as its scaling factor. Similarly, ϵ q = ⌊ ϵ ∆ w ⌉ , represents for the quantized value of ϵ with ∆ w as its scaling factor.

The random perturbation vector z is sampled from normal distribution with zero-mean and standard deviation N (0 , I n ) , we can use static quantization with a pre-determined z max to pre-calculate ∆ z . For example, in the case of z max = 3 . 5 , with 8 -bit symmetric quantization, ∆ z = 0 . 0276 , and 1 q = 36 . Similarly, ϵ q can be pre-calculated, if a pre-trained model with w max is given. It is noted that ϵ is a very small value (e.g., 1 e -3 ). Therefore, we require 16 -bit to be used for weight quantization, such that ϵ can be properly represented by the minimum representation power of ∆ w without clipping loss, and small perturbation can be reflected on the weights change in the quantized space.

In (6), two values with 16 -bit and 8 -bit are multiplied, and then fed to a quantized add/subtract operation. In hardware, a 32 -bit accumulator is used to hold the result. The result is then re-quantized to 16 -bit by a multiply and a shift operation through a post-processing block (Appendix A), using the original weight scaling factor ∆ w . The quantized perturbed weights are denoted as (∆ w , w q + ) and (∆ w , w q -) . The above formulation is derived under per-tensor quantization, however, per-channel quantization can be similarly derived with finer granularity.

Quantized Forward Gradients. Based on the quantization method in (5), quantized forward gradients, estimated from sign-m-SPSA, can be calculated as:

where g q represents for the quantized gradients, and it is using the same quantization scaling factor and bit-width as perturbation vector z .

Quantized Weights Update. We can further quantize the learning rate η to a quantized value of 1 , using quantization scaling factor of ∆ η = η . Finally, quantized weights update can be computed by:

where ¯ w q represents for the change of weights in the quantized space, with ∆ w as the re-quantized scaling factor (Appendix A). ∆ η can be pre-calculated. In our experiments, we find that it is important to keep weights in 16 -bit, while the perturbation z and gradient g can be in 8 -bit representations.

3.4 QZO-FF enhancement

Momentum Guided Sampling. Besides naive SGD, quantized forward gradient learning can also be combined with other optimizers such as Adam or SGD with momentum, with slight overhead to

Algorithm 1 QZO-FF: Quantized Zero-order Forward Gradient Learning(quantized, fp16)

Require: quantized model parameters w q ∈ I n , loss L : I n → R , perturbation scale ϵ , training steps T , batch size B , learning rate schedule { η t }

1: · Given a pre-defined z max of perturbation z , calculate ∆ z = z max / (2 b -1 -1) with b -bit.

Quantize 1 . 0 to 1 q with ∆ z .

Get the quantization scaling factor, ∆ w i , of quantized weights of each layer.

store the gradient history. Similarly, by allocating additional memory to store the perturbation history, momentum can be used to guide the sampling process. Instead of sampling solely from a zero-centered Gaussian distribution, perturbations are computed from a combination of a momentum-centered and a zero-centered Gaussian distribution. Mathematically, z 1 ∼ N (0 , I n ∗ √ α ) , z 2 ∼ N ( z t , I n ∗ √ 1 -α ) , and z t +1 = β ∗ z 1 +(1 -β ) ∗ z 2 . Here, β is a smoothing parameter; α and β can be adaptively adjusted during training. For example, during the initial training stage, random perturbations are applied with β = 1 . As training progresses, a history of the momentum z t is incorporated to guide the new sampling process.

Sharpness-aware Perturbation. Motivated by the connection between sharpness of the loss landscape and model generalization, we can perturb parameter values from its neighborhood location. This is done by performing an additional step of directional gradient ascent through parameter perturbation and loss evaluation, prior to QZO-FF, as illustrated in Figure 2. This process helps to prevent the model from converging to a sharp minimum.

Sparse Update. To further reduce memory consumption, the forward gradient learning can be combined with a sparsity algorithm such that only a subset of the weights are selected from the network for updating. Examples of sparsity algorithm may include pruning by topk magnitude, randomized pruning, pruning values beyond a specified threshold, to determine the importance of the weights. Our experiments show that incorporating sparsity with forward gradient learning allows for a 90% reduction in the size of trainable parameters, with only minor decrease in accuracy, as well as slight improvement in convergence speed.

Kernel-wise Normalization. In (3), forward gradients are estimated through sign-m-SPSA. In addition, we can also apply a kernel-wise normalization to scale the gradient adaptively. z is normalized by the norm of w in each layer.

4 Experiments

4.1 Few-shot learning

We first apply forward gradient learning in the setting of few-shot learning, targeting to adapt a base-learner to a new task for which only a few labeled samples are available. Experiments across a variety of challenging few-shot learning benchmarks in both vision and audio domains are explored. Models are trained for each dataset individually and then evaluated with the corresponding test split.

To address whether forward gradient learning (FF) could match the performance of backpropagation (BP), we explore classification tasks on training models with full fine-tuning (FT) and linear probing (LP), utilizing float16 (fp16) precision. Training accuracy with quantized FF (16-bit weights and 8-bit activations, 16w8a) is also evaluated and compared with that of fp16 precision. Details and analysis on memory usage during training are reported in Appendix B - E.

Vision Benchmark. Image classification models are compared across commonly used 5 few-shot learning benchmark datasets (Table 1). Training methods are evaluated on 3 network backbones (modified Resnet12 Ye et al. [2020], Resnet18 He et al. [2015] and ViT tiny Dosovitskiy et al. [2020]), with ProtoNets Snell et al. [2017] as few-shot classifier.

Table 2 demonstrates the classification accuracy on vision benchmarks. We first show that FF significantly improves over zero-shot performance across model types and tasks. Given that FF solely utilizes directional derivatives for gradient estimation, it is expected that BP generally outperforms FF in most tasks. The accuracy gap between BP and FF can vary based on factors such as backbone architecture, dataset and task difficulty. The largest accuracy degradation is observed when training Resnet12 on Cifar-100 dataset with an input resolution of 32 × 32 . However, using a stronger backbone such as ViT, can help bridge this accuracy gap. This indicates that while FF may show some degradation with smaller architectures and low-resolution inputs, performance improvements can be achieved with more advanced models. Overall, FF achieves comparable performance (accuracy within 5% ) to BP in 26 out of 30 comparable experiments. A minimal accuracy drop is observed in quantized FF training, when a strong backbone such as ViT tiny is used. These promising results

indicate that FF can perform comparably to BP with only a slight degradation in accuracy, while significantly reducing the memory cost (see analysis in Appendix B.1). With the same memory footprint as inference, model training with FF is feasible on low memory devices where BP cannot be afforded.

Audio Benchmark. Two audio benchmark datasets (ESC-50 and FSDKaggle18) are selected (Table 3) for sound classification use cases using few-shot learning. Similar to vision, training methods are evaluated on 2 representative architectures CRNN (Heggan et al. [2022]) and Audio Spectrogram Transformer (AST Gong et al. [2021]), with SimpleShot (Wang et al. [2019]) and ProtoNets (Snell et al. [2017]) as few-shot classifiers.

Table 4 reports classification accuracy on audio benchmarks. Compared to vision tasks, the accuracy gap is larger, ranging from -11 . 39% to +11 . 66% . This may be due to the extremely challenging training setting of 5 -way 1 -shot, where only 1 example of each class is seen in each task. Additionally, we found that the pretrained model from AudioSet (AST) does not produce a good zero-shot performance across all tasks. This indicates that a good initial baseline is critical for model adaptation. Overall, FF achieves comparable (accuracy within 5% ) or better performance to BP on 11 out of 16 tasks. Training with quantized FF (16w8a) maintains similar accuracy level as fp16. From memory analysis in Appendix B.2, training an AST model with quantized forward gradients combined with sparse update, requires only 0 . 19 MBscratch memory, which fits into most existing edge devices.

4.2 Cross-domain Adaptation

We further conduct experiments on model adaptation to cross-domain datasets, in which a models is fine-tuned on tasks with data distribution significantly different from those of the pre-trained model. For ablation studies on various impacts on the training accuracy, we take ViT tiny ( 5 . 5 Mparameters) as backbone for feature extractor, and apply a randomly initialized linear layer as the decoder for binary classifier. The model is pretrained on ImageNet-1k through DeiT (Touvron et al. [2021]), and adapted for Visual Wake Word (VWW) task (Chowdhery et al. [2019]) through linear probing (LP), where only the decoder layer is fine-tuned, and visual-prompt tuning with deep prompts (D-VPT, Jia et al. [2022]), where prompts in each Encoder layer are also fine-tuned. Testing accuracy is reported in Figure 2, and detailed training hyper-parameters are listed in Appendix C.

Effectiveness of Quantized FF. With LP, quantized forward gradient learning is capable of training the model to an accuracy of 87 . 30% from 48 . 50% , with an accuracy gap of 0 . 63% compared to BP in fp16.

Gradient averaging in FF. A larger m , used to average forward gradients, helps to smooth the noisy estimation and increases the model accuracy. With D-VPT training in fp16, simply increasing m to 3

Classification mean accuracy and standard deviation(%)

(ViT Tiny, VWW)

48.50

87.26(±0.11)

87.93 (±0.05)

87.47(±0.06)

LP

87.30(±023)

87.50 (±0.16)

87.47(±0.20)

48.65

87.09(±0.12)

87.47 (±0.08)

SA

t+1

48.48

92.75 (±0.20)

87.58(±0.26)

88.80(±0.33)

D-VPT

87.37(±0.57)

88.98 (±0.41)

47.02

87.26

88.10(±0.61)

88.41 (±0.19)

(±0.38)

0

20

40

60

80

100

zero shot

BP, fp16

FF, fp16, m=1

FF, fp16, m=3

(b)Schematicofsharpness-aware update.weightsperturbationat neighborhoodposition.

FF, fp16, m=3, FF-enhancement

FF, quant, m=1

FF, quant, m=3

FF, quant, m=3, Binomial

(a).Adaptationaccuracy(quant:16w8a,unlessspecified).

boosts the accuracy by 1 . 22% . However, there is a trade-off between model accuracy and training efficiency.

Quantization bit-width. Experiments show that 8 -bit weights quantization (8w8a) does not lead to model convergence. Therefore, 16 -bit weights quantization is necessary to capture the small perturbation, while the perturbation z and gradients can use 8-bit.

Perturbation sampling. The random perturbation z in Equation (2) is sampled from a normal distribution with zero-mean and standard deviation N (0 , I n ) . Other distibutions, such as Binomial distribution, also works well for forward gradient learning.

QZO-FF enhancement. FF can be extended with sharpness-aware scheme, where a perturbation is performed at a neighborhood location through an extra step of gradient ascent. Together with kernel-wise normalization, this technique results in the closest performance to BP in both training methods. Although obtaining the norm of weights involves a trade-off between computation and accuracy, efficient implementations using gemm and sqrt operations can minimize the overhead on hardware.

Loss landscape. It is believed that the convergence and generalization property of perturbation-based learning, such as forward gradient learning, depends on the loss landscape instead of number of parameters. Visualization of loss landscape has the potential to help us answer several important questions about how a neural network is trained, and why do the resulting minima generalize under certain training approach. Utilizing the tool provided in Li et al. [2018], we show the 2D contours of loss landscape of ViT tiny network under the task of cross-domain adaptation, together with the loss trajectory during training, providing an empirical characterization of neural loss functions, and exploring how training with forward gradients navigates in the loss landscape (See Appendix E).

4.3 In-domain OOD Adaptation

On-device model adaptation often involves fine-tuning on data that is out-of-distribution (OOD). To evaluate the performance of FF, we pretrain a ViT tiny backbone on Cifar10, and fine-tune the decoder on Cifar10-C (Hendrycks and Dietterich [2019]), where 15 types of corruptions, such as Gaussian noise or pixelation, of varying severity are applied. We take the lowest (easy), middle (medium), and highest (hard) corruption severity from the dataset as separate benchmarks for fine-tuning. Finetuning techniques include LP with 1 linear decoder layer, LP with 3 linear decoder layers, and D-VPT (Jia et al. [2022]). Additionally, we explore the impact of sparsity by pruning 90% of the trainable parameters using a zero-order method (Chen et al. [2024]). Table 5 shows a comparison of accuracy on the test set between BP, FF, quantized FF and Sparsed FF, alongside different fine-tuning methods. Detailed training hyper-parameters are listed in Appendix D.

As the number of trainable parameters increases, forward gradient learning improves the model accuracy on OOD dataset. Even with a sparsity level of 90% , FF can still achieve comparable accuracy levels to those of BP. The largest accuracy disparity between the two is 6 . 98% , observed on the Cifar10-C (hard) category using the LP method for 3 decoder layers. As corruption intensifies,

the loss surface becomes less smooth, potentially causing FF to be impacted more from the noisy gradient estimation.

5 Conclusion

Continuously updating pre-trained models to local data on the edge is the last mile for model adaptation and customization. To overcome the memory limitation of most existing low power devices, forward gradients are used for model adaptation. We have formulated the forward gradient learning in the quantized space, where weight perturbations and gradient calculations are all in fixed-point during model training. To investigate the feasibility of on-device training with fixed-point forward gradients, we have extensively conducted experiments across a variety of deep learning benchmark tasks in both vision and audio domains. Model adaptation to cross-domain dataset and in-domain OOD datasets are further evaluated and analyzed.We further explore 2D contours of loss landscape, together with loss trajectory during training, providing an empirical explanation on how the model is trained. We have shown that quantized forward gradient learning with 16w8a can effectively adapt most typical model architectures (e.g., Resnet, ViT-tiny, CRNN, AST) and scales. With minimum accuracy reduction, fixed-point forward gradients allows model adaptation using the same memory footprint and operation support as inference, as opposed to backpropagation. Therefore, it has the potential to enable model fine-tuning on existing edge devices with limited memory and backpropagation support, without requiring additional hardware adaptation.

References

AST. Pretrained ast checkpoint. URL ❤/a116/a116♣/a115✿✴✴❣✐/a116❤✉❜✳❝♦♠✴❨✉❛♥●♦♥❣◆❉✴❛/a115/a116✴/a116/a114❡❡✴ ♠❛/a115/a116❡/a114 .

P. Baldi and P.J. Sadowski. A theory of local learning, the learning channel, and the optimality of backpropagation. 83:51-74, 2016. doi: 10.1016/j.neunet.2016.07.006.

A. G. Baydin, B. A. Pearlmutter, D. Syme, F. Wood, and P Torr. Gradients without backpropagation. 2022. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴✷✷✵✷✳✵✽✺✽✼ .

G. Belouze. Optimization without backpropagation. 2022. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴ ✷✷✵✾✳✵✻✸✵✷ .

J. Bernstein, Y. Wang, K. Azizzadenesheli, and A. Anandkumar. Signsgd: Compressed optimisation for non-convex problems. Proceedings of the 35th International Conference on Machine Learning , 2018. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴✶✽✵✷✳✵✹✹✸✹ .

L. Bertinetto, J.F. Henriques, P.H.S. Torr, and A. Vedaldi. Meta-learning with differentiable closed-form solvers. ICLR , 2019. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴✶✽✵✺✳✵✽✶✸✻ .

A. Chen, Y. Zhang, J. Jia, J. Diffenderfer, J. Liu, K. Parasyris, Y . Zhang, Z. Zhang, B. Kailkhura, and S. Liu. Deepzero: Scaling up zeroth-order optimization for deep model training. ICLR , 2024. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴✷✸✶✵✳✵✷✵✷✺ .

A. Chowdhery, P. Warden, J. Shlens, A. Howard, and R. Rhodes. Visual wake words dataset. 2019. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴✶✾✵✻✳✵✺✼✷✶ .

S. Dhar, J. Guo, J. Liu, S. Tripathi, U. Kurup, and M. Shah. On-device machine learning: An algorithms and learning theory perspective. 2019. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴✶✾✶✶✳ ✵✵✻✷✸✈✶ .

A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly, J. Uszkoreit, and N. Houlsby. An image is worth 16 × 16 words: Transformers for image recognition at scale. CVPR , 2020. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴ ❛❜/a115✴✷✵✶✵✳✶✶✾✷✾ .

E. Fonseca, M. Plakal, D. P. W. Ellis, F. Font, X. Favory, and X. Serra. Learning sound event classifiers from web audio with noisy labels. ICASSP , 2019. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴❛❜/a115✴ ✶✾✵✶✳✵✶✶✽✾ .

L. Fournier, S. Rivaud, E. Belilovsky, M. Eickenberg, and E. Oyallon. Can forward gradient match backpropagation? Proceedings of the 40 th International Conference on Machine Learning , 2023. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴✷✸✵✻✳✵✻✾✻✽ .

Y. Gong, Y. Chung, and J. Glass. Ast: Audio spectrogram transformer. Interspeech 2021 , 2021. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴❛❜/a115✴✷✶✵✹✳✵✶✼✼✽ .

K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In CVPR , 2015. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴❛❜/a115✴✶✺✶✷✳✵✸✸✽✺ .

C. Heggan, S. Budgett, T. Hospedales, and M. Yaghoobi. Metaaudio: A few-shot audio classification benchmark. ICANN , 2022. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴✷✷✵✹✳✵✷✶✷✶ .

D Hendrycks and T. Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. Proceedings of the International Conference on Learning Representations , 2019.

E.J. Hu, Y. Shen, P. Wallis, Z. Allen-Zhu, Y . Li, S. Wang, L. Wang, and W. Chen. Lora: Low-rank adaptation of large language models. 2021. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴✷✶✵✻✳✵✾✻✽✺ .

M. Jia, L. Tang, B. Chen, C. Cardie, S. Belongie, B. Hariharan, and S. Lim. Visual prompt tuning. In European Conference on Computer Vision (ECCV) , 2022.

G. Keren and B. Schuller. Convolutional rnn: an enhanced model for extracting features from sequential data. 2017. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴✶✻✵✷✳✵✺✽✼✺ .

B. M. Lake, R. Salakhutdinov, and J. B. Tenenbaum. Human-level concept learning through probabilistic program induction. Science , pages 1332-1338, 2015. URL ❤/a116/a116♣/a115✿✴✴❞♦✐✳♦/a114❣✴ ✶✵✳✷✷✵✵✷✴❉✶✳✷✵✵✾✽ .

H. Li, Z. Xu, G. Taylor, C. Studer, and T. Goldstein. Visualizing the loss landscape of neural nets. NeurIPS , 2018. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴✶✼✶✷✳✵✾✾✶✸ .

X. L. Li and P. Liang. Prefix-tuning: Optimizing continuous prompts for generation. 2021. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴✷✶✵✶✳✵✵✶✾✵ .

J. Lin, J. Zhu, W. Chen, W. Wang, C. Gan, and S. Han. On-device training under 256kb memory. NeurIPS , 2022. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴✷✷✵✻✳✶✺✹✼✷ .

S. Liu, P. Chen, B. Kailkhura, G. Zhang, A. Hero, and P.K. Varshney. A primer on zeroth-order optimization in signal processing and machine learning. IEEE Signal Processing Magazine , 2020. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴✷✵✵✻✳✵✻✷✷✹ .

S. Malladi, T. Gao, E. Nichani, A. Damian, J.D. Lee, D. Chen, and S. Arora. Fine-tuning language models with just forward passes. NeurIPS , 2023. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴ ✷✸✵✺✳✶✼✸✸✸ .

P. Micikevicius, S. Narang, J. Alben, G. Diamos, E. Elsen, D. Garcia, B. Ginsburg, M. Houston, O. Kuchaiev, G. Venkatesh, and H. Wu. Mixed precision training. ICLR , 2018. URL ❤/a116/a116♣/a115✿ ✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴✶✼✶✵✳✵✸✼✹✵ .

J. J. Moon, H.S. Lee, J. Chu, D. Park, S. Hong, H. Seo, D. Jeong, S. Kong, and M. Ham. A new frontier of ai: On-device ai training and personalization. ICSE , 2024. URL ❤/a116/a116♣/a115✿ ✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴✷✷✵✻✳✵✹✻✽✽ .

H. Mostafa and X. Wang. Parameter efficient training of deep convolutional neural networks by dynamic sparse reparameterization. Proceedings of the 36th International Conference on Machine Learning , 2019. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴✶✾✵✷✳✵✺✾✻✼ .

M. Nagel, M. Fournarakis, R.A. Amjad, Y. Bondarenko, M.V. Baalen, and T. Blankevoort. A white paper on neural network quantization. CVPR , 2021. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴ ✷✶✵✻✳✵✽✷✾✺ .

K. J. Piczak. Dataset for environmental sound classification. Proceedings of the 23rd ACM international conference on Multimedia , 2015. URL ❤/a116/a116♣/a115✿✴✴❞❧✳❛❝♠✳♦/a114❣✴❞♦✐✴♣❞❢✴✶✵✳ ✶✶✹✺✴✷✼✸✸✸✼✸✳✷✽✵✻✸✾✵ .

M. Ren, E. Triantafillou, S. Ravi, J. Snell, K. Swersky, J. B. Tenenbaum, H. Larochelle, and R.S. Zemel. Meta-learning for semi-supervised few-shot classification. ICLR , 2018. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴❛❜/a115✴✶✽✵✸✳✵✵✻✼✻ .

M. Ren, S. Kornblith, R. Liao, and G. Hinton. Scaling forward gradient with local losses. ICLR , 2023. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴♣❞❢✴✷✷✶✵✳✵✸✸✶✵ .

resnet12. Pretrained resnet12 checkpoint download. URL ❤/a116/a116♣/a115✿✴✴❞/a114✐✈❡✳❣♦♦❣❧❡✳❝♦♠✴ ❢✐❧❡✴❞✴✶▼✾✸❥❞❖❥❆♥✽■✐❤■❈/a80❑❏❣✽▼❜✹❇✲❡❨❉❙❩❢❊✴✈✐❡✇ .

resnet18. Pretrained resnet18 checkpoint download. URL ❤/a116/a116♣/a115✿✴✴❞♦✇♥❧♦❛❞✳♣②/a116♦/a114❝❤✳ ♦/a114❣✴♠♦❞❡❧/a115✴/a114❡/a115♥❡/a116✶✽✲❢✸✼✵✼✷❢❞✳♣/a116❤ .

D. Silver, A. Goyal, I. Danihelka, M. Hessel, and H.V. Hasselt. Learning by directional gradient descent. ICLR , 2022. URL ❤/a116/a116♣/a115✿✴✴♦♣❡♥/a114❡✈✐❡✇✳♥❡/a116✴♣❞❢❄✐❞❂✺✐✼❧❏▲✉❤❚♠ .

J. Snell, K. Swersky, and R. Zemel. Prototypical networks for few-shot learning. In Advances in Neural Information Processing Systems , 2017.

J.C. Spall. Multivariate stochastic approximation using a simultaneous perturbation gradient approximation. IEEE Transactions on Automatic Control , pages 332-341, 1992.

ViT tiny. Pretrained vit tiny checkpoint download. URL ❤/a116/a116♣/a115✿✴✴❞❧✳❢❜❛✐♣✉❜❧✐❝❢✐❧❡/a115✳ ❝♦♠✴❞❡✐/a116✴❞❡✐/a116❴/a116✐♥②❴♣❛/a116❝❤✶✻❴✷✷✹✲❛✶✸✶✶❜❝❢✳♣/a116❤ .

H. Touvron, M. Cord, M. Douze, F. Massa, A. Sablayrolles, and H. Jegou. Training data-efficient image transformers & distillation through attention. In International Conference on Machine Learning , volume 139, pages 10347-10357, July 2021.

O. Vinyals, C. Blundell, T. Lillicrap, K. Kavukcuoglu, and D. Wierstra. Matching networks for one shot learning. 2016. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴❛❜/a115✴✶✻✵✻✳✵✹✵✽✵ .

C. Wah, S. Branson, P. Welinder, P. Perona, and S. Belongie. Caltech-ucsd birds dataset. 2022. URL ❤/a116/a116♣/a115✿✴✴❞♦✐✳♦/a114❣✴✶✵✳✷✷✵✵✷✴❉✶✳✷✵✵✾✽ .

Y. Wang, W. Chao, K. Q. Weinberger, and L. Maaten. Simpleshot: Revisiting nearest-neighbor classification for few-shot learning. CVPR , 2019. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴❛❜/a115✴✶✾✶✶✳ ✵✹✻✷✸ .

H. Ye, H. Hu, D. Zhan, and F. Sha. Few-shot learning via embedding adaptation with set-to-set functions. CVPR , 2020. URL ❤/a116/a116♣/a115✿✴✴❛/a114①✐✈✳♦/a114❣✴❛❜/a115✴✶✽✶✷✳✵✸✻✻✹ .

A Fixed-point re-quantization

The process of quantized perturbation (Equation 6) and gradient calculation (Equation 8) involves a re-quantization process. In fixed-point engines, this is approximated by a multiply and a shift operation through a post-processing block.

where m and k are integer numbers, and 2 k ≈ ∆ z

B Few-shot learning experiments

In our experiments, the number of forward-forward calls performed ( m ) for averaging gradients is 3 unless specified. All our experiments are running on single Nvidia Tesla V100 GPU. It is noted that our experiments do not aim to beat the benchmark state-of-the-art (SOTA) performance, but to compare the performance gap between forward and backward gradient learning across datasets and tasks. Due to the limited tuning performed, it is possible to obtain a specific result marginally better than those presented. However, this does not undermine the comparision investigated in this work.

B.1 Vision Tasks

In vision benchmark, five common few-shot learning datasets are explored: CUB ([41]), Omniglot ([20]), Cifar100_fs ([6]), miniImageNet ([40]) and tieredImageNet ([31]). Each dataset is split into three parts based on different non-overlapping sets of classes, for model training, validation, and testing. All recognition tasks across datasets are using 5 -way 5 -shot setting.

Table 6: The hyper-parameters used in our few-shot learning experiments for vision tasks. For fair comparisons, FF and BP are using the same hyper-parameters. Model architectures of Resnet18, modified Resnet12 and ViT tiny are based on [14], [43], and [39]. Pre-trained models used for zero-shot evaluation can be found at [33], [34] and [38]. Different learning rate grids are explored, and the best accuracy is reported.

Total Memory Usage (M)

100.00

79.75

80.00

54.91

60.00

47.69

50.24

43.00

44.93

40.00

20.00

22.79

11.81

/11.8011.76

25.35

22.58

22.47

25.40

25.13

0.00

Resnet18

BP, FT, fp16

FF, FT, fp16

BP, LP, fp16

FF, LP, fp16

FF,LP,Quant

Scratch Memory Usage (M)

60.00

54.90

50.00

40.00

30.00

31.64

25.34

25.39

30.06

/22.58

20.00

11.43

10.00

0.450.440.40

2.990.230.12

0.550.28

0.00

Resnet18

BP,FT,fp16

FF, FT, fp16

BP, LP, fp16

FF, LP, fp16

FF,LP, Quant

Figure 3 shows the memory usage of BP and FF during the training. The total memory usage during training is composed of two parts, a scratch buffer used for input and output activation tensors for

gradient calculation and storage, and allocated memory for weights storage. Without storing the activation tensors, forward gradient learning has a significant reduction on the scratch memory usage. For example, in the case of full fine-tuning on ViT Tiny network, under the same precision of fp16, FF reduces the scratch memory from 31 . 64 MBto 11 . 43 MB( 2 . 8 × ). When sparse update and fixed-point training are enabled, only 0 . 40 MBof scratch memory is needed for model fine-tuning.

The extent of memory saving with FF depends on the number of layers being fine-tuned, and their positions within the network. When applied to methods such as full fine-tuning, LoRA ([17]) and other parameter-efficient fine-tuning approaches, FF shows significant memory reduction because it eliminates the need to store intermediate activations. In the case of LP, where only the last few layers are updated, the difference of memory usage between BP and FF will get smaller. As the number of trainable layers increases, FF benefits more in memory savings. These promising results indicate that FF can perform comparably to BP with only a slight degradation in accuracy, while significantly reducing the memory cost. With the same memory footprint as inference, model training with FF is feasible on low memory devices where BP cannot be afforded.

B.2 Audio Tasks

In audio use cases, two few-shot audio classification benchmark datasets are selected: ESC-50 ([30]) and FSDKaggle18 ([11]). Prior to adaptation, publicly available pretrained models based on AudioSet are adopted ([1]). The averaged accuracy after 200 epochs over 10 , 000 tasks drawn from the test set is reported.

Figure 4 compares the memory usage of BP and FF during the training. For a small model such as CRNN, there is at least 4 × reduction in total memory when full fine-tuning is used. In the case of AST architecture, model training with quantized forward gradient combined with sparse update only requires 0 . 19 MBscratch memory, which fits into most existing edge devices.

(a) Total Memory Usage (MB)

(b) Scratch Memory Usage (MB)

Total Memory Usage (M)

500.00

385.58

400.00

341.40

300.00

170.89

200.00

170.89170.76

100.00

12.03 2.95 2.71 2.71 1.48

0.00

CRNN

ViTBase

BP, FT, fp16

FF, FT, fp16

BP, LP, fp16

FF, LP, fp16

FF, LP, Quant

Scratch Memory Usage (M)

250.00

215.02

200.00

170.84

150.00

100.00

50.00

11.79 2.70 2.46 2.46 1.23

0.330.32 0.19

0.00

CRNN

ViTBase

BP,FT,fp16

FF, FT, fp16

BP, LP, fp16

FF, LP, fp16

FF,LP, Quant

C Cross-domain adaptation

Cross-domain adaptation is performed on VWW dataset. Table 8 lists all hyper-parameters used in training.

(a) Training curves: LP

(b) Training curves: D-VPT

train/loss_step, LP

BP_fp16

FF_fp16_m1

1.5

FF_fp16_m3

FF_quant_m1

SSC

FF_quant_m3

0.5

10k

20k

30k

40k

Training Steps

train/loss_step, D-VPT

BW_fp16

FF_fp16_m1

FF_fp16_m3

FF_quant_m1

wquenb

10k

20k

30k

40k

Training Steps

Figure 5 shows the training curves of BP and FF under various settings. In general, FF requires a smaller learning rate, resulting more training iterations to converge than BP. However, for a single iteration, BP performs one forward pass and one backward pass, while FF needs two forward passes. The FLOPs of a backward pass are ∼ 2 × of that of a forward pass (e.g., for both Convolutional and Linear layers). Therefore, FF has a 1 . 5 × speedup in one iteration of the training. The total training time depends on the number of iterations required for model convergence and the time taken to complete each iteration.

D In-domain OOD adaptation

Cifar10-C provides 5 levels of corruption severity, from which we take the lowest (easy), middle (medium), and highest (hard) corruption severity as separate benchmarks for fine-tuning, randomly partitioning each section into a 90% -10% train-test split.

E Empirical Studies, Discussions and Limitations

The convergence and generalization property of perturbation-based learning, such as forward gradient learning, depends on the loss landscape instead of number of parameters. Visualization of loss landscape has the potential to help us answer several important questions about how a neural network is trained, and why do the resulting minima generalize under certain training approaches.

Figure 6 compares the 2D contour of loss landscape and loss trajectory during training under BP and QZO-FF. Both forward and backward learning shows a locally smooth loss contour, and the trajectory follows the gradient descent direction, with forward gradient learning taking a more conservative step after each epoch, resulting in slower convergence. We also observed that a good initialization (e.g., pre-trained model) is critical for forward gradient learning. Therefore, the convergence may not be guranteed if a model is trained from scratch. However, it is still promising that quantized forward gradients to be used for model adaptation on low resource devices, in which a general pre-trained model has been deployed.

In our experiments, it is also observed that 8-bit quantization of weights does not lead to model convergence. This is because the small perturbation of ϵ is quantized using the scaling factor of weights ( ∆ w ). It requires higher bits to be properly represented without clipping loss, thus the weights change can be reflected in the quantized space. In future, techniques for ultra low bit (i.e., 8-bit, 4-bit) forward gradient learning can be explored. In addition, experiments beyond classification and across multiple modalities can be conducted for further evaluations.

3

2

1

0

1

2

3

1st PC: 88.68 %

3

2

1

0

1

2

3

2nd PC: 4.58 %

0.30

0.35

0.40

0.45

0.50

0.55

0.60

0.65

0.70

0.70

0.75

0.75

0.80

0.80

0.85

0.85

0.90

0.90

0.95

1.00

1.05

1.10

1.15

1.20

1.25

1.30

1.35

1.40

1.45

1.50

1.55

1.60

1.65

1.70

1.75

1.80

1.85

1.90

1.95

(a) BP, LP, test error 12.13%.

3

2

1

0

1

2

3

1st PC: 82.82 %

3

2

1

0

1

2

3

2nd PC: 9.47 %

0.20

0.25

0.30

0.35

0.35

0.40

0.45

0.50

0.55

0.55

0.60

0.60

0.60

0.65

0.65

0.65

0.70

0.70

0.70

0.75

0.80

0.85

0.90

0.95

1.00

(b) BP, D-VPT, test error 7.02%.

3

2

1

0

1

2

3

1st PC: 65.92 %

3

2

1

0

1

2

3

2nd PC: 14.27 %

0.35

0.40

0.45

0.50

0.55

0.60

0.60

0.65

0.65

0.70

0.70

0.75

0.75

0.80

0.80

0.85

0.85

0.90

0.90

0.95

0.95

1.00

1.00

1.05

1.10

1.15

1.20

1.25

1.30

1.35

1.40

1.45

1.50

1.55

1.60

1.65

1.70

1.75

1.80

1.85

1.90

1.95

(c) FF, LP, test error 12.49%.

10.0

7.5

5.0

2.5

0.0

2.5

5.0

7.5

10.0

1st PC: 71.54 %

10.0

7.5

5.0

2.5

0.0

2.5

5.0

7.5

10.0

2nd PC: 12.62 %

0.30

0.35

0.40

0.45

0.50

0.55

0.55

0.60

0.60

0.65

0.65

0.65

0.70

0.70

0.70

0.75

0.75

0.75

0.80

0.80

0.85

0.85

0.90

0.90

0.95

0.95

1.00

1.00

1.05

1.05

1.10

1.10

1.15

1.15

1.20

1.25

1.25

1.30

1.30

1.35

1.35

1.40

1.45

1.50

1.55

1.60

1.65

1.70

1.75

1.80

1.85

1.90

1.95

(d) FF, D-VPT, test error 11.06%.

3

2

1

0

1

2

3

1st PC: 71.83 %

3

2

1

0

1

2

3

2nd PC: 12.58 %

0.30

0.35

0.40

0.40

0.45

0.45

0.50

0.50

0.55

0.55

0.60

0.60

0.65

0.65

0.70

0.70

0.75

0.75

0.80

0.80

0.85

0.85

0.90

0.90

0.95

0.95

1.00

1.05

1.10

1.15

1.20

1.25

1.30

1.35

1.40

1.45

1.50

1.55

1.60

1.65

1.70

1.75

1.80

1.85

1.90

1.95

(e) FF Quant (16w8a), LP, test error 12.74%.

4

3

2

1

0

1

2

3

4

1st PC: 77.33 %

4

3

2

1

0

1

2

3

4

2nd PC: 9.29 %

0.30

0.35

0.40

0.45

0.50

0.55

0.60

0.65

0.70

0.75

0.80

0.80

0.85

0.85

0.90

0.90

0.95

0.95

1.00

1.00

1.05

1.05

1.10

1.10

1.15

1.15

1.20

1.20

1.25

1.25

1.30

1.30

1.35

1.35

1.40

1.40

1.45

1.45

1.50

1.55

1.60

1.65

1.70

1.75

1.80

1.85

1.90

1.95

(f) FF Quant (16w8a), D-VPT, test error 11.38%.

3

2

1

0

1

2

3

1st PC: 100.00 %

0.100

0.075

0.050

0.025

0.000

0.025

0.050

0.075

0.100

2nd PC: 0.00 %

1.6

1.8

2.0

2.2

2.4

2.6

2.8

3.0

3.2

3.4

3.6

3.8

4.0

4.2

4.4

4.6

4.8

5.0

5.2

5.4

5.6

5.8

4

3

2

1

0

1

2

3

4

1st PC: 100.00 %

0.100

0.075

0.050

0.025

0.000

0.025

0.050

0.075

0.100

2nd PC: 0.00 %

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

10

NeurIPS Paper Checklist

1. Claims

Question: Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope?

Answer: [Yes]

2. Limitations

Question: Does the paper discuss the limitations of the work performed by the authors?

Answer: [Yes]

3. Theory Assumptions and Proofs

Question: For each theoretical result, does the paper provide the full set of assumptions and a complete (and correct) proof?

Answer: [Yes]

Justification: Definitions are cross-referenced. Equations and formulas are derived in details.

4. Experimental Result Reproducibility

Question: Does the paper fully disclose all the information needed to reproduce the main experimental results of the paper to the extent that it affects the main claims and/or conclusions of the paper (regardless of whether the code and data are provided or not)?

Answer: [Yes]

Justification: Model architectures and pretrained checkpoints are all from publicly available sites, which are referenced. Experimental hyper-parameters are all listed in Appendix.

5. Open access to data and code

Question: Does the paper provide open access to the data and code, with sufficient instructions to faithfully reproduce the main experimental results, as described in supplemental material?

Answer: [No]

Justification: We use public dataset, known model architectures, and publicly available pretrained model checkpoints for further experiments. Links are all provided, and crossreferenced. All experimental hyper-parameters are given in Appendix. We can also provide instructions to reproduce the results. However, we cannot open source the code.

6. Experimental Setting/Details

Question: Does the paper specify all the training and test details (e.g., data splits, hyperparameters, how they were chosen, type of optimizer, etc.) necessary to understand the results?

Answer: [Yes]

7. Experiment Statistical Significance

Question: Does the paper report error bars suitably and correctly defined or other appropriate information about the statistical significance of the experiments?

Answer: [Yes]

Justification: All results are explained in text about how the accuracy is reported.

8. Experiments Compute Resources

Question: For each experiment, does the paper provide sufficient information on the computer resources (type of compute workers, memory, time of execution) needed to reproduce the experiments?

Answer: [Yes]

Justification: All our experiments are based on single Nvidia Tesla V100 GPU. Since our experiments mainly focus the performance of quantized forward gradient learning, training computation is not the bottleneck. Most experiments in the paper only requires a few hours of training on a single GPU.

9. Code Of Ethics

Question: Does the research conducted in the paper conform, in every respect, with the NeurIPS Code of Ethics ❤/a116/a116♣/a115✿✴✴♥❡✉/a114✐♣/a115✳❝❝✴♣✉❜❧✐❝✴❊/a116❤✐❝/a115●✉✐❞❡❧✐♥❡/a115 ?

Answer: [Yes]

10. Broader Impacts

Question: Does the paper discuss both potential positive societal impacts and negative societal impacts of the work performed?

Answer: [NA]

Justification: A foundamental training approach is discussed in the paper for potential model personalization in the future. This aims to bring model adaptation to local devices, thus protect users' privacy. We do not see any negative societal impacts of this work.

11. Safeguards

Question: Does the paper describe safeguards that have been put in place for responsible release of data or models that have a high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?

Answer: [NA]

Justification: We conduct experiments on commonly used public dataset.

12. Licenses for existing assets

Question: Are the creators or original owners of assets (e.g., code, data, models), used in the paper, properly credited and are the license and terms of use explicitly mentioned and properly respected?

Answer: [Yes]

13. New Assets

Question: Are new assets introduced in the paper well documented and is the documentation provided alongside the assets?

Answer: [NA]

14. Crowdsourcing and Research with Human Subjects

Question: For crowdsourcing experiments and research with human subjects, does the paper include the full text of instructions given to participants and screenshots, if applicable, as well as details about compensation (if any)?

Answer: [NA]

15. Institutional Review Board (IRB) Approvals or Equivalent for Research with Human Subjects

Question: Does the paper describe potential risks incurred by study participants, whether such risks were disclosed to the subjects, and whether Institutional Review Board (IRB) approvals (or an equivalent approval/review based on the requirements of your country or institution) were obtained?

Answer: [NA]

Peer reviews:
{"IS_META_REVIEW": false, "comments": "SUMMARY:\n**Context**. The focus of the present paper is on-device fine-tuning (gradient computation and weight update **starting from a pre-trained model**) under limited memory budget. One way to cut the memory cost of storing the computational graph for gradient computation by standard backprop is the Memory Efficient Zeroth Order (MeZO) optimizer [Malladi et al, 2023], whereby a directional gradient is computed via weight perturbation (a.k.a SPSA): computing the loss $L$ difference yielded by two forward passes with weights differing by $\\epsilon u$ estimates $\\nabla L \\cdot u$. Since it is a purely forward procedure, it obviates the need to cache activations to execute a backward pass.\n\n**Core contribution**. The present paper proposes a quantized version of MeZO where weight perturbation, gradient computation and weight update are carried out on quantized quantities. The proposed algorithm, coined QZO-FF (Alg. 1), is tested against a variety of fine-tuning tasks (few-shot learning, cross-domain and in-domain adaptation), modalities (image and audio data), and architectures (convolutional, attention-based, recurrent), with several variants being explored (with fp8 / fp32 activations) and benchmarked against standard backprop. The efficiency of QZO-FF, both in terms of resulting performance and memory usage, is demonstrated.\n\n**Paper outline**. More precisely:\n- Section 2 provides background knowledge on memory-efficient backprop (2.1), forward-mode differentiation (2.2) and quantized training (2.3).\n- Section 3.1 and 3.2 formalizes further \"forward gradients\" (3.1)  and the SPSA / weight perturbation procedure to estimate them (3.2). A hardware-friendly extension of SPSA coined as \"Sign-m-SPSA\", which estimates $\\text{sign}(\\nabla L \\cdot u) u$, , is introduced along with the resulting SGD update (3.2).\n- Section 3.3 presents the core algorithmic contribution by combining SPSA / weight perturbation and weight quantization (Alg. 1). More precisely, weights and perturbation are statically, symmetrically quantized (e.g. their range are estimated and set once, before fine-tuning), with one scale for each ($\\Delta_w$ and $\\Delta_q$). Therefore: i) $\\Delta_w$ and $\\Delta_q$ are fixed, with weights and perturbations quantized with 16 and 8 bits respectively, ii) the integer part of the perturbed weights is accumulated in 32 bit, iii) the dequantized perturbed weights is quantized-dequantized back into 16 bits using the same $\\Delta_w$ scale (Eq. 6). The Sign-m-SPSA gradient estimator is applied and quantized-dequantized using the perturbation scale ($\\Delta_z$, Eq. 7) . Finally, the weight update itself is quantized, such that it happens in the quantized integer part and is rescaled by $\\Delta_w$ (Eq. 8). Alg. 1 summarizes the procedure in the case where the number of perturbed directions at use is 1 ($m=1$).\n- Section 3.4 presents several algorithmic \"enhancements\" of the QZO-FF algorithm to improve the optimization procedure itself or its memory footprint.\n- Section 4 presents experimental results. First, few-shot learning is considered (4.1) on visual and audio data. Here, \"FF\" refers for short to \"QZO-FF\". A quantized version of FF, where 8 bits activations are used, is also tested. On vision, three architectures are tested (ResNet12, 18 and ViT tiny) on 5 different standard few-short learning datasets. Two scenarii are considered: full fine-tuning and linear probing. It is shown overall that FF always yields better performance than the zero-shot baseline and within 5%, accuracy-wise, to the BP baseline on 26/30 experiments, and that the ViT backbone yields the least degradation. On audio, a similar experiment is done with two architectures (CRNN, AST) on two audio datasets. On 11/16 experiments, FF accuracy is 5% off the BP baseline. Then, a cross-domain adaptation task (4.2) is considered, where the different algorithmic enhancements previously introduced (e.g. quantized FF, gradient averaging, \"sharpness aware\" scheme...) are tested. Most importantly, it is observed that quantizing weights to 8 bits jeopardize the FF algorithm. Finally, sector, 4.3 presents in-domain OOD adaptation using the same fine-tuning schemes (LP, D-VPT) with three levels of corruptions of the CIFAR-10 dataset as OOD datasets. In this setting, FF achieves comparable performance with BP.\n\nSTRENGTHS:\n- The problem tackled is highly relevant to on-device training, pragmatic and builds upon recent work [Malladi et al, 2023].\n- The proposed algorithm is sound and well-explained.\n- There are a lot of experimental settings, data modalities and architectures being explored.\n- The proposed technique is effective in providing a learning signal, effectively training models and yielding relatively good performance compared to the BP baseline.\n\nWEAKNESSES:\n- It is unclear what is kept in full precision in the proposed procedure (see my questions below).\n- On a related note, it is also unclear that the proposed algorithm enhancements don't offset the advantages of manipulating statically quantized quantities (see my questions below). \n- The experiments aren't all sufficiently well explained, neither in the main nor in the appendix, which is frustrating because there is a lot of work done there and we fail to deeply understand the proposed setups. I would even say that there are almost too many different experimental setups. Under constrained time budget to write the paper, I would have prioritized a lesser number of better detailed experiments rather than a lot of them left unsufficiently explained.\n- **There aren't any error bars in any table and figures**, although the authors ticked in their checklist that they reported error bars and provided appropriate information about the statistical significance of their experiments (L. 520). For lack of this, it is very hard to draw any clear conclusion in terms of comparison between the different algorithms at use, e.g. is there a statistically significant gap here, or are these two results within error bar? We don't know.\n- I don't understand what the 2D plot of the loss landscape really brings here in terms of insights.\n\nQUESTIONS:\n- L. 135: \"in order to mitigate the noisy component of forward gradients estimated by SPSA, we propose sign-m-SPSA\": do you have evidence that sign-m-SPSA results in less noisy gradients? \n- Section 3.3: could you please clarify what is kept in full precision? I see at least three different quantities not being quantized: i) the scales $\\Delta_w$ and $\\Delta_z$,  ii) the loss for each perturbed weights and therefore its difference, iii) the averaged gradient (Eq. 7). Most importantly, do you confirm that you need to accumulate gradients across each direction ($i=1 \\cdots m$) in higher precision (32 bits I guess?) and then quantize-dequantize it using the scale of the perturbation $\\Delta_z$? Your pseudo-algorithm only treats the case $m=1$ so it remains unclear how this all work when $m>1$ and you need to average gradients. **Could you please write a new pseudo-algorithm**, alike Alg.1, **in the case $m>1$**, highlighting with **two different color codes** the quantized (int8 and int16) and full precision (fp32) quantities?\n- L.193-198 (momentum-guided sampling): I think that incorporating momentum into your approach is crucial. However, I don't understand neither how it works. What do you mean by \"as training progresses, a history of the momentum $z$ is incorporated to guide the new sampling process\"?\n- L.199 (sharpness-aware perturbation): you mean an \"extra step of **directional** gradient ascent\"?\n- L.204-210 (sparse updates): which sparsity scheme did you employ? top-k magnitude based scheme may be quite costly, if it boils down to ranking all the weights by their magnitude.\n- L.211 (kernel-wise normalization): in this case we agree that $\\hat{g}$ needs to be stored in full precision? Also, the computation of the norms of $z$ and $w$ is computationally expensive ($O(d)$, where $d$ denotes the dimension of $w$ or $z$), as expensive as it would be to dynamically recompute $\\Delta_z$ and $\\Delta_w$, which you avoided by statically quantizing them. Don't you lose the advantage here of using static scales if in any case you need to perform this $O(d)$ operations?\n- L.216 (few-shot learning): \"a few labeled samples are available\", but how many? Could you please clarify the experimental setup?\n- L.222: \"16w8a\" means 16 bits for weights and 8 for activations, correct? I may not take this for granted and clearly define this notation.\n- Table 2: I would rather compute the **relative** accuracy degradation (acc_BP - acc_qFF / acc_BP) rather than the **absolute** accuracy degradation.\n- Table 2: the accuracy degradation when employing FF in the FT setting compared to BP in the same setting is quite severe (11.08% gap), although you are using a relatively small architecture (ResNet12) with relatively small input dimensionality (32x32). Why is this the case?\n- Table 2: **there are not any error bars**, which makes it hard to make any sense of a $\\sim 0.2/0.5$ difference between two experiments.\n- Could you please define precisely what you mean by \"zero shot\" (I assume no training at all?), \"linear probing\" (I assume only the last linear layer is learned?) and \"full fine-tuning\" (all parameters are learned)? \n- L. 238 (audio benchmark): could you please detail the few-shot setup for this task, and the tasks themselves? It is important for people not familiar with this literature.\n- L. 252: I really did not understand what \"cross-domain adaptation\" really is about. Could you please explain better what it is? \n- L.256: what is \"visual-prompt tuning with deep prompts\"?\n- Fig. 2: except for large discrepancies between bars, it is difficult to draw any conclusion from this figure **for lack of error bars**. Could you please add them?\n- Which conclusions / insights do you really gain from plotting the 2D contours of the loss landscape in the different settings?\n\nLIMITATIONS:\nSee weaknesses and questions above.\n\nIf I had detailed description of each of the experimental setups tackled, a precise knowledge of what exactly is kept in full precision, how some of the algorithmic enhancements really work and error bars on all figures, I would be prone to increasing my score. I really want to encourage the authors to do so because I do believe that the core of this work is of interest.", "TITLE": "Official Review", "RECOMMENDATION": 7, "REVIEWER_CONFIDENCE": 3, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-07-04"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper explores the feasibility of on-device training using fixed-point forward gradients. The authors propose methods including sign-m-SPSA, Momentum Guided Sampling, Sharpness-aware Perturbation, Sparse Update, and Kernel-wise Normalization to reduce memory footprint and accuracy gaps and conduct experiments across various deep learning tasks in vision and audio domains. Key contributions of this paper include formulating forward gradients in the quantized space, demonstrating the feasibility of on-device training, and visualizing the neural loss landscape during training. The study shows that training with fixed-point forward gradients might be a practical approach for model customization on edge devices.\n\nSTRENGTHS:\n++ This paper proposes an improved method for forward gradients, called Quantized Zeroth-order Forward Gradient (QZO-FF), which enables forward gradients training using quantization. \n\n++ QZO-FF is quantized and does not require backpropagation, thereby reducing memory overhead and eliminating the need for processors to have training capabilities. However, I doubt this because even though forward gradients do not require backpropagation, they still need to update weights and possibly save momentum and they need to perform additional quantization for $z$ in QZO-FF. Therefore, we may need some hardware adaption to assist feed-forward training.\n\n++ The experiments across various benchmarks show that there is only a slight degradation in accuracy while the memory cost is reduced.\n\nWEAKNESSES:\n1. Some results are missing in the experiment. For example, (1) the memory cost of (BP, LP, fp16) is not measured. I think the memory cost of LP is important because it seems that the reduction of memory cost mainly comes from LP instead of FF and Quant in Figure 3 and Figure 4, and I think the claim that \"this number is further reduced to only 0.28MB\" and \"the saving increases to 8.1× when sparse update and fixed-point are enabled\" in Appendix B is totally misleading and unfair. (2) The accuracy of (BP, LP, quant) is not measured so there is no baseline for (FF, LP, Quant). (3) The accuracy of (FF, FT, Quant) and (BP, FT, Quant) is not measured. (BP, FT, Quant) should be some BP fixed-point training methods like Quantization-Aware Scaling (QAS) mentioned in related work.\n\n2. Lack of ablation studies. The effects of techniques proposed in Section 3.4 are not well-studied. (1) There is no ablation study for Section 4.1. (2) The effect of sharpness-aware and kernel-wise normalization is not measured separately in Section 4.2. (3) I want to know __which__ of these techniques work in __what__ experiment settings. I believe that, as a new algorithm with many enhancement techniques, the authors should inform the readers about which parts of the algorithm are useful under which circumstances.\n\n3. The model size (100K - 80M) is somewhat small compared to the concept of \"pretrained models\". How does the proposed method perform for larger models and how does the model size affect the effectiveness of the method?\n\nQUESTIONS:\n1. Although one can understand the meaning of these symbols after a careful reading, the notation in equation (6) is somewhat confusing because $1_q$ and $\\epsilon_q$ have the same subscript but different scaling factors. I think it would be better to add a notation related to the scaling factor above them.\n\n2. typo in line 271: extenteded\n\nLIMITATIONS:\nThe limitations are discussed well by the authors.", "TITLE": "Official Review", "RECOMMENDATION": 5, "REVIEWER_CONFIDENCE": 3, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-07-11"}

comments: SUMMARY:
The authors investigate fixed-point forward gradients for quantized training. They conduct experiments across various deep learning tasks in vision and audio to assess if this method yields competitive models while conserving memory and computational resources.
They introduce algorithm enhancements to reduce memory usage and accuracy gaps compared to backpropagation, using fixed-point precision for forward gradients during training or adaptation.
Their findings demonstrate the feasibility of on-device training with fixed-point forward gradients across diverse model architectures (e.g., CNN, RNN, ViT-based) and parameter sizes (100K to 80M), offering practical solutions for model adaptation on edge devices.
The authors also visualize neural loss landscapes and training trajectories, providing insights into the dynamics of training with forward gradients for efficient on-device model adaptation.

STRENGTHS:
1 .They understand quantization and tried not to leave anything float

2. Experimenting with SAM and ZO is nice 

3. The paper is well written

WEAKNESSES:
1. Sadly no experiments on LLMs on which most fine tuning is done today

2. Marginal novelty: generally they just added quantization to ZO-FF – is that enough?

QUESTIONS:
1. why you loop over w can’t you just do it vector wise?

2. Can you specify m (the number of pertubations) used for each experiment?

3. Can you calculate the memory consumption (MB/GB)  and computation complexity (in FLops) compared to QLoRA with BP.

LIMITATIONS:
yes
TITLE: Official Review
SOUNDNESS_CORRECTNESS: 2
DATE: 2024-07-11

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe paper proposes a quantization approach for fine-tuning pretrained data to new local data on resource-constrained devices. In particular, the weights perturbation, gradients estimation, and weights updates are quantized to either 8-bit or 16-bit. This quantization approach is combined with Momentum Guided Sampling, Sharpness-aware Perturbation, Sparse Update, and Kernel-wise Normalization to enhance fine-tuning performance. The proposed approaches are evaluated on various AI benchmarks. The results of this study indicate that quantized forward gradients are a good candidate for a fine-tuning approach that can be deployed on edge devices.\n\nSTRENGTHS:\n1- The paper is well-written and well-organized.\n\n2- The quantized approach is evaluated on a variety of tasks that show the generalizability of the new approach.\n\n3- The Sign-m-SPSA-SGD approach is interesting and novel.\n\nWEAKNESSES:\n1- The author are recommended to discuss the accuracy degradation of quantized forward gradients compared to the backpropagation algorithm. In some cases, the accuracy degradation is high (more than 5%). A comparison of performance versus hardware complexity (FLOPs or another metric) is recommended, as seen in [1].\n\n2- Evaluating the efficacy of quantized forward gradients on fine-tuning LLM models such as LLaMA-3 is recommended. \n\n[1] Carmichael, Zachariah, et al. \"Performance-efficiency trade-off of low-precision numerical formats in deep neural networks.\" Proceedings of the conference for next generation arithmetic 2019. 2019.\n\nQUESTIONS:\nWhy is the random perturbation vector z sampled from a normal distribution with zero mean and standard deviation? Is it possible to sample from a log-normal distribution since activation gradients are shown to be distributed near log-normal [1]?\n\n[1] Chmiel, Brian, et al. \"Neural gradients are near-lognormal: improved quantized and sparse training.\" arXiv preprint arXiv:2006.08173 (2020).\n\nLIMITATIONS:\nThe author addresses the limitations of this study by mentioning the initialization requirements for forward gradients and 16-bit weight quantization.\n\n1- It would be suggested to discuss various initialization approaches that might be used instead of a pretrained network.\n2- It would be suggested to discuss other numerical formats, such as 8-bit floating point or Posit, to solve the 16-bit weight quantization problem.", "TITLE": "Official Review", "RECOMMENDATION": 5, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-07-18"}