Reading the Diff: Typed Draft-to-Draft Similarity as a Stopping Rule for Black-Box Refinement

Many language-model systems improve answers by looping: the model writes a draft, critiques it, and rewrites it, often several times. Each extra round adds a full generation, so a loop of three or four rounds can make a request take several times longer. On closed models served only through an API, the main existing way to cut this cost, folding the reflection into the model's internal activations, is not available. The usual workaround is a fixed number of rounds. That wastes time on easy inputs, and on hard inputs it keeps rewriting after the answer has started getting worse. This proposal asks whether a cheap external signal can tell the loop when to stop, when to continue, and when to go back to an earlier draft. The signal is a structured description of how each new draft differs from the previous one.

The idea in two sentences: after each refinement round, align the new draft against the old one chunk by chunk and label each change. Labels say whether a chunk is unchanged in meaning, reworded, made more specific, contradicted, added, or deleted. Then use the mix of labels as the stopping signal. The hypothesis is that the kind of change predicts whether the next round will help, and that it does so better than how much changed. A loop that is only rewording has converged. A loop that starts contradicting content it previously kept stable is drifting and should revert.

Core Claim

A single similarity score between consecutive drafts, such as a cosine of 0.93, mixes up three situations that need opposite actions. The first is harmless rewording, where the loop should stop. The second is a few small specializations that add needed detail, where it should continue or stop soon after. The third is a few contradictions in a short span that reverse a fact, where it should revert. All three can give similar scalar scores. Typed alignment can tell them apart. Typed alignment comes from interpretable semantic textual similarity (iSTS), which labels aligned chunk pairs as equivalent, opposite, more-specific, similar, related, or unaligned. The claim is that a small controller reading these typed change profiles gets close to the hindsight-optimal stopping point of a refinement loop with closed models, at an overhead of one encoder pass per round and no extra generated tokens. It should also beat scalar-similarity stopping matched for compute. If the scalar version does as well, the typed decomposition is unnecessary, and the proposal is designed to show that outcome plainly if it happens.

Grounding in Prior Work

The motivating evidence comes from the latency side. Volcano runs a critique-revise-decide loop for vision-language answers and reports 2x to 3x the latency of one forward pass. Teaching Language Models to Self-Improve by Learning from Language Feedback trains models to critique and then refine. It raises Tulu2-70B's AlpacaEval 2.0 win rate from 9.6% to 25.8%, and its authors name the doubled decoding as a main cost. RAG-Critic replaces scalar scores with a 4,000-label error taxonomy and gains +5.3% on average, but its generate-critique-plan-execute loop adds substantial latency. RepoCoder iterates retrieval and generation with no adaptive stopping, and its later rounds can pull in irrelevant context. All four establish that refinement pays off and that its cost scales with the number of rounds. None of them decides the number of rounds per input.

Two works limit what the design can be. Meta-Reflection collapses reflection into one pass using a codebook placed at layer 26 of 32. It cuts first-token latency on Taobao ECID from 951ms to 246ms and reaches 63.4% Pass@1 on MBPP against 58.8% zero-shot. It needs hidden-state access, so the controller here must use only model outputs. Let's Revise Step-by-Step (ReLoc) shows that a learned scalar "revision distance" can steer code search, lifting LiveCodeBench Pass@1 from 33.8% to 38.4% with 37% fewer tokens than tree search. It is the strongest evidence that a scalar learned signal is enough to guide refinement, so this proposal must beat a scalar signal of that kind rather than ignore it.

