FlashFFN: Multi-Head Decomposition Enables I/O-Aware Feed-Forward Network

Minshen Zhang, Xiang Hu, Jianguo Li, Wei Wu, Kewei TuNeurIPS 2026

TL;DR

FlashAttention revolutionized Transformers by fusing attention operations to stay inside ultra-fast GPU SRAM, yet the Feed-Forward Network (FFN) still forces GPUs to write massive intermediate tensors out to slow main memory. Why hasn't anyone given the FFN the same "Flash" treatment? Because a standard monolithic FFN is simply too wide to fit on chip—so the authors of FlashFFN redesign the FFN architecture around the physical geometry of GPU silicon, cutting memory usage by up to 2.7× while making models faster and smarter at the exact same compute budget.

What Problem Does This Paper Address?

Every modern LLM is essentially a repeating stack of two components: Attention and the Feed-Forward Network (FFN). To understand why FFNs bottleneck memory, picture a GPU's memory hierarchy: there is tiny, lightning-fast on-chip SRAM (like a workbench right in front of you, ~228 KB per streaming multiprocessor on an NVIDIA H100), and massive, much slower off-chip HBM (like a warehouse down the street).

Standard FFNs (like SwiGLU) take an input of width $d_{\text{model}}$, expand it into a wide intermediate tensor, apply an activation, and project it back down. Because that wide intermediate tensor is written to and read back from the HBM warehouse between matrix multiplications, it dominates activation memory at long sequences.

You might wonder: why not tile and fuse the FFN in one pass on the SRAM workbench, just like FlashAttention does? The authors prove a hardware-geometry constraint: under one-pass tiled execution, the GPU must hold an output accumulator spanning the entire hidden dimension ($d_{\text{model}}$) in SRAM. Once $d_{\text{model}} \ge 2048$, the working set balloons to ~2.3 MB—roughly 10× larger than an H100's SRAM budget. Attention only gets away with FlashAttention because it is already split into small heads!

Figure 1: Per-SM SRAM budget on H100 (Bq = 128, Bk = 64, bf16 inputs, fp32 accumulator). Multi-head FFN at dh =128 keeps all resident tiles (Qtile, Km, Um, Vm, Otile, plus the Cmisc margin) inside the 228 KB cutoff with headroom. Monolithic FFN at dh = dmodel = 2048 overflows by an order of magnitude: Qtile alone (512 KB) already exceeds the cutoff, and the full set sums to ∼2.3 MB. This illustrates Cor. 3.2.

Methods

Instead of trying to shoehorn an oversized FFN onto tiny silicon, the authors let the SRAM constraint dictate the neural architecture, deriving FlashFFN in three steps:

  1. Multi-Head Decomposition (R1): To shrink the SRAM footprint, they split the model dimension into $H$ independent FFN heads of width $d_h = d_{\text{model}} / H$ (e.g., $d_h = 128$). Now the per-tile working set depends on $d_h$ instead of $d_{\text{model}}$, fitting comfortably inside the 228 KB SRAM limit regardless of how large the overall model scales.
  2. Sub-Network Ratio Restoration (R2): Splitting into heads creates a sneaky second-order mathematical bug. Standard SwiGLU works best when its intermediate-to-input expansion ratio is roughly $8/3$. If you shrink a head's input width to $d_h$ while keeping the intermediate dimension big, that ratio explodes as models scale (hitting 45× at 1.3B parameters), degrading model quality. FlashFFN fixes this by dividing each head into $E$ parallel SwiGLU "sub-networks," each calibrated to the sweet-spot width $d_e \approx \frac{8}{3} d_h$. A lightweight router applies dense, per-token sigmoid-normalized gates to weight and sum the sub-networks (unlike sparse Mixture-of-Experts, all sub-networks run every step).
  3. Fused I/O-Aware Kernel: Written in Triton and ThunderKittens, the custom kernel loops over sub-networks and tiles completely on-chip. The wide intermediate activations live purely in registers and never touch HBM.
Figure 3: Per-head FFN structure (one head; replicated across all H). The per-head input enters E parallel SwiGLU sub-networks at the optimal de ≈(8/3)dh ratio (R2). The Router produces per-token sigmoid-normalized gates r1, . . . , rE that re-weight each sub-network’s output before aggregation into the head output S:,h,:.

Datasets

No new datasets are introduced; the authors rely on standard, well-established benchmarks:

  • Training: Models (128M, 370M, and 1.3B parameters) are trained from scratch on The Pile (60B tokens for 128M/370M; 100B tokens for 1.3B).
  • Evaluation: Language modeling perplexity (PPL) is evaluated on the PG19 validation split. Downstream zero-shot reasoning and reading comprehension are tested across six benchmarks: HellaSwag, SIQA, PIQA, OpenBookQA (OBQA), WinoGrande, and RACE.

