GroupBERT: Enhanced Transformer Architecture with Efficient Grouped Structures

Ivan Chelombiev, Daniel Justus, Douglas Orr, Anastasia S. D. Dietrich, Frithjof Gressmann, Alexandros Koliousis, Carlo Luschi

TL;DR

GroupBERT introduces a more compute-efficient Transformer encoder by interleaving multi-head attention with grouped convolutions and replacing dense feed-forward blocks with grouped feed-forward networks (GFFNs). By decoupling local sequence mixing from global attention and introducing structured parameter sparsity, GroupBERT Base outperforms BERT Large on masked language modeling while consuming less than half the training FLOPs and training time.

What Problem Does This Paper Address?

Transformer models like BERT dominate natural language processing, but their scale requires massive computational resources. Standard Transformer encoders suffer from two key architectural inefficiencies:

  1. Computational Bottleneck in FFNs: Feed-forward network (FFN) layers account for roughly two-thirds of total model FLOPs and parameter count. Naively applying grouped matrix multiplications often degrades representation quality.
  2. Redundant Attention Allocation: Multi-head attention (MHA) is computationally expensive, yet empirical studies show that many attention heads simply learn local, position-based patterns rather than complex, long-range token relationships.

Prior attempts to introduce grouped operations or convolutions into Transformers often struggled with hardware efficiency or suffered severe performance drops unless combined with heavy knowledge distillation.

Methods

GroupBERT redesigns the standard Transformer layer into a four-module sequence: Grouped Convolution $\rightarrow$ GFFN $\rightarrow$ Multi-Head Attention $\rightarrow$ GFFN.

[Input] -> [Grouped Conv] -> [GFFN] -> [MHA] -> [GFFN] -> [Output]

Key technical components include:

  • Asymmetric Grouped Feed-Forward Networks (GFFN): Rather than sparsifying both projection matrices, GroupBERT keeps the first expanding matrix dense (preventing representation loss) and sparsifies the second down-projection into $G = 4$ groups. It then adds a final dense linear projection to eliminate channel-locality constraints, cutting FFN parameters by 25% while maintaining performance.
  • Grouped Convolution Module: Employs a 1D grouped convolution over the sequence dimension (group size 16, kernel size 7) preceded by a Gated Linear Unit (GLU) and Swish activation. This explicitly handles short-range token interactions.
  • Training Dynamics Optimizations:
  • Uses Pre-Layer Normalization (Pre-LN) instead of Post-LN, stabilizing optimization and allowing a $4\times$ increase in learning rate.
  • Discards dropout during pre-training (restoring it only during fine-tuning), maximizing capacity when training on massive corpora.
  • Hardware-Aware Execution: Evaluated on Graphcore IPUs, whose on-chip SRAM mitigates the low arithmetic intensity (FLOPs-to-memory-access ratio) typical of grouped operations.

Datasets

  • Pre-training: English Wikipedia and BookCorpus (Zhu et al., 2015), split into Phase 1 (sequence length 128, 10 epochs) and Phase 2 (sequence length 384, 5 epochs).
  • Downstream Fine-Tuning: SQuAD v1.1 question-answering benchmark.
  • No new benchmarks or datasets were introduced.

Key Insights and Ideas

  • Decoupling Local and Global Interactions: Measuring normalized positional entropy across attention heads reveals that vanilla BERT Base averages 0.75, showing strong diagonal/local focus. Adding convolutions boosts entropy to 0.92, freeing attention heads to act as position-agnostic, long-range mixers.
  • Synergy Between Sequence Mixers and GFFNs: Ablations revealed that alternating every sequence-mixing block (both convolution and MHA) with its own dedicated GFFN delivers a significantly higher Pareto gain than simply stacking sequence modules or using single large FFNs.
  • Sparsity Placement Matters: Fan-out (expanding) layers in MLPs are disproportionately sensitive to pruning and grouping. Sparsifying the fan-in (projection) layer retains model expressivity.

Key Results

  • Pre-training FLOP & Time Efficiency: GroupBERT Base achieves a lower validation Masked Language Model (MLM) loss (1.516) than BERT Large, while requiring only 47% of the FLOPs and cutting wall-clock training time roughly in half (~2.1× training speedup).
  • SQuAD v1.1 Fine-tuning Performance:
  • Base Scale: GroupBERT Base achieves 83.5 Exact Match (EM) / 90.2 F1, outperforming BERT Base (81.6 EM / 88.9 F1).
  • Large Scale: GroupBERT Large achieves 85.5 EM / 91.7 F1, outperforming BERT Large (84.2 EM / 90.8 F1).
  • Pareto Superiority: Across Small, Medium, Base, and Large configurations, GroupBERT consistently shifts the Pareto frontier outward compared to standard BERT, DeLighT, and SqueezeBERT baselines.

Limitations and Future Work

  • Hardware Dependence: Grouped convolutions and sparse matrix operations have lower arithmetic intensity. While highly efficient on SRAM-based hardware (Graphcore IPU), they can face memory-bandwidth bottlenecks on conventional GPU architectures without custom kernels.
  • Language and Domain Scope: Experiments were conducted solely on English-language corpora.
  • Dataset Concerns: The authors acknowledge using BookCorpus, which has faced scrutiny regarding documentation and licensing ethics.
  • Future Directions: Incorporating dynamic weight sparsity and conditional computation/Mixture-of-Experts (MoE) to expand parameter capacity across multimodal or multilingual domains.

Summary updated

BibTeX
@inproceedings{chelombiev2022groupbert,
  author = {Ivan Chelombiev and Daniel Justus and Douglas Orr and Anastasia S. D. Dietrich and Frithjof Gressmann and Alexandros Koliousis and Carlo Luschi},
  title = {{GroupBERT: Enhanced Transformer Architecture with Efficient Grouped Structures}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=eYyvftCgtD},
}
Figure