Blockwise Parallel Transformer for Large Context Models

Hao Liu, Pieter Abbeel
5/30/2023
cs.CLcs.LG

No official code found. Best implementation: haoliuhl/ringattention (773 stars, Apache-2.0, last commit 2025-10-13).

Abstract

Transformers have emerged as the cornerstone of state-of-the-art natural language processing models, showcasing exceptional performance across a wide range of AI applications. However, the memory demands posed by the self-attention mechanism and the large feedforward network in Transformers limit their ability to handle long sequences, thereby creating challenges for tasks involving multiple long sequences or long-term dependencies. We present a distinct approach, Blockwise Parallel Transformer (BPT), that leverages blockwise computation of self-attention and feedforward network fusion to minimize memory costs. By processing longer input sequences while maintaining memory efficiency, BPT enables training sequences 32 times longer than vanilla Transformers and up to 4 times longer than previous memory-efficient methods. Extensive experiments on language modeling and reinforcement learning tasks demonstrate the effectiveness of BPT in reducing memory requirements and improving performance.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Large Context Attention

77353PythonJun 1, 20231 years agoApache-2.0
large-language-modelslong-contextmemory-efficienttransformers

Similar Papers

Cite this paper

@article{liu2023blockwise,
  title  = {Blockwise Parallel Transformer for Large Context Models},
  author = {Hao Liu and Pieter Abbeel},
  year   = {2023},
  eprint = {2305.19370},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2305.19370v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2305.19370.svg)](https://codeofpaper.com/paper/2305.19370)

Discussion