cs.SEFeb 25, 2026

An Evaluation of Context Length Extrapolation in Long Code via Positional Embeddings and Efficient Attention

Authors: Madhusudan Ghosh, Rishabh Gupta

Organizations: Indian Association for the Cultivation of Science, Kolkata, India · Bosch Research and Technology Centre, Bangalore, India

Abstract

The rapid advancement of large language models (LLMs) has led to a significant increase in automated tools in the software engineering, capable of performing various code-related tasks such as code generation, completion, and translation. Despite these advancements, its effectiveness is constrained by fixed context lengths, limiting its ability to generalize across long, domain-specific code sequences. To address this challenge, we investigate zero-shot, inference-only methods aimed at improving position encodings and optimizing attention mechanisms. Our goal is to provide a thorough analysis of current approaches that facilitate context length extrapolation in code, particularly in the context of long code completion tasks.

Figures & tables

Explore similar work

CardsList
  1. The Limits of Long-Context Reasoning in Automated Bug Fixing

    Feb 17, 2026Ravi Raju, Mengmeng Ji, Shubhangi Upasani +2Long-Context Reasoning in Language ModelsLong-Context Language Model Evaluation

  2. LongAttnComp: Cross-Family Context Compression for Long-Context Reasoning

    May 31, 2026Mengmeng Ji, Ravi Shanker Raju, Jonathan Lingjie Li +1LLM CompressionLLM Fine-Tuning

  3. EndPrompt: Efficient Long-Context Extension via Terminal Anchoring

    May 14, 2026Han Tian, Luxuan Chen, Xinran Chen +10Long-Context Language ModelingLLM Fine-Tuning