English

Reconsidering the Past: Optimizing Hidden States in Language Models

Computation and Language 2021-12-17 v1

Abstract

We present Hidden-State Optimization (HSO), a gradient-based method for improving the performance of transformer language models at inference time. Similar to dynamic evaluation (Krause et al., 2018), HSO computes the gradient of the log-probability the language model assigns to an evaluation text, but uses it to update the cached hidden states rather than the model parameters. We test HSO with pretrained Transformer-XL and GPT-2 language models, finding improvement on the WikiText103 and PG-19 datasets in terms of perplexity, especially when evaluating a model outside of its training distribution. We also demonstrate downstream applicability by showing gains in the recently developed prompt-based few-shot evaluation setting, again with no extra parameters or training data.

Keywords

Cite

@article{arxiv.2112.08653,
  title  = {Reconsidering the Past: Optimizing Hidden States in Language Models},
  author = {Davis Yoshida and Kevin Gimpel},
  journal= {arXiv preprint arXiv:2112.08653},
  year   = {2021}
}

Comments

Findings of EMNLP version

R2 v1 2026-06-24T08:19:48.390Z