Year: 2026
Type: conference-paper
Abstract: This paper introduces Late Code Chunking (LC 2 ), a chunking strategy designed to improve the semantic understanding of code segments for Large Language Models (LLMs).Repository-level code completion requires predicting the completion of unfinished code by leveraging cross-file context spread across a repository.However, when retrieved fragments have missing semantics-the loss of structural or behavioral information during chunking-LLMs struggle to interpret the target code.To address this, LC 2 refines retrieved chunks by constructing a dual context: a "Code Retrieval Context" optimized for similarity-based search, and a "Code Comprehension Context" that serves as a late enrichment step through context expansion and augmentation.This dual-context design reduces information loss due to chunking and enhances the ability of LLMs to utilize retrieved code.Additionally, we introduce an Asymmetric Query-Chunk Sizing strategy to further optimize retrieval quality by minimizing query noise.Our experiments demonstrate that LC 2 provides robust performance gains, achieving a statistically significant 19.7% improvement in Exact Match accuracy on the CrossCodeEval benchmark compared to the best existing chunking method.
Authors: Seungmin Oh, Eunseok Lee
Institution: Sungkyunkwan University
Language: English
Subfield: Information Systems
Field: Computer Science
Domain: Physical Sciences
Open Access status: hybrid
Award: G5365383813
OpenAlex ID: W7166853808
