cAST: Enhancing Code Retrieval-Augmented Generation with Structural Chunking via Abstract Syntax Tree
On the map: Retrieval-augmented generation → RAG for code
Abstract (arXiv)
Retrieval-Augmented Generation (RAG) has become essential for large-scale code generation, grounding predictions in external code corpora to improve actuality. However, a critical yet underexplored aspect of RAG pipelines is chunking -- the process of dividing documents into retrievable units. Existing line-based chunking heuristics often break semantic structures, splitting functions or merging unrelated code, which can degrade generation quality. We propose chunking via Abstract Syntax Trees (ourwork), a structure-aware method that recursively breaks large AST nodes into smaller chunks and merges sibling nodes while respecting size limits. This approach generates self-contained, 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 RepoEval 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.
Key facts. Cited by 17 papers in the map (data through 7 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 36 of its 50 references that are in the map. First posted on arXiv 18 Jun 2025.
Builds on
36 of 50 references.
Closest ancestors · 1
Same direction, newest first
Other references · 35
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,767
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
- 2019HuggingFace's Transformers: State-of-the-art Natural Language Processingcited by 2,201
- 2020REALM: Retrieval-Augmented Language Model Pre-Trainingcited by 2,126
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2020Leveraging Passage Retrieval with Generative Models for Open Domain Question Answeringcited by 1,203
- 2022Atlas: Few-shot Learning with Retrieval Augmented Language Modelscited by 940
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
23 more
- 2024RAPTOR: Recursive Abstractive Processing for Tree-Organized Retrievalcited by 519
- 2024StarCoder 2 and The Stack v2: The Next Generationcited by 484
- 2024Agentless: Demystifying LLM-based Software Engineering Agentscited by 400
- 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 357
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
- 2018code2vec: Learning Distributed Representations of Codecited by 249
- 2023CrossCodeEval: A Diverse and Multilingual Benchmark for Cross-File Code Completioncited by 181
- 2018code2seq: Generating Sequences from Structured Representations of Codecited by 177
- 2018TRANX: A Transition-based Neural Abstract Syntax Parser for Semantic Parsing and Code Generationcited by 88
- 2024Enhancing Noise Robustness of Retrieval-Augmented Language Models with Adaptive Adversarial Trainingcited by 88
- 2021Language-Agnostic Representation Learning of Source Code from Structure and Contextcited by 63
- 2024NExT: Teaching Large Language Models to Reason about Code Executioncited by 60
- 2024GISTEmbed: Guided In-sample Selection of Training Negatives for Text Embedding Fine-tuningcited by 40
- 2024Meta Large Language Model Compiler: Foundation Models of Compiler Optimizationcited by 39
- 2022StructCoder: Structure-Aware Transformer for Code Generationcited by 33
- 2024AST-T5: Structure-Aware Pretraining for Code Generation and Understandingcited by 32
- 2024Revisiting Code Similarity Evaluation with Abstract Syntax Tree Edit Distancecited by 26
- 2024An Empirical Study on LLM-based Agents for Automated Bug Fixingcited by 23
- 2022CodeRetriever: Unimodal and Bimodal Contrastive Learning for Code Searchcited by 21
- 2023MinT: Boosting Generalization in Mathematical Reasoning via Multi-View Fine-Tuningcited by 16
- 2024Improving Retrieval-augmented Text-to-SQL with AST-based Ranking and Schema Pruningcited by 16
- 2024Beyond Relevance: Evaluate and Improve Retrievers on Perspective Awarenesscited by 12
- 2024textttMixGR: Enhancing Retriever Generalization for Scientific Domain through Complementary Granularitycited by 9
Built on by
Citing papers per year: 2025: 3; 2026: 14.
17 papers.
Sort:
By area:
- 2025LongCodeZip: Compress Long Context for Code Language Modelscited by 38
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approachescited by 20
- 2026Codebase-Memory: Tree-Sitter-Based Knowledge Graphs for LLM Code Exploration via MCPcited by 6
- 2026Reliable Graph-RAG for Codebases: AST-Derived Graphs vs LLM-Extracted Knowledge Graphscited by 4
- 2026Your Code Agent Can Grow Alongside You with Structured Memorycited by 4
- 2026MatClaw: An Autonomous Code-First LLM Agent for End-to-End Materials Explorationcited by 4
- 2025Practical Code RAG at Scale: Task-Aware Retrieval Design Choices under Compute Budgetscited by 3
- 2026DomAgent: Leveraging Knowledge Graphs and Case-Based Reasoning for Domain-Specific Code Generationcited by 1
- 2026Coding with Eyes: Visual Feedback Unlocks Reliable GUI Code Generating and Debuggingcited by 1
- 2026Structure-Aware Chunking for Tabular Data in Retrieval-Augmented Generationcited by 1
- 2026Chunking Methods on Retrieval-Augmented Generation - Effectiveness Evaluation Against Computational Cost and Limitationscited by 1
- 2026Engineering Reliable Coding Agents: Evaluating and Operating the System Around the Modelcited by 1
5 more
- 2026Context-Augmented Code Generation Using Programming Knowledge Graphscited by 0
- 2026How Does Chunking Affect Retrieval-Augmented Code Completion? A Controlled Empirical Studycited by 0
- 2026BLAgent: Agentic RAG for File-Level Bug Localizationcited by 0
- 2026SemChunk-C: Semantic Segmentation for C Codecited by 0
- 2026RefactorPlatform: An Open-Source Harness for Controlled Evaluation of Repository-Scale Refactoring Agentscited by 0
- 2026RefactorPlatform: An Open-Source Harness for Controlled Evaluation of Repository-Scale Refactoring Agents4 Sep 2026
- 2026Engineering Reliable Coding Agents: Evaluating and Operating the System Around the Model14 Aug 2026
- 2026Chunking Methods on Retrieval-Augmented Generation - Effectiveness Evaluation Against Computational Cost and Limitations30 May 2026
- 2026BLAgent: Agentic RAG for File-Level Bug Localization18 May 2026
- 2026SemChunk-C: Semantic Segmentation for C Code12 May 2026
- 2026How Does Chunking Affect Retrieval-Augmented Code Completion? A Controlled Empirical Study6 May 2026
- 2026Structure-Aware Chunking for Tabular Data in Retrieval-Augmented Generation1 May 2026
- 2026MatClaw: An Autonomous Code-First LLM Agent for End-to-End Materials Exploration3 Apr 2026
- 2026Codebase-Memory: Tree-Sitter-Based Knowledge Graphs for LLM Code Exploration via MCP28 Mar 2026
- 2026DomAgent: Leveraging Knowledge Graphs and Case-Based Reasoning for Domain-Specific Code Generation22 Mar 2026
- 2026Coding with Eyes: Visual Feedback Unlocks Reliable GUI Code Generating and Debugging14 Mar 2026
- 2026Your Code Agent Can Grow Alongside You with Structured Memory25 Feb 2026
5 more
- 2026Context-Augmented Code Generation Using Programming Knowledge Graphs28 Jan 2026
- 2026Reliable Graph-RAG for Codebases: AST-Derived Graphs vs LLM-Extracted Knowledge Graphs13 Jan 2026
- 2025Practical Code RAG at Scale: Task-Aware Retrieval Design Choices under Compute Budgets23 Oct 2025
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches6 Oct 2025
- 2025LongCodeZip: Compress Long Context for Code Language Models1 Oct 2025
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approachescited by 20
- 2026Reliable Graph-RAG for Codebases: AST-Derived Graphs vs LLM-Extracted Knowledge Graphscited by 4
- 2026Structure-Aware Chunking for Tabular Data in Retrieval-Augmented Generationcited by 1
- 2026Chunking Methods on Retrieval-Augmented Generation - Effectiveness Evaluation Against Computational Cost and Limitationscited by 1
- 2026How Does Chunking Affect Retrieval-Augmented Code Completion? A Controlled Empirical Studycited by 0
- 2026BLAgent: Agentic RAG for File-Level Bug Localizationcited by 0
- 2026Chunking Methods on Retrieval-Augmented Generation - Effectiveness Evaluation Against Computational Cost and Limitations30 May 2026
- 2026BLAgent: Agentic RAG for File-Level Bug Localization18 May 2026
- 2026How Does Chunking Affect Retrieval-Augmented Code Completion? A Controlled Empirical Study6 May 2026
- 2026Structure-Aware Chunking for Tabular Data in Retrieval-Augmented Generation1 May 2026
- 2026Reliable Graph-RAG for Codebases: AST-Derived Graphs vs LLM-Extracted Knowledge Graphs13 Jan 2026
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches6 Oct 2025
- 2026Codebase-Memory: Tree-Sitter-Based Knowledge Graphs for LLM Code Exploration via MCPcited by 6
- 2026Your Code Agent Can Grow Alongside You with Structured Memorycited by 4
- 2026MatClaw: An Autonomous Code-First LLM Agent for End-to-End Materials Explorationcited by 4
- 2026Engineering Reliable Coding Agents: Evaluating and Operating the System Around the Modelcited by 1
- 2026RefactorPlatform: An Open-Source Harness for Controlled Evaluation of Repository-Scale Refactoring Agentscited by 0
- 2026RefactorPlatform: An Open-Source Harness for Controlled Evaluation of Repository-Scale Refactoring Agents4 Sep 2026
- 2026Engineering Reliable Coding Agents: Evaluating and Operating the System Around the Model14 Aug 2026
- 2026MatClaw: An Autonomous Code-First LLM Agent for End-to-End Materials Exploration3 Apr 2026
- 2026Codebase-Memory: Tree-Sitter-Based Knowledge Graphs for LLM Code Exploration via MCP28 Mar 2026
- 2026Your Code Agent Can Grow Alongside You with Structured Memory25 Feb 2026
- 2025LongCodeZip: Compress Long Context for Code Language Modelscited by 38
- 2025Practical Code RAG at Scale: Task-Aware Retrieval Design Choices under Compute Budgetscited by 3
- 2026Coding with Eyes: Visual Feedback Unlocks Reliable GUI Code Generating and Debuggingcited by 1
- 2026Context-Augmented Code Generation Using Programming Knowledge Graphscited by 0
- 2026SemChunk-C: Semantic Segmentation for C Codecited by 0
- 2026SemChunk-C: Semantic Segmentation for C Code12 May 2026
- 2026Coding with Eyes: Visual Feedback Unlocks Reliable GUI Code Generating and Debugging14 Mar 2026
- 2026Context-Augmented Code Generation Using Programming Knowledge Graphs28 Jan 2026
- 2025Practical Code RAG at Scale: Task-Aware Retrieval Design Choices under Compute Budgets23 Oct 2025
- 2025LongCodeZip: Compress Long Context for Code Language Models1 Oct 2025
Similar, not cited
Close in wording, no citation either way
- 2026Do Not Treat Code as Natural Language: Implications for Repository-Level Code Generation and Beyond
- 2024Context-Augmented Code Generation Using Programming Knowledge Graphs
- 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChat
- 2024Repoformer: Selective Retrieval for Repository-Level Code Completion
- 2026Not All RAGs Are Created Equal: A Component-Wise Empirical Study for Software Engineering Tasks
- 2024A Lightweight Framework for Adaptive Retrieval In Code Completion With Critique Model
- 2026Are you Synthesizing or Recalling? Evaluating LLMs on Algorithmic Code Retrieval
- 2025SACL: Understanding and Combating Textual Bias in Code Retrieval with Semantic-Augmented Reranking and Localization