Don't Think It Twice: Exploit Shift Invariance for Efficient Online Streaming Inference of CNNs

Christodoulos Kechris, Jonathan Dan, José Miranda, David Atienza

TL;DR

StreamiNNC is a novel strategy that slashes the computational cost of running Convolutional Neural Networks (CNNs) on live time-series data. By exploiting the mathematical property of shift invariance, it skips redundant calculations in overlapping data windows, achieving a linear speedup while maintaining high accuracy (within 2-4% of standard inference).

The Problem: Redundant Computation in Streaming

In applications like wearable health monitors or robotics, AI models must process data in "streaming" mode—producing an output as soon as a new data point arrives. To ensure smooth results and handle edge effects, these models typically process overlapping windows of data.

However, this creates a massive efficiency gap: if you move a window by just one sample, you are re-calculating almost the exact same features you just computed for the previous window. While convolutions are theoretically "shift-invariant" (meaning a shift in input results in a corresponding shift in output), standard deep learning practices like zero-padding and pooling break this property. This makes it difficult to reuse previous calculations without the model's accuracy falling apart.

The StreamiNNC Framework

The authors introduce StreamiNNC, a framework to adapt CNNs for efficient streaming by restoring shift invariance. Key components include:

  • Signal Padding: Instead of padding the edges of a data window with zeros (which introduces "fake" positional information), they use "Signal Padding." This involves buffering actual activations from the previous window to use as the "padding" for the current one, creating an "Aggregated Embedding."
  • Pooling Alignment: The authors prove that pooling is only perfectly shift-invariant if the window step size is a multiple of the pooling length. For cases where they aren't aligned, they derive theoretical error upper bounds to predict the resulting noise.
  • Incremental Computation: Instead of re-processing the whole window, the system only computes the activations for the new incoming samples and appends them to a buffer.
Signal Padding vs. Zero Padding: Signal padding uses actual past activations to maintain shift invariance, whereas zero padding introduces artifacts that lead to approximate, less accurate embeddings.

Key Insights

Zero-Padding is the Enemy

In deep networks, the "damage" from zero-padding compounds. By the 5th or 6th layer, over 50% of the activations can be "corrupted" by the influence of those edge zeros, making standard streaming nearly impossible for deep architectures without significant accuracy loss.

The corruption of zero-padding: As data moves through deeper convolutional layers, the percentage of activations affected by edge zeros increases significantly, reaching over 50% by the 5th layer.

"Good Enough" Pooling

While pooling isn't always perfectly invariant, the authors show that if the sampling frequency is high enough relative to the signal's bandwidth, the error from misaligned pooling becomes negligible. This allows StreamiNNC to remain effective even in architectures with complex pooling layers.

Key Results

  • High Fidelity: StreamiNNC achieved a very low deviation from "full" (standard) inference, with a Normalized Root Mean Squared Error (NRMSE) between 2.03% and 3.55% across three biomedical applications (PPG heart rate extraction, EEG seizure detection, and wrist acceleration monitoring).
  • Linear Speedup: The computational saving is linear. If windows overlap by 90%, the system can theoretically achieve nearly a 10x speedup by only calculating the 10% of "new" information. In practice, they achieved a speedup coefficient of roughly 0.13x the original cost.
  • Accuracy Recovery: In the heart rate task, switching from zero-padding to signal padding reduced the NRMSE from a broken 18.91% down to a functional 2.60%.

Limitations and Future Work

  • The Classifier Bottleneck: StreamiNNC optimizes the feature extractor (convolutional layers). However, the final classifier (usually fully connected layers) is not shift-invariant. Using Fully Convolutional Networks (FCNs) could potentially solve this.
  • Memory Overhead: To achieve "exact" streaming, the system must store buffers of activations for every layer. For very deep or wide networks, this increased memory footprint is a trade-off against the computational speedup.
  • Future Directions: The authors suggest extending these strategies to more modern architectures, such as group-equivariant self-attention layers, which also possess specific invariance properties.

Summary updated

BibTeX
@inproceedings{kechris2025don,
  author = {Christodoulos Kechris and Jonathan Dan and José Miranda and David Atienza},
  title = {{Don't Think It Twice: Exploit Shift Invariance for Efficient Online Streaming Inference of CNNs}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i17.33958},
}
Figure