arXiv:2610.25108cs.DBOct 2026

Manuscript Offprint

arXiv:2610.25108

Which Code Changes Need Re-embedding? CIPBench and the Limits of Multi-Signal Index Maintenance

Nannan Zhao, Jiameng Zhang, Taoyu Zhong, Hao Wang, Bo Wang

NANNAN ZHAO, Northwestern Polytechnical University, China

JIAMENG ZHANG, Northwestern Polytechnical University, China

TAOYU ZHONG, Northwestern Polytechnical University, China

HAO WANG, Northwestern Polytechnical University, China

BO WANG, Northwestern Polytechnical University, China

Repository-level retrieval-augmented generation systems must keep vector indexes synchronized with continuously evolving code, yet there is no principled basis for deciding which changed code units actually need new embeddings. We ask whether the retrieval impact of a code change can be anticipated before that embedding is computed.

Across 10 open-source repositories in Python, Go, and JavaScript, we characterize how a change propagates from syntactic substantiality through embedding displacement to retrieval impact. The links are informative but not deterministic: syntactic class separates displacement sharply, yet impact depends on a unit's retrieval exposure as much as on how far its representation moves, and recurring counterexamples bound what any single signal can decide. We formalize the decision as CIPBench, a benchmark that scores maintenance policies under a strict pre-embedding information boundary.

Prediction works, and one signal exhausts it. A ranker using only a unit's change history substantially reduces retrieval harm relative to random and recency-based scheduling. Combining it with three further signals — individually discriminative and largely unassociated with one another — leaves the decision statistically unchanged across every budget we evaluate, for reasons we trace to the structure of the score rather than to its tuning. What does pay off is not ranking but filtering: units whose text is unchanged from the indexed state can be skipped with no risk and, in the most reversion-heavy project, at nearly half the embedding cost. Signal-level informativeness is therefore not evidence of decision-level value, and separating the two requires evaluating the decision a signal produces rather than its association with the outcome.

CCS Concepts: • Software and its engineering → Software evolution; • Information systems → Search engine indexing; Retrieval models and ranking.

Additional Key Words and Phrases: Retrieval-augmented generation, Repository-level code retrieval, Vector index maintenance, Code embeddings, Index staleness, Empirical software engineering, Benchmark.

ACM Reference Format:

Nannan Zhao, Jiameng Zhang, Taoyu Zhong, Hao Wang, and Bo Wang. 2026. Which Code Changes Need Re-embedding? CIPBench and the Limits of Multi-Signal Index Maintenance. ACM Trans. Softw. Eng. Methodol. 1, 1 (October 2026), 39 pages. https://doi.org/10.1145/nnnnnnn.nnnnnnn

Authors' Contact Information: Nannan Zhao, Northwestern Polytechnical University, Xi'an, China, nannanzhao@nwpu.edu.cn; Jiameng Zhang, Northwestern Polytechnical University, Xi'an, China, zhangjiameng@mail.nwpu.edu.cn; Taoyu Zhong, Northwestern Polytechnical University, Xi'an, China, zhongtaoyu@mail.nwpu.edu.cn; Hao Wang, Northwestern Polytechnical University, Xi'an, China, kingshulk989@mail.nwpu.edu.cn; Bo Wang, Northwestern Polytechnical University, Xi'an, China, wb2022302586@mail.nwpu.edu.cn.

Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org. © 2026 Copyright held by the owner/author(s). Publication rights licensed to ACM. Manuscript submitted to ACM

Nannan Zhao, Jiameng Zhang, Taoyu Zhong, Hao Wang, and Bo Wang

1 Introduction

Modern software repositories evolve continuously, while repository-level retrieval-augmented generation (RAG) systems rely on vector indexes built from particular repository snapshots [47, 53]. As code changes, these indexes become stale: a modified function may no longer be represented by the vector stored in the index, causing the retriever to return outdated context to the downstream large language model. Keeping the index synchronized with the repository is therefore a recurring maintenance task in repository-level code intelligence systems.

The straightforward solution is to re-embed every changed code unit, but at repository scale this wastes computation. Full re-embedding scales with corpus size, while per-change incremental re-embedding still recomputes a representation for every observed update—including changes with little or no effect on retrieval. The shape of the problem is familiar from predictive test selection, where a change arrives, a budget constrains the downstream work it triggers, and a signal derived from the change must decide what to spend that budget on [26, 34]. Here the downstream work is embedding, and the decision is: when a code unit changes, does its representation actually need to be recomputed?

Answering this is less straightforward than it appears. A natural intuition is that the syntactic nature of a change should serve as a signal: a formatting or documentation edit may be less consequential than a modification to a function body or signature. Prior work already cautions against taking that correspondence for granted—Fluri and Gall showed that textual edits need not correspond to substantive program changes [11], and Kawrykow and Robillard documented how much of a version history consists of non-essential modifications [22]—but the gap that matters here opens one layer further downstream. The maintenance objective is not syntactic substantiality but whether a change alters the unit's representation enough to affect retrieval, and these need not coincide. A syntactically substantial edit may leave the embedding almost unchanged; an embedding may move substantially without altering any relevant top-K result; and a small movement may change retrieval when the unit lies near a ranking boundary. The question is therefore not whether code has changed, but how a change propagates from syntax, through embedding space, to retrieval outcomes.

