mlsanityData to 7 Oct 2026

cAST: Enhancing Code Retrieval-Augmented Generation with Structural Chunking via Abstract Syntax Tree

arXiv 2506.15655 ↗First posted 18 Jun 2025cs.SE cs.AI cs.CLcited by 17

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

  1. 2024CodeRAG-Bench: Can Retrieval Augment Code Generation?20 Jun

Other references · 35

  1. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
  2. 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
  3. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  4. 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,767
  5. 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
  6. 2019HuggingFace's Transformers: State-of-the-art Natural Language Processingcited by 2,201
  7. 2020REALM: Retrieval-Augmented Language Model Pre-Trainingcited by 2,126
  8. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  9. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  10. 2020Leveraging Passage Retrieval with Generative Models for Open Domain Question Answeringcited by 1,203
  11. 2022Atlas: Few-shot Learning with Retrieval Augmented Language Modelscited by 940
  12. 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
23 more
  1. 2024RAPTOR: Recursive Abstractive Processing for Tree-Organized Retrievalcited by 519
  2. 2024StarCoder 2 and The Stack v2: The Next Generationcited by 484
  3. 2024Agentless: Demystifying LLM-based Software Engineering Agentscited by 400
  4. 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 357
  5. 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
  6. 2018code2vec: Learning Distributed Representations of Codecited by 249
  7. 2023CrossCodeEval: A Diverse and Multilingual Benchmark for Cross-File Code Completioncited by 181
  8. 2018code2seq: Generating Sequences from Structured Representations of Codecited by 177
  9. 2018TRANX: A Transition-based Neural Abstract Syntax Parser for Semantic Parsing and Code Generationcited by 88
  10. 2024Enhancing Noise Robustness of Retrieval-Augmented Language Models with Adaptive Adversarial Trainingcited by 88
  11. 2021Language-Agnostic Representation Learning of Source Code from Structure and Contextcited by 63
  12. 2024NExT: Teaching Large Language Models to Reason about Code Executioncited by 60
  13. 2024GISTEmbed: Guided In-sample Selection of Training Negatives for Text Embedding Fine-tuningcited by 40
  14. 2024Meta Large Language Model Compiler: Foundation Models of Compiler Optimizationcited by 39
  15. 2022StructCoder: Structure-Aware Transformer for Code Generationcited by 33
  16. 2024AST-T5: Structure-Aware Pretraining for Code Generation and Understandingcited by 32
  17. 2024Revisiting Code Similarity Evaluation with Abstract Syntax Tree Edit Distancecited by 26
  18. 2024An Empirical Study on LLM-based Agents for Automated Bug Fixingcited by 23
  19. 2022CodeRetriever: Unimodal and Bimodal Contrastive Learning for Code Searchcited by 21
  20. 2023MinT: Boosting Generalization in Mathematical Reasoning via Multi-View Fine-Tuningcited by 16
  21. 2024Improving Retrieval-augmented Text-to-SQL with AST-based Ranking and Schema Pruningcited by 16
  22. 2024Beyond Relevance: Evaluate and Improve Retrievers on Perspective Awarenesscited by 12
  23. 2024textttMixGR: Enhancing Retriever Generalization for Scientific Domain through Complementary Granularitycited by 9

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 3; 2026: 14.

17 papers.

Sort:

By area:

  1. 2025LongCodeZip: Compress Long Context for Code Language Modelscited by 38
  2. 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approachescited by 20
  3. 2026Codebase-Memory: Tree-Sitter-Based Knowledge Graphs for LLM Code Exploration via MCPcited by 6
  4. 2026Reliable Graph-RAG for Codebases: AST-Derived Graphs vs LLM-Extracted Knowledge Graphscited by 4
  5. 2026Your Code Agent Can Grow Alongside You with Structured Memorycited by 4
  6. 2026MatClaw: An Autonomous Code-First LLM Agent for End-to-End Materials Explorationcited by 4
  7. 2025Practical Code RAG at Scale: Task-Aware Retrieval Design Choices under Compute Budgetscited by 3
  8. 2026DomAgent: Leveraging Knowledge Graphs and Case-Based Reasoning for Domain-Specific Code Generationcited by 1
  9. 2026Coding with Eyes: Visual Feedback Unlocks Reliable GUI Code Generating and Debuggingcited by 1
  10. 2026Structure-Aware Chunking for Tabular Data in Retrieval-Augmented Generationcited by 1
  11. 2026Chunking Methods on Retrieval-Augmented Generation - Effectiveness Evaluation Against Computational Cost and Limitationscited by 1
  12. 2026Engineering Reliable Coding Agents: Evaluating and Operating the System Around the Modelcited by 1
5 more
  1. 2026Context-Augmented Code Generation Using Programming Knowledge Graphscited by 0
  2. 2026How Does Chunking Affect Retrieval-Augmented Code Completion? A Controlled Empirical Studycited by 0
  3. 2026BLAgent: Agentic RAG for File-Level Bug Localizationcited by 0
  4. 2026SemChunk-C: Semantic Segmentation for C Codecited by 0
  5. 2026RefactorPlatform: An Open-Source Harness for Controlled Evaluation of Repository-Scale Refactoring Agentscited by 0

Similar, not cited

Close in wording, no citation either way

  1. 2026Do Not Treat Code as Natural Language: Implications for Repository-Level Code Generation and Beyond
  2. 2024Context-Augmented Code Generation Using Programming Knowledge Graphs
  3. 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChat
  4. 2024Repoformer: Selective Retrieval for Repository-Level Code Completion
  5. 2026Not All RAGs Are Created Equal: A Component-Wise Empirical Study for Software Engineering Tasks
  6. 2024A Lightweight Framework for Adaptive Retrieval In Code Completion With Critique Model
  7. 2026Are you Synthesizing or Recalling? Evaluating LLMs on Algorithmic Code Retrieval
  8. 2025SACL: Understanding and Combating Textual Bias in Code Retrieval with Semantic-Augmented Reranking and Localization