English

The EOS Decision and Length Extrapolation

Computation and Language 2020-10-15 v1

Abstract

Extrapolation to unseen sequence lengths is a challenge for neural generative models of language. In this work, we characterize the effect on length extrapolation of a modeling decision often overlooked: predicting the end of the generative process through the use of a special end-of-sequence (EOS) vocabulary item. We study an oracle setting - forcing models to generate to the correct sequence length at test time - to compare the length-extrapolative behavior of networks trained to predict EOS (+EOS) with networks not trained to (-EOS). We find that -EOS substantially outperforms +EOS, for example extrapolating well to lengths 10 times longer than those seen at training time in a bracket closing task, as well as achieving a 40% improvement over +EOS in the difficult SCAN dataset length generalization task. By comparing the hidden states and dynamics of -EOS and +EOS models, we observe that +EOS models fail to generalize because they (1) unnecessarily stratify their hidden states by their linear position is a sequence (structures we call length manifolds) or (2) get stuck in clusters (which we refer to as length attractors) once the EOS token is the highest-probability prediction.

Cite

@article{arxiv.2010.07174,
  title  = {The EOS Decision and Length Extrapolation},
  author = {Benjamin Newman and John Hewitt and Percy Liang and Christopher D. Manning},
  journal= {arXiv preprint arXiv:2010.07174},
  year   = {2020}
}

Comments

16 page, 7 Figures, 9 Tables, Blackbox NLP Workshop at EMNLP 2020

R2 v1 2026-06-23T19:20:58.704Z