Energy-Sized Backward Passes for Batteryless On-Device Learning

A batteryless sensor runs on a small capacitor charged by sunlight, radio waves, or vibration, and it loses all volatile memory whenever that charge runs out. Such devices can already run neural network inference, but they struggle to learn in the field. A single backward pass through one layer, together with saving its state to non-volatile memory, can need more energy than the capacitor holds. When that happens the device reboots, retries the same step, and fails forever. We propose to make each training step exactly as large as the energy currently available. On every power cycle the device reads its capacitor voltage and computes how much backward-pass work it can afford. It then updates only the small set of weight blocks judged most useful to change right now, and it leaves every other weight frozen in non-volatile memory, where freezing costs nothing to keep.

The ingredient that makes this possible comes from work on dynamic parameter importance: the observation that which weights matter changes during training, so frozen weights must be able to come back. Existing mechanisms for bringing weights back either keep accumulating gradients on the inactive weights in the background or keep full optimizer state for them, and both are unaffordable on a microcontroller that must write its state to memory before every brownout. Our design replaces that background state with one or two bytes per block: a remembered usefulness score and a count of how long the block has been frozen. The claim is that this is enough to keep the network adaptable while guaranteeing, by construction, that no training step exceeds the capacitor.

Core Claim

On an intermittently powered microcontroller, on-device fine-tuning under distribution shift can be made free of livelock and more accurate per harvested millijoule than the alternatives. These alternatives are design-time architecture shrinking, last-layer-only training, and data filtering. The method has two parts. First, each step's set of trainable blocks is sized at runtime to the measured capacitor energy using a per-block energy model. Second, the blocks are chosen by a cheap score that combines a remembered update magnitude with a staleness bonus. The forward pass always uses all weights; only the backward pass is shrunk. Frozen blocks therefore carry no gradient, no optimizer state, and no checkpoint cost.

We state plainly which part we are less sure of. The energy-sizing part addresses a documented failure mode. The importance-scoring part is a hypothesis that could turn out no better than random block choice. The experiments are built so that this question gets answered rather than assumed.

How This Differs From Existing Work

Work combining the two directions so far keeps parameter importance fixed at runtime. Intermittent Inference with Nonuniformly Compressed Multi-Exit Neural Network compresses a multi-exit network offline with reinforcement learning and uses a runtime Q-learner to choose which exit to compute. EVE switches among three nested pruning masks fixed during an offline search. Both handle inference only, and neither updates weights. NExUME and its companion Revisiting DNN Training for Intermittently Powered Energy Harvesting Micro Computers train on simulated power traces so the model tolerates dropped operations. That training happens on mains-powered machines, so the deployed device does not learn. Intermittent Learning does learn on the device. It saves energy by skipping data samples and scheduling atomic learn/infer actions, but it has no notion of which parameters to update.

The paper that constrains our design most is Design-Time Optimization of Deep Neural Networks for Intermittent Learning on Microcontrollers. It names the "energy wall": a training step whose layer backward pass plus state checkpoint exceeds the capacitor livelocks the device. Its remedy is to search at design time for architectures in which every layer fits. We reuse its method, namely linear-regression energy predictors fit to hardware measurements for compute and memory writes. We move the fitting decision from design time to every power cycle. That allows the architecture to stay larger than the worst-case energy would permit, with the backward pass shrunk only when energy is scarce.

On the importance side, three papers motivate the approach. Dynamic Network Surgery shows that pruned weights must stay revivable to avoid accuracy loss. It achieves this by continuing to update masked weights in the background, which is exactly the state an intermittent device cannot afford to save. DLoRA freezes ("kills") fine-tuning adapters whose update norm falls below a threshold and periodically revives them, cutting edge compute by 82%. That result shows freezing-with-revival is cheap when the frozen modules need no state; we adopt its update-norm signal. Parameter-Level Soft-Masking for Continual Learning keeps the forward pass fully unmasked and restricts only gradients. It reached 58.1% on ImageNet-100 while blocking about 2% of parameters, against about 41.8% for hard isolation. That result supports our choice to restrict only the backward pass. Prospect Pruning shows early importance does not predict later importance. This is the reason we cannot fix the trainable set once, and the reason our score includes a staleness bonus.

