LayerNorm Induces Recency Bias in Transformer Decoders

Junu Kim, Xiao Liu, Zhenghao Lin, Lei Ji, Yeyun Gong +1 more
9/25/2025
cs.CLcs.LG

No official code found. Best implementation: starmpcc/layernorm_recency_bias (4 stars, MIT, last commit 2026-04-20).

Abstract

Causal self-attention provides positional information to Transformer decoders. Prior work has shown that stacks of causal self-attention layers alone induce a positional bias in attention scores toward earlier tokens. However, this differs from the bias toward later tokens typically observed in Transformer decoders, known as recency bias. We address this discrepancy by analyzing the interaction between causal self-attention and other architectural components. We show that stacked causal self-attention layers combined with LayerNorm induce recency bias. Furthermore, we examine the effects of residual connections and the distribution of input token embeddings on this bias. Our results provide new theoretical insights into how positional information interacts with architectural components and suggest directions for improving positional encoding strategies.

View on arXivView PDF

Code Implementations(1)

MIT

An official implementation of paper "LayerNorm Induces Recency Bias in Transformer Decoders"

40Jupyter NotebookSep 25, 20256 months agoMIT

Similar Papers

Cite this paper

@article{kim2025layernorm,
  title  = {LayerNorm Induces Recency Bias in Transformer Decoders},
  author = {Junu Kim and Xiao Liu and Zhenghao Lin and Lei Ji and Yeyun Gong and Edward Choi},
  year   = {2025},
  eprint = {2509.21042},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2509.21042v2}
}

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

Discussion