Manuscript Offprint
arXiv:2610.41460RetryRoute: Retry-Aware Model Routing for Agentic Image Editing Services
Hanshuai Cui
School of Artificial Intelligence,
Beijing Normal University, Beijing
100875, China
Institute of Artificial Intelligence and
Future Networks, Beijing Normal
University, Zhuhai 519087, China
Zhiqing Tang
Institute of Artificial Intelligence and
Future Networks, Beijing Normal
University, Zhuhai 519087, China
Zhi Yao
School of Artificial Intelligence,
Beijing Normal University, Beijing
100875, China
Institute of Artificial Intelligence and
Future Networks, Beijing Normal
University, Zhuhai 519087, China
Jun Luo
College of Computing and Data
Science, Nanyang Technological
University, Singapore
Abstract
Web agents increasingly edit images by calling open editing models in a critique-and-retry loop, and these models differ in cost by more than an order of magnitude. After every rejected edit, a service must decide whether to retry the same model, escalate to another or give up. Existing routers pick one model per request, and cascades escalate in a fixed order. However, both treat a retry as an independent draw. We identify sticky failures, meaning that a retry after a failure succeeds only 17–53% as often as a first try across six open models, three benchmarks and two judges. Based on this finding, we propose RetryRoute, a retry-aware router that estimates each model's chance of success given the request's failure history. It plans retries, escalations and abandonment over failure states and adds live queue waits to the cost, so the same plan becomes load-aware dispatch. At the main budget, RetryRoute's success under the in-loop judge exceeds the strongest of eleven prior baselines by 2.8 points on average over eight groups. On a GPU serving testbed it raises the share of edits delivered within the service-level objective by 5.0–6.3 points over the best prior baseline at every load.
CCS Concepts
• Information systems → Web services; • Computer systems organization → Cloud computing; • Computing methodologies → Image manipulation.
1 Introduction
Image editing has become a routine tool call for Web agents [31, 59], from recoloring product photos to localizing the text on a banner. Following the critique-and-revise pattern of agent systems [38, 48, 51, 58], the agent sends the image and an instruction to an editing model, asks a vision-language judge whether the result follows the instruction, and retries when it does not. The open editing models behind such calls [13, 45] differ by more than an order of magnitude in cost. A 4-step distilled model [46] returns an edit in under 6 s on a 24 GB GPU, while the strongest open models need
Weijia Jia
Institute of Artificial Intelligence and
Future Networks, Beijing Normal
University, Zhuhai 519087, China

(a) First try vs. retry after a failure, two judges averaged.

(b) “Replace the text ‘WOOD’ with ‘LAND’.”
Figure 1: Sticky failures. A model that fails an edit mostly fails it again, while a different model often succeeds.
minutes. However, a service that runs these loops pays for every rejected attempt, so where it sends the next attempt after a rejection decides both its cost and how many edits it delivers. Retry routing is therefore a cost and reliability problem of agentic Web services, a topic of the Web Infrastructure and Agentic Systems track.
Serving systems for generative models already exploit this cost spread. Per-request routers pick one model for each request from its features [29, 40, 44]. Following the cheap-first cascade of Viola and Jones [50], serving cascades send a request to a light model first and escalate to a heavier one when a quality check fails [1, 2, 16, 57]. Agent frameworks and Best-of-N sampling simply retry the same model with a new seed. All three share an implicit assumption about the retry. They treat a second attempt on a failed model as an independent draw with the same success probability, and under this assumption retrying the cheapest adequate model is the cost-optimal policy ( ).
However, these designs overlook how a failure changes the next attempt's chance of success, which concurrent work on code generation has begun to observe [18]. We measure it on six open editing models in two pools, on three benchmarks with GEdit-Bench in two languages, and with two independent judges, and identify sticky failures. The retry rate is only 17–53% of the first-try rate (Figure 1a). FLUX.2 [klein] [10] passes 67% of edits on the first try but only 15% of the edits it has just failed, while another model of its pool still solves 45% of them (Figure 1a). This also explains why cascades help but stall. They escalate after a failure, but in a fixed order and mostly once per model, so they rarely retry a cheap model while a retry is still worth its cost.
Turning sticky failures into better retry decisions raises two challenges. (C1) How can a service estimate each model's chance of success given a request's failure history? First-try rates overstate the retry rate by about two- to sixfold (§3.2), while counting outcomes per failure history spreads the logs thin, since few requests reach deep failure states. (C2) How can it turn these estimates into retry, escalation and abandonment decisions that stay good as the load changes? When a request is hard for several models at once, a failure on one model also lowers the others' chances, so no fixed priority rule over the models is optimal in general. A fixed retry plan tuned at one load can also collapse at another, because a busy GPU makes its model's next attempt slower (Figure 2c).
We therefore propose RetryRoute, a router for agentic image editing services named for routing every retry rather than every request (Figure 3). To address C1, RetryRoute estimates , the probability that model 's next attempt succeeds given the failure counts so far, by counting logged attempts per failure state and shrinking each category's estimate toward the all-category one. For C2, it solves a Bellman equation over failure states to plan retries, escalations and abandonment, adds each model's live queue wait to the cost and re-plans after every attempt, which turns escalation into load-aware dispatch. We validate RetryRoute against eleven prior baselines in eight evaluation groups and on a three-GPU serving testbed. At the main budget and under the in-loop judge it leads the strongest prior baseline by 2.8 points on average and up to 5.6, and same-model retry by 3.5–13.3 (§5.2). With one setting, its goodput on the testbed exceeds the best prior baseline's by 5.0–6.3 points at all three loads (§5.6). Our contributions are threefold.
- We identify sticky failures and show that retries of open editing models are strongly correlated with the failure they follow, across eight groups and 50 model–judge cells and even in the judges' late passes, and we give a formulation as planning over failure states that explains it.
- We propose RetryRoute, a router built on one estimate, the next attempt's success given the failure history, with an exact planner over failure states that charges live queue waits and an online learner on the same estimate.
- We evaluate RetryRoute against eleven prior baselines in eight offline groups and on a GPU serving testbed, with controls, ablations, robustness, generalization, per-category and judge checks.

(a) Next attempt after failures.

(c) Fixed plans under load.

(b) Cost per success.
(d) Single-judge check.
Figure 2: Four findings behind RetryRoute. Panels a and b use English GEdit-Bench with bands over four pool-1 groups, and panel c replays the logged edits under load on 3 GPUs.
2 Related Work
Serving and routing generative image models. DiffServe [2] and HADIS [57] cascade a light and a heavy text-to-image model under a quality check or a query-aware router, and Cost-Aware Routing [29] and GenRouter [14] pick one model or one agentic workflow per request. All of them decide once per request, whereas RetryRoute plans across attempts. OctoT2I [25] chooses again after each rejected round. A large language model (LLM) picks the cheapest text-to-image model it expects to pass, from per-model success records and the earlier rounds. However, OctoT2I neither counts how a failure changes each model's next success nor plans the remaining attempts under a budget and load.
LLM routing and cascades. RouteLLM [40] routes each query between a strong and a weak model, FrugalGPT [16] and AutoMix [1] escalate when a scorer or a self-check rejects an answer, and TREAT-CLE [63] learns when to re-query or switch LLMs under a budget. Concurrent work on code generation finds that escalating beats resampling after a verifier rejection [18]. None of them, nor the algorithm selection view of routing [44], plans over failure states as RetryRoute does.
Retries, sampling and agents. ACQB [6] learns from user retrials but gives a retrial the success probability of a first attempt, latency-aware routing [41] adds instance load to the first decision, and vLLM Semantic Router [35] switches models from recent outcomes without a planning model. Agents refine their outputs from feedback [38] and editing agents revise them with tools [31, 51, 58], and judges [17, 27, 37, 55, 65] and hard-edit benchmarks [64] make such loops measurable. RetryRoute instead decides which model the loop calls next and charges queue waits at every attempt.