Research Program

The network is divided into blocks: output-channel groups of each convolution, or row groups of each dense layer. For each block $b$ we store in non-volatile ferroelectric RAM (FRAM, a fast, low-energy non-volatile memory) three things: its weights, a one-byte score $s_b$, and a one-byte staleness counter $t_b$. The score $s_b$ is an exponential moving average of the block's update norm from the last time it trained. The counter $t_b$ records steps since the block was last trained.

At the start of each step, the device reads the capacitor voltage $V$ and converts it to usable energy $E(V)=\tfrac{1}{2}C(V^2-V_H^2)$. Here $C$ is the capacitance and $V_H$ is the brownout threshold, below which memory is lost. The device then chooses the trainable set $S$ to satisfy

$$ E_{\text{fwd}} + \sum_{b\in S}\left(e^{\text{bwd}}_b + e^{\text{nvm}}_b\right) \le E(V) - E_{\text{margin}}, $$

where $E_{\text{fwd}}$ is the predicted cost of the dense forward pass, $e^{\text{bwd}}_b$ is block $b$'s backward cost, and $e^{\text{nvm}}_b$ is the cost of writing its updated weights and optimizer state to FRAM. All three are predicted with the regression models of the design-time optimization paper, which reports 16.6% error for compute energy and 0.9% for memory reads and writes. The margin $E_{\text{margin}}$ is set from the error of those predictors.

Blocks are added greedily in order of priority per unit energy, $(s_b + \lambda \log(1+t_b))/(e^{\text{bwd}}_b+e^{\text{nvm}}_b)$. The weight $\lambda$ trades off exploiting known-useful blocks against reviving stale ones; it is a bandit-style exploration bonus. Backpropagation must still pass through layers above the trainable blocks to reach them. The energy model therefore also charges the cost of propagating activation gradients through frozen upper layers. This favours blocks near the output when energy is scarce, which is the right behaviour, and the choice follows from measured costs rather than a hand-set rule.

Correctness under power loss relies on reactive hibernation in the style of Hibernus, which saves state only when voltage crosses a threshold. The state saved is only the active set's intermediates, bounded by construction. If a step is interrupted anyway, the step is simply discarded. Frozen weights were never touched, and active weights are committed with a double-buffered write, so the model is always consistent.

We will build this on an nRF52840 with external FRAM, matching the design-time optimization paper, and on an MSP430 with FRAM. Power will come from replayed harvesting traces. The analysis will produce three things: the livelock rate as a function of capacitor size, accuracy over the course of adaptation, and how often importance scores actually lead to revivals.

Baselines

The naive reference point is full-network on-device training with standard reactive checkpointing, applied to the same model. We expect it to livelock whenever the capacitor is small. We will report the smallest capacitor at which it makes forward progress, and at that capacitor its accuracy is the ceiling any cheaper method should approach. A second naive point is no adaptation at all: deploy the offline-trained model and never update it. It shows how much the distribution shift costs.

The strongest existing method for on-device intermittent training is the design-time optimization approach of Design-Time Optimization of Deep Neural Networks for Intermittent Learning. Its search finds an architecture in which every layer's full backward pass fits the capacitor, and that architecture then trains normally. It is the strongest competitor because it solves the same livelock problem with no runtime machinery. We run its search with its reported energy predictors on the same hardware, capacitor sizes, and traces, with an equal hyperparameter tuning budget. On the CWRU Bearing dataset it reports a 94% reduction in total predicted energy with minimal validation-loss increase. No accuracy-under-shift number is reported, so we will measure it ourselves. Beating it means higher post-shift accuracy at equal harvested energy, or equal accuracy with less energy, when both methods start from the same dense model budget.

The data-level competitor is the action planner and sample filtering of Intermittent Learning. That work reports about 80% average accuracy and 37% less energy than the Alpaca baseline on its own sensing tasks, which are not our benchmarks. We implement its k-Last-List filtering on top of full-network and last-layer training. Because filtering and our method are orthogonal, we also test the combination.

