PSC: Extending Context Window of Large Language Models via Phase Shift Calibration

Wenqiao Zhu, Chao Xu, Lulu Wang, Jun Wu
5/18/2025
cs.CLcs.AI

Official code: WNQzhu/PSC (2 stars, last commit 2025-05-15).

Abstract

Rotary Position Embedding (RoPE) is an efficient position encoding approach and is widely utilized in numerous large language models (LLMs). Recently, a lot of methods have been put forward to further expand the context window based on RoPE. The core concept of those methods is to predefine or search for a set of factors to rescale the base frequencies of RoPE. Nevertheless, it is quite a challenge for existing methods to predefine an optimal factor due to the exponential search space. In view of this, we introduce PSC (Phase Shift Calibration), a small module for calibrating the frequencies predefined by existing methods. With the employment of PSC, we demonstrate that many existing methods can be further enhanced, like PI, YaRN, and LongRoPE. We conducted extensive experiments across multiple models and tasks. The results demonstrate that (1) when PSC is enabled, the comparative reductions in perplexity increase as the context window size is varied from 16k, to 32k, and up to 64k. (2) Our approach is broadly applicable and exhibits robustness across a variety of models and tasks. The code can be found at https://github.com/WNQzhu/PSC.

View on arXivView PDF

Code Implementations(1)

WNQzhu/PSCOfficial100%

PSC: Extending Context Window of Large Language Models via Phase Shift Calibration [EMNLP 2024-Main]

20Shell, PythonSep 23, 20241 years ago

Similar Papers

Cite this paper

@article{zhu2025psc,
  title  = {PSC: Extending Context Window of Large Language Models via Phase Shift Calibration},
  author = {Wenqiao Zhu and Chao Xu and Lulu Wang and Jun Wu},
  year   = {2025},
  eprint = {2505.12423},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.12423v1}
}

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

Discussion