FFN Fusion: Rethinking Sequential Computation in Large Language Models

Akhiad Bercovich, Mohammed Dabbah, Omri Puny, Ido Galil, Amnon Geifman, Yonatan Geifman, Izhak Golan, Ehud Dov Karpas, Itay Levy, Zach Moshe, Najeeb Nabwani, Tomer Ronen, Itamar Schen, Ido Shahaf, Oren Tropp, Ran Zilberstein, Ran El-Yaniv

TL;DR

Researchers have introduced FFN Fusion, an architectural optimization technique that transforms sequential Feed-Forward Network (FFN) layers in Large Language Models (LLMs) into parallel operations. By merging these layers, they distilled Llama-3.1-405B into a highly efficient Ultra-253B-Base model. This new architecture achieves a 1.71x speedup in inference latency and a 35x lower cost per token, all while maintaining—and sometimes exceeding—the original model's accuracy.

Introduction: The Sequential Bottleneck

As LLMs scale to hundreds of billions of parameters, the "sequential bottleneck" becomes a critical barrier to efficient inference. Standard Transformers process data through a long series of sequential blocks, each containing an attention layer followed by an FFN. On modern hardware like H100 GPUs, the time spent on communication (synchronizing data between GPUs in a Tensor Parallel setup) and the overhead of launching many small operations often outweighs the actual computation time.

While techniques like structural pruning can remove layers, they often struggle to find significant redundancy without hurting accuracy. The authors identify a specific, unexploited opportunity: after pruning certain attention layers, models are left with long "runs" of consecutive FFN layers. FFN Fusion asks a fundamental question: Do these layers really need to execute sequentially, or can we run them simultaneously?

Methodology: Pruning and Fusion

The authors propose a two-step optimization pipeline to restructure the model for parallel execution:

FFN Fusion Pipeline
  1. Structural Pruning (Puzzle): First, they utilize the "Puzzle" framework to identify and remove redundant attention layers. This step creates uninterrupted sequences of FFNs.
  2. FFN Fusion: This is the core architectural innovation. Instead of calculating the layers sequentially (e.g., $FFN_2(FFN_1(X))$), the model calculates them in parallel (e.g., $FFN_1(X) + FFN_2(X)$).
  3. Mathematical Equivalence: The authors demonstrate that summing multiple FFN outputs is mathematically equivalent to passing the input through a single, much wider FFN where the weight matrices are concatenated.
  4. Dependency Analysis: To ensure parallelization doesn't degrade model behavior, they employ a Pairwise Block Dependency Heatmap. By measuring the cosine distance between layer outputs when predecessors are removed, they identify "weakly coupled" regions that are safe to fuse.
  5. Refinement: Following fusion, lightweight Knowledge Distillation (KD) and Continual Pre-training (CPT) are applied using a 224-billion token dataset (a mix of FineWeb, Dolma, Buzz-V1.2, and synthetic data) to recover any minor performance drops.

Key Insights

  • Sequentiality is Overrated: A major takeaway is that many layers in deep LLMs do not strictly depend on the fine-grained details of the immediately preceding layer. Instead, they operate more like parallel contributors to a shared residual stream.
  • Hardware-Aware Optimization: In a Tensor Parallel (TP) setting, every sequential layer requires an all-reduce synchronization operation. Fusing 50 layers into just 4 parallel sequences eliminates 46 synchronization points, drastically reducing latency.
  • The "Wide" Advantage: GPUs are significantly more efficient at processing one large matrix multiplication (GEMM) than many small ones. FFN Fusion naturally creates these larger, hardware-friendly operations.

Key Results

The flagship result of this methodology is Ultra-253B-Base, derived from the Llama-3.1-405B-Instruct model.

Performance Comparison of Ultra-253B-Base
  • Efficiency: The fused model delivers a 1.71x speedup in user latency and an impressive 35x reduction in cost per token at a batch size of 32.
  • Performance: Despite having approximately 150B fewer parameters, Ultra-253B-Base achieves 87.54% on MMLU Instruct and 84.92% on Arena Hard, matching or beating its 405B parent model.
  • Memory: The architecture reduces the KV-cache memory footprint by 2x.
  • Scalability: The technique is not limited to a single model family; it was successfully validated across different architectures (Mistral Large 2) and scales (Llama 8B).

Limitations and Future Work

While highly effective, FFN Fusion has boundaries. The authors noted that the very last FFN in a sequence is often highly sensitive; fusing it usually leads to a significant accuracy drop, so it is typically left unfused. Additionally, while parallelizing full blocks (Attention + FFN) is theoretically possible, it currently results in higher accuracy degradation compared to FFN-only fusion and lacks native support in optimized inference kernels like vLLM.

A promising future direction is applying FFN Fusion to Mixture-of-Experts (MoE) architectures, potentially fusing expert layers while maintaining sparse activation patterns to further push the boundaries of LLM efficiency.

Summary updated

BibTeX
@inproceedings{bercovich2025ffn,
  author = {Akhiad Bercovich and Mohammed Dabbah and Omri Puny and Ido Galil and Amnon Geifman and Yonatan Geifman and Izhak Golan and Ehud Dov Karpas and Itay Levy and Zach Moshe and Najeeb Nabwani and Tomer Ronen and Itamar Schen and Ido Shahaf and Oren Tropp and Ran Zilberstein and Ran El-Yaniv},
  title = {{FFN Fusion: Rethinking Sequential Computation in Large Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=XUmGMBRv4M},
}
Figure