Figure 3: Overview of RetryRoute. It (a) estimates offline, (b) plans over failure states and (c) re-plans with queue waits. In the bottom row a5 fails twice and RetryRoute escalates to a4.
Table 1: Editing models, called arms, and GPU seconds per edit, with pool 1 above the rule and pool 2 below.
| Arm | Model | Steps | Time (s) |
|---|---|---|---|
| a5 | FLUX.2 [klein] 4B [10] | 4 | 5.7 |
| a4 | Qwen-Image-Edit-2511 [54] + Lightning [30] | 8 | 39.8 |
| a3 | Qwen-Image-Edit-2511 | 40 | 170.7 |
| a1 | FLUX.1 Kontext-dev [12] | 28 | 60.2 |
| a2 | a1 + Turbo-Alpha [4] | 8 | 25.7 |
| b1 | VIBE [3] | 20 | 0.9 |
| b2 | LongCat-Image-Edit [39], CPU offload | 50 | 108 |
| b3 | Step1X-Edit v1.2 [34, 61], 2 GPUs | 28 | 173 |
3 Background and Motivation
3.1 The Agentic Editing Loop
Agentic editing loop. A request , an image with an instruction, is served by a sequence of attempts. Each attempt picks an editing model, an tried at most times, pays cost for generation plus one 10 s judge call, and is accepted or rejected by a judge. The request ends at the first acceptance or when the policy abandons it. Our two pools of open models span and in generation time on 24 GB RTX 4090D GPUs (Table 1).
Planning over failure states. Because a request continues only after a rejection, every policy is a sequence of attempts with value , where is the success probability of the -th attempt given that all earlier ones failed, its GPU seconds, and a cost weight. With the failures so far as the state , let be the probability that the next attempt on is accepted after the rejections in . The optimal policy then
solves the Bellman equation [9]:
where 0 is abandonment and the unit vector of , and sweeping traces a cost-success frontier. Same-model retry, per-request routers and cascades all plan with the first-try rate at the state 0 with no failures in place of , which is exact only if retries are independent.
3.2 Failures Are Sticky
Benchmarks and judges. We use 438 GEdit-Bench [34] items in 11 edit categories with Chinese and with English instructions, 230 items of GEditBench v2 [26], and 180 ImgEdit [60] items from 9 categories. Each model is run with 8 seeds for the cheapest arm and 2 seeds for the others, and the -th attempt of a model on an item is its seed . Two independent judges score every image. EditScore [37] on Qwen3-VL-8B [7] uses its pass threshold , and EditReward [55] on Qwen2.5-VL-7B [8] uses a threshold set to give the same overall pass rate. In the loop we use an ensemble of the two vision-language judges, which averages each score's quantile over all images and passes an attempt above a threshold that gives the pass rate of EditScore at . Pool 1 on Chinese and English GEdit-Bench (GEdit-CN and GEdit-EN), a five-arm English set, GEditBench v2 and ImgEdit, and pool 2 on Chinese and English GEdit-Bench and ImgEdit form eight groups, which together hold 30,042 edited images.
A retry rarely succeeds, but another model often does. In all 50 model-judge cells, a retry succeeds only 17–53% as often as a first try, and Figure 1a averages them per model. For a5 on English GEdit-Bench the next a5 attempt passes 0.143 after one failure, while a4 still passes 0.436 (Figure 2a), and eight a5 attempts reach 0.804 where independence predicts 1.000. We call this sticky failures. The next attempt's chance depends on the failure history, which motivates estimating per failure state ( ).
Latent difficulty explains it. Sticky failures are what heterogeneous request difficulty predicts, as Appendix A proves.
LEMMA 1. Let a request have a latent difficulty z, and let attempts of arm a on it succeed independently with probability . Then a history of rejections affects the next attempt only through the failure counts s, so (1) over s is exact. With the expectation given s:
A retry is therefore never more likely to succeed than the attempt it follows, and strictly less likely when requests differ in difficulty for that model. With shared difficulty, where , a failure also lowers the other models' chances, as a4's drop from 0.733 to 0.436 after one a5 failure shows.
When to escalate depends on the failures so far. Per success, a second a5 attempt costs as much as an a4 attempt (110 s against 114 s) and a third twice as much (Figure 2b). Choosing the model up front adds only about one point, since a5 is the cheapest per success in all 11 categories. The decision that matters comes after each failure, which motivates planning over failure states ( ).
Load flips the best fixed plan. The fixed plan is best at 0.02 req/s with goodput 82.7% but drops to 9.3% at 0.06, where keeps 74.2% (Figure 2c). Goodput is the share of requests that succeed within the service-level objective ( ). No fixed plan is best at every load, which motivates re-planning with live queue waits after every attempt ( ).
Late passes are less reliable. EditReward confirms 84–93% of the in-loop judge's first-try passes but only 51–75% of its late passes, those after a failure, and this rate is lower in all eight groups (Figure 2d). Many attempts on a weak model collect false passes, so a retry loop should trust a late pass less ( ).
4 RetryRoute Design
RetryRoute rests on one quantity, , which an estimator learns from logged attempts for C1 and a planner turns into the next action after every rejection for C2 (Figure 3). §4.3 then shows when simpler fixed rules are already optimal.
4.1 Estimating Success Given Failures
To address C1, RetryRoute estimates by counting. Among logged training requests whose attempts in s all failed, it takes the fraction whose next attempt on a passed. States far down the tree have few requests, so we estimate per request category and shrink toward the all-category estimate [21]:
where of the category-g requests in state s passed on a, k of n over all categories, and . This keeps the sharp drop after a failure, which first-try rates miss, while a category with few logs falls back to the pooled estimate.
Counting needs no model of difficulty. We count rather than fit the latent-difficulty model of the Lemma, since counts need no parametric form for and are most accurate in the shallow states that most requests visit.
4.2 Planning Retries under Load
Exact planning. To address C2, RetryRoute acts on the estimates by exact planning or, for cold start and drift, by online learning, and it adds the load to the cost. The state space is small, with states, for example 81 for three arms with caps 8, 2 and 2. Memoized recursion solves (1) exactly in 0.35 ms for three arms and 5.6 ms for five, and we call it the dynamic-programming (DP) planner.
Load-aware re-planning. In a shared service, an attempt on a busy arm also costs queueing delay. At each decision, RetryRoute adds to the current expected wait of arm a's queue and of the judge queue. Each wait follows Little's law [32] as queue length times measured service time divided by the number of workers, and RetryRoute then re-solves (1) from the request's current state. Under light load this reduces to the static plan, and under heavy load it shifts attempts toward idle arms or abandons earlier.
Online learning. For cold start or drift, RetryRoute can instead learn online with LinUCB [5, 28] plus an abandon action. The context at each attempt is the request category, the number of failures so far on each arm and the attempt index, and the reward of an attempt is its acceptance minus . Without the failure history it treats every retry as a first attempt, as ACQB [6] does.
4.3 When Fixed Rules Are Optimal
Index rules are optimal for independent alternatives in classical index and search theory [24, 49, 53], and here fixed rules are optimal only in special cases, with proofs in Appendix A.
PROPOSITION 1. (i) If retries are independent, , an optimal policy tries the arms in increasing order of cost per success , each up to times, skipping arms with . With it repeats the single arm . (ii) If a failure changes only the failed arm's own success rate, non-increasing in , the index rule is optimal. It tries the arm with the smallest current , stops when , and in particular escalates from to as soon as .
Part (i) is the logic behind retry loops on a cheap model, and part (ii) says when to escalate. For a5 the switch comes after the first or second failure (Figure 2b). With shared difficulty, the Cov term of the Lemma, no fixed index is optimal in general. The next arm's value depends on which arms have failed, and only (1) over the failure counts captures it. For example, let 70% of requests be easy and the rest hard for both arms (Appendix A). The index rule then tries a, a, b and is worth 0.514, while the planner over failure counts is worth 0.560.
5 Evaluation
5.1 Setup
Protocol. Offline results replay the logged edits of §3.2, so every success is a real model output accepted by the judges and every cost is a measured GPU time from Table 1. Every method tunes its
Table 2: Offline success rate (%) at the main budget of 50 s for pool 1 and 120 s for pool 2.
| Method | Pool 1 (50 s) | Pool 2 (120 s) | ||||||
|---|---|---|---|---|---|---|---|---|
| GEdit-CN | GEdit-EN | EN 5 arms | GEdit-v2 | ImgEdit | GEdit-CN | GEdit-EN | ImgEdit | |
| Oracle, per-item hindsight | 92.466 | 91.553 | 93.151 | 88.261 | 87.778 | 87.671 | 88.584 | 92.778 |
| Retry or route one model | ||||||||
| Same-model retry | 81.735 | 81.735 | 82.648 | 80.435 | 78.889 | 77.397 | 73.973 | 79.444 |
| Rewrite-retry, blind | 80.822 | 82.420 | 84.703 | 79.565 | 81.667 | 77.397 | 73.973 | 77.778 |
| Rewrite-retry, critique | 78.311 | 81.279 | 83.333 | 77.391 | 80.000 | 77.397 | 73.973 | 79.444 |
| Best-of-N | 74.886 | 76.256 | 79.224 | 74.348 | 74.444 | 77.397 | 73.973 | 79.444 |
| Cost-Aware Routing [29] | 83.790 | 83.333 | 86.530 | 80.435 | 83.333 | 77.397 | 78.082 | 87.222 |
| RouteLLM-SW [40] | 81.735 | 81.735 | 82.648 | 80.435 | 78.889 | 77.397 | 73.973 | 82.222 |
| RouteLLM-MF [40] | 82.420 | 82.420 | 85.388 | 80.435 | 85.000 | 77.854 | 76.941 | 83.333 |
| Cascade in a fixed order | ||||||||
| FrugalGPT [16] | 79.452 | 81.507 | 85.616 | 80.435 | 81.667 | 84.475 | 81.735 | 86.667 |
| AutoMix [1] | 81.735 | 83.790 | 86.301 | 83.043 | 81.667 | 84.475 | 82.648 | 86.667 |
| DiffServe [2] | 84.247 | 83.562 | 87.443 | 82.609 | 83.889 | 82.877 | 82.877 | 86.667 |
| HADIS [57] | 84.247 | 83.562 | 87.443 | 81.739 | 83.333 | 82.877 | 82.877 | 86.667 |
| Controls without failure history | ||||||||
| DP planner on first-try rates | 84.018 | 85.388 | 88.356 | 83.478 | 79.444 | 85.388 | 86.301 | 92.778 |
| LinUCB without retry history, ACQB-like | 86.073 | 84.932 | 86.986 | 83.913 | 85.556 | 77.397 | 74.658 | 90.000 |
| RetryRoute with failure history | ||||||||
| Fixed ladder | 87.900 | 88.813 | 90.639 | 83.913 | 84.444 | 85.845 | 85.160 | 92.778 |
| Online, LinUCB | 87.215 | 84.247 | 87.900 | 83.478 | 85.000 | 81.507 | 78.539 | 91.667 |
| RetryRoute, DP planner | 88.813 | 88.813 | 90.639 | 83.913 | 85.000 | 84.932 | 85.616 | 92.778 |
own knobs on the training folds of a 5-fold split and is reported on the test folds. At a budget , the mean GPU seconds per request with judge calls, each method contributes its best point whose test cost is at most . The main budget is 50 s for pool 1 and 120 s for pool 2, about one a4 or LongCat attempt, and differences are paired per item with bootstrap [20] 95% confidence intervals (CIs). Two numbers summarize a whole curve over a range of budgets (Appendix E). The average performance gap recovered (APGR) of RouteLLM [40] is the mean share of the gap between one attempt of the cheapest model and the strongest single model that a method closes, and the area under the curve (AUC) is the mean success.
Baselines. Same-model retry and Best-of-N each retry one arm. Rewrite-retry, after the critique-and-revise pattern [38, 58], has a vision-language model rewrite the instruction before each retry of the cheap arm, from the source alone (blind) or also from the failed edit and its score (critique). The routers are Cost-Aware Routing [29] (CA-Routing) and the similarity-weighted (SW) and matrix-factorization (MF) routers of RouteLLM [40], and the cascades are FrugalGPT [16], AutoMix [1], DiffServe [2] and HADIS [57]. Ours are the DP planner, LinUCB, a fixed ladder of arms and a queue threshold (Appendix E). The controls are the DP fed first-try rates and LinUCB without failure history, which resembles ACQB, and the oracle picks the cheapest successful attempt per item. Table 2 shows the oracle and the controls in gray rows and marks the top two in bold and underline.
Serving testbed. RetryRoute runs on three RTX 4090D GPUs, one each for a5, a4 and the judge, and serves 160 GEdit-Bench requests at two steady loads and a bursty one (Appendix F). A request counts toward goodput, which we adapt from DistServe [66], if it succeeds within a 300 s service-level objective. The DP uses one setting () at all loads.
5.2 Main Results
Conditioning on failures beats prior routing. At the main budget RetryRoute is never below any of the eleven prior baselines (Table 2). The methods that retry one model trail it the most in every group, and its lead over the strongest prior baseline is significant in five. The DP also beats the strongest single model in every group, at a lower cost in seven. Fed first-try rates instead, the same planner drops significantly on four of the five pool-1 groups, so there the gain comes from conditioning on failures. The cheapest setting of OctoT2I [25] already exceeds the main budget in five groups, so Table 8 compares the two at OctoT2I's own cost for round limits of one to four. There RetryRoute is significantly more successful in 27 of the 32 settings and never significantly less, with a lead of up to 17.35 points at a round limit of one.
The lead holds over most budgets. Even against the best prior baseline picked separately at every budget, RetryRoute is ahead over most of the range (Figure 4). It matches the strongest single model at a lower cost in every group, up to lower.
RetryRoute leads on both curve summaries. In every group RetryRoute has a higher APGR and AUC than every prior baseline, and Figure 5 draws its lead over the four that are strongest in some group. In six of the eight groups its APGR exceeds one, so over the budget range it gains more than the whole gap between the cheapest and the strongest single model.