The method comes from the similarity side. The chunk-align-label pipeline and relation types come from SemEval-2016 Task 2 and Interpretable Semantic Textual Similarity: Finding and explaining differences between sentences. The latter reports alignment F1 of 0.77 and Type+Score F1 of 0.53 on headlines. Joint neural aligners such as iUBC avoid cascading errors between pipeline stages. For structured outputs, STED gives order-invariant typed tree edits (insert, delete, update). STED has been used only as an offline evaluation metric, and here it becomes an online signal. A continuous alternative to discrete types is the per-axis cosine decomposition of Revisiting Cosine Similarity via Normalized ICA-transformed Embeddings. It splits a cosine score additively over sparse, near-independent semantic axes, and the program tests it as a second decomposition. Finally, Instance-dependent Early Stopping stops computation per example when the second difference of its loss flattens. It gives 1.2x to 1.4x training speedup but breaks down at 40% label noise. We borrow its idea of judging change by its trajectory and treat its noise failure as a warning that our aligner's own errors may be the binding constraint.

Research Program

At round $t$ the loop holds drafts $y_0,\dots,y_t$. A frozen aligner maps the pair $(y_{t-1}, y_t)$ to a change profile $h_t$. This is the length-weighted fraction of chunk mass in each relation type: equivalent, specific-more, specific-less, similar, related, opposite, inserted, deleted. It also includes a stability term $s_t$, the fraction of chunks that were labeled equivalent in the previous round and are now labeled opposite or deleted. A small classifier $\pi$ (gradient-boosted trees or a two-layer network) reads $(h_t, h_{t-1}, s_t, t)$ and picks one of three actions: stop and return $y_t$, continue, or revert and return $y_{t-1}$. It is trained on logged refinement trajectories, using as the label the action that maximizes final task quality minus a per-round latency cost $\lambda$:

$$a_t^\ast = \arg\max_{a \in \{\text{stop},\text{continue},\text{revert}\}} \; \mathbb{E}[\,Q(y_{\text{final}}) \mid a\,] - \lambda \cdot \text{rounds}(a),$$

where $Q$ is the task metric (answer F1, Pass@1, judge win) and sweeping $\lambda$ traces a quality-latency curve.

The aligner is domain-specific but always cheap and non-generative. For free text it is a joint iSTS aligner trained on SemEval-2016 Task 2 and lightly adapted on a few hundred annotated draft pairs. The adaptation is needed because SemEval found that alignment quality collapses off-domain on the Answer-Students set, and LLM drafts are off-domain for headline-trained aligners. For JSON outputs it is STED's typed tree edits. For code it is the same tree-edit typing applied to abstract syntax trees, which separates renames and reformatting from changed control flow or changed constants. The trajectories come from three loop styles: plain self-critique and rewrite, critique-free "improve this answer" prompting, and retrieval-in-the-loop in the RepoCoder style. These run on two closed API models and one open model for reproducibility, so the controller can be tested for transfer across loop styles and models.

The program has three questions. First, is the change profile predictive? We measure how well $h_t$ predicts the sign of $Q(y_{t+1}) - Q(y_t)$ compared with scalar similarity. Second, does a controller built on it reach the hindsight-oracle stopping point at low cost? Third, does the revert action recover from drift, meaning cases where a later draft is worse than an earlier one? Revert is the part with no counterpart in fixed-round or threshold-based stopping.

Baselines

The naive reference point is a fixed-round loop at one, two, and four rounds, run with the same prompts and models. The single-round, no-refinement point fixes the latency floor. The four-round point approximates current practice and, per Volcano, costs several times a single pass. Beating it means matching its quality at a clearly lower average number of rounds. The ceiling is the oracle that picks the best draft in hindsight. We report what fraction of the gap between the fixed-round loop and the oracle each controller closes.

The ablation that isolates the key ingredient is a scalar-similarity controller. It has the same classifier, the same training trajectories, and the same tuning budget, but its features are scalar: cosine between consecutive drafts from the same encoder, normalized edit distance, and their first and second differences across rounds, as in IES. This is the most dangerous competitor because it costs the same and tests exactly whether typing matters. Beating it means a statistically reliable gain in area under the quality-latency curve across at least two of the three domains, together with higher accuracy on detecting drift.