Existing research supplies pieces of this problem without characterizing the propagation end to end. Fine-grained code-change analysis—ChangeDistiller [12], GumTree [8], non-essential-change detection [22]—describes what changed and relates it to defects, tests, refactorings, or affected program entities, but never to embedding displacement or retrieval impact. Approaching from the other side, code-search benchmarks such as CodeSearchNet [20] and CoSQA [19] and RAG evaluators such as RAGAS [7] and ARES [35] assume a fixed indexed corpus, while dynamic vector-index systems such as SPFresh [51], Ada-IVF [30] and Quake [29] begin after the new vector exists, optimizing how it is incorporated rather than whether computing it was necessary. Drift-aware retrieval such as DeDrift [1] likewise responds to drift once it has occurred. This leaves an upstream decision unevaluated: which changed units should be re-embedded at all?

We study that decision as an empirical and evaluative problem, characterizing a three-layer funnel from syntactic substantiality through embedding displacement to retrieval impact across 10 open-source repositories in Python, Go and JavaScript—2,366 function-level units and 8,936 real updates—with key measurements replicated over three embedding models. The layers turn out to be related but not interchangeable. Change type separates displacement sharply, yet displacement alone does not determine retrieval: the effect is jointly moderated by a unit's position in the retrieval space. Recurring counterexamples—documentation edits that move an embedding without moving retrieval, comment edits that remain retrieval-relevant despite leaving executable syntax untouched, reversions that move nothing at all—mark the boundaries of any single-signal rule. Change history supplies a further inexpensive prior, following the persistence that Girba et al. observed for change-prone entities [15].

These findings expose a second problem: no standard way exists to evaluate the re-embedding decision itself. A code-search benchmark asks whether a system retrieves the right code from a snapshot. An index-maintenance benchmark must ask whether a system can decide, before observing the updated embedding or its retrieval effect, which changes deserve recomputation. We therefore introduce CIPBench(open-source code available at https://github.com/nnzhaocs/CIPBench), which turns evolving-index maintenance into a reproducible decision problem under a strict pre-embedding information boundary, with two tracks: filtering, which exposes the safety-savings trade-off when changed units are skipped, and budget-constrained scheduling, which evaluates which units to prioritize when only a fraction can be re-embedded.

Finally, we ask whether these regularities are operationally useful, and the answer separates cleanly. Prediction works: a single historical signal, computable before re-embedding, cuts retrieval harm substantially relative to both random and freshness-based scheduling. Combining signals does not. Adding three further signals to that one leaves the decision statistically unchanged across every budget we evaluate. Filtering, by contrast, does work: skipping units whose text is unchanged from the indexed state is safe by construction and avoids up to half of all re-embedding computations in the most reversion-heavy project.

That contrast is the paper’s main empirical lesson. The signals are discriminative and, with one exception related by construction, unassociated with one another—exactly the condition under which combining features is standard practice—and combining them still changes no decision. Signal-level informativeness and decision-level relevance are different properties, and telling them apart requires an evaluation that scores decisions rather than signals.

In summary, this work makes four contributions:

• An empirical characterization of how code changes propagate into retrieval impact. We study the relationship among syntactic change type, embedding displacement, and retrieval outcomes across 10 repositories, 8,936 real updates, three programming languages, and three embedding models, establishing both the predictive structure of this propagation and the recurring counterexamples that bound it.

• CIPBench, an evaluation that separates informative signals from useful ones. Existing practice validates a maintenance signal by showing it correlates with the outcome. CIPBench instead scores the decision a signal produces, under a strict pre-embedding information boundary, across two tracks and five reference baselines. That distinction is what makes the saturation in Section 6 visible: the signals that pass a correlational test there still change no outcome. The benchmark ships with an open toolchain and human-validated change labels (Cohen’s κ=0.786\kappa = 0.786; classifier accuracy = 88.7%).

• A negative result on multi-signal scheduling, with its mechanism. On the full 20-point Track B grid a weighted combination of four pre-embedding signals is statistically equivalent to history alone, and a 130-point sweep spanning budgets from 5% to 100% finds no budget at which that changes. The combination is invariant to the substantive weight and unimproved by the orthogonal exposure signal. Cross-validation discards retrieval exposure entirely in eight of the ten repositories, so the combination reduces in practice to the single signal it was built to improve on.

• A measured, deployable filter. Track A shows that hash-identity skipping is safe by construction in all 10 repositories with savings up to 49.2%. A Python docstring rule applies to only eight units across the benchmark and misses one, too few to validate; we give a label-free probing guard for deploying it but cannot exercise that guard on this data. Both rules are detectable from the changed text alone, so the filter stage costs a hash comparison and a tree-sitter parse and consumes no GPU.

Nannan Zhao, Jiameng Zhang, Taoyu Zhong, Hao Wang, and Bo Wang

References (19)