Randomized YaRN Improves Length Generalization for Long-Context Reasoning

Manas Mehta, Fangcong Yin, Greg Durrett


Abstract
Large language models (LLMs) are typically pretrained on short sequences and then extended to work on longer sequences with additional training. However, LLMs still struggle to generalize to very long sequences. We propose Randomized YaRN, a training method that improves length generalization by combining YaRN-based positional extrapolation with randomized positional encoding and a length curriculum. During training on short context data, tokens are assigned YaRN positional encodings sampled from a larger position range, exposing the model to out-of-distribution positional representations without requiring long-context inputs. We evaluate Randomized YaRN on two challenging long-context reasoning benchmarks, BABILong and Multi-Round Coreference Resolution (MRCR). When training on data with <8K context, Randomized YaRN consistently improves reasoning performance on context lengths from 16K to 128K and outperforms standard fine-tuning baselines, with the largest gains appearing at far out-of-distribution lengths. Our results suggest that progressively exposing models to OOD positional distributions provides an effective recipe for generalizable long-context reasoning.
Anthology ID:
2026.findings-emnlp.1409
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2026
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
Findings
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
30045–30055
Language:
URL:
https://aclanthology.org/2026.findings-emnlp.1409/
DOI:
10.18653/2026.findings-emnlp.1409
Bibkey:
Cite (ACL):
Manas Mehta, Fangcong Yin, and Greg Durrett. 2026. Randomized YaRN Improves Length Generalization for Long-Context Reasoning. In Findings of the Association for Computational Linguistics: EMNLP 2026, pages 30045–30055, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
Randomized YaRN Improves Length Generalization for Long-Context Reasoning (Mehta et al., Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-emnlp.1409.pdf