Leave No Context Behind: Efficient Infinite Context Transformers with Infini-attention

Tsendsuren Munkhdalai, Manaal Faruqui, Siddharth Gopal
4/10/2024
cs.CLcs.AIcs.LG

No official code found. Best implementation: Beomi/InfiniTransformer (374 stars, MIT, PyTorch, last commit 2024-04-23). 2 more below.

Abstract

This work introduces an efficient method to scale Transformer-based Large Language Models (LLMs) to infinitely long inputs with bounded memory and computation. A key component in our proposed approach is a new attention technique dubbed Infini-attention. The Infini-attention incorporates a compressive memory into the vanilla attention mechanism and builds in both masked local attention and long-term linear attention mechanisms in a single Transformer block. We demonstrate the effectiveness of our approach on long-context language modeling benchmarks, 1M sequence length passkey context block retrieval and 500K length book summarization tasks with 1B and 8B LLMs. Our approach introduces minimal bounded memory parameters and enables fast streaming inference for LLMs.

View on arXivView PDF

Code Implementations(3)

PyTorchMIT

PyTorch implementation of Infini-Transformer from "Leave No Context Behind: Efficient Infinite Context Transformers with Infini-attention" (https://arxiv.org/abs/2404.07143)

30024PythonApr 15, 20242 years agoMIT
attention-mechanismdeep-learninginfini-attentionlong-contextmixture-of-depths+2 more
PyTorchMIT

Unofficial PyTorch/🤗Transformers(Gemma/Llama3) implementation of Leave No Context Behind: Efficient Infinite Context Transformers with Infini-attention

37435Shell, PythonApr 12, 20242 years agoMIT
gemmahuggingfaceinfinitransformerllamallama3+2 more
PyTorch

Really simple unofficial PyTorch implementation of the InfiniAttention paper (https://arxiv.org/pdf/2404.07143).

111PythonJun 14, 20242 years ago
infini-attentionpytorchpytorch-implementation

Similar Papers

Cite this paper

@article{munkhdalai2024leave,
  title  = {Leave No Context Behind: Efficient Infinite Context Transformers with Infini-attention},
  author = {Tsendsuren Munkhdalai and Manaal Faruqui and Siddharth Gopal},
  year   = {2024},
  eprint = {2404.07143},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2404.07143v2}
}

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/2404.07143.svg)](https://codeofpaper.com/paper/2404.07143)

Discussion