Spaced Feedback: Prime-Boost Scheduling for Code Refinement Agents

Vaccines given too close together work worse: a booster delivered before the immune system has finished maturing its antibody lineages floods the reaction with antigen, weakens selection for high-quality binders, and exhausts the cells that present evidence to the system. Lengthening the interval lets weak candidates be pruned and strong ones mature, which is why a 12-week Ebola vaccine schedule produces markedly more mutated, higher-affinity antibodies than a 4-week one. Meanwhile, large language models that write and debug code do exactly the opposite of this: every compiler error, traceback, and test failure is pasted back into the prompt immediately, iteration after iteration. The result is a well-documented stall — improvement flattens after two to four rounds of feedback — and, worse, a compounding-error trap where the model reinforces its own mistakes because the only signal it sees is its own output.

The proposal here is to treat execution feedback in code-refinement loops as a dosing schedule rather than a firehose. Concretely: hold a population of candidate fixes, let them "mature" by being generated, executed, and scored against tests without new feedback for a set interval, prune weak candidates, and only then inject a batched, summarised "booster" of fresh execution evidence into the context. Domain mismatch supplies the regime where this should matter most — real repositories, noisy data directories, and legacy languages produce feedback text that is expensive and garbled under the model's tokenizer — and tokenization fertility (how many subword pieces a string shatters into) supplies the measurement layer that tells us when feedback has become "exhausting." No study we found on Lacuna has transferred interval-scheduling principles from multi-dose immunization to iterative code refinement; the intersection is unoccupied.

Core Claim

The claim is specific and falsifiable: the timing and batching of execution feedback, not just its content, is an unexplored control variable in iterative code refinement, and scheduling it — spacing injections, enforcing a maturation interval between a candidate's generation and its selection, and pruning the candidate population between boosts — will raise final success rates on domain-mismatched benchmarks at matched compute budgets, with the largest gains on tasks whose feedback streams have high subword fertility. Current systems treat feedback as immediate, unspaced, and homogeneous; every closed-loop system we surveyed concatenates each new error straight into the context window, and none varies the schedule.

Three observations motivate the mechanism rather than merely decorating it. First, refinement curves plateau: on the LLMTrans portion of CodeTransOcean, ChatGPT starts at a 48.57% debugging success rate and three rounds of compiler feedback add only four points, to 52.57%, with most of the gain in round one — exactly the diminishing-returns shape that immediacy-driven feedback would predict. Second, immediate self-feedback without external verification actively harms quality: in the Stanford developer study, 36% of AI-assisted users wrote SQL-injection-vulnerable code versus 7% of controls, and secure encryption implementations fell from 43% to 24% — the "model close" trap, structurally analogous to antigen excess damping selection pressure in a germinal center. Third, germinal-center modeling gives the analogy a quantitative spine: the stochastic GC model of Pelissier et al. found roughly a seven-day delay between a mutation arising and its clone dominating, and Wang et al. showed that moving repeated exposure from two weeks to four prevented dendritic-cell exhaustion. The ML translations are: a candidate edit needs some number of evaluation rounds before its value is legible, and feedback injected faster than the loop can metabolise it degrades rather than helps.

The Mechanism, Made Concrete

We build a scheduling layer, drop-in replaceable with the feedback loop of an existing agent, with four components mapped one-to-one onto the immunology. Prime: the initial generation round, seeded with the issue and retrieved context, produces a population of $N$ candidate patches (clonal expansion). Maturation interval: for $K$ rounds, candidates are executed against the available tests and scored, but no new external feedback enters the context; scoring is selection, and the lowest-scoring candidates are pruned with rollback to the last passing checkpoint, generalising the rollback mechanism that MEIC showed is essential to avoid regressions. Boost: only when accumulated pending feedback crosses a token budget is it injected — batched, deduplicated, and summarised. The budget is measured in the currency the model actually spends, subword tokens, not characters:

$$M_t = \sum_{s \in F_t} \phi(s), \qquad \text{inject feedback when } M_t \ge B$$

where $F_t$ is the set of pending feedback strings (tracebacks, test output, file listings) and $\phi(s)$ is the number of subword tokens the model's tokenizer produces for string $s$. This is where tokenization stops being background and becomes the control variable. The fertility literature shows $\phi$ varies wildly and asymmetrically across domains: evidential Japanese suffixes trigger byte fallback that inflates perplexity by a factor of 28 until the offending tokens are excluded (Inconsistent Tokenizations Cause Language Models to be Perplexed by Japanese Grammar), Amharic retrieval degrades directly with fertility (Mekonnen et al.), and NaturalCodeBench shows GPT-4 falling from roughly 80% on HumanEval to 52.8% pass@1 when queries come from real users instead of curated puzzles. Our hypothesis is that high-fertility feedback — Verilog identifier soup, legacy-language syntax, noisy Kaggle directory dumps — exhausts context early and drives the plateau, so $\phi$ should predict per-task plateau depth, and scheduling should help most precisely where $\phi$ is high. Notably, the Japanese-grammar paper's "Weblab paradox" (a uniformly bad tokenizer beat a mostly-good one with local spikes) predicts the harm is worst under asymmetric fertility, which we can test by comparing feedback fertility to code fertility per task.

Research Program

The program has three parts. First, build the scheduler as a modular wrapper around open agent scaffolds (an SWE-Agent-style loop for repository tasks, the AutoTransExecuter-style loop for translation), with two free parameters — maturation interval $K$ and budget $B$ — plus the population size $N$, tuned once on a held-out split with the same search budget given to every baseline. Second, build the fertility instrumentation: for every benchmark, log $\phi$ for each feedback string, cumulative token mass, context occupancy, and the round at which improvement stalls, producing the first token-level account of why refinement loops plateau; CodeTransOcean and MEIC both document plateau and regression phenomena but neither analyzes tokenization across their loops, which is the open gap they explicitly leave. Third, test the durability analogue of Laher et al., who found a late HIV booster at 12 months restored titers with a slower decay slope: we measure whether fixes from spaced schedules survive a "delayed re-test" — the full test suite re-run after the fix context is stripped — better than fixes from immediate-feedback schedules, treating regression-under-retest as the decay kinetics of the code world.

