Foundations to Frontier
Tests
M. Robust, Verifiable and Onboard AI › M4 Edge and Onboard AI

Low-Power Inference

A sensor node, a drone or a small satellite has a fixed energy budget, so the question is not only how accurate a model is but how many joules each answer costs and how long the system can keep answering. Energy depends on the work per inference, the voltage and frequency it runs at, how long the processor sleeps between inferences, and whether cheap computation can decide when expensive computation is needed. The exercises build cascades, early-exit networks and wake-up detectors, choose voltage–frequency operating points under a deadline, and simulate a solar-powered node that adapts its model to its stored energy.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Thinking only as hard as needed

People do not think equally hard about everything: most decisions are quick, and only puzzling ones get full attention. A battery-powered device can work the same way. A tiny model looks at each input first and calls a big model only when it is unsure; a network can stop after its first layers when the answer is already clear; and the processor can run slowly at low voltage, or quickly and then sleep, whichever uses less energy. Between inferences it sleeps, and if the battery runs low it can switch to a cheaper model instead of going blind.

🎮 Edge AI lab
0.8 V, 16 MHz
5.511 µJ per period
0.9 V, 32 MHz
5.335 µJ per period
1 V, 48 MHz
5.874 µJ per period
1.2 V, 96 MHz
7.488 µJ per period

Best point 0.9 V, 32 MHz: average power 53.35 µW, coin-cell life about 527 days (ignoring self-discharge); 9% of the energy is spent asleep.

Low static power favours the lowest voltage (dynamic energy per cycle ∝ V²); high static power favours racing to idle. At low rates sleep power dominates, so a cheaper model barely helps. Illustrative parameters from M4-3.

Why engineers care

The dynamic energy of a digital circuit per operation grows with the square of its supply voltage, so running a little slower at a lower voltage can save a large share of energy.

📝 Quick check (Level 0)
0/3 answered
  1. 1. A cascade calls the big model…
  2. 2. Between inferences, a low-power device should…
  3. 3. When the battery is low, a device can…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Dynamic and static power: switching power C·V²·f, plus leakage and peripheral power drawn whenever the chip is awake.
  • DVFS: dynamic voltage and frequency scaling, choosing an operating point that meets the deadline at the least energy.
  • Race to idle: run fast and sleep, which wins when static power is high.
  • Duty cycling: waking only to sense and infer; at low rates, sleep power and wake-up costs dominate.
  • Cascades: a cheap model answers confident inputs and forwards the rest to an expensive one.
  • Early-exit networks: classifiers attached to intermediate layers, stopping when one is confident enough.
  • Wake-up detection: an always-on detector gates a larger model, as in keyword spotting.
  • Energy harvesting and energy-aware scheduling: adapting the workload to harvested and stored energy.
📝 Quick check (Level 1)
0/3 answered
  1. 1. Dynamic power scales as…
  2. 2. Race to idle wins when…
  3. 3. An early-exit network stops when…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

Spending energy where it matters

Exercise 1.

  • An 8-class task with many small clusters in 8 dimensions, where depth matters: a large 8-96-96-8 model, a small 8-16-16-8 model, and a three-exit network of 48 units per layer trained with a loss on every exit.
  • Cascade and early-exit inference with confidence thresholds, counting the MACs actually spent.
  • An illustrative microcontroller power model: dynamic C·V²·f, static power proportional to V, 5 µW sleep, four voltage–frequency points, and a 0.675 Wh coin cell.

Practice.

  • Measure energy per answer at the deployed rate, including sleep and wake-up, not only per inference.
  • Pick the operating point from measurements: the lowest voltage is not always the cheapest once leakage is counted.
  • Make the first stage good enough: a cascade saves energy only if its cheap stage is right on most inputs.
  • Set gating thresholds from the cost of a miss, and validate recall on the rare events that matter.
  • Plan for the energy you will harvest, with modes that degrade gracefully when stored energy runs low (topic M3-3).
def period_energy(cycles, V, f, period):
    t = cycles / f
    return (C * V**2 * f + P_static * V) * t + P_sleep * (period - t)

def cascade(small, large, X, tau):
    p = softmax(small(X)); unsure = p.max(1) < tau
    pred = p.argmax(1); pred[unsure] = large(X[unsure]).argmax(1)
    return pred
🐍 Exercise 1: adaptive computation and power
Implement cascades, early-exit networks and a voltage–frequency power model, and find the cheapest operating point that meets a deadline.
📝 Quick check (Level 2)
0/3 answered
  1. 1. A cascade with a weak first stage…
  2. 2. At very low inference rates, energy is dominated by…
  3. 3. Gating thresholds should be set from…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Voltage and frequency. A CMOS circuit switching capacitance C at frequency f and voltage V draws dynamic power CV²f, so a job of N cycles costs CV²N in dynamic energy regardless of f. Static power P_s(V) is drawn for the job’s duration N/f. The active energy N·(CV² + P_s(V)/f) therefore trades a V² term, which favours low voltage, against a static term, which favours high frequency. Because the maximum frequency falls as voltage falls, the optimum lies in between and moves to faster points as leakage grows; when leakage dominates, finishing as fast as possible and sleeping (race to idle) is best.

Duty cycling. With one inference every T seconds, average power is (E_active + P_sleep(T − t_active))/T. As T grows, average power tends to P_sleep, and the model’s cost stops mattering; as T shrinks, it tends to E_active/T. The crossover where the two are equal, T* ≈ E_active/P_sleep, tells which to optimize.

Cascades and early exits. If a first stage costing c₁ forwards a share q of inputs to a second stage costing c₂, the mean cost is c₁ + q·c₂, which beats c₂ alone only when q < 1 − c₁/c₂. The forwarded share depends on how often the first stage is confident and right, so a first stage that is too small forwards nearly everything. Early exits avoid paying twice for the shared layers, but their intermediate classifiers are trained jointly and can lower the final accuracy.

Energy-aware scheduling. A node harvesting P_h(t) with storage Q must keep Q ≥ 0; choosing between modes of energy e₁ > e₂ by the state of charge keeps the node available whenever the average harvest exceeds the cheap mode’s demand, and spends the surplus on the better mode.

📝 Quick check (Level 3)
0/3 answered
  1. 1. Dynamic energy of N cycles is…
  2. 2. A cascade beats the large model alone when the forwarded share is below…
  3. 3. As the inference period grows, average power tends to…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

How much energy do cascades, early exits and the choice of operating point save for an always-on classifier, and at what cost in accuracy?

History.

  • T. Burd and R. Brodersen (1996) analysed energy-efficient processor design with voltage scaling; Intel SpeedStep (2000) and ARM’s DVFS brought it to products.
  • P. Viola and M. Jones (2001) used a cascade of increasingly complex classifiers for real-time face detection.
  • S. Teerapittayanon, B. McDanel and H. T. Kung (2016) introduced BranchyNet early exits; G. Huang and colleagues (2018) multi-scale dense networks for anytime prediction.
  • Always-on keyword spotting with small networks (Y. Zhang and colleagues, 2017) made wake-up detection standard on phones and microcontrollers.
  • A. Kansal and colleagues (2007) studied power management for energy-harvesting sensor networks.

Exercise 2.

  • 4,000 training, 1,000 validation and 2,000 test points; the cascade threshold is the cheapest on validation data with accuracy within 0.005 of the large model, the early-exit threshold the cheapest within 0.005 of the network’s last exit.
  • One inference every 0.1 s with a 10 ms deadline; each scheme uses its cheapest operating point.

Seed 0:

scheme accuracy mean MACs threshold operating point energy per period average power coin-cell life
large 0.9215 10,752 – 0.9 V, 32 MHz 5.335 µJ 53.4 µW 527 days
small 0.6800 512 – 0.9 V, 32 MHz 0.730 µJ 7.3 µW 3,851 days
cascade 0.9060 7,796 0.75 0.9 V, 32 MHz 4.006 µJ 40.1 µW 702 days
early exit 0.9015 3,512 0.79 0.9 V, 32 MHz 2.080 µJ 20.8 µW 1,352 days
early-exit network, all layers 0.9060 5,376 – 0.9 V, 32 MHz 2.918 µJ 29.2 µW 964 days
large at the fastest point 0.9215 10,752 – 1.2 V, 96 MHz 7.488 µJ 74.9 µW 376 days

Seeds 1 and 2: large 0.9225 and 0.9140; cascade 0.9190 and 0.9090 with 9,565 and 8,641 MACs; early exit 0.8970 and 0.8795 with 3,382 and 3,355 MACs (2.021 and 2.009 µJ per period).

Findings.

  • The cascade saved only 11% to 28% of the work, because its small first stage (0.66 to 0.68 accuracy) was unsure on most inputs; its accuracy was 0.0035 to 0.0155 below the large model.
  • The early-exit network used 2.6 to 2.7 times less energy than the large model but was 2.0 to 3.5 points less accurate; against its own full path it saved 35% to 38% of the MACs for 0.25 to 0.95 points.
  • 0.9 V at 32 MHz was the cheapest operating point: the fastest point cost 40% more energy, and the slowest lost to static power accumulated over its longer run.
  • Coin-cell life at 10 inferences per second ranged from under a year and a half (large model) to over ten years (small model), ignoring self-discharge.
🐍 Exercise 2 (research): how much energy do cascades, early exits and the choice of operating point save for an always-on classifier, and at what cost in accuracy?
Compare a large model, a small one, a cascade and an early-exit network for energy and accuracy, with the cheapest voltage–frequency point for each.

Low-power inference in practice

  • Phones and wearables run always-on wake-word and activity detectors on low-power cores and wake the main processor only on detection.
  • Satellites and rovers schedule inference around power and thermal budgets, eclipse periods and downlink windows (topic M4-5).
  • Microcontroller deployments (TinyML) combine int8 models (topic M4-2), DVFS, sleep modes and event-driven sensing.

References

  1. T. Burd and R. Brodersen (1996). “Processor design for portable systems.” Journal of VLSI Signal Processing.
  2. P. Viola and M. Jones (2001). “Rapid object detection using a boosted cascade of simple features.” CVPR.
  3. S. Teerapittayanon, B. McDanel and H. T. Kung (2016). “BranchyNet: fast inference via early exiting from deep neural networks.” ICPR.
  4. G. Huang, D. Chen, T. Li, F. Wu, L. van der Maaten and K. Weinberger (2018). “Multi-scale dense networks for resource efficient image classification.” ICLR.
  5. Y. Zhang, N. Suda, L. Lai and V. Chandra (2017). “Hello edge: keyword spotting on microcontrollers.” arXiv:1711.07128.
  6. A. Kansal, J. Hsu, S. Zahedi and M. Srivastava (2007). “Power management in energy harvesting sensor networks.” ACM Transactions on Embedded Computing Systems.