Skip to main content
QUICK REVIEW

[논문 리뷰] An Evaluation of Context Length Extrapolation in Long Code via Positional Embeddings and Efficient Attention

Madhusudan Ghosh, Rishabh Gupta|arXiv (Cornell University)|2026. 02. 25.
Software Engineering Research인용 수 0
한 줄 요약

본 논문은 긴 코드 컨텍스트 외삽을 위한 훈련 없이 추론만으로 작동하는 방법들을 비교하고, 위치 인코딩(RoPE/ReRoPE)과 효율적 어텐션(Paged Attention, Flash Attention, StreamingLLM)을 Python, Csharp, Java에서의 긴 코드 완성에 대해 평가한다. EM(Exact Match)과 Edit Sim(Edit Similarity) 결과를 분석하여 코드 컨텍스트 외삽의 강점과 트레이드오프를 식별한다.

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.

연구 동기 및 목표

  • 추론 전용 메서드가 제로샷 코드 완성 작업에서 긴 코드 시퀀스를 어떻게 처리하는지 평가한다.
  • 긴 코드에 대한 위치 인코딩 기반 외삽과 효율적 어텐션 메커니즘의 경험적 평가를 통해 비교한다.
  • 여러 프로그래밍 언어에서 긴 코드 컨텍스트의 구문과 구조를 보존하는 방법을 식별한다.

제안 방법

  • 맥락 길이 외삽 방법을 위치 인코딩 기반과 효율적 어텐션 기반으로 분류한다.
  • RoPE, ReRoPE와 여러 효율적 어텐션 기법(StreamingLLM, Paged Attention, Flash Attention)을 긴 코드 완성 작업에 대해 평가한다.
  • 제로샷 추론과 탐욕적 디코딩을 사용하여 긴 코드 시퀀스에서 100개의 토큰을 생성한다.
  • 정확 일치(EM)와 편집 유사도(Edit Sim) 지표로 성능을 측정한다.
  • Guo 등(2023)으로부터 도출된 Python, Csharp, Java 데이터셋에서 결과를 분석한다.
  • 한계점을 논의하고 하이브리드 접근법 및 새로운 평가 지표를 위한 방향을 제시한다.
Figure 1. Comparison of length extrapolation techniques for code completion, categorized into Positional Encoding Based (e.g., RoPE, ReRoPE) and Efficient Attention Based methods (e.g., StreamingLLM, Paged Attention, Flash Attention). These approaches address the challenges of handling long code seq
Figure 1. Comparison of length extrapolation techniques for code completion, categorized into Positional Encoding Based (e.g., RoPE, ReRoPE) and Efficient Attention Based methods (e.g., StreamingLLM, Paged Attention, Flash Attention). These approaches address the challenges of handling long code seq

실험 결과

연구 질문

  • RQ1RQ-1: 효율적 어텐션 메커니즘이 프로그래밍 언어 전반의 긴 코드 길이 외삽 성능에 어떤 영향을 미치는가?
  • RQ2RQ-2: 위치 외삽(RoPE, ReRoPE)이 효율적 어텐션 방법과 비교했을 때 긴 코드 외삽에 어떤 차이를 보이는가?
  • RQ3RQ-3: 언어 구문과 구조(Python, Csharp, Java)가 제로샷 긴 코드 완성 성능에 어떤 영향을 미치는가?

주요 결과

  • 효율적 어텐션(Paged Attention)은 다양한 언어에서 일반적으로 위치 외삽 방법보다 높은 정확 일치(EM) 점수를 달성한다(예: Python에서 Paged Attn의 EM 0.377 대 RoPE의 0.013).
  • 위치 외삽 방법(특히 ReRoPE)은 긴 코드 시퀀스에서 더 높은 Edit Sim 점수와 더 나은 구조적 일관성을 보인다.
  • StreamingLLM과 Flash Attention은 속도 향상에 강한 이점을 보이지만 제로샷 코드 작업에서 긴 컨텍스트 외삽에 어려움을 겪어 일부 경우 EM과 Edit Sim이 낮다.
  • ReRoPE는 언어 간에 편집 유사도를 일관되게 높게 유지하여 긴 코드 완성에서 구문적·계층적 구조 보존에 더 나은 성능을 시사한다.
  • EM과 Edit Sim 사이에는 뚜렷한 격차가 있으며, 정확한 토큰 수준 매칭을 넘어 기능적 정확성과 코드 품질을 포착하는 지표의 필요성이 강조된다.
  • 언어별 추세로 Python이 Java나 Csharp보다 종종 더 높은 Edit Sim을 보이는 경향이 있으며, 이는 Java/Csharp의 구문적 강직성과 대조될 수 있다.

더 나은 연구,지금 바로 시작하세요

연구 설계부터 논문 작성까지, 연구 시간을 획기적으로 줄여보세요.

카드 등록 없음 · 무료 플랜 제공

이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.