Key Insights and Ideas

  • Architecture and kernel are mutually dependent: Neither trick works alone. Without multi-head splitting, a one-pass kernel physically cannot fit in SRAM. Without the fused kernel, multi-head splitting actually increases HBM traffic linearly with $H$ (causing out-of-memory crashes at 16K tokens).
  • Architectural synergy beats isolated tweaks: In 370M ablation studies, multi-head splitting alone (MH-FFN) washes out against the baseline because of the warped expansion ratio, while dense sub-networks alone (Dense-MoE) slightly hurt performance due to gating noise. Composing them together produces a strict quality jump—the sub-networks restore the $8/3$ expressivity floor inside each head's local subspace.
  • $d_h = 128$ is both a hardware and quality sweet spot: On an H100, the strict SRAM math caps $d_h$ at ~184. Sweeping $d_h \in \{64, 128, 256\}$ reveals that 128 isn't just safe for hardware occupancy—it also yields the best perplexity and downstream accuracy.

Key Results

At strictly matched parameter counts and FLOPs against a Llama-style SwiGLU baseline on H100 GPUs, FlashFFN achieves a true Pareto improvement—simultaneously better, faster, and lighter:

  • Peak Memory: Up to 2.74× lower per-layer peak FFN memory than eager SwiGLU and Liger Kernel, and up to 1.93× lower than torch.compile at 32K context.
  • Throughput: Up to 1.18× faster end-to-end model prefill (at 32K context) and 1.19× faster CUDA-graphed decode at 1.3B scale.
  • Model Quality: At 1.3B parameters, FlashFFN ($d_h=128$) drops PG19 perplexity by 0.84 points (16.33 vs. 17.17)—the largest improvement of all tested scales—and boosts average accuracy across the six downstream tasks by +1.60 points (43.35% vs. 41.75%), with the biggest jumps on reasoning-heavy tasks like HellaSwag (+3.49).
Figure 4: Pareto improvement at every scale. Eval PPL vs. measured per-layer peak FFN memory (H100, trained configu- rations, bs=8, L=8064, log x; values in Appendix G), a uniform reduction of about 2.6×. FlashFFN (blue) lies strictly south- west of SwiGLU (red) at 128M, 370M, and 1.3B.

Limitations and Future Work

  • Scale of Empirical Validation: Due to compute budgets, pretraining experiments top out at 1.3B parameters and 100B tokens, though the perplexity advantage over SwiGLU widened at the largest scale.
  • Dense Regime Only: All sub-networks are evaluated for every token, meaning FlashFFN does not decouple parameter capacity from FLOPs like sparse Mixture-of-Experts (MoE) models do. However, the authors point out a natural sequel (FlashMoE): applying top-$k$ sparse routing across the $H \times E$ sub-network pool to combine MoE scaling with SRAM-feasible execution.

Summary updated

Abstract

The Feed-Forward Network (FFN) dominates the activation memory of modern Transformers because the wide intermediate tensor is materialized in off-chip HBM between the two matmul stages. FlashAttention-style I/O-aware tiling avoids the analogous cost in attention, but the same one-pass fusion does not fit a monolithic FFN. We identify the reason as a hardware-geometry constraint: under one-pass tiled accumulation a fused FFN kernel must keep an output accumulator spanning the full hidden dimension in on-chip SRAM, which is infeasible for hidden dimensions of 2048 or more on currently shipping NVIDIA datacenter GPUs (A100/H100/B200) under one-pass tiled execution with sequence tiles of 128 or more tokens. We formalize this as an SRAM-feasibility proposition and prove a corollary: multi-head decomposition is the simplest architectural transform that brings FFN inside this SRAM-feasible regime, because it makes the per-head accumulator width (the hidden dimension divided by the number of FFN heads) a free parameter that can be driven below the GPU's SRAM cutoff. Naïve multi-head FFN, however, blows up the per-head expansion ratio as the hidden dimension grows, drifting away from the well-validated SwiGLU 8/3 optimum and degrading quality at scale; we resolve this with a dense MoE-like sub-network correction that restores the optimal ratio while preserving SRAM-feasibility. The resulting architecture, FlashFFN, is an SRAM-feasible FFN block that replaces SwiGLU under matched parameter and FLOPs budgets and derives directly from the SRAM constraint. Across 128M–1.3B parameter models trained on 60–100B tokens of The Pile, FlashFFN achieves a Pareto improvement over SwiGLU at fixed compute: up to 2.7× lower peak activation memory at long sequences, inference latency that matches or improves over SwiGLU (up to 1.18× faster end-to-end prefill and 1.19× faster decode on H100), and consistent quality gains (up to -0.84 in evaluation perplexity (PPL) and +1.60 average accuracy points across six downstream benchmarks at 1.3B). Code: https://github.com/alexzms/FlashMHF
BibTeX
@inproceedings{zhang2026flashffn,
  author = {Minshen Zhang and Xiang Hu and Jianguo Li and Wei Wu and Kewei Tu},
  title = {{FlashFFN: Multi-Head Decomposition Enables I/O-Aware Feed-Forward Network}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=b8w3ugs7jR},
}
Figure