Figure 4: RetryRoute against the best of eleven prior baselines at each budget, with the main budget as a vertical line.

Figure 5: Lead of RetryRoute in APGR and AUC over four prior baselines in each group.
The gain comes from both retrying and escalating. The cascades almost never retry and same-model retry never escalates. Retry-Route retries the cheap arm while a retry is still cheaper per success, escalates otherwise and fails on the fewest requests (Figure 6). Figure 8 shows both on two pool-1 requests in English. To replace a printed word, RetryRoute escalates to a4 after one failure on a5, while the three methods that stay on a5 fail. To make the ram ceramic, it passes on its fifth a5 attempt, while Best-of-N, AutoMix and DiffServe deliver an earlier a5 attempt that fails. The gain is also broad across edit types, positive in 17 of the 22 category and pool pairs (Figure 7).

Figure 6: How requests end at the main budget for pool 1 and pool 2, with success in percent on top of each bar.

Figure 7: Lead of RetryRoute over the strongest prior baseline in each GEdit-Bench edit category, pooling Chinese and English, with 95% CIs.
Rewriting helps but does not replace escalation. Rewriting the instruction before a retry is a strong low-cost baseline. At the main budget RetryRoute significantly beats both rewrite variants in 14 of the 16 settings, while near the rewrite loop's own spend the two mostly tie, so the gain comes from spending the rest of the budget on escalation. Rewriting is also complementary, since as one more action inside RetryRoute it never lowers success significantly and adds at most 2.2 points.
5.3 Ablations and Robustness
Multi-attempt planning matters most. Capping a request at two attempts loses significantly in every group (Figure 9b), and allowing the cheap arm only once loses significantly in six of the eight. Every moderate shrinkage stays close to the default, while no shrinkage at loses significantly in four of the eight groups (Figure 9a). In the online learner the failure history helps on pool 2 (Table 2).
The lead is robust to the judge and the training data. Shifting the pass threshold in either direction keeps RetryRoute at or above the best prior baseline in 30 of the 32 shifted cells (Figure 9c). With less training data, given to every method, its lead stays positive on average in both pools down to 5% of the logs (Figure 9d). Flipped training verdicts never put RetryRoute significantly behind at any tested rate, and a coarser cost-weight grid moves the lead by less than half a point in most settings. Over six random splits into folds, RetryRoute is never below the strongest of the nine prior baselines that do not rewrite and never significantly below any of them.
5.4 Generalization and Online Learning
RetryRoute transfers to unseen categories and benchmarks. With each category held out from training in turn, the DP barely changes

