How Does Chunking Affect Retrieval-Augmented Code Completion? A Controlled Empirical Study
- URL: http://arxiv.org/abs/2605.04763v1
- Date: Wed, 06 May 2026 11:09:42 GMT
- Title: How Does Chunking Affect Retrieval-Augmented Code Completion? A Controlled Empirical Study
- Abstract summary: Retrieval-augmented generation pipelines rely on chunking to segment source files into retrievable units.<n>We present a controlled empirical study isolating the effect of chunking on code completion quality.<n>Our results reveal that chunking strategy has a statistically significant effect on RAG-based code completion.
- Score: 6.9242874337023705
- License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/
- Abstract: Retrieval-augmented generation (RAG) pipelines for code completion rely on chunking to segment source files into retrievable units, yet chunking strategies are typically adopted without empirical justification, and practitioner recommendations are notably inconsistent. We present a controlled empirical study isolating the effect of chunking on code completion quality by crossing four representative strategies (Function, Declaration, Sliding Window, and cAST) with four retrievers, five generators, and nine parameter configurations on two benchmarks (RepoEval and CrossCodeEval), totaling 864 experimental settings. Our results reveal that chunking strategy has a statistically significant effect on RAG-based code completion. Contrary to intuition, chunking based on functions underperforms all other strategies by 3.57--5.64 percentage points on RepoEval (Cliff's delta = -1.0), while the remaining chunking strategies perform comparably. Our further analysis demonstrates that this observation holds across all retriever--generator combinations. We also find that cross-file context length is the dominant parameter: doubling from 2,048 to 8,192 tokens yields up to 4.2 percentage points of improvement, whereas chunk size has a weaker, non-monotonic effect. On the cost--quality Pareto front, Sliding Window and cAST dominate both benchmarks; Function chunking is never Pareto-optimal.
Related papers
- PARSER: Read in Parallel, Reason in Depth for Long-Context LLM Agents [85.82624962221026]
We introduce PARSER, which decouples reading from reasoning.<n>A bank of lightweight subagents each bound to a single chunk read the entire document in parallel.<n>On multi-hop QA with contexts ranging from 7K to 896K tokens, PARSER with a 4B backbone outperforms the strongest sequential memory baseline.
arXiv Detail & Related papers (2026-09-06T16:19:01Z) - Recursive Agentic Reasoning [4.7490116928645065]
Test-time reasoning methods such as iterative refinement, decomposition, and repeated sampling are often evaluated in isolation.<n>We introduce a unified view of these methods as recursion operators over an agent's reasoning trace.<n>We evaluate all three operators against a single-pass chain-of-thought baseline under a shared harness with identical prompts, token budgets, and grading code.
arXiv Detail & Related papers (2026-08-25T01:34:08Z) - Reproducing and Stress-Testing Two Approaches to LLM Reasoning Reliability: Test-Time Probability Aggregation and Logic-Representation Editing [0.0]
We independently reproduce two methods for making large language model (LLM) reasoning more reliable, and stress-test them across domains and models.<n>The first, RPC, aggregates token probabilities and self-consistency at inference; the second, LCF, trains projectors that split hidden states into "content" and "logic" and edits the logic part toward a valid region.
arXiv Detail & Related papers (2026-08-09T06:22:02Z) - GradCuit: Credit-Assigned Gradient Flow Enables Robust and Interpretable Test-Time Latent Reasoning [61.67411833252235]
We introduce GradCuit, which inserts optimizable latent states at a selected Transformer layer between the hidden representations of the prompt and the generated continuation.<n>Across five instruction-tuned backbones, three reasoning benchmarks, and two answer formats, GradCuit achieves an average accuracy of 64.5%.<n>For interpretability, token-level gradient attribution reveals that latent influence concentrates on reasoning-connector tokens, while layer analysis identifies early-to-middle Transformer layers as the most effective optimization space.
arXiv Detail & Related papers (2026-08-03T17:55:24Z) - Operational Proto-Introspection in Looped Language Models: Process-Quality Taps, Executable Branching, and the Readout-Control Boundary [0.0]
Can a language model read the quality of its ongoing computation?<n>Can an external intervention turn that readout into better outcomes?<n>We test both questions in a frozen 2.6B looped transformer, Ouro-RLTT.
arXiv Detail & Related papers (2026-07-20T22:40:36Z) - Efficient Test-Time Inference via Deterministic Exploration of Truncated Decoding Trees [68.04613115686509]
Self-consistency boosts inference-time performance by sampling multiple reasoning traces in parallel and voting.<n>We propose Distinct Leafion (DLE), a deterministic decoding method that treats truncated sampling as a pruned tree and systematically enumerates distinct leaves instead of sampling with replacement.<n>DLE explores higher-quality reasoning traces, yielding better performance on math, coding, and general reasoning tasks.
arXiv Detail & Related papers (2026-04-22T12:42:03Z) - APEX-EM: Non-Parametric Online Learning for Autonomous Agents via Structured Procedural-Episodic Experience Replay [7.370176470430802]
LLM-based autonomous agents lack persistent procedural memory.<n>We present APEX-EM, a non-parametric online learning framework that accumulates, retrieves, and reuses structured procedural plans.
arXiv Detail & Related papers (2026-03-31T00:24:56Z) - CoT2-Meta: Budgeted Metacognitive Control for Test-Time Reasoning [17.364321308755667]
CoT2-Meta is a training-free metacognitive reasoning framework.<n>It combines object-level chain-of-thought generation with meta-level control over partial reasoning trajectories.<n>It consistently outperforms strong single-path, sampling-based, and search-based baselines.
arXiv Detail & Related papers (2026-03-30T07:59:47Z) - Adaptive Chunking: Optimizing Chunking-Method Selection for RAG [0.0]
We introduce Adaptive Chunking, a framework that selects the most suitable chunking strategy for each document.<n>On a diverse corpus spanning legal, technical, and social science domains, our metric-merge adaptive method significantly improves downstream RAG performance.
arXiv Detail & Related papers (2026-03-26T11:20:52Z) - DeepPrune: Parallel Scaling without Inter-trace Redundancy [53.62015294143274]
Over 80% of parallel reasoning traces yield identical final answers, representing substantial wasted computation.<n>We propose DeepPrune, a novel framework that enables efficient parallel scaling through dynamic pruning.<n>Our work establishes a new standard for efficient parallel reasoning, making high-performance reasoning more efficient.
arXiv Detail & Related papers (2025-10-09T17:24:54Z) - Eigen-1: Adaptive Multi-Agent Refinement with Monitor-Based RAG for Scientific Reasoning [53.45095336430027]
We develop a unified framework that combines implicit retrieval and structured collaboration.<n>On Humanity's Last Exam (HLE) Bio/Chem Gold, our framework achieves 48.3% accuracy.<n>Results on SuperGPQA and TRQA confirm robustness across domains.
arXiv Detail & Related papers (2025-09-25T14:05:55Z) - Towards Storage-Efficient Visual Document Retrieval: An Empirical Study on Reducing Patch-Level Embeddings [70.26204343623215]
ColPali/ColQwen2 encodes each page into multiple patch-level embeddings and leads to excessive memory usage.<n>This empirical study investigates methods to reduce patch embeddings per page at minimum performance degradation.
arXiv Detail & Related papers (2025-06-05T13:06:01Z) - CrackSCF: Lightweight Cascaded Fusion Network for Robust and Efficient Structural Crack Segmentation [36.93774494071781]
CrackSCF is a lightweight Cascaded Fusion Crack Network designed to achieve robust crack segmentation.<n>This approach efficiently captures local patterns while operating with a minimal computational footprint.<n>The experimental results show that the CrackSCF method consistently outperforms the existing methods.
arXiv Detail & Related papers (2024-08-23T03:21:51Z) - Provable Stochastic Optimization for Global Contrastive Learning: Small
Batch Does Not Harm Performance [53.49803579981569]
We consider a global objective for contrastive learning, which contrasts each positive pair with all negative pairs for an anchor point.
Existing methods such as SimCLR requires a large batch size in order to achieve a satisfactory result.
We propose a memory-efficient optimization algorithm for solving the Global Contrastive Learning of Representations, named SogCLR.
arXiv Detail & Related papers (2022-02-24T22:16:53Z) - A Unified Framework of Surrogate Loss by Refactoring and Interpolation [65.60014616444623]
We introduce UniLoss, a unified framework to generate surrogate losses for training deep networks with gradient descent.
We validate the effectiveness of UniLoss on three tasks and four datasets.
arXiv Detail & Related papers (2020-07-27T21:16:51Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.