HGRN2: Gated Linear RNNs with State Expansion

Zhen Qin, Songlin Yang, Weixuan Sun, Xuyang Shen, Dong Li +2 more
4/11/2024
cs.CL

No official code found. Best implementation: fla-org/flash-linear-attention (5,257 stars, MIT, last commit 2026-04-29). 2 more below.

Abstract

Hierarchically gated linear RNN (HGRN, \citealt{HGRN}) has demonstrated competitive training speed and performance in language modeling while offering efficient inference. However, the recurrent state size of HGRN remains relatively small, limiting its expressiveness. To address this issue, we introduce a simple outer product-based state expansion mechanism, which significantly enlarges the recurrent state size without introducing any additional parameters. This enhancement also provides a linear attention interpretation for HGRN2, enabling hardware-efficient training. Our extensive experiments verify the advantage of HGRN2 over HGRN consistently across different settings and competitive with other recurrent models.

View on arXivView PDF

Code Implementations(3)

MIT

🚀 Efficient implementations for emerging model architectures

5,257563Shell, PythonDec 20, 20235 months agoMIT
large-language-modelsmachine-learning-systemsnatural-language-processingsequence-modeling
OpenNLPLab/HGRN2Community100%

HGRN2: Gated Linear RNNs with State Expansion

582Shell, PythonApr 7, 20242 years ago
kyegomez/HGRN2Community66%
MIT

Implementation of the paper: "HGRN2: Gated Linear RNNs with State Expansion" in PyTorch

50ShellApr 15, 20241 years agoMIT

Similar Papers

Cite this paper

@article{qin2024hgrn,
  title  = {HGRN2: Gated Linear RNNs with State Expansion},
  author = {Zhen Qin and Songlin Yang and Weixuan Sun and Xuyang Shen and Dong Li and Weigao Sun and Yiran Zhong},
  year   = {2024},
  eprint = {2404.07904},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2404.07904v2}
}

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

Discussion