2601.00376v1 Jan 01, 2026 cs.SE

컨텍스트에 맞춰: 컨텍스트 삽입을 통한 저장소 수준 코드 생성

In Line with Context: Repository-Level Code Generation via Context Inlining

Wenhao Zeng
Wenhao Zeng
Citations: 21
h-index: 2
Yuling Shi
Yuling Shi
Citations: 217
h-index: 8
Chao Hu
Chao Hu
Citations: 32
h-index: 3
Beijun Shen
Beijun Shen
Citations: 106
h-index: 6
Xiaodong Gu
Xiaodong Gu
Citations: 98
h-index: 4

저장소 수준 코드 생성은 최근 몇 년 동안 상당한 관심을 받고 있습니다. 함수 수준 코드 생성과 달리, 저장소 수준 코드 생성은 모델이 전체 저장소를 이해하고, 함수, 클래스 및 모듈 간의 복잡한 의존성을 추론해야 합니다. 그러나 기존 접근 방식인 검색 증강 생성(RAG) 또는 컨텍스트 기반 함수 선택은 종종 한계에 부딪힙니다. 이러한 방식은 주로 표면적인 유사성에 의존하며, 저장소 수준 의미를 지배하는 풍부한 의존성을 파악하는 데 어려움을 겪습니다. 본 논문에서는 저장소 수준 코드 생성을 위한 새로운 프레임워크인 InlineCoder를 소개합니다. InlineCoder는 미완성 함수를 호출 그래프에 삽입하여 저장소 컨텍스트에 대한 이해를 향상시킵니다. 이를 통해 어려운 저장소 이해 문제를 보다 쉬운 함수 수준 코딩 작업으로 재구성합니다. 주어진 함수 시그니처에 대해, InlineCoder는 먼저 '앵커(anchor)'라고 하는 초안 코드를 생성합니다. 이 앵커는 다운스트림 의존성을 근사화하고, 퍼플렉시티 기반의 신뢰도 추정을 가능하게 합니다. 이 앵커는 양방향 삽입 프로세스를 구동합니다. (i) 업스트림 삽입은 앵커를 해당 호출자(callers)에 삽입하여 다양한 사용 시나리오를 포착합니다. (ii) 다운스트림 검색은 앵커의 호출 대상(callees)을 프롬프트에 통합하여 정확한 의존성 컨텍스트를 제공합니다. 초안 코드와 업스트림 및 다운스트림 관점을 결합한 풍부한 컨텍스트는 LLM에게 포괄적인 저장소 뷰를 제공합니다.

Original Abstract

Repository-level code generation has attracted growing attention in recent years. Unlike function-level code generation, it requires the model to understand the entire repository, reasoning over complex dependencies across functions, classes, and modules. However, existing approaches such as retrieval-augmented generation (RAG) or context-based function selection often fall short: they primarily rely on surface-level similarity and struggle to capture the rich dependencies that govern repository-level semantics. In this paper, we introduce InlineCoder, a novel framework for repository-level code generation. InlineCoder enhances the understanding of repository context by inlining the unfinished function into its call graph, thereby reframing the challenging repository understanding as an easier function-level coding task. Given a function signature, InlineCoder first generates a draft completion, termed an anchor, which approximates downstream dependencies and enables perplexity-based confidence estimation. This anchor drives a bidirectional inlining process: (i) Upstream Inlining, which embeds the anchor into its callers to capture diverse usage scenarios; and (ii) Downstream Retrieval, which integrates the anchor's callees into the prompt to provide precise dependency context. The enriched context, combining draft completion with upstream and downstream perspectives, equips the LLM with a comprehensive repository view.

1 Citations
0 Influential
4 Altmetric
21.0 Score

No Analysis Report Yet

This paper hasn't been analyzed by Gemini yet.

댓글

댓글을 작성하려면 로그인하세요.

아직 댓글이 없습니다. 첫 번째 댓글을 남겨보세요!