Short-Term Memory Convolutions

Grzegorz Stefański, Krzysztof Arendt, Paweł Daniluk, Bartłomiej Jasik, Artur Szumaczuk

TL;DR

Short-Term Memory Convolutions (STMC) is a novel optimization for convolutional neural networks (CNNs) that slashes inference latency and memory usage in real-time tasks like speech separation. By using layer-wise shift registers to cache intermediate feature maps, STMC achieves the low-latency benefits of Recurrent Neural Networks (RNNs) while maintaining the training stability and performance of CNNs—all without requiring the model to be retrained.

The Latency Tax in Real-Time Processing

In the world of real-time audio processing (like noise cancellation or live captions), latency is the enemy. Humans are incredibly sensitive to audio-visual lags; delays over 40ms can ruin a conversation.

While Deep Learning has revolutionized signal quality, it has introduced a "latency tax." Standard CNNs require a "chunk" of data at least as large as their receptive field to produce a single output. To get high-quality results, these chunks often overlap, leading to redundant calculations and high "algorithmic latency." RNNs and LSTMs can process data sample-by-sample, but they are notoriously harder to parallelize and train than CNNs. The authors sought a way to give CNNs the "streaming" efficiency of RNNs without sacrificing their architectural advantages.

Methods: Caching for Efficiency

The authors introduce Short-Term Memory Convolutions (STMC) and their decoder-side counterpart, transposed STMC (tSTMC).

Diagram illustrating the architecture of Short-Term Memory Convolution (STMC) and transposed STMC (tSTMC), highlighting the use of memory buffers to cache previous states.

The core idea is layer-wise caching. Instead of just caching the raw input (incremental inference), STMC caches the output of every convolutional layer in shift registers. When a new, small chunk of data arrives:

  1. The model only calculates the convolution for the brand-new data points.
  2. It retrieves the "past context" from the shift registers.
  3. It concatenates the new results with the cached ones to form the input for the next layer.

This ensures that every mathematical operation is performed exactly once. Furthermore, the authors tackle a subtle mathematical hurdle: transposed convolutions (used in U-Nets to upsample data) are naturally "anti-causal," meaning they technically look into the future. The paper proposes a systematic way to shift these operations and skip-connections to ensure the model remains strictly causal (only looking at the past and present).

Illustration of how STMC handles skip connections in an encoder-decoder architecture, ensuring causal processing without looking ahead.

Datasets and Evaluation

The researchers evaluated their method on two distinct tasks:

  • Speech Separation: They used the Deep Noise Suppression (DNS) Challenge (Interspeech 2020) dataset, which contains roughly 100 million audio samples. They tested this using a U-Net architecture.
  • Acoustic Scene Classification (ASC): They used the TAU Urban Acoustic Scene 2020 Mobile dataset, evaluating a GhostNet architecture to see how STMC performs in smaller, mobile-oriented models.

Key Insights

  • Zero Redundancy: Unlike standard sliding-window CNN inference, STMC ensures no part of the signal is processed twice. This makes computation time scale linearly with the chunk size.
  • Post-Training Compatibility: One of the biggest advantages is that STMC is applied after the model is trained. You can take a standard, high-performing CNN and "convert" it into an STMC version without losing accuracy or needing to re-run expensive training cycles.
  • The "Anti-Causal" Trap: The authors highlight that simply making a model "causal" isn't enough when using auto-encoders. Transposed convolutions in the decoder naturally create a look-ahead effect that must be manually countered by shifting indices, a detail often overlooked in real-time DL research.
  • Memory vs. Speed Trade-off: While STMC requires extra memory to store the shift registers, it significantly reduces peak memory consumption during inference because the active data chunks being processed are much smaller.

Key Results

The performance gains are substantial, particularly for audio-focused architectures:

  • Speech Separation (U-Net): On a desktop CPU, STMC achieved a 5-fold reduction in inference time and a 2-fold reduction in total latency compared to standard incremental inference, with zero impact on signal quality (SI-SNRi).
  • Mobile Performance: On a Samsung Galaxy Fold 3, the inference time for a causal U-Net dropped from 14.02ms to just 2.77ms using tSTMC.
  • Acoustic Scene Classification: Using GhostNet, STMC was up to 4 times faster on CPU while preserving the original accuracy (65.83%). It even outperformed specialized MobileViT models in terms of the speed-to-accuracy trade-off for this specific task.

Limitations and Future Work

While powerful, STMC isn't a universal solution for every architecture:

  • Layer Specificity: It is currently designed specifically for convolutional and pooling layers. It doesn't apply to architectures dominated by Attention mechanisms or pure LSTMs.
  • Implementation Complexity: While the theory is task-agnostic, the exact implementation of shift registers becomes significantly more complex when dealing with varied strides and dilations across many layers.
  • Causality Requirement: To get the best latency results, the underlying model should be trained with causal convolutions. Applying STMC to a non-causal model still requires a "look-ahead" buffer, which limits the latency reduction.

The authors suggest that future work could involve integrating STMC into standard deep learning frameworks to make these optimizations more accessible to developers.

Summary updated

BibTeX
@inproceedings{stefanski2023short,
  author = {Grzegorz Stefański and Krzysztof Arendt and Paweł Daniluk and Bartłomiej Jasik and Artur Szumaczuk},
  title = {{Short-Term Memory Convolutions}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=4DU_HCijfJp},
}
Figure