EMNLP Findings2025
cAST: Enhancing Code Retrieval-Augmented Generation with Structural Chunking via Abstract Syntax Tree
Yilin Zhang, Xinran Zhao, Zora Zhiruo Wang, Chenyang Yang, Jiayi Wei, Tongshuang Wu
摘要
Retrieval-Augmented Generation (RAG) has become essential for large-scale code generation, grounding predictions in external code corpora to improve factuality. However, a critical yet underexplored aspect of RAG pipelines is chunking-the process of dividing documents into retrievable units. Existing linebased chunking heuristics often break semantic structures, splitting functions or merging unrelated code, which can degrade generation quality. We propose chunking via Abstract Syntax Trees (CAST), a structure-aware method that recursively breaks large AST nodes into smaller chunks and merges sibling nodes while respecting size limits. This approach generates selfcontained, semantically coherent units across programming languages and tasks, improving performance on diverse code generation tasks, e.g., boosting Recall@5 by 4.3 points on Re-poEval retrieval and Pass@1 by 2.67 points on SWE-bench generation. Our work highlights the importance of structure-aware chunking for scaling retrieval-enhanced code intelligence.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 2 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- AIRCoder: Adaptive Integration of Multi-dimensional Retrieval for Repository-level Code Completion 引用了 LongCodeZip: Compress Long Context for Code Language Models
- LongCodeZip: Compress Long Context for Code Language Models 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
引用它的顶会 Paper2
它引用的 Paper21
- Retrieval-Augmented Generation for Knowledge-Intensive NLP TasksPatrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni 等NeurIPS 2020 · 19,162 次引用
- Retrieval Augmented Language Model Pre-TrainingKelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat 等ICML 2020 · 2,937 次引用
- CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan 等EMNLP Findings 2020 · 2,828 次引用
- SWE-bench: Can Language Models Resolve Real-world Github Issues?Carlos E. Jimenez, John Yang, Alexander Wettig, Shunyu Yao 等ICLR 2024 · 2,082 次引用
- GraphCodeBERT: Pre-training Code Representations with Data FlowDaya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng 等ICLR 2021 · 1,644 次引用
相关 Paper
- Document Segmentation Matters for Retrieval-Augmented GenerationZhitong Wang, Cheng Gao, Chaojun Xiao, Yufei Huang 等ACL Findings 2025 · 19 次引用
- SRACG: A Code Generation Framework with Selective Retrieval AugmentationMengzhen Wang, Shukai Ma, Songwen Gong, Jiexin Wang 等AAAI 2026
- SmartChunk Retrieval: Query-Aware Chunk Compression with Planning for Efficient Document RAGXuechen Zhang, Koustava Goswami, Samet Oymak, Jiasi Chen 等ICLR 2026 · 1 次引用
- SAGE: A Framework of Precise Retrieval for RAGJintao Zhang, Guoliang Li, Jinyang SuICDE 2025 · 9 次引用
- Not All RAGs Are Created Equal: A Component-Wise Empirical Study for Software Engineering TasksQiang Ke, Yanjie Zhao, Hongjin Leng, Shengming Zhao 等FSE 2026
