Skip to content
Preprint

CARET: Training-Free Test-Time Scaling for Repository-Level Code Completion

Oct 2026 · 0 citations · 36 references
Computer Science

TL;DR

It is argued both stages of retrieval and generation can be improved together, with generation in particular gaining from test-time scaling, and CARET, a training-free method is presented.

Abstract

Retrieval-augmented generation (RAG) dominates repository-level code completion: it retrieves cross-file context (R), then decodes one greedy completion (G). Existing work mainly focuses on retrieval and stops there. We argue both stages can be improved together, with generation in particular gaining from test-time scaling. We present CARET, a training-free method. For R, CARET routes among retrieval contexts using the agreement among its own samples, cascading to an alternative context when the samples scatter. For G, it samples candidates over a cached prompt prefix, so the long retrieved context is encoded once rather than once per sample. It then selects the final completion by reverse-context likelihood: a correct completion makes the code after the cursor more probable, so the same model grades its own candidates by reading ahead. Across CrossCodeEval, RepoEval-Line, and RepoEval-API with six code models (1.1B to 7B, four families), CARET improves exact match in all 18 combinations by 10.8 points on average over greedy decoding and 5.3 over self-consistency@10. Token-level compute stays near 1.45 times one generation (measured wall-clock 1.3-2.9 times, growing with generator size). Improving retrieval and generation together yields more accurate code than improving retrieval alone, at a budget that stays close to a single pass.

View source

Similar papers

Open access Oct 2026

LLM See, LLM Do: Enhancing Repository-Aware Code Generation in LLMs Through Logical Context and Usage Knowledge

Large language models (LLMs) have significantly advanced automatic code generation. Although they have demonstrated remarkable ability in writing standalone code, they still struggle with real-world repository-level coding tasks due to the lack of repository-specific knowledge. Existing studies typically employ retriev...

Tanghaoran Zhang, Xin-Jun Mao, Yu-Xin Zhao et al. · 0 citations

ReMCTS: Reflection-Enhanced Monte Carlo Tree Search for Code Generation

ReMCTS, an execution-grounded, memory-augmented, LLM-guided MCTS-style search framework that organizes program candidates as tree states, retains branch-local debugging context, retrieves failure experience across branches, and distinguishes failed checks from unavailable evidence is presented.

Hui-Fei Wang, Xin-Yi Huang, Yi-Heng Sun et al. · 0 citations
Nov 2026

What to Retrieve? Investigating Effective Call Information in Repository-level Code Generation

Retrieval-Augmented Generation (RAG) emerges as a widely adopted solution in repository-level code generation by retrieving functions for direct reuse or learning similar usage patterns. Nevertheless, it remains unexplored which types of contexts effectively assist LLMs. In this paper, we categorize the context of func...

Si-Yu Nan, Jian Wang, Ya-Ling Luo et al. · 0 citations
#artificial intelligence Preprint Oct 2026

MAP4CS: A Multi-dimensional Data Pruning Framework for Efficient Code Retriever Fine-tuning

Retrieval-Augmented Generation (RAG) has become a cornerstone in software engineering for enhancing Large Language Models (LLMs) with domain-specific knowledge. However, adapting retrievers to evolving code repositories remains challenging due to the noise and redundancy inherent in massive code corpora. Standard fine-...

Yuxuan Chen, Ming-Wei Liu, Guang-Sheng Ou et al. · 0 citations
Open access Nov 2026

Prompt Augmentation with Context at Repository Scale for Code Summarization with the Cache-Augmented Generation Paradigm

Preloading comprehensive code context into the LLM's context window is effective for producing semantically aligned code summaries with minimal latency, however, CAG has a notable limitation: its cache must be updated when new information needs to be incorporated.

Erwin Hartanto, Maria Seraphina Astriani · 0 citations
Preprint Nov 2026

Toward Executable Multi-framework Front-end Code Generation with Self-Correction

Generating codes from UI screenshots has recently benefited from MLLMs, yet existing methods centered on HTML targets and transfer poorly to multi-frameworks such as React, Vue, and Angular. However, unlike HTML, which does not entail compilation issues, generating executable code in multi-framework settings is more ch...

Lin-Xiao Li, Hao-Ran Ma, Chen-Yue Wang et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.