The strongest existing learned signal is a ReLoc-style scalar revision-distance model used as a stopping critic, evaluated on code where ReLoc reports 38.4% Pass@1 on LiveCodeBench. To keep the comparison fair, our controller's training data is capped at the same trajectory count used for the reimplemented scalar critic. We also compare against a self-judgment stop, where the API model is asked whether the draft needs further revision. It costs a short generation per round, and its latency is charged honestly. For adaptive stopping of refinement loops on closed models specifically, no reported result was found on Lacuna. Meta-Reflection's figures (246ms first-token latency, 63.4% MBPP) are cited only as a white-box reference that our setting cannot reproduce.

Why not just…?

Why not just sample N drafts in parallel and pick the best? Parallel sampling removes sequential latency, but the file's evidence suggests it gives up quality. The self-refinement paper reports that critique-and-revise beats Best-of-N re-ranking, and ReLoc reports that Best-of-N plateaus as token budgets grow while revision-based search keeps improving. Parallel sampling also needs a selector, and that selector faces the same scalar-versus-typed question. We include Best-of-N at matched wall-clock and matched tokens. If it dominates our controller on any domain, we report that the domain does not benefit from sequential refinement at all.

Why not just threshold cosine similarity between consecutive drafts? This is the real threat, and the scalar ablation above exists to settle it. The case for typing is that a contradiction confined to one short span barely moves a sentence-level cosine. The token-level matching work (Going Beyond Sentence Embeddings) argues exactly that pooled vectors wash out localized substitutions. If the scalar controller matches ours, the conclusion is that convergence is easy to detect and drift is rare, and the paper will say so.

Why not just ask the model whether it is done? Self-judgment needs no new components, but it costs a generation each round, which adds latency, and it is judged by the same model that produced the drift. RAG-Critic's finding that GPT-4o identifies RAG errors at 78.0% accuracy, against 96.2% for a specialized critic, suggests general models are unreliable judges of their own failures. Our experiments measure the precision of self-judgment on rounds that turned out harmful.

Why not just distill the loop into one pass? For open models this is a strong option, as Meta-Reflection and DCFold's single-pass compression of a multi-step loop show. It is unavailable for closed APIs, which is the setting this proposal targets. On the open model we report a distilled single-pass variant to show where the black-box approach stands relative to it.

Proposed Experiments

Free-text refinement uses GSM8K and HotpotQA. For HotpotQA we use the distractor setting, scored by answer and supporting-fact F1, and for reference BiDAF reaches 58.28 answer F1 there. Both feed retrieval-free and retrieval-in-the-loop variants. Open-ended refinement uses AlpacaEval 2.0 with the judge's win rate as $Q$. Code uses MBPP and LiveCodeBench Pass@1, plus RepoEval for retrieval-iterating completion scored by exact match and edit similarity. Structured output uses prompts in the style of the STED synthetic JSON benchmark, scored by schema validity and field-level correctness. For each setting we log four-round trajectories, then train controllers on half the problems and test on the other half. Transfer is tested across models (train on one API model, test on another) and across loop styles.

The metrics are area under the quality-versus-mean-rounds curve, wall-clock latency including aligner time, generated tokens, fraction of the oracle gap closed, and, for revert, the rate at which the controller recovers the best draft when the final draft is worse.

The first decisive check is predictive. On held-out rounds, does the change profile predict whether the next round will help better than scalar features do, and is the opposite-type and stability signal specifically what flags degrading rounds? The second is aligner noise, by analogy with IES's noise failure. We inject controlled errors into the alignment labels and measure how fast the advantage over scalar features disappears. We also report results with SemEval-only aligners against domain-adapted ones, since the Answer-Students failure predicts that the unadapted aligner will be weak. The third is overhead. The aligner must cost under a tenth of one generation round, or the latency savings are not real. If typing beats scalar features only in code and JSON, where typed edits are exact, and not in free text, where chunk alignment is noisy, that would be a useful and publishable narrowing of the claim.