Proposed Experiments

Four benchmark families, chosen because each isolates a different mismatch. On SWE-bench Lite, we wrap the scheduler around the same scaffold and backbone as MAGIS and measure resolution rate against its reported 25.33% (with SWE-Agent at 18.00% and AutoCodeRover at 16.11% as secondary references); the SWE-bench "lost in the middle" finding — larger context suppressing fault localization — is our exhaustion endpoint. On CoDA-Bench (resource: CoDA-Bench), 1,009 data-discovery tasks where the current best, Mini-SWE-agent with GPT-5.5, reaches 61.1% execution accuracy (49.6% on CoDA-HARD) and agents fail to even find target files in roughly 20% of tasks, we test whether spacing the noisy data-discovery feedback — the highest-fertility feedback in our inventory — closes part of the 25–28-point gap that oracle file locations reveal. On CodeTransOcean's LLMTrans and NicheTrans subsets we measure debugging success rate at rounds 0 through 6 against the reported DSR@3 of 52.57%, asking whether scheduling extends the curve past the two-to-four-round plateau, and whether gains correlate with per-language fertility across the 45 languages. On the 178-bug RTLLM set we compare against MEIC's reported 93% syntax and 78% functional fix rates, using Verilog — whose identifiers and keywords fragment badly under natural-language-optimized tokenizers — as the extreme-fertility condition. Throughout, total LLM calls, total tokens, and wall-clock are held equal across methods, so spacing cannot win by simply buying more compute.

Baselines

The naive reference point is one-shot generation with no feedback loop: GPT-4 at 52.8% pass@1 on NaturalCodeBench as reported by NaturalCodeBench, and GPT-4 at 1.74% on the SWE-bench subset under sparse retrieval as reported by MAGIS — numbers that establish how much the loop itself, before any scheduling, is worth. The strongest competitor is the immediate-feedback iterative agent: MAGIS at 25.33% resolution on SWE-bench Lite, MEIC at 78% functional fix rate on RTLLM, and Mini-SWE-agent plus GPT-5.5 at 61.1% execution accuracy on CoDA-Bench, each the best reported number on Lacuna for its benchmark. We will run our scheduler as a modification of these same systems — same backbone model, same retrieval, same agent roles, same test harness — changing only when and how feedback enters the context, and we will give the baseline our tuned population size and sampling budget so the only difference is the schedule. Beating the baseline means a statistically significant improvement in resolution rate, execution accuracy, or fix rate on at least two of the four benchmark families at matched total token cost. Two further comparisons isolate our ingredients: an ablation with population and selection but immediate, unbatched feedback (isolating scheduling), and a feedback-truncation baseline that discards old feedback to meet the same token budget without batching or maturation (isolating summarisation-plus-selection from mere context hygiene).

Why not just…?

Why not just run more iterations or sample more candidates? This is the cheapest alternative and it is partly absorbed into our design — our maturation interval does spend samples. But the evidence says sampling alone plateaus: CodeTransOcean shows three rounds of feedback buying only four points over the initial 48.57%, and MEIC needed rollback machinery precisely because extra rounds introduce regressions. Our immediate-feedback-with-population ablation is exactly this alternative, run head-to-head; if it matches the scheduled version, the scheduling claim is dead and we will report that.

Why not just use a longer context window or better retrieval? SWE-bench directly rebuts the longer-context version: models degrade on fault localization as context grows ("lost in the middle"), and giving Claude 2 the gold files only lifted it to 4.8%. Better retrieval helps — MAGIS built its Custodian role for this — but retrieval addresses what enters the context, not when or at what rate, and CoDA-Bench's oracle experiments show the residual gap after perfect retrieval is still 25–28 points on data-intensive tasks. Retrieval and scheduling are complementary; our experiments hold retrieval fixed.

Why not just fine-tune the model on the target domain, like fBERT? Domain-adaptive pre-training genuinely works for a static target distribution: fBERT lifted HatEval Macro F1 from 0.483 to 0.596 by continued pre-training on 1.4 million offensive posts. But repository-level tasks have a different domain per instance (each repo, each Kaggle community, each legacy language), so there is nothing stable to pre-train on at acceptable cost, and the approach risks the catastrophic forgetting of formal competence documented across the domain-adaptation literature. This is a real threat only for the recurring-domain case, such as NicheTrans's 37 legacy languages; we will settle it empirically by running a fine-tuned CodeT5+ baseline there, noting that CodeTransOcean reports such models reaching only 6.42 average BLEU in many-to-many translation, which leaves substantial room.

Decisive Checks and Limits

The single most decisive result would be the fertility–plateau correlation: if cumulative token mass at plateau does not predict stall depth across tasks and languages, the tokenization half of the story is wrong even if scheduling still helps, and we would report the scheduling result as an unexplained empirical finding. We are also honest that the immunological mapping is a source of design priors, not a derivation — a skeptic could attribute any gains to generic context management, which is why the truncation baseline exists and why we pre-register the prediction that gains concentrate in high-$\phi$, high-mismatch conditions (CoDA-HARD, NicheTrans, RTLLM) rather than uniformly. Finally, if spacing helps only when feedback is noisy and token-expensive, that is itself the paper: a boundary condition telling the field when immediacy — the default in every system from DeepFix through POLO — is the wrong default.