"Replace the text 'DORIT' with 'DRINK'"
"Craft the ram with fine ceramic."
Figure 8: What each method delivers at the main budget on two pool-1 GEdit-Bench requests in English, framed blue for a pass and pink for a failure, with the arm and attempt on each badge.

(a) Shrinkage , default 20.
(b) Cap on attempts per request.

(c) Judge threshold shift.

(d) Training data for all methods.
Figure 9: Sensitivity in points. Panels a and b give the change from the default RetryRoute, and panels c and d the lead over the best prior baseline.
Table 3: Success (%) of Ours and the best prior baseline (Prior) in-domain, on unseen categories and across benchmarks.
| Pool | Test set | In-domain | Unseen category | Cross-benchmark | |||
|---|---|---|---|---|---|---|---|
| Prior | Ours | Prior | Ours | Prior | Ours | ||
| 1 | GEdit-CN | 84.25 | 88.81 | 84.25 | 87.67 | 85.16 | 87.56 |
| 1 | GEdit-EN | 83.79 | 88.81 | 83.79 | 88.81 | 84.47 | 88.01 |
| 1 | EN 5 arms | 87.44 | 90.64 | 87.44 | 90.87 | - | - |
| 1 | GEdit-v2 | 83.04 | 83.91 | 82.61 | 84.35 | 83.26 | 83.70 |
| 1 | ImgEdit | 85.00 | 85.00 | 83.89 | 85.56 | 83.89 | 85.28 |
| 2 | GEdit-CN | 84.47 | 84.93 | 84.47 | 86.07 | 84.47 | 85.16 |
| 2 | GEdit-EN | 82.88 | 85.62 | 82.88 | 84.93 | 82.88 | 84.70 |
| 2 | ImgEdit | 87.22 | 92.78 | 86.67 | 92.78 | 86.67 | 92.78 |
and stays above the best prior baseline in all eight groups (Table 3). Trained on another benchmark of the same pool, it is at least as high as the best prior baseline transferred the same way in every train and test pair, and the table averages two sources per test set. Bold in Table 3 marks where Ours is at least as high as Prior.

(a) Cold start, relative reward.
(b) Drift, EN ImgEdit.
Figure 10: Online learning from a cold start and after a shift.
RetryRoute carries over to text-to-image generation. We run the prompts of GenEval [23] with the text-to-image tools of OctoT2I [25] and its NVILA verifier [36] in the loop (Appendix G). At the main budget RetryRoute passes the verifier on 91.9% of prompts, the oracle rate, and is significantly above 14 of the 15 compared methods. At equal cost it is also significantly above OctoT2I at every round limit whose cost RetryRoute can match, two to four rounds.
RetryRoute can start without logs. Starting cold and learning only from its own attempts, the DP reaches 97% of the reward of the DP trained on full logs within 100 requests, and the failure history also helps LinUCB (Figure 10a). Under a shift from English GEdit-Bench to ImgEdit, both the planner trained before the shift and the online learners hold their reward (Figure 10b).
5.5 Planning Cost and Number of Models
Planning is cheap. One exact solve takes well under a millisecond for up to three arms, eight arms still plan in 0.2 s, and plans are cached per category and load level. A LinUCB decision takes 92 s, and on the testbed the router adds a median 6.9 ms per decision against attempts that take seconds.
More models keep the lead. The lead grows from two arms to three and then stays flat, and with all six models of both pools in one loop RetryRoute leads the strongest prior baseline on all three test sets at both budgets, significantly in five of the six cases. On a third pool, FLUX.2 [klein] 9B [11], Qwen-Image-2.1 [42] and GLM-Image [62], RetryRoute passes 91.8% on GEdit-EN at the main budget, the oracle rate. It is significantly above all nine prior baselines that do not rewrite the instruction (Appendix G).
Table 4: Testbed goodput (%) and p95 latency (s) at three loads, with p95 in italics when it exceeds the 300 s SLO.
| Method | Steady 0.045 | Steady 0.055 | Bursty 0.05 | |||
|---|---|---|---|---|---|---|
| Good. | p95 | Good. | p95 | Good. | p95 | |
| Queue thr. | 85.00 | 218.1 | 85.00 | 190.6 | 84.38 | 210.2 |
| Cascade a5→a4 | 81.25 | 167.4 | 80.00 | 248.4 | 78.75 | 277.5 |
| Fixed ladder | 80.62 | 447.3 | 76.88 | 777.4 | 81.25 | 361.7 |
| HADIS | 76.25 | 631.6 | 75.62 | 945.2 | 75.00 | 1064.3 |
| Retry a5×8 | 73.12 | 869.7 | 70.62 | 1479.8 | 58.13 | 1938.6 |
| RouteLLM-MF | 56.88 | 1629.0 | 56.25 | 1792.8 | 57.50 | 2153.2 |
| Ours | 86.25 | 279.2 | 86.25 | 296.3 | 84.38 | 275.1 |

(a) Success.
(b) Mean latency.
(c) p95 latency.
Figure 11: Load replay against testbed over 30 runs on the same request streams, with latency in seconds on log axes.
5.6 Serving Testbed
Load awareness pays off on GPUs. The DP has the highest goodput at all three loads, stays within the service-level objective, and is significantly above the five policies without load awareness in 10 of the 15 comparisons by a two-proportion test (Table 4). HADIS and the fixed ladder pile attempts onto the single a4 GPU and miss the service-level objective. Offline, without queues, the DP and the fixed ladder are within about a point, so the gap comes mostly from load awareness. At 0.055 req/s the DP waits a third as long in queues as the fixed ladder. A second testbed serves pool 2 on three GPUs at one steady load, where RetryRoute reaches a goodput of 81.2% against 67.5% for same-model retry, the best of the four prior methods run there (Appendix F).
Load replay matches the testbed. For loads the testbed does not cover, load replay runs the router's planner on the logged edits, with their verdicts and measured service times, in a discrete-event model of the GPU queues (Appendix F). Over 30 testbed runs on two machines, replayed success is within 2.5 points of the measured one and the median error of mean latency is about 1% (Figure 11).
A heuristic tuned per load is not enough. Table 6 tunes the queue threshold and the ladder at one of three loads and runs each in load replay at steady loads from 0.04 to 0.06 req/s and a bursty one. The threshold nears the DP only when tuned for the right load, and one picked at 0.045 req/s loses over a third of its goodput at 0.06, while one keeps the DP best at every load.
RetryRoute sustains more load than fixed plans. In load replay the DP keeps the highest goodput from 0.03 req/s upward, while

(a) Load sweep, 3 GPUs.
(b) Capacity, 3 GPUs.
Figure 12: Goodput in load replay and the highest load sustained at each success floor within the service-level objective.