For offline robustness, we include NExUME's DynFit training (NExUME), which reports about 76% on CIFAR-10 against about 71% for the next best method. We use it as the pre-deployment starting point for all methods, not as a competitor, since it does not learn on the device.

Three ablations isolate the key ingredients. The first keeps the energy-sized budget but picks blocks uniformly at random. The second keeps the budget but always trains the top-scoring blocks without the staleness bonus, which gives kill without revive. The third uses a fixed per-step budget sized for the worst-case capacitor charge. The first isolates importance scoring, the second isolates revival, and the third isolates runtime sizing.

Why not just…?

Why not just train the last layer on device? Updating only the classifier head is the standard tiny-ML answer, and it avoids backpropagating through anything. This is a real threat. For shifts that only move class boundaries it may match our method. Our selector already includes this solution: when energy is scarce and scores favour the head, it will choose the head. The question is whether the gradient-carrying shifts we target need feature-level changes. We will settle it with a head-only baseline on every benchmark. We will also report results separately for shifts where the head-only model recovers most of the gap and shifts where it does not, such as unseen subjects in activity recognition. If head-only matches us everywhere, the proposal's claim fails and we will say so.

Why not just pick random blocks each step? Random selection under the same energy-sized budget keeps the livelock guarantee and costs no score storage. Prospect Pruning suggests importance drifts, so a stale score could be no better than chance. This is the second real threat and is the purpose of the first ablation. If random matches the scored selector, the contribution reduces to runtime energy sizing, and we would recommend the simpler random version. The evidence against random comes from DLoRA, where update-norm freezing preserved accuracy while removing most compute. That result, however, is on large language model adapters under stable power, not on microcontrollers.

Why not just use DVFS or task slicing and leave the network alone? Frequency and voltage scaling (Balsamo et al.) and task fusion stretch or split work in time, but they cannot shrink the smallest indivisible unit of work. The design-time optimization paper argues that one layer's backward pass plus its checkpoint is such a unit. Our naive full-training baseline with hibernation measures this directly: the capacitor size at which it stops making progress.

Why not just size the architecture at design time? This works when the worst-case energy is known, but the network must then be permanently as small as the worst power cycle allows. Our comparison against the design-time optimization baseline at equal model memory tests whether the extra capacity kept by runtime sizing turns into accuracy.

Proposed Experiments

The benchmarks come from the intermittent-learning literature. For vibration anomaly detection we use the CWRU Bearing dataset, and for industrial state classification the 700,000-sample Machine Status Monitoring dataset from NExUME. For human activity recognition we use MHEALTH and PAMAP2 with cross-subject splits; each new subject is a natural distribution shift. For each benchmark, a model is trained offline on the source split, deployed, and then adapted on-device to the target split as a data stream. Power traces are the Elizabeth City State University solar irradiance traces used by Decentralized Federated Learning With Energy Harvesting Devices, plus synthetic bursty traces that imitate radio-frequency and kinetic harvesting. We sweep capacitor sizes from well below to well above the full-backprop livelock point.

Metrics are target-domain accuracy against cumulative harvested energy, the fraction of power cycles that end in a livelocked or discarded step, training steps completed per millijoule, source-domain accuracy after adaptation (forgetting), and total FRAM bytes written, since memory wear limits how long the device lasts.

Three results would be decisive. First, at capacitor sizes where full training livelocks, our method must make steady progress with a near-zero discarded-step rate. This tests whether the energy model and margin actually hold on hardware. Second, at matched energy, the scored selector must beat random selection and last-layer training on at least the cross-subject activity shifts. If it does not, the importance mechanism is unnecessary. Third, removing the staleness bonus should visibly hurt accuracy on long streams with a mid-stream shift, for example a change in machine operating state on the Machine Status dataset. We will also log whether revived blocks then receive large updates. This would show that one-byte scores can replace the background gradients of Dynamic Network Surgery without losing the ability to bring weights back.