Skip to main content
Back

Learnable Pulse Accumulator Runs Speech AI 3.27x Faster on iPhones

A new O(n) sequence mixer swaps attention for learned gate windows, cutting wav2vec2 inference by 3.27x at 120 seconds of audio.

Pro

  • New O(n) attention replacement called Learnable Pulse Accumulator uses learned gate windows instead of key-query dot products.
  • Replacing 8 of 12 wav2vec2 layers gives 10.61% WER on LibriSpeech test-clean vs 3.37% baseline.
  • Delivers 3.27x speedup at 120s audio on Apple M4 Pro through a fused MLX inference kernel.
  • An MSE diagnostic sweep determines which layers are safe to replace and in what order.
  • Depth wall appears at 8-9 layers in wav2vec2 but not in acoustic-only SepFormer, suggesting a linguistic-computation boundary.
  • All operations map to mobile neural accelerators; code and checkpoints promised on publication.

Self-attention is the bottleneck nobody wants on a phone. It scales quadratically with sequence length, and speech models push thousands of frames per utterance at 50 Hz, so memory and latency blow up fast on any device that isn't sitting in a data center. A new paper proposes a swap: replace most attention layers in a pretrained speech encoder with a cheap O(n) primitive called the Learnable Pulse Accumulator (LPA), and keep the accuracy loss manageable enough to be practical.

After replacing 8 of 12 attention layers in wav2vec2-base, the model hits 10.61% word error rate on LibriSpeech test-clean, +7.24 percentage points over the 3.37% baseline, with a 3.27x speedup at 120 seconds of audio on an Apple M4 Pro using an optimized MLX inference path.

Why attention hurts on the edge

The pain isn't just the FLOP count. Neural accelerators like Apple's ANE and Qualcomm Hexagon achieve peak throughput on element-wise and convolution operations but lack efficient support for the dynamic n by n matrix multiplications that attention requires. This forces GPU fallback and negates the accelerator's power efficiency. Even if you have dedicated silicon on your phone, attention refuses to use it well.

Prior workarounds each carry a compromise. Linear attention approximates the softmax kernel. State space models like Mamba use recurrent state evolution. SummaryMixing uses mean pooling. LPA takes a different angle by learning explicit windows over the sequence instead of trying to approximate the attention math.

Gates instead of dot products

The core idea is a matched-filter argument. If the useful signal in a layer lives on a contiguous stretch of time, you don't need pairwise similarity scores; you just need to know where the stretch is and average inside it. LPA turns that intuition into three complementary gate types that each pulse can use:

  • Aperiodic gates predict a center and half-width from the input, producing a soft rectangular window around a content-dependent location.
  • Periodic gates predict a period, phase, and duty cycle to capture rhythmic structure like syllable rate. Period is initialized across scales from about 10 to 512 frames to capture phoneme-to-word-level repetitions.
  • Positional gates are content-independent, built from a learned combination of sin/cos basis functions to encode fixed structural biases.

Each pulse produces a gated mean of value-projected features, and the layer output is a weighted sum across pulses. Per-layer cost is O(nPd + nd^2) versus attention's O(n^2d + nd^2). At 120 seconds of audio, that translates to 281 KB of gate memory against attention's 137 MB, a 500x reduction.

Retrofitting a pretrained model

Training this from scratch would be one path. The more interesting contribution is a conversion procedure that takes a pretrained wav2vec2 checkpoint and swaps in LPA layers one at a time. Two ingredients drive it:

  1. MSE diagnostic sweep. Each layer gets temporarily replaced with an overprovisioned LPA and trained for two epochs to match the original attention output. The resulting MSE gives a difficulty score, and elastic net regularization prunes unused pulses to reveal how much capacity that layer actually needs.
  2. Progressive replacement in easy-to-hard order. Layers are converted from lowest MSE upward, with selective weight init from the original attention, temperature annealing on the gates (soft to near-binary), FFN co-adaptation at a lower learning rate, and joint alignment across all replaced layers.

The ablation is illuminating. Selective initialization from attention weights combined with layer norm unfreezing account for -31.8 pp, the single largest gain. Replacement order matters more than fancier architecture: deferring the hard layer 8 from position 3 to position 7 reduces 6/12 WER from 7.32% to 5.64%. Total training cost for the full pipeline is around 4 GPU-hours on an H100.

The depth wall

Push replacement past 8 or 9 layers and quality falls off a cliff. The transition from 9/12 to 10/12 adds +13-20 pp depending on configuration. The MSE sweep explains why: layer 11 has MSE 60x higher than layer 0 (0.370 vs. 0.006), and layer 10 is 15x harder. The author's read is that the deep layers of wav2vec2 do linguistic computation that genuinely needs content-dependent global routing.

To test that hypothesis, the same recipe is applied to SepFormer, a speech enhancement model that is purely acoustic. All 16 layers are replaced, every stage remains above baseline, and no depth wall appears. That is meaningful evidence the wall reflects what the layer is doing rather than a ceiling of the LPA primitive itself.

Where the speedup actually comes from

Trained gates end up near-binary once temperature annealing finishes, so at inference the aperiodic sigmoid product collapses to a simple contiguous-frame indicator. The paper ports the model to Apple's MLX framework and computes gate accumulation as a dense binary matmul on GPU, avoiding CPU-GPU sync overhead entirely.

Audio lengthFP16 attentionLPA on MLXSpeedup
10s45 ms42 ms1.07x
30s186 ms125 ms1.49x
60s522 ms244 ms2.14x
120s1767 ms540 ms3.27x

A useful subtlety at batch size 1: pulse count is essentially free. The four 768x768 linear projections account for 60% of LPA time and are completely pulse-count-independent. Going from 12 to 36 pulses per layer adds under 1% latency because the accumulation is memory-bandwidth-bound on the input tensor.

What it fits and what it doesn't

LPA works well when you want long-form, on-device streaming ASR and can tolerate a WER gap in exchange for real-time factors around 0.0045 at two minutes of audio. The near-binary gates map cleanly to mobile neural accelerators, which is where attention consistently falls off silicon. It is not a drop-in replacement for attention in tasks that need content-dependent global routing, and the +7.24 pp WER gap at 8/12 replacement is real, not a rounding error.

Several factors suggest the gap is reducible: no distillation loss is used, only 4 attention layers are kept (aligning with the 3:1 linear-to-attention ratio Qwen3-Next found optimal), and hyperparameter search was limited to a single temperature schedule. LPA also composes with quantization and distillation, since its element-wise operations quantize cleanly to low precision.

The author states that code and pretrained checkpoints will be released upon publication. For anyone shipping speech models to phones, the practical takeaway is the pairing itself: a diagnostic that tells you which layers are safe to swap, alongside a primitive that maps to accelerator-friendly ops.