mlsanityData to 14 Oct 2026

RCL: A Retrieval-Confidence Layer for Detecting Insufficient Context in Enterprise Retrieval-Augmented Code Generation

arXiv 2609.11023 ↗First posted 10 Sep 2026cs.SEcited by 0

On the map: Retrieval-augmented generation → RAG for code

Abstract (arXiv)

Retrieval-Augmented Generation (RAG) for code generation has been studied extensively on public repositories, where a model's parametric knowledge often compensates for imperfect retrieval. This breaks down in enterprise codebases, where private APIs, internal frameworks, and undocumented team conventions fall entirely outside any model's pretraining distribution. Recent work on private-library code generation shows that even oracle (perfect) retrieval does not eliminate errors, but locates failures downstream in API usage; separately, confidence-gated retrieval has been studied for open-domain question answering using model-internal confidence. Neither addresses whether retrieval itself was structurally sufficient for a private-code query before generation begins. We introduce RCL (Retrieval-Confidence Layer), a lightweight module inserted between retrieval and generation that combines a call-graph-derived structural coverage score with a novelty score estimating a query's dependence on knowledge outside the model's prior, to detect insufficient retrieval before generation occurs. When confidence falls below a calibrated threshold, RCL triggers a targeted follow-up retrieval or labels the output for human review, rather than generating silently against incomplete context. We describe RCL's architecture, formalize its scoring functions, and propose an evaluation methodology using a private-code benchmark built by injecting synthetic internal APIs into open-source Java repositories, simulating the enterprise condition without proprietary code. We report results (Section 7) comparing RCL against similarity-only retrieval on generation correctness. Our position is that retrieval sufficiency, assessed structurally rather than from model-internal confidence, is a distinct and currently underaddressed signal for building safer code-generation systems in private, enterprise settings.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 10 of its 11 references that are in the map. First posted on arXiv 10 Sep 2026.

Builds on

10 of 11 references.

Closest ancestors · 6

Same direction, newest first

  1. 2026Beyond "What to Retrieve": Uncertainty in Retrieval-Augmented Code Generation27 Jul
  2. 2026Learning from Execution: Self-Evolving Memory for Private-Library Code Generation27 Apr
  3. 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches6 Oct
  4. 2025An Empirical Study of Retrieval-Augmented Code Generation: Challenges and Opportunities23 Jan
  5. 2024GraphCoder: Enhancing Repository-Level Code Completion via Code Context Graph-based Retrieval and Language Model11 Jun
  6. 2024Repoformer: Selective Retrieval for Repository-Level Code Completion15 Mar

Other references · 4

  1. 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 367
  2. 2024RLCoder: Reinforcement Learning for Repository-Level Code Completioncited by 44
  3. 2026Evaluating Confidence-Gated Retrieval with Matched Trajectory Replaycited by 3
  4. 2026CodePoisonRAG: Knowledge Poisoning Attacks on Retrieval-Augmented Code Generationcited by 1

Built on by

Not cited yet.

Similar, not cited

Close in wording, no citation either way

  1. 2025What to Retrieve for Effective Retrieval-Augmented Code Generation? An Empirical Study and Beyond
  2. 2024CodeRAG-Bench: Can Retrieval Augment Code Generation?
  3. 2026Retrieval-Augmented Generation for Scientific Code Understanding
  4. 2026Adaptive Critical Token-Aware Retrieval for Repository-Level Code Generation
  5. 2024Context-Augmented Code Generation Using Programming Knowledge Graphs
  6. 2026Context-Augmented Code Generation Using Programming Knowledge Graphs
  7. 2024Assessing the Answerability of Queries in Retrieval-Augmented Code Generation
  8. 2026Not All RAGs Are Created Equal: A Component-Wise Empirical Study for Software Engineering Tasks