How to Actually Tokenmaxx and Save Millions — Alvin Pane, OutRival
Read the talk
How to Actually Tokenmaxx and Save Millions
Alvin Pane’s optimization playbook starts by measuring how often production disagrees with itself. Caching, shorter instructions and smaller models then face a harder test: whether they preserve or improve the work users need.
From a talk by Alvin Pane
At a glance
Ideas worth remembering
Measure production’s self-disagreement before interpreting candidate disagreement. The reported 7% self-disagreement shows why 18% cross-model disagreement is not an error rate.
Preserve inputs, output schema and scoring while searching for shorter instructions. The illustrated 51% token reduction still requires a quality evaluation.
Shadow evaluation needs production self-comparisons, candidate self-comparisons and cross-version comparisons. Human review determines whether differences are improvements, regressions or acceptable alternatives.
Keep evaluations paired and repeated conversations grouped. Release on a positive lower confidence bound with critical categories checked separately, then continue measuring.
A long prompt becomes a recurring compute tax
A customer-intent classifier accumulates twenty edge cases, pedantic definitions and a paragraph pleading with the model not to hallucinate. Each addition may have answered a real failure. Together, they become text the application sends again on every request. Multiply that by millions of requests, and prompt maintenance becomes a recurring compute bill.
Alvin Pane, introduced as head of agent intelligence at OutRival, uses this fictional classifier as a synthetic proxy for production prompt bloat. OutRival’s digital workers handle tasks over phone, text and email; Pane reports application-layer usage of billions of tokens per day. At that scale, redundant calls and repeated instructions consume money and latency that could support additional capabilities. The synthetic example teaches the optimization procedure; it does not demonstrate realized million-dollar savings.
That makes token-consumption leaderboards a peculiar success metric. As Pane puts it, “Tokens aren't the work, they're what you pay to get the work done.” His version of tokenmaxxing asks how much useful behavior an application can retain while reducing the payload and compute needed to produce it.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Measure the task—and ask whether production agrees with itself
Start at the shared model client. Instrument each attempt so a task’s model calls, tool calls and retries belong to one trace. Record the prompt version, model settings, token usage, latency and cost. Pane names OpenTelemetry as a framework for this instrumentation. The trace connects the bill to the work that generated it, while the recorded production examples provide a benchmark for testing changes.
The tempting first experiment is straightforward: give the existing prompt to a cheaper model and compare its answers with historical production answers. In Pane’s account, a candidate disagreed with the expensive baseline about 18% of the time across a few thousand historical examples. The team rejected it. That decision treated agreement with one production answer as the quality standard.
Messy customer inputs complicate that standard. A production answer is itself one probabilistic decision; another run of the unchanged system may choose differently. The 18% disagreement therefore combines behavioral differences between systems with variation already present inside production. It cannot, by itself, tell the team how much quality the cheaper model lost.
The correction was an A/A test: run the expensive production model three separate times on the same inputs and compare its answers. Production disagreed with itself roughly 7% of the time, yielding about 93% self-agreement. Pane calls this the “ceiling test.” It calibrates expectations against the system’s observed repeatability; it does not establish an accuracy ceiling or turn the remaining difference into a measured error rate.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Cache repeated prefixes, then search for shorter instructions
With a measured baseline, the first cost lever is prefix caching. Structure prompts to maximize reuse of their repeated beginning, reducing the cost of processing text shared across requests. This comes before rewriting the task instructions: first reduce avoidable repeated work, then reduce the amount of instruction text itself.
The fictional classifier’s prompt is almost 5,000 tokens long. It contains accumulated rules such as “do not confuse enthusiasm with authorization,” plus long hard-coded transcripts serving as worked examples. The maintenance trap is familiar: nobody wants to delete the line that prevents a production failure. Manual shortening leaves each deletion dependent on someone’s confidence about why the text was added.
DSPy makes that editing problem searchable. Define the inputs, required output schema and scoring function—the application behavior that must remain stable—then give the instructions to an optimizer such as GEPA. Candidate instructions run against the benchmark’s historical labels, and feedback from failures guides revisions. In the illustration, the optimizer replaces almost all the long worked examples with compact rules, reducing instruction tokens by 51% while retaining the same application interface.
The useful comparison is between the information carried by long examples and the compact rules that replace them. A shorter prompt has removed input cost, but matching the interface only means the application can still consume its answers. Whether those answers preserve quality is the next test.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Two ways to spend less on the model
A tighter prompt and a benchmark make model downsizing easier to investigate. Pane describes two distinct strategies:
- Split the work. Break a large prompt into smaller components. A cheaper model handles initial routing or data extraction; expensive frontier models handle the heavy reasoning. The saving comes from assigning simpler work to cheaper compute.
- Optimize for the smaller model. Run the DSPy search with the smaller model, using answers generated by the large production model as benchmark targets. GEPA searches for instructions that help this particular model reproduce the task performance needed on that dataset.
The second strategy changes the prompt rather than the model’s weights: the smaller model searches its own instruction space. But success on the benchmark can conceal overfitting, and decomposing work can introduce additional failure points. Pane reports that many downsizing experiments produced prompts that were not good enough to release. A cheaper model remains a candidate until the broader quality comparison holds.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Separate behavioral drift from ordinary variation
After cutting the fictional prompt roughly in half, shadow evaluation asks both systems to answer the same inputs. Repetition matters on both sides: production varies, and the cheaper candidate has its own internal variation. The evaluation therefore needs three comparisons:
- Production against production: how much the unchanged baseline moves between runs.
- Candidate against candidate: how much the proposed replacement moves between runs.
- Candidate against production: how much their answers differ across versions.
Pane describes a disagreement adjustment: take the cross-version disagreement and subtract the average within-version disagreement. This uses the two self-comparisons to account for answers moving around even without a system change. The remaining quantity measures separation between the systems’ decision probabilities. The recording does not specify the estimator or its assumptions, so this is a conceptual recipe rather than a complete statistical implementation.
That adjustment answers how behavior changed, not whether the change was good. Production may already contain mistakes; faithfully reproducing them would preserve agreement while preventing improvement. Inspect the disagreements and distinguish three outcomes: the candidate did better, production did better, or both answers were acceptable responses to an ambiguous input.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Count improvements and regressions, then test the net gain
The fictional review makes the distinction concrete: suppose reviewers find 443 regressions and 2,463 improvements. That is almost six improvements per regression, with 2,020 more improvements than regressions, from a prompt roughly half the size. These are illustrative review counts, not reported production outcomes. Their purpose is to show why a raw disagreement percentage can hide a favorable change.
Those counts still describe one batch. To assess whether its net gain is convincing, calculate a confidence interval while keeping the comparison paired: both versions must answer the same requests. Keep repeated runs of the same conversations grouped together, too, rather than treating repeated observations as unrelated new evidence. The review counts answer which system won on this batch; the interval addresses uncertainty around the estimated gain.
The release criterion requires the lower confidence bound to exceed zero. If the interval crosses zero, gather more evidence before claiming the candidate is better. A positive point estimate alone is insufficient. The talk does not supply an interval value or confidence level for the fictional counts, so the example establishes the decision rule rather than a completed statistical result.
Run the analysis separately for critical customer categories. An overall gain can conceal deterioration in a vital intent, so a favorable global interval cannot carry the release by itself. Pane’s rule combines the two requirements: critical categories must hold up, and the lower confidence bound on net gain must be above zero. Then ship—and keep measuring.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Start Monday with the most expensive task
The closing assignment is deliberately bounded: choose the most expensive task, measure its baseline variation and put its instructions through a search loop. Cache repeated work, shorten the prompt and investigate a smaller model, then test whether quality holds. The objective is to discover how much bloat the application is paying for while preserving the work it needs to perform. That gives “making every single token count” an operational meaning—and a release rule.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Resources
Related talks
- Beating RL With Reflection: GEPA and Optimize Anything
Lakshya Agrawal explains the reflective prompt search behind GEPA, including how execution feedback guides edits and how retaining specialist candidates helps search escape dead ends.
Read the complete timestamped transcript
- 0:00
Hey everyone, I'm Alvin, the head of agent intelligence at OutRival. By now, everyone's heard of token maxing. People have built leaderboards inside companies for who's using the most AI tokens. At Meta, they even had a title for this, Token Legend, a badge of honor for whoever's burning the most compute. It's a funny meme, but if you're actually shipping a product, token usage is a bizarre measurement of success. Tokens aren't the work, they're what you pay to get the work done.
- 0:31
At OutRival, our digital workers handle complex tasks over phone, text, and email. At the application layer, we're processing billions of tokens every single day, and when you operate at that scale, every redundant model call compounds into massive latency and millions of dollars in compute costs. Take a look at this prompt. I've built a synthetic proxy that mirrors what structural bloat looks like in a pipeline. Let's pretend we're classifying customer intents for a fictional company called Harborbyte.
- 1:01
We've all seen one of these. It's got twenty edge cases, overly pedantic definitions, and a paragraph practically begging the model not to hallucinate. When you're sending this much text on every single request millions of times a day, it isn't just a prompt anymore, it's a massive self-inflicted compute tax. If you want to give your agents more capabilities, you need the architectural headroom to do it. So today, we're reclaiming token maxing. It shouldn't be about burning the most tokens, but
- 1:31
about extracting the maximum surface area of intelligence from the absolute minimum token payload. So here's how to actually token max. Let's get into the playbook. First, observe. You can't fix what you can't measure. Instrument your shared model client so each attempt becomes part of a trace, connecting the model calls, tools, and retries for a single task. Record the prompt version, model settings, token
- 2:01
usage, latency, and cost. OpenTelemetry is a great framework for tracking this. Now that you have that telemetry, you can actually build a benchmark of how production is behaving, but here's where most optimization efforts hit a wall. Let me tell you how it usually goes. You take your massive prompt, you hand it to a smaller, cheaper model, and you run it against a few thousand of those historical production examples.
- 2:31
We did this. Our cheaper candidate model disagreed with our expensive production baseline about eighteen percent of the time, so naturally, we threw it out. It wasn't good enough. But what does that eighteen percent actually represent? Because language models in production are dealing with inherently ambiguous real-life inputs, that eighteen percent is actually a composite metric. It introduces a critical hidden
- 3:01
variable, the baseline variance of the model itself. When the input is messy, your production prompt will inevitably disagree with its own past decisions. So to isolate that hidden variable and understand what your rewrite actually changed, we asked a really dumb question: Does prod even agree with prod? We ran an AA test. We call this the ceiling test. We
- 3:31
took our massive, expensive production model and ran it three separate times on the same inputs and compared the answers. We discovered that it disagreed with itself roughly seven percent of the time. Production's own agreement was only about ninety-three percent, so we were demanding a standard of per-perfection from the cheap candidate that our existing expensive system couldn't even hit. Once you establish that ceiling test
- 4:01
benchmark, you finally have a measured baseline. Now, you can start making the work cheaper. There are three technical levers I like to pull, and they run in a sequence. The very first is caching. Specifically structuring your prompts to maximize your prefix cache rate is a really easy and really effective way to bring down the cost to run given tasks.
- 4:27
The second lever is to actually shrink the footprint of the prompt itself. So let's bring that Harborbyte prompt example back up. This prompt is almost five thousand tokens long, and why? Because over time, developers kept bolting on paragraphs of rules. For example, do not confuse enthusiasm with authorization is one such example. Uh, plus massive hard-coded
- 4:57
transcripts that were acting as worked examples. Nobody wants to be the one who deletes a line and breaks prod, so what do you do? You automate it. You turn prompting into a search problem. With a framework like DSPy, you can actually stop manually writing instructions. You define the exact interface contract, the inputs, the required output schema, and the scoring function, and then you hand it
- 5:26
off to an optimizer like GEPA. The optimizer treats your prompt as a search space. It runs against your benchmark, attempting to match those historical labels, and it uses feedback on failures to revise the instructions. It stripped out almost all of our long worked examples and replaced them with compact rules, a fifty-one percent reduction in instruction tokens with the same application contract. Now we
- 5:56
can move to test whether quality holds. That is instant margin. The third lever is to actually downsize the model. Now that you have a tight prompt and a measurable search loop, you don't always need a massive frontier model. You can start aggressively cutting compute. There are two interesting strategies here. First, you can break a massive prompt into smaller components. You use a cheaper model to
- 6:26
handle something like initial routing or data extraction, and only wake up your expensive frontier models for heavy reasoning. Second, you can use that exact same DSPy search loop we just built, but plug a smaller model into it. You let the smaller model search its own prompt space to match the benchmark answers generated by your large production model. You're essentially using GEPA to teach a tiny model to match the task performance of a massive one for your
- 6:56
specific data set. But the reality of optimization is not quite so easy when it comes to these small models. Um, if you're trying to compress the behavior of a large model into a smaller one, you'll notice that you introduce new points of failure and overfitting. Um, and in many of our downsizing experiments, uh, we found that the prompts weren't good enough to release. Which brings us to the final hurdle. We've cut
- 7:26
Harborbyte's prompt in half, but now we have to prove that we actually didn't break the product. Remember, these models are probabilistic. Production doesn't always agree with itself, and likewise, our new cheaper candidate is also going to have its own internal variance. So you run a massive shadow deployment on the exact same inputs and measure the system from three angles, production against production, candidate against candidate,
- 7:56
and candidate against production. There's a useful bit of math here. You take the disagreement between the two versions and subtract the average disagreement inside each one. What's left gives you a measure of how different their decision probabilities are. This is where that ceiling test pays off. We aren't guessing. We have a mathematical baseline for how much these answers move around when we haven't changed a thing. And here's the secret about that
- 8:26
drift. Different doesn't automatically mean wrong. If your optimizer did its job, the distributions should be different because the cheaper prompt is actually doing a better job. We aren't necessarily trying to build a perfect clone of a production system that may already have some flaws baked into it. So you stop panicking about the raw differences, you pull the diffs, and you manually review some of them. Was the candidate better? Was production better? Or were they just
- 8:56
two different, equally acceptable ways to handle an ambiguous input? For Harborbyte, let's say the completed review confirmed four hundred and forty-three regressions, but it also found two thousand four hundred and sixty-three outright improvements. That is almost six improvements for every one regression from a prompt that is half the size. But you do not ship on a point estimate. You have to account for sampling noise. We measured a massive gain on this
- 9:26
specific batch of requests, but we need to know exactly how much statistical confidence we can put behind it. So we calculate a confidence interval around that net gain. You keep the comparison strictly paired, both versions answering the exact same requests, and you keep the repeated runs of the same conversations grouped together. To say the candidate is better, we want the lower confidence bound above zero. If the interval crosses zero, we need more evidence before making that claim.
- 9:56
And one final sanity check is that you have to run this math on your critical categories separately. A great global average can actually, uh, silently hide that one vital customer intent is tanking. Uh, if your critical categories hold up and your lower confidence bound is above zero, you have your answer, ship it, and keep measuring. So this process is how you can replace the guesswork of prompt engineering with an explicit release rule.
- 10:27
Cache the obvious stuff, let an optimizer shrink your instructions, right-size your model, and use the ceiling test to understand the variation, then test whether quality holds. So here's your homework for Monday morning. Go pick your most expensive task, measure your baseline variance, put it through a search loop, and find out exactly how much bloat you're paying for. We need to reclaim token maxing. Let the rest of the industry fight for the high score
- 10:57
on the leaderboard. The real token legends are the ones making every single token count.