advanced rag-information-theory 21 min read

The Workload You Do Not Know: Choosing an Architecture from an Estimate

The previous topic read the architecture off a partition of the workload simplex and treated the workload as given — it is estimated, and a partition is exactly the structure that punishes estimation error hardest where it is hardest to avoid

A lookup table with a missing input

The previous topic ended with something that looks like an answer. Fix the price of a generator call and the size of the deployment, locate your workload mixture ww on the simplex, and read off the architecture that the cell you landed in recommends. The map w↦a^(w)w \mapsto \hat a(w) partitions the simplex; you look yourself up.

Except that you do not know ww. You estimate it — from a sample of traffic, from a week of logs, from an intuition about what users will ask — and the estimate w^\hat w carries error like any other. The obvious question is how much that error matters.

The obvious answer would be “a little, and less as you collect more data”. It is the right answer in the interior of a cell and badly wrong near a boundary, for a structural reason:

Remark (A partition is the worst possible consumer of an estimate).

The map from workload to architecture is piecewise constant. A piecewise constant function is maximally insensitive to its input almost everywhere and maximally sensitive on a measure-zero set, and there is no in-between. So estimation error is free in the interior of a cell — the recommendation does not move at all, however wrong you were — and at a boundary an arbitrarily small error flips it outright.

Neither half of that is what “the estimate has error” usually implies, and the second half is why a Pareto verdict cannot simply be annotated with an error bar.

Three rules, and one of them is not a rule

Write π\pi for a posterior over ww given nn observed queries: with a Dirichlet prior it is Dir(nw^+α)\mathrm{Dir}(n\hat w + \alpha), and nn is what concentrates it. Three ways to choose an architecture from it:

a^plug=arg⁡max⁡aU(a,w^),a^Bayes=arg⁡max⁡aEπ[U(a,w)],a^mm=arg⁡min⁡amax⁡w[U(a∗(w),w)−U(a,w)].\hat a_{\text{plug}} = \arg\max_a U(a, \hat w), \qquad \hat a_{\text{Bayes}} = \arg\max_a \mathbb{E}_{\pi}[U(a, w)], \qquad \hat a_{\text{mm}} = \arg\min_a \max_{w} \big[ U(a^\ast(w), w) - U(a, w) \big].

The first pretends the estimate is the truth. The second averages over what it does not know. The third minimizes the worst regret it could come to feel — the amount by which the arm it picked trails whichever arm turns out to have been right.

That looks like three genuinely different ideas. It is two:

Proposition 1 (The Bayes rule is the plug-in rule at a shrunk estimate).

Utility is affine in the workload — each arm’s quality and both its costs are averages over question kinds, weighted by ww. Therefore, for any posterior π\pi whatsoever,

Eπ[U(a,w)]=U(a,Eπ[w]),\mathbb{E}_{\pi}\big[ U(a, w) \big] = U\big(a, \mathbb{E}_{\pi}[w] \big),

with no approximation. The Bayes rule is the plug-in rule evaluated at the posterior mean, and for a Dirichlet posterior that mean is available in closed form:

Eπ[w]=nw^+αn+Cα,\mathbb{E}_\pi[w] = \frac{n \hat w + \alpha}{n + C\alpha},

which is w^\hat w shrunk toward the prior with weight Cα/(n+Cα)C\alpha/(n + C\alpha).

So the entire difference between plug-in and Bayes is a shrinkage that vanishes like 1/n1/n. Both are point rules: they collapse the posterior to a single workload and look it up. Only the minimax rule uses the shape of the posterior rather than its location, and it is the only one of the three with no closed form.

That asymmetry is worth holding onto, because it reappears as an engineering fact. In the laboratory below, the plug-in and Bayes rules are recomputed live and exactly in the browser, while the hedge is read from a precomputed grid — not an implementation compromise, but Proposition 1 showing up in the software.

plug-inagenticBayescorrectiveminimaxcorrective0% bridge100% bridge
plug-in
agentic
Bayes
corrective
minimax (the hedge)
corrective
verdict
the hedge differs

Plug-in and Bayes are recomputed here exactly, live, from the utility kernel — because utility is linear in the workload, both have closed forms. The hedge does not, so it is the one rule read from a precomputed grid. That asymmetry is the topic's own result showing up in its laboratory. Slide across the boundary and the three bands part company only in a narrow region; slide n and the disagreement shrinks everywhere except on the boundary itself.

The six architectures and their quality and costs arrive unchanged from the two predecessor topics; nothing is re-measured here. Prices are fixed at λ = 0.00003, ρ = 1000. The posterior is Dirichlet with a uniform prior (α = 1) over the 6 kinds of question, and worst-case regret is its 0.95 quantile over 2000 draws rather than a maximum, which would grow with the draw count and could not be baked. Plug-in, Bayes and every utility on this page are recomputed live and exactly from the utility kernel; only the hedge and the realized regret are Monte-Carlo and therefore baked, and both are seeded.