(a) Bursty stream.
(b) DiffusionDB trace.
Figure 13: Highest load sustained in load replay at each success floor within the service-level objective on three GPUs, under bursty arrivals and an arrival trace.
the fixed ladder and later the threshold tuned at 0.055 collapse (Figure 12a). At the same success floor and service-level objective it sustains up to the arrival rate of the best fixed ladder on three GPUs, the ratio written above the bars of Figure 12b.
The gain persists under bursty arrivals. With the bursty stream of the testbed and with a DiffusionDB arrival trace, RetryRoute sustains up to and the arrival rate of the stronger tuned heuristic, ladder or queue threshold, respectively. Figure 13 writes this ratio above the bars at each floor.
5.7 Judge Robustness
Either single judge in the loop keeps the lead. With EditScore or EditReward in the loop instead of the ensemble, Table 9 gives the success of RetryRoute and of the strongest prior baseline in each group. RetryRoute is never significantly below any of the eleven prior baselines in the eight groups and is significantly above in 83 and 75 of the 88 comparisons, respectively.
Annotators confirm the in-loop judge. Two members of our research group labeled a sample of attempts stratified by group and by the judges' verdicts, half of them near the pass line. They read each English instruction with a machine translation as an aid, and we reweight the sample to all attempts with equal weight per group. Against their majority vote the in-loop ensemble is right on 83.7% of attempts, significantly more than either single judge, with only 2.6% false accepts (Table 7). The annotators agree with a Cohen's kappa of 0.86.
At the main budget a quality gate does not put RetryRoute behind. On pool 2 we also gate each pass on a VIEScore [27] perceptual-quality bar, set at three levels around LongCat's median first-try score, and refit every method (Appendix G). RetryRoute is never significantly below the strongest prior baseline and is significantly above a single LongCat try in 7 of the 9 settings. Averaged over the three sets, its margin shrinks as the bar rises until it ties the strongest prior baseline at the strictest bar. With the same gate on pool 1, RetryRoute ties the strongest prior baseline at the middle bar in every set and leads it significantly in three sets at the lowest bar of the three.
6 Conclusion
We presented RetryRoute, a retry-aware router for agentic image editing services, motivated by sticky failures. A model that has failed an edit will most likely fail it again, while a different model often still succeeds. RetryRoute estimates each model's chance of success given the request's failure history and plans retries, escalations and abandonment over failure states, with live queue waits in the cost. At the main budget and under the in-loop judge it leads the strongest of eleven prior baselines by 2.8 points on average over eight offline groups. On a GPU serving testbed its goodput exceeds the best prior baseline's by 5.0–6.3 points at every load with one setting. The correlation also reaches the judges, so retry loops should be stricter about late passes. We expect failure-aware planning to help other tools in agent loops, such as code interpreters and search engines that agents call again after a rejected answer.
References
[1] Pranjal Aggarwal, Aman Madaan, Ankit Anand, et al. 2024. AutoMix: Automatically Mixing Language Models. In Advances in Neural Information Processing Systems (NeurIPS), Vol. 37. 131000–131034.
[2] Sohaib Ahmad, Qizheng Yang, Haoliang Wang, Ramesh K. Sitaraman, and Hui Guan. 2025. DiffServe: Efficiently Serving Text-to-Image Diffusion Models with Query-Aware Model Scaling. In Proceedings of Machine Learning and Systems (MLSys), Vol. 7.
[3] Grigori Alekseeenko, Aleksandr Gordeev, Irina Tolstykh, Bulat Suleimanov, Vladimir Dokholyan, Georgii Fedorov, Sergey Yakubson, Aleksandra Tsybina, Mikhail Chernyshov, and Maksim Kuprashevich. 2026. VIBE: Visual Instruction Based Editor. arXiv:2601.02242
[4] Alimama Creative. 2024. FLUX.1-Turbo-Alpha. https://huggingface.co/alimama-creative/FLUX.1-Turbo-Alpha. Hugging Face model card.
[5] Peter Auer, Nicolò Cesa-Bianchi, and Paul Fischer. 2002. Finite-time Analysis of the Multiarmed Bandit Problem. Machine Learning 47, 2–3 (2002), 235–256.
[6] Seoungbin Bae, Junyoung Son, and Dabeen Lee. 2026. Learning to Route and Schedule LLMs from User Retrials via Contextual Queueing Bandits. arXiv:2602.02061
[7] Shuai Bai, Yuxuan Cai, Ruizhe Chen, et al. 2025. Qwen-3-VL Technical Report. arXiv:2511.21631
[8] Shuai Bai, Keqin Chen, Xuejing Liu, et al. 2025. Qwen2.5-VL Technical Report. arXiv:2502.13923
[9] Richard Bellman. 1952. On the Theory of Dynamic Programming. Proceedings of the National Academy of Sciences 38, 8 (1952), 716–719.
[10] Black Forest Labs. 2026. FLUX.2 [klein] 4B. https://huggingface.co/black-forest-labs/FLUX.2-klein-4B. Hugging Face model card.
[11] Black Forest Labs. 2026. FLUX.2 [klein] 9B. https://huggingface.co/black-forest-labs/FLUX.2-klein-9B. Hugging Face model card.
[12] Black Forest Labs et al. 2025. FLUX.1 Kontext: Flow Matching for In-Context Image Generation and Editing in Latent Space. arXiv:2506.15742
[13] Tim Brooks, Aleksander Holynski, and Alexei A. Efros. 2023. InstructPix2Pix: Learning to Follow Image Editing Instructions. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). 18392–18402.
[14] Harold Haodong Chen, Zhiyu Hou, Wen-Jie Shu, Weilin Ruan, Yingjie Xu, Litao Guo, and Ying-Cong Chen. 2026. GenRouter: Unified Workflow Routing for Agentic Image Generation. arXiv:2608.16721
[15] Junsong Chen, Shuchen Xue, Yuyang Zhao, Jincheng Yu, Sayak Paul, Junyu Chen, Han Cai, Song Han, and Enze Xie. 2025. SANA-Sprint: One-Step Diffusion
with Continuous-Time Consistency Distillation. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV). 16185–16195.
[16] Lingjiao Chen, Matei Zaharia, and James Zou. 2024. FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance. Transactions on Machine Learning Research (2024).
[17] Tianyu Chen, Yasi Zhang, Zhi Zhang, et al. 2026. EdiVal-Agent: An Object-Centric Framework for Automated, Fine-Grained Evaluation of Multi-Turn Editing. In International Conference on Learning Representations (ICLR).
[18] Teng-Ruei Chen. 2026. Resample or Reroute? Recoverable Stopping Debt Without Identified Action Selection. arXiv:2607.08665
[19] DeepSeek-AL. 2026. DeepSeek-V4: Towards Highly Efficient Million-Token Context Intelligence. arXiv:2606.19348
[20] Bradley Efron. 1979. Bootstrap Methods: Another Look at the Jackknife. The Annals of Statistics 7, 1 (1979), 1–26.
[21] Bradley Efron and Carl Morris. 1975. Data Analysis Using Stein's Estimator and Its Generalizations. Journal of the American Statistical Association 70, 350 (1975), 311–319.
[22] Patrick Esser, Sumith Kulal, Andreas Blattmann, et al. 2024. Scaling Rectified Flow Transformers for High-Resolution Image Synthesis. In International Conference on Machine Learning (ICML), Vol. 235. 12606–12633.
[23] Dhruba Ghosh, Hannaneh Hajishirzi, and Ludwig Schmidt. 2023. GenEval: An Object-Focused Framework for Evaluating Text-to-Image Alignment. In Advances in Neural Information Processing Systems (NeurIPS).
[24] John C. Gittins. 1979. Bandit Processes and Dynamic Allocation Indices. Journal of the Royal Statistical Society Series B: Statistical Methodology 41, 2 (1979), 148–164.
[25] Xu Jiang, Bin Chen, Gehui Li, Yule Duan, Ronggang Wang, and Jian Zhang. 2026. OctoT2: A Self-Evolving Agentic Text-to-Image Router. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). 31628–31638.
[26] Zhangqi Jiang, Zheng Sun, Xianfang Zeng, Yufeng Yang, Xuanyang Zhang, Yongliang Wu, Wei Cheng, Gang Yu, Xu Yang, and Bihan Wen. 2026. EditBench v2: A Human-Aligned Benchmark for General Image Editing. arXiv:2603.28547
[27] Max Ku, Dongfu Jiang, Cong Wei, Xiang Yue, and Wenhu Chen. 2024. VIEScore: Towards Explainable Metrics for Conditional Image Synthesis Evaluation. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). 12268–12290.
[28] Lihong Li, Wei Chu, John Langford, and Robert E. Schapire. 2010. A Contextual-Bandit Approach to Personalized News Article Recommendation. In Proceedings of the 19th International Conference on World Wide Web (WWW). 661–670.
[29] Qinchan Li, Kenneth Chen, Changyue Su, Wittawat Jikrittum, Qi Sun, and Pat-sorn Sangkoly. 2026. Cost-Aware Routing for Efficient Text-to-Image Generation. Transactions on Machine Learning Research (2026).
[30] LightX2V. 2025. Qwen-Image-Edit-2511-Lightning. https://huggingface.co/lightx2v/Qwen-Image-Edit-2511-Lightning. Hugging Face model card.
[31] Yunlong Lin, Linqing Wang, Kunjie Lin, et al. 2024. JarvisEvo: Towards a Self-Evolving Photo Editing Agent with Synergistic Editor-Evaluator Optimization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). 27291–27302.
[32] John D. C. Little. 1961. A Proof for the Queuing Formula: . Operations Research 9, 3 (1961), 383–387.
[33] Jie Liu, Gongye Liu, Jiajun Liang, Yangguang Li, Jiaheng Liu, Xintao Wang, Pengfei Wan, Di Zhang, and Wanli Ouyang. 2025. Flow-GRPO: Training Flow Matching Models via Online RL. In Advances in Neural Information Processing Systems (NeurIPS).
[34] Shiyu Liu, Yucheng Han, Peng Xing, et al. 2025. Step1X-Edit: A Practical Framework for General Image Editing. arXiv:2504.17761
[35] Xunzhuo Liu, Huamin Chen, Samzong Lu, et al. 2026. vLLM Semantic Router: Signal Driven Decision Routing for Mixture-of-Modality Models. arXiv:2603.04444
[36] Zhijian Liu, Ligeng Zhu, Baifeng Shi, et al. 2025. NVILA: Efficient Frontier Visual Language Models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). 4122–4134.
[37] Xin Luo, Jiahao Wang, Chenyuan Wu, Shitao Xiao, Xiyan Jiang, Defu Lian, Jiajun Zhang, Dong Liu, and Zheng Liu. 2026. EditScore: Unlocking Online RL for Image Editing via High-Fidelity Reward Modeling. In International Conference on Learning Representations (ICLR).
[38] Aman Madaan, Niket Tandon, Prakash Gupta, et al. 2023. Self-Refine: Iterative Refinement with Self-Feedback. In Advances in Neural Information Processing Systems (NeurIPS), Vol. 36. 46534–46594.
[39] Meituan LongCat Team, Hanghang Ma, Haoxian Tan, et al. 2025. LongCat-Image Technical Report. arXiv:2512.07584
[40] Isaac Ong, Amjad Almahairi, Vincent Wu, Wei-Lin Chiang, Tianhao Wu, Joseph E. E. Gonzalez, M. Waled Kadou, and Ion Stoica. 2025. RouteLLM: Learning to Route LLMs from Preference Data. In International Conference on Learning Representations (ICLR).
[41] Shivam Patel, Akaash R. Parthasarathy, Akash Dhasade, Ankur Mallick, and Gauri Joshi. 2026. Mind the Delay: Latency-aware Query Routing for Heterogeneous LLM pools. arXiv:2607.18253
[42] Qwen Team. 2026. Qwen-Image-2.1. https://huggingface.co/Qwen/Qwen-Image-2.1. Hugging Face model card.
[43] Qwen Team. 2026. Qwen3.8-Flash-Next: A New Architecture, Towards Ultimate Cost-Efficiency. https://qwen.ai/blog?id=qwen3.8-flash-next.
[44] John R. Rice. 1976. The Algorithm Selection Problem. In Advances in Computers. Vol. 15. 65–118.
[45] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. 2022. High-Resolution Image Synthesis with Latent Diffusion Models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). 10674–10685.
[46] Tim Salimans and Jonathan Ho. 2022. Progressive Distillation for Fast Sampling of Diffusion Models. In International Conference on Learning Representations (ICLR).
[47] Axel Sauer, Dominik Lorenz, Andreas Blattmann, and Robin Rombach. 2024. Adversarial Diffusion Distillation. In Proceedings of the European Conference on Computer Vision (ECCV). 87–103.
[48] Noah Shinn, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan, and Shunyu Yao. 2023. Reflexion: Language Agents with Verbal Reinforcement Learning. In Advances in Neural Information Processing Systems (NeurIPS), Vol. 36. 8634–8652.
[49] Herbert A. Simon and Joseph B. Kadane. 1975. Optimal Problem-Solving Search: All-or-None Solutions. Artificial Intelligence 6, 3 (1975), 235–247.
[50] Paul Viola and Michael Jones. 2001. Rapid Object Detection Using a Boosted Cascade of Simple Features. In Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR), Vol. 1. 511–518.
[51] Zhenyu Wang, Aoxue Li, Zhenguo Li, and Xihui Liu. 2024. GenArtist: Multimodal LLM as an Agent for Unified Image Generation and Editing. In Advances in Neural Information Processing Systems (NeurIPS), Vol. 37. 128374–128395.
[52] Zijie J. Wang, Evan Montoya, David Munechika, Haoyang Yang, Benjamin Hoover, and Duen Horng Chau. 2023. DiffusionDB: A Large-scale Prompt Gallery Dataset for Text-to-Image Generative Models. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (ACL). 893–911.
[53] Martin L. Weitzman. 1979. Optimal Search for the Best Alternative. Econometrica 47, 3 (1979), 641–654.
[54] Chenfei Wu, Jiahao Li, Jingren Zhou, et al. 2025. Qwen-Image Technical Report. arXiv:2508.02324
[55] Keming Wu, Sicong Jiang, Max Ku, Ping Nie, Minghao Liu, and Wenhu Chen. 2026. EditReward: A Human-Aligned Reward Model for Instruction-Guided Image Editing. In International Conference on Learning Representations (ICLR).
[56] Enze Xie, Junsong Chen, Yuyang Zhao, et al. 2025. SANA 1.5: Efficient Scaling of Training-Time and Inference-Time Compute in Linear Diffusion Transformer. In International Conference on Machine Learning (ICML), Vol. 267. 68578–68598.
[57] Qizheng Yang, Tung-I Chen, Siyu Zhao, Ramesh K. Sitaraman, and Hui Guan. 2025. HADIS: A Hybrid Architecture for Query-Aware Diffusion Model Serving. arXiv:2509.00642
[58] Zhengyuan Yang, Jianfeng Wang, Linjie Li, Kevin Lin, Chung-Ching Lin, Zicheng Liu, and Lijuan Wang. 2024. Idea2Img: Iterative Self-refinement with GPT-4V for Automatic Image Design and Generation. In Proceedings of the European Conference on Computer Vision (ECCV). 167–184.
[59] Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik R. Narasimhan, and Yuan Cao. 2023. ReAcT: Synergizing Reasoning and Acting in Language Models. In International Conference on Learning Representations (ICLR).
[60] Yang Ye, Xianyi He, Zongjian Li, Bin Lin, Shanghai Yuan, Zhiyuan Yan, Bohan Hou, and Li Yuan. 2025. ImgEdit: A Unified Image Editing Dataset and Benchmark. In Advances in Neural Information Processing Systems (NeurIPS), Vol. 38. 146002–146032.
[61] Fukun Yin, Shiyu Liu, Yucheng Han, et al. 2025. ReasonEdit: Towards Reasoning-Enhanced Image Editing Models. arXiv:2511.22625
[62] Z.ai. 2026. GLM-Image. https://huggingface.co/zai-org/GLM-Image. Hugging Face model card.
[63] Xuechen Zhang, Zijian Huang, Ege Onur Taga, Carlee Joe-Wong, Samet Oymak, and Jiasi Chen. 2024. Efficient Contextual LLM Cascades Through Budget-Constrained Policy Learning. In Advances in Neural Information Processing Systems (NeurIPS), Vol. 37. 91691–91722.
[64] Xiangyu Zhao, Peiyuan Zhang, Kexian Tang, et al. 2025. Envisioning Beyond the Pixels: Benchmarking Reasoning-Informed Visual Editing. In Advances in Neural Information Processing Systems (NeurIPS), Vol. 38. 192865–192904.
[65] Liannin Zheng, Wei-Lin Chiang, Ying Sheng, et al. 2023. Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena. In Advances in Neural Information Processing Systems (NeurIPS), Vol. 36. 46595–46623.
[66] Yinmin Zhong, Shengyu Liu, Junda Chen, Jianbo Hu, Yibo Zhu, Xuanzhe Liu, Xin Jin, and Hao Zhang. 2024. DistServe: Disaggregating Prefill and Decoding for Goodput-optimized Large Language Model Serving. In 18th USENIX Symposium on Operating Systems Design and Implementation (OSDI). 193–210.
Appendix
A Proofs
Policies are sequences. A request continues only after a rejection, so before its j-th attempt a policy always knows the same thing, namely that all earlier attempts failed. A deterministic policy is therefore a fixed sequence of arms with a stopping point, and its value is with .
Lemma. Given , attempts are independent, so a rejection history with failure counts has likelihood , which depends on the history only through . The posterior is and the next attempt on succeeds with , hence (1) over is exact. One more failure on reweights the posterior by , so , which is the stated identity. For the covariance is a variance and the change is never positive.
Proposition. Take two adjacent attempts on different arms, and assume a failure changes only the failed arm's own rate. Swapping them leaves and every later rate unchanged, and . So an optimal sequence can be taken in non-decreasing order of [49]. Since does not increase with , each arm's own ratios increase along its attempts, and the sorted order is the one the index rule produces. An attempt adds , which is positive exactly when . A sorted tail whose ratios are all at least is worth at most per unit of reach, so inserting any attempt with at its sorted position never lowers , and the optimal sequence is the sorted set of all such attempts. Part (i) is the case , and with the sequence repeats and is worth .
Shared difficulty breaks the index rule. The example of §4.3 lets 70% of requests be easy with and , and 30% hard with and , with , , , and . The index rule there uses each arm's own failure counts. We also checked the Lemma and both parts of the Proposition numerically. On 2,000 random latent-difficulty instances the identity holds to , and on 300 random instances each the index rule and the DP match an exhaustive search.
B Model-Judge Cells
Table 5 summarizes per group the first-try and retry pass rates of the 50 cells behind Figure 1a, thresholding EditReward at the pass rate of EditScore at .
C Full Cost-Success Curves
Figure 14 shows the test-fold Pareto frontier of each method, leaving out Cost-Aware Routing, RouteLLM-SW and DiffServe for legibility.
D Example Selection
The rows of Figure 8 come from distinct edit categories, and each is a request on which RetryRoute passes and at least two of the six shown baselines fail, screened for content suitable for display and not used in Figure 1. The second row is chosen among such

