KV Shifting Attention Enhances Language Modeling

Mingyu Xu, Wei Cheng, Bingning Wang, Weipeng Chen
11/29/2024
cs.CL

No official code found. Best implementation: erogol/BlaGPT (117 stars, PyTorch, last commit 2026-01-26).

Abstract

The current large language models are mainly based on decode-only structure transformers, which have great in-context learning (ICL) capabilities. It is generally believed that the important foundation of its ICL capability is the induction heads mechanism, which requires at least two layers attention. In order to more efficiently implement the ability of the model's induction, we revisit the induction heads mechanism and proposed a KV shifting attention. We theoretically prove that the KV shifting attention reducing the model's requirements for the depth and width of the induction heads mechanism. Our experimental results demonstrate that KV shifting attention is beneficial to learning induction heads and language modeling, which lead to better performance or faster convergence from toy models to the pre-training models with more than 10 B parameters.

View on arXivView PDF

Code Implementations(1)

erogol/BlaGPTCommunity100%
PyTorch

Experimental playground for benchmarking language model (LM) architectures, layers, and tricks on smaller datasets. Designed for flexible experimentation and exploration.

11712C++, CudaOct 20, 20248 months ago
attention-mechanismsdeep-learningdiffusion-llmdllmgpt+9 more

Similar Papers

Cite this paper

@article{xu2024shifting,
  title  = {KV Shifting Attention Enhances Language Modeling},
  author = {Mingyu Xu and Wei Cheng and Bingning Wang and Weipeng Chen},
  year   = {2024},
  eprint = {2411.19574},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2411.19574v2}
}

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

Discussion