The hedge is not a safe default

A natural suspicion about minimax rules is that they retreat to something bland — the option that is never terrible, chosen forever. Measured, that is not what happens here. Deep inside a cell the minimax arm is that cell’s arm: on bridge-heavy traffic it is the iterative architecture, on global-heavy traffic the graph one, and those are different arms. The hedge tracks where the posterior sits.

It departs from the plug-in rule in a narrow band around a boundary, and over workloads drawn without regard to where the boundaries are — which is the situation a deployment is actually in — the two rules differ on 7.67% of them.

How much traffic is enough

The natural question, once the estimate is admitted to be an estimate, is how much traffic settles it. The measurement is a sharp two-regime answer.

Inside a cell, almost none: the rules agree from n = 10 when the truth sits inside a cell, because the recommendation is simply not sensitive to where in the cell you are. On a boundary the same question is still paying at n = 5120 — about five hundred times as much traffic for a decision between two arms that are, at that point, nearly tied in value.

The worst-case regret itself decays monotonically with nn, and it is tempting to write down the 1/n1/\sqrt n law that the multinomial rate would suggest. The halving ratios measured here are 0.98,0.84,0.88,0.74,0.77,0.75,0.72,0.72,0.690.98, 0.84, 0.88, 0.74, 0.77, 0.75, 0.72, 0.72, 0.69 against the 0.7070.707 such a law implies: they approach it from above rather than sitting on it. What the topic asserts is the monotone decay and the tail, not the rate.

Remark (Why a maximum could not be used).

Worst-case regret is reported as the 0.950.95 quantile of the regret distribution over 2000 draws, not as a maximum over them. A maximum is an extreme statistic whose value grows with the number of draws — run the simulation longer and the “worst case” gets worse, without anything about the problem having changed. Nothing computed that way can be baked into a figure or compared across runs. A quantile estimates a fixed property of the distribution instead, and a test pins its stability across seeds before any number here is quoted.

What the hedge costs

Hedging is usually discussed as though its only cost were a little foregone upside. Here the accounting is measurable, and it is less comfortable than that.

Both the Bayes rule and the hedge shrink toward the middle of the simplex. That is not a neutral act — it is a bet that the traffic is more central than the data says. Below the boundary the bet pays handsomely: the plug-in rule’s realized regret is several times the hedge’s, because the plug-in rule keeps being fooled by samples that stray across the boundary. Above it, where the truth genuinely sits in a narrow cell, the plug-in rule was correctly confident all along and the hedge drags it back out of the cell it was right about.

And the loss on that side is larger than the gain on the other. A hedge here is a trade, not insurance bought at a discount, and which way it goes depends on something you cannot observe: whether your true workload is nearer the middle of the simplex than your estimate suggests.

Connections

  • Supplies, through the import chain, the entire measurement this topic reasons about: six architectures, five local query classes and a global regime, with quality and both costs for each pairing. Nothing here re-measures any of it. What this topic adds is that the query-class mixture — which that topic fixed by construction, twenty queries per class — is in a deployment an unknown quantity estimated from traffic. rag-architecture-mechanisms
  • The sharpest contrast in the arc, because both topics reason under uncertainty and about completely different things. That topic is uncertain about WHICH QUERY it is looking at and chooses a strategy per query, so its uncertainty is resolved query by query and never accumulates. This one is uncertain about WHAT THE TRAFFIC IS and commits to a single architecture for all of it, so its uncertainty is a property of the deployment rather than of any request — and it shrinks only with observed volume. adaptive-retrieval-routing
  • Establishes the estimators-have-error discipline this topic applies one level up. There the quantity with a standard error was a retrieval metric; here it is the workload mixture itself, and the consequence is worse than a wide interval, because the decision that consumes the estimate is discontinuous. A confidence interval on a continuous quantity degrades gracefully; one that straddles a cell boundary does not degrade at all, it flips. significance-testing-calibration
  • The nearest decision-theoretic sibling, and a useful contrast in what is being hedged. Chow's rule trades an error rate against an abstention rate for a single answer under a calibrated posterior; the minimax rule here trades regret across a whole deployment under a posterior on the workload. Both are arg-min problems over a loss the model does not get to see directly, and both are only as good as the distribution they average or maximize over. selective-generation-abstention
  • Its water-filling allocation assumed a known workload exactly as the pareto topic did, and the same caveat applies one level down: an allocation tuned to a measured traffic mixture inherits that mixture's estimation error. The lesson transfers in shape rather than in decimals — a budget split that is optimal at the estimate can be far from optimal at the truth when the optimum sits near a kink. capstone-multimodal-financial-rag

References & Further Reading