Faster Activation Functions at the Edge for Post-Training Speedups

Anton Lydike, Jun Bi, Jackson WoodruffICML 2026

On-device AI has gained significant attention for enabling efficient, low-latency inference directly on edge devices, from smart home microcontrollers to mobile phones. However, the tight resource constraints of these platforms make deploying accurate, lightweight deep learning models a persistent challenge. A major, often-overlooked bottleneck in this deployment pipeline is the computational cost of modern activation functions.

The Edge Bottleneck: Complex Activation Functions

In deep learning, activation functions (AFs) are the mathematical engines that allow neural networks to learn complex, non-linear patterns. While the simple ReLU (Rectified Linear Unit) dominated the field for years due to its computational cheapness, modern architectures like Transformers and ConvNeXts rely heavily on "smoother" functions such as GELU or SiLU to achieve state-of-the-art accuracy.

The problem is that these smooth functions are computationally expensive. They require complex mathematical operations like exponentiation, division, and logarithms. High-end GPUs handle these with dedicated hardware "fast-paths," but edge devices do not. On a standard microcontroller, calculating a GELU can be up to 100x slower than a ReLU. This hardware limitation forces engineers into a frustrating trade-off: deploy a slow but accurate model, or a fast but less accurate one.

Introducing FFCC: The Power of Bit-Casting

To bridge this gap, researchers introduce FFCC (Fast Floating-point Compiler), a specialized compiler that automatically generates lightning-fast approximations of complex activation functions.

Instead of calculating precise exponential functions, FFCC revives and generalizes a classic low-level programming trick—famously used for the "Fast Inverse Square Root" in Quake III Arena—bringing it into the era of automated machine learning compilers. The core mechanism relies on bit-casting: reinterpreting the bits of a floating-point number as an integer.

Under the IEEE 754 standard, floating-point numbers are stored using a sign, an exponent, and a mantissa. The authors demonstrate that treating these floating-point bits as an integer yields a highly accurate, piecewise-linear approximation of a base-2 logarithm ($\log_2 x$). Conversely, treating an integer as a float approximates $2^x$. On modern CPUs with shared registers for integers and floats (like Intel chips with AVX2), this bit-casting operation is literally free, requiring zero CPU cycles.

The FFCC Pipeline

FFCC automates this bit-level manipulation through a streamlined pipeline:

  1. Normalization: The compiler ingests a mathematical expression (e.g., the formula for SiLU) and rewrites it using base-2 operations.
  2. Approximation: Expensive mathematical calls are replaced with bit-casting operations combined with simple additions and multiplications.
  3. Holistic Constant Tuning: To minimize approximation error, FFCC uses gradient descent via PyTorch to find "magic constants." Crucially, FFCC tunes the constants for the entire activation function expression at once, rather than tuning the exponential part in isolation. This holistic approach allows internal errors to cancel each other out, resulting in significantly higher accuracy.
  4. Lowering: Finally, FFCC outputs optimized code in PyTorch, NumPy, or LLVM-IR, ready to be dropped into an existing model.

Performance and Results

The researchers evaluated FFCC across standard benchmarks, including ImageNet (using ConvNeXt Tiny and Femto) and the MLPerf Tiny v1.1 suite (covering Image Classification, Keyword Spotting, and Anomaly Detection). The compiler was tested on architectures like MobileNetV2, ShuffleNetV2, DenseNet-121, ResNet-18, and SqueezeNet.

Massive Speedups: FFCC's approximations achieved order-of-magnitude speedups over accurate baselines. On an Arm Cortex-M7 microcontroller, FFCC was 13 to 26x faster than exact implementations. On Intel platforms, the generated approximations outperformed even the hand-tuned assembly kernels used in llama.cpp by 23x.

End-to-End Gains: These activation-level improvements translate directly to real-world performance. When applied to the ConvNeXt-Femto model, FFCC delivered a 1.2x to 1.37x overall end-to-end speedup across various stages of the model.

Post-Training Drop-in with Negligible Accuracy Loss: Unlike many optimization techniques that require expensive retraining from scratch, FFCC's approximations are accurate enough to be swapped into pre-trained models right before deployment. In most evaluated cases, the drop in model accuracy was less than 0.2 percentage points. Remarkably, in 7 out of 8 MLPerf Tiny benchmarks, there was no observable accuracy drop compared to using perfect mathematical functions.

Limitations and Future Directions

While FFCC offers a powerful solution for edge AI, it does have numerical boundaries. The bit-cast approximation is only stable within a specific range (roughly between -74 and 74 for single-precision floats). If a model produces activation values outside this window, the approximation can output zero or "explode."

Currently, developers must manually add "guards" (if-statements) to handle these extreme values, as the compiler does not yet generate them automatically. This limitation was observed in an Anomaly Detection model benchmark, where activations spanned an unusually wide numerical range, causing the approximation to fail.

Future work aims to make FFCC "distribution-aware." By analyzing the expected distribution of a model's activations, a future iteration of the compiler could automatically determine exactly when and where to apply these bit-casting approximations safely, further streamlining the deployment of high-accuracy AI on the edge.

Summary updated

BibTeX
@inproceedings{lydike2026faster,
  author = {Anton Lydike and Jun Bi and Jackson Woodruff},
  title = {{Faster Activation Functions at the Edge for Post-Training Speedups}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=u2o6hPE8ik},
}
Figure