Longhorn: State Space Models are Amortized Online Learners

Bo Liu, Rui Wang, Lemeng Wu, Yihao Feng, Peter Stone +1 more
7/1/2024

No official code found. Best implementation: Cranial-XIX/longhorn (57 stars, last commit 2024-12-04).

Abstract

Modern large language models are built on sequence modeling via next-token prediction. While the Transformer remains the dominant architecture for sequence modeling, its quadratic decoding complexity in sequence length poses a major limitation. State-space models (SSMs) present a competitive alternative, offering linear decoding efficiency while maintaining parallelism during training. However, most existing SSMs rely on linear recurrence designs that appear somewhat ad hoc. In this work, we explore SSM design through the lens of online learning, conceptualizing SSMs as meta-modules for specific online learning problems. This approach links SSM design to formulating precise online learning objectives, with state transition rules derived from solving these objectives. Based on this insight, we introduce a novel deep SSM architecture, Longhorn, whose update resembles the closed-form solution for solving the online associative recall problem. Our experimental results show that Longhorn outperforms state-of-the-art SSMs, including the Mamba model, on standard sequence modeling benchmarks, language modeling, and vision tasks. Specifically, Longhorn achieves a 1.8x improvement in sample efficiency compared to Mamba, and can extrapolate over contexts that are up to 16x longer during inference.

View on arXivView PDF

Code Implementations(1)

Official PyTorch Implementation of the Longhorn Deep State Space Model

573Shell, PythonJul 18, 20241 years ago

Similar Papers

Cite this paper

@article{liu2024longhorn,
  title  = {Longhorn: State Space Models are Amortized Online Learners},
  author = {Bo Liu and Rui Wang and Lemeng Wu and Yihao Feng and Peter Stone and Qian Liu},
  year   = {2024},
  eprint = {2407.14207},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2407.14207},
  journal = {ICLR 2024 2024}
}

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

Discussion