Figure 14: Cost-success frontiers of each method.
Table 5: First-try and retry pass rates and their ratio in percent, as ranges over the arms of each group.
| Group | EditScore | EditReward | ||||
|---|---|---|---|---|---|---|
| first | retry | ratio | first | retry | ratio | |
| P1 GEdit-CN | 65-73 | 16-30 | 24-41 | 66-75 | 15-22 | 22-29 |
| P1 GEdit-EN | 70-75 | 14-29 | 21-39 | 68-76 | 16-22 | 24-30 |
| P1 EN 5 arms | 48-75 | 14-29 | 21-42 | 41-79 | 11-23 | 24-37 |
| P1 GEdit-v2 | 68-73 | 18-30 | 26-43 | 65-70 | 17-22 | 25-32 |
| P1 ImgEdit | 64-72 | 22-37 | 34-52 | 63-74 | 13-24 | 21-32 |
| P2 GEdit-CN | 44-73 | 21-25 | 33-53 | 45-72 | 15-26 | 24-36 |
| P2 GEdit-EN | 43-74 | 21-28 | 37-48 | 46-71 | 11-20 | 20-30 |
| P2 ImgEdit | 66-73 | 23-27 | 34-40 | 63-75 | 11-31 | 17-46 |
requests on which DiffServe also fails, and the other rows are drawn at random with a fixed seed. Frames show the in-loop verdict, blue for a pass and pink for a failure, and each badge names the arm and attempt that produced the image.
E Protocol and Baselines
Offline results replay logged edits, as the offline evaluations of RouteLLM, FrugalGPT and AutoMix replay logged outputs [1, 16, 40]. On pool-1 ImgEdit, offline replays use only arms a5 and a4. APGR averages over budgets from 20 to 100 s for pool 1 and from 10 to 220 s for pool 2. AUC is the mean success over budgets from 30 to 80 s for pool 1 and from 40 to 160 s for pool 2. The ladder is a fixed plan as in §3.2, the single arm sequence, such as a5×3→a4, that scores best on the training folds, and the queue threshold falls back to the cheap arm when the next arm's wait is too long. Cost weights lie on a common grid of 97 values from 0.0003 to 0.03, CIs use 2,000 bootstrap resamples, and unless stated otherwise every experiment uses the in-loop judge, folds, grid and budget rule of §5. Same-model retry picks the best arm and k. The rewriter of rewrite-retry is Qwen3-VL-8B [7], charged 2 s per rewrite, and the judge keeps the original instruction. CA-Routing picks one arm per category and retries it up to k times, and the RouteLLM routers read instruction and source-image embeddings. FrugalGPT learns
its order, and AutoMix runs a partially observable Markov decision process (POMDP) over judge-score buckets. The queue threshold follows a ladder such as a5×3→a4 and falls back to the cheap arm when the next arm's expected wait exceeds a tuned threshold. The LinUCB control drops both the failure counts and the attempt index. OctoT2I keeps the routing prompt of its released code, with our arms as its tools and DeepSeek-V4-Flash [19] at temperature 0 as its LLM, and builds its knowledge of each arm from the first-try pass rates of the training folds instead of self-evolution. It stops at the first pass, after R rounds or once the most expensive arm has failed twice, and RetryRoute is compared with it at a budget equal to its mean cost.
F Implementation and Testbed
RetryRoute runs as a router in front of one resident worker per GPU, each holding one editing model or the judge in memory. The router tracks queue lengths and service-time estimates, passes them to the planner as extra cost, and dispatches the next attempt of a request as soon as the previous one is judged. Load replay feeds the logged edits, with their verdicts and measured service times, through a discrete-event model of the GPU queues and runs the same planner and policy code as the router. The judge worker runs EditScore at τ = 7.5. The 160 requests arrive as steady Poisson streams of 0.045 and 0.055 req/s and as a bursty on-off stream averaging 0.05 req/s. The bursty stream switches between 1.6 and 0.4 times its mean rate every 600 s. The queue threshold is re-tuned per load in load replay, RouteLLM-MF and HADIS run as per-item sequences trained offline, and load-replay sweeps use 1,500 requests and 3 seeds per point.
In four further runs the DP is never behind the best fixed ladder. On a second, harder request stream at 0.045 req/s both reach the same goodput, and the DP cuts p95 latency from 520 s to 320 s. It leads by 2.5 points at 0.04 req/s, significantly by 3.8 points under bursty arrivals on a second machine, and by 1.9 points on a DiffusionDB [52] arrival trace. At 0.055 req/s a request waits in queues for 40 s on average under the DP and for 136 s under the fixed ladder. Table 6 runs policies tuned at one load at the others in load replay, over 800 requests and 3 seeds per load.
Over the 30 testbed runs of Figure 11, success differs by at most 2.5 points, the median error of mean latency is −1.3%, and 26 of 30
Table 6: Goodput (%) in load replay when a policy tuned at load L, written @L, runs at other loads.
| Policy (load in req/s) | 0.04 | 0.05 | 0.06 | burst 0.055 | worst |
|---|---|---|---|---|---|
| Queue thr. @0.045 | 80.50 | 77.60 | 49.30 | 61.70 | 49.30 |
| Queue thr. @0.055 | 80.50 | 80.10 | 78.80 | 76.30 | 76.30 |
| Queue thr. @burst 0.05 | 79.70 | 79.70 | 79.00 | 78.40 | 78.40 |
| Ladder @0.045 | 80.70 | 79.60 | 74.80 | 73.50 | 73.50 |
| Ladder @0.055 | 80.40 | 80.00 | 78.60 | 76.60 | 76.60 |
| Ladder @burst 0.05 | 79.40 | 78.50 | 76.80 | 77.20 | 76.80 |
| Ours, one λ | 82.40 | 81.60 | 80.00 | 79.20 | 79.20 |
Table 7: Agreement of each judge with the majority vote of two annotators, reweighted to all attempts, with 95% CIs.
| Judge | Agreement (%) | κ | AUC | FA (%) | FR (%) |
|---|---|---|---|---|---|
| In-loop ensemble | 83.70 [79.95, 87.39] | 0.621 | 0.935 | 2.61 | 13.69 |
| EditScore | 75.93 [72.48, 79.16] | 0.450 | 0.853 | 5.74 | 18.33 |
| EditReward | 78.65 [75.14, 82.05] | 0.512 | 0.890 | 4.37 | 16.97 |
| VIEScore | 79.53 [73.65, 85.25] | 0.520 | 0.853 | 5.04 | 15.43 |
Table 8: Lead of RetryRoute in points over OctoT2I at OctoT2I's own cost for each round limit R, with the cost of OctoT2I at R = 1 in GPU seconds per request.
| Pool | Test set | Cost | Round limit R | |||
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 1 | GEdit-CN | 60.12 | +17.35 | +10.05 | +7.76 | +6.85 |
| 1 | GEdit-EN | 65.49 | +15.98 | +9.82 | +6.39 | +5.02 |
| 1 | EN 5 arms | 97.44 | +13.47 | +5.48 | +3.42 | +2.97 |
| 1 | GEdit-v2 | 47.18 | +14.78 | +11.74 | +7.39 | +5.65 |
| 1 | ImgEdit | 24.04 | +5.56 | +3.33 | -0.56 | -0.56 |
| 2 | GEdit-CN | 124.2 | +7.08 | +4.11 | +1.83 | +0.68 |
| 2 | GEdit-EN | 123.3 | +13.01 | +5.94 | +2.28 | +1.14 |
| 2 | ImgEdit | 91.75 | +14.44 | +10.56 | +5.00 | +4.44 |
runs are within 11% either way. In four runs, all three RouteLLM-MF runs and the HADIS run at 0.055 req/s, load replay underestimates mean latency by 12–22% and p95 by 13–34%.
A second testbed serves pool 2 with b1, b2 and the judge on one RTX 4090D GPU each and the serve half of GEdit-CN. Its 160 requests arrive as one Poisson stream at the steady load of Table 4 scaled by the ratio of the two pools' expensive arm times (0.0203 req/s) under a service-level objective of 814 s scaled the same way, and every knob is picked in load replay as for Table 4. Retry-Route reaches a goodput of 81.2%, against 67.5% for same-model retry and at most 51.2% for RouteLLM-MF, a two-level cascade and a router in the style of HADIS, with every request that hits the router's 3600 s timeout counted as failed.
G Further Results
In the quality gate of §5.7, an attempt on pool 2 passes only if the ensemble judge accepts it and its VIEScore [27] perceptual-quality (PQ) score, the smaller of the naturalness and artifact ratings given
Table 9: Success (%) at the main budget of the strongest prior baseline and of RetryRoute when a single judge replaces the ensemble in the loop.
| Pool | Test set | EditScore in loop | EditReward in loop | ||
|---|---|---|---|---|---|
| Prior | Ours | Prior | Ours | ||
| 1 | GEdit-CN | 83.56 | 84.93 | 82.65 | 84.70 |
| 1 | GEdit-EN | 85.62 | 87.44 | 82.65 | 82.88 |
| 1 | EN 5 arms | 85.39 | 87.90 | 84.70 | 87.21 |
| 1 | GEdit-v2 | 85.65 | 90.43 | 78.70 | 81.74 |
| 1 | ImgEdit | 87.78 | 89.44 | 82.78 | 82.22 |
| 2 | GEdit-CN | 83.33 | 85.39 | 81.28 | 83.79 |
| 2 | GEdit-EN | 83.11 | 86.07 | 79.68 | 81.05 |
| 2 | ImgEdit | 85.56 | 89.44 | 83.33 | 86.11 |
by Qwen3.8-Flash-Next [43] with the original prompt, reaches the bar. The middle bar is the lower median of LongCat's first-try PQ on the training folds, 6 on GEdit-CN and 7 on GEdit-EN and ImgEdit, and the other two are one point lower and higher. Methods that read the judge's score see the smaller of the ensemble score and the PQ score shifted so that the two bars coincide. Every method is refit on the gated labels with the same folds, grid and budget rule, and without the gate the replay reproduces Table 2 exactly. Under the gate the strongest prior baseline is the best of the nine that do not rewrite the instruction. Pool 1 uses the same gate, PQ score and refitting, with a middle bar of 6 on all five sets and the other two one point lower and higher, and its strongest prior baseline is the best of all eleven. Blind rewrite-retry is regenerated for the requests that the gate newly fails, while critique rewrite-retry is not and enters with a pessimistic and an optimistic bound on its pass rate, under both of which RetryRoute ties the strongest prior baseline at the middle bar.
With a blind rewrite of the cheap arm as one more action (§5.2), RetryRoute is significantly above blind rewrite-retry in all nine gated settings at the main budget, including the strictest bar on ImgEdit, where it passes 53.33% of requests against 48.89%.
We also charge each judge call 5 s instead of 10 s and re-tune every method under the new charge. At the main budget Retry-Route leads the best of the nine prior baselines that do not rewrite significantly in all eight groups.
The third pool runs FLUX.2 [klein] 9B with eight seeds and Qwen-Image-2.1 and GLM-Image with two seeds each on the 438 GEdit-EN requests, timed on A800 GPUs. GLM-Image conditions on and outputs images whose sides are multiples of 32, with the short side at least 512 and the long side at most 2048 pixels. Its main budget is the cost of one GLM-Image attempt (37.5 s), where RetryRoute is 5.9 points above the strongest single arm.
For text-to-image generation we take the 553 GenEval prompts and the five tools of OctoT2I as arms, namely SD-Turbo and SDXL-Turbo [47], SANA-Sprint [15], SANA 1.5 [56] and Flow-GRPO [33] on SD3.5-Medium [22], with its NVILA-Lite-2B verifier [36, 56] as the in-loop judge. GenEval's six subtasks serve as categories, every method is refit with the folds, grid and budget rule of §5, and the main budget is the cost of one Flow-GRPO attempt, 6.98 s. At the main budget RetryRoute is 2.5 points above two Flow-GRPO attempts at 63% of their cost. OctoT2I runs its released loop with the same tools, its own knowledge files and DeepSeek-V4-Flash, and at its mean cost under round limits of two, three and four RetryRoute is significantly more successful, while with a single round OctoT2I costs less than the cheapest setting of RetryRoute.
Table 7 lists all four judges against the annotators of §5.7. The agreement of the in-loop ensemble is on par with that of the external VIEScore judge, and the ensemble makes the fewest false accepts of the four. Of 200 sampled attempts, 186 keep a majority vote once unsure labels are dropped, and the annotators agree on 170 of the 180 attempts they both judged (Cohen's kappa 0.856). A stratum combines a group, the two single judges' verdicts and whether the score is near the pass line. Every group has equal weight, and CIs, also of the paired gaps between judges, bootstrap within strata. FA and FR are the shares of all attempts that a judge wrongly accepts and wrongly rejects, respectively.
H Use of Generative Artificial Intelligence
Generative artificial intelligence assistants helped draft and edit the text and write the experiment and plotting code. An image-generation model sketched candidate layouts for Figure 3, which we redrew as a vector diagram, and drew some of its icons. The authors checked every statement, number and figure against the experiment records and take full responsibility for the paper.