← Lab /AI/ML

Constant-time activation functions achieve identical cycle counts on ARM Cortex-M4

The proposed methodology yields activation-function implementations with fixed execution time and high numerical accuracy on microcontrollers

AI/ML arXiv 21 May 2026 Method Prototype evidence Threat model

Published as “A Constant-Time Implementation Methodology for Activation Functions on Microcontrollers”

Why it matters

Enables side-channel-resistant neural-network inference on resource-constrained edge devices without relying on random delays.

Summary

The paper shows that a constant-time implementation methodology yields activation-function code that runs in exactly 108 clock cycles for all inputs across ReLU, sigmoid, tanh, GELU and Swish on an ARM Cortex-M4, eliminating input-dependent timing leakage; the evidence comes from cycle-accurate measurements on a real STM32F411 board. It also demonstrates that a prior desynchronization-based countermeasure remains breakable with a template-based timing attack. The evaluation is limited to single-precision floating-point functions on one microcontroller and does not cover special IEEE values.

What they found 3

  1. Desynchronization-based countermeasure can still be attacked using a template-based timing analysis.

    “we show, for ReLU, sigmoid, and tanh, that a desynchronization-based countermeasure can still be attacked using a template-based timing analysis.”

  2. Unprotected sigmoid and tanh implementations show visible input-dependent timing variation.

    “sigmoid and tanh exhibit visible input-dependent timing variation.”

  3. Unprotected ReLU runs ~12 cycles, sigmoid ~221 cycles, tanh ~403 cycles, confirming a timing-leakage baseline.

    “ReLU exhibits the lowest execution time and remains close to 12 cycles (0.143 μs) over the evaluated domain, whereas the unprotected sigmoid and tanh implementations require substantially longer execution times, approximately 221 cycles (2.63 μs) and 403 cycles (4.80 μs), respectively.”

What’s new here 4

  • Applies a constant-time design (branchless, masking, cycle-aligned) to five common activation functions on microcontrollers.
  • Uses a shared Padé-type rational approximation as both an efficiency and side-channel mitigation component.
  • Shows that desynchronization-based hiding can still be defeated by a profiled template attack.
  • Provides a reusable methodology that can be instantiated for other activation functions.

Threat model stated by the source

Adversaryattacker targeting embedded neural-network inference on a microcontroller
Capabilitycan observe execution time of activation-function evaluations and collect reference measurements to build statistical models
Assumesattacker may perform profiled attacks; attacker has access to repeated timing measurements