Anchor-based Large Language Models

Jianhui Pang, Fanghua Ye, Derek Fai Wong, Xin He, Wanshun Chen +1 more
2/12/2024
cs.CLcs.AI

No official code found. Best implementation: pangjh3/AnLLM (20 stars, last commit 2024-06-17).

Abstract

Large language models (LLMs) predominantly employ decoder-only transformer architectures, necessitating the retention of keys/values information for historical tokens to provide contextual information and avoid redundant computation. However, the substantial size and parameter volume of these LLMs require massive GPU memory. This memory demand increases with the length of the input text, leading to an urgent need for more efficient methods of information storage and processing. This study introduces Anchor-based LLMs (AnLLMs), which utilize an innovative anchor-based self-attention network (AnSAN) and also an anchor-based inference strategy. This approach enables LLMs to compress sequence information into an anchor token, reducing the keys/values cache and enhancing inference efficiency. Experiments on question-answering benchmarks reveal that AnLLMs maintain similar accuracy levels while achieving up to 99% keys/values cache reduction and up to 3.5 times faster inference. Despite a minor compromise in accuracy, the substantial enhancements of AnLLMs employing the AnSAN technique in resource utilization and computational efficiency underscore their potential for practical LLM applications.

View on arXivView PDF

Code Implementations(1)

pangjh3/AnLLMCommunity100%
205Shell, PythonMar 4, 20242 years ago

Similar Papers

Cite this paper

@article{pang2024anchorbased,
  title  = {Anchor-based Large Language Models},
  author = {Jianhui Pang and Fanghua Ye and Derek Fai Wong and Xin He and Wanshun Chen and Longyue Wang},
  year   = {2024},
  eprint = {2402.07616},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2402.07616v3}
}

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

Discussion