The Research Report
APEX: Why Your Prompt Optimizer Is Wasting 90% of Its Compute Budget on the Wrong Data
Google and UCLA show that stratifying training data into easy, hard, and mixed tiers during prompt optimization doubles efficiency—and the insight generalizes far beyond prompts.
If you've ever run an automated prompt optimizer and watched it spin through thousands of API calls only to produce marginal improvements, you've bumped into one of the field's most underappreciated bottlenecks: the optimizer is probably evaluating the wrong data.
Not wrong in the sense of "bad examples." Wrong in the sense that the optimizer treats every example in its development set as equally informative, when in reality most examples are either trivially solved or fundamentally unsolvable—neither of which helps the search converge. It's the information-theoretic equivalent of panning for gold in a river that's already been dredged.
A new paper from Google Research and UCLA, published June 2026 as arXiv:2606.11459, tackles this head-on. APEX (Automated Prompt Engineering eXpert) doesn't try to improve the search algorithm. Instead, it improves what data the search algorithm looks at. The results are striking: under a fixed budget of 5,000 evaluation calls, APEX outperforms the initial prompt by an average of 11.2 percentage points on Gemini 2.5 Flash and 6.8 points on Gemma 3 27B, across three diverse benchmarks.
The core insight is deceptively simple. Let me unpack why it matters.
The Problem: Your Data Is Mostly Noise
Modern prompt optimizers—APO, GEPA, and their descendants—work through an iterative cycle of mutation and selection:
- Mutation: The optimizer looks at error cases from the current prompt and asks an LLM to generate a better prompt variant.
- Selection: The new candidate is evaluated against the full dataset (or a random subset) and ranked against the current population.
Both stages are data-hungry. The mutation stage needs informative errors—cases where the model failed but could succeed with a better prompt. The selection stage needs discriminative cases—examples where candidate prompts actually differ in performance, so you can tell which one is better.
Here's the problem. As optimization progresses, the dataset fractures into three categories:
- Easy cases: Every prompt variant solves these. Evaluating them tells you nothing about which prompt is better.
- Hard cases: No prompt variant solves these. They represent the model's irreducible failure modes. Mutating on these errors sends the LLM on wild goose chases.
- Mixed cases: Some prompts solve them, others don't. These are the gold—the addressable frontier for mutation and the rank-sensitive frontier for selection.
Current optimizers treat all cases identically. They sample errors randomly for mutation and evaluate on the full set (or a random subset) for selection. The selection stage alone accounts for over 90% of total compute cost in typical optimization runs, and most of that compute is wasted on cases that provide zero discriminating signal.
The authors formalize this with a sparse score matrix S ∈ {0, 1, ∅}^{|P| × |D|}, where each entry records whether prompt Pⱼ passes or fails on datapoint xᵢ. The discriminative set—the only examples that matter for selection—is:
D_disc = {xᵢ ∈ D | ∃Pₐ, Pᵦ ∈ Pₜ : s(Pₐ, xᵢ) ≠ s(Pᵦ, xᵢ)}
Everything outside D_disc is noise for ranking purposes.
The APEX Framework: Dynamic Stratification
APEX's architecture has three stages that run in each optimization iteration:
Stage 1: Dynamic Data Stratification
Using a lookback window of the last k prompt variants in the optimization lineage, APEX classifies each datapoint into one of six fine-grained buckets:
| Bucket | Notation | Meaning |
|---|---|---|
| Mixed-Fail | B_{M,0} | Mixed tier, most recent result is fail |
| Mixed-Pass | B_{M,1} | Mixed tier, most recent result is pass |
| Mixed-Unseen | B_{M,∅} | Mixed tier, not yet evaluated in this cycle |
| Easy-Unseen | B_{E,∅} | Consistently passed, not yet evaluated |
| Hard-Unseen | B_{H,∅} | Consistently failed, not yet evaluated |
| Hard-Fail | B_{H,0} | Consistently failed, most recent result is fail |
The "Mixed" tier is defined as datapoints where different prompt variants in the lineage produce different outcomes—some pass, some fail. This is the operational definition of informativeness: these are the examples on the cusp of being solved, where the right prompt can make a real difference.
The stratification is dynamic. A datapoint that starts as Mixed can become Easy (if all recent variants solve it) or stay Mixed (if performance remains inconsistent). This is critical: the utility of data changes as optimization progresses.
Stage 2: Trajectory-Guided Mutation
Instead of sampling error cases randomly, APEX draws mutation examples from B{M,0} ∪ B{H,0}—the Mixed-Fail and Hard-Fail buckets, prioritizing unseen datapoints. The key distinction from random sampling is the addressable frontier: Mixed-Fail errors are volatile, meaning they're solvable by some prompt variants. Mutating on these gives the LLM concrete, achievable targets rather than impossible ones.
The authors also track mutation history—which error patterns have already been shown to the LLM for critique. Unseen errors get priority, ensuring the optimizer explores new failure modes rather than repeating the same critique loop.
Stage 3: Rank-Sensitive Selection
This is where APEX delivers its biggest efficiency gains. Rather than evaluating candidates on the full dataset or a random subset, APEX constructs a stratified evaluation set:
- Required evaluation (Dreq = B{M,∅}): All Mixed-tier unseen datapoints are mandatory. These have the highest probability of being discriminative.
- Positive stratum (Dpos): Sampled from B{M,1} (Mixed-Pass) and then B_{E,∅} (Easy-Unseen), weighted by a dynamically adjusted ratio α that balances positive and negative samples.
- Negative stratum (Dneg): Sampled from B{M,0} (Mixed-Fail) and then B_{H,∅} (Hard-Unseen), capturing the failure side.
The anchor parameter α starts conservatively and anneals upward as the optimizer succeeds, gradually expanding the evaluation scope. This is elegant: early in optimization, when Mixed-tier data is abundant, α stays small and evaluation is tightly focused. As optimization progresses and the Mixed tier shrinks, α expands to capture broader signal.
The total evaluation budget per step is capped at N calls, with previously evaluated datapoints skipped via incremental evaluation—only new datapoints or those not yet seen by the current prompt pair are evaluated.
Results: What the Numbers Say
APEX is evaluated on three benchmarks that span very different capabilities:
- IFBench: Instruction-following benchmark with 540 examples and 1,635 constraints
- SimpleQA Verified: Factuality benchmark with 3,556 examples (verified subset)
- FACTS Grounding: Long-context grounding benchmark with 820 examples
Two target LLMs:
- Gemini 2.5 Flash (proprietary, strong instruction-following)
- Gemma 3 27B (open-weight, competitive open model)
Under a fixed budget of 5,000 evaluation calls, APEX achieves:
| Model | IFBench | SimpleQA Verified | FACTS Grounding | Average |
|---|---|---|---|---|
| Gemini 2.5 Flash | +8.4 | +14.0 | +11.2 | +11.2 |
| Gemma 3 27B | +3.8 | +9.4 | +7.2 | +6.8 |
Compare this with the baselines: random sampling for mutation + full-set evaluation for selection (the APO default) and random sampling for both stages (the GEPA default). APEX consistently outperforms both, often by significant margins. On SimpleQA Verified with Gemini 2.5 Flash, APEX improves by 14.0 points over the initial prompt—nearly double what random-data-mutation achieves.
The ablation studies are equally telling. Removing the Mixed-tier prioritization from selection (using random sampling instead) causes performance to drop 2-4 points across benchmarks. Removing trajectory-guided mutation (sampling errors randomly rather than from the addressable frontier) causes another 1-3 point drop. Both components matter, but the selection-side improvement is the larger contributor.
Why This Matters Beyond Prompts
APEX's insight—that data utility is dynamic, not static—generalizes far beyond prompt optimization.
Consider any iterative optimization process that uses a fixed evaluation set: hyperparameter search, neural architecture search, even reinforcement learning from human feedback (RLHF). In all of these, the informativeness of any given training signal changes as the model improves. Early in training, easy examples provide gradient signal; later, they're noise. Hard examples that were once insurmountable might become addressable as the model scales—or they might remain permanently out of reach.
The LIMA hypothesis (Zhou et al., 2023) established that data quality matters more than quantity for fine-tuning. APEX extends this principle from static curation to dynamic curation: the optimal training set isn't just a one-time filter—it's a moving target that shifts with every optimization step.
This has practical implications for anyone running LLM evaluation pipelines:
- Stop evaluating on the full benchmark every iteration. Most of your compute is wasted on examples that don't discriminate between candidates.
- Track which examples your model gets right/wrong over time. The trajectory tells you which examples are informative.
- Prioritize the "mixed" examples. These are where small prompt changes have outsized effects, and where your evaluation signal is richest.
The Black-Box Advantage
One of APEX's most practical features is that it's entirely black-box compatible. It doesn't require access to model logits, gradients, or internal representations. All it needs is binary pass/fail evaluation outcomes—the same signals any prompt optimizer already collects.
This distinguishes it from prior data selection methods like Diao et al. (2024) and Dong et al. (2025), which require internal model signals (logit probabilities) or human-in-the-loop annotation. Those approaches are limited to classification tasks or require white-box access, making them inapplicable to the common scenario of optimizing prompts against proprietary APIs.
For practitioners working with GPT-4, Claude, Gemini, or any closed API, APEX is drop-in compatible. You already have the pass/fail signal from your evaluation pipeline; APEX just uses it more intelligently.
Connection to Google's Vertex AI Prompt Optimizer
The connection to Google's production infrastructure is worth noting. Author Fei Wang is a researcher at Google, and the Vertex AI Prompt Optimizer product—now in general availability—uses evolutionary prompt optimization that closely resembles the APO/GEPA paradigm that APEX improves upon. The data efficiency insights from APEX could directly reduce the cost of running production prompt optimization at scale, where each evaluation call costs real API dollars.
In production settings, the 90%+ compute cost that selection consumes isn't an academic concern—it's a billing line item. APEX's approach of focusing evaluation on discriminative examples could reduce API costs by an order of magnitude for the same optimization quality.
Limitations and Open Questions
APEX isn't without caveats:
- Binary evaluation only: The framework assumes pass/fail outcomes. For continuous scoring (e.g., BLEU, ROUGE, or model-based grading with partial credit), the easy/hard/mixed classification needs adaptation.
- Lookback window sensitivity: The lookback parameter k determines how many historical prompt variants inform the tier classification. Too small and the tiers are noisy; too large and they're stale. The paper uses k=5, but optimal values may vary by task.
- Single-objective optimization: APEX optimizes for a single metric. Multi-objective settings (e.g., accuracy vs. latency) would need a Pareto-aware variant—potentially combining APEX with GEPA's Pareto-front tracking.
- Cold start: APEX requires an initial full evaluation of P₀ on D to populate the score matrix. For very large datasets, this initial pass can be expensive, though it's a one-time cost.
The Bigger Picture: Data-Centric AI Matures
APEX sits at the intersection of two important trends:
- Data-centric AI: The shift from "how do we improve the model?" to "how do we improve the data?" is accelerating. From LIMA to AlpaGasus to LESS, the evidence is mounting that curation beats volume. APEX adds a temporal dimension: data curation isn't a one-time step, it's an ongoing process that must adapt to the optimizer's current state.
- Efficient evaluation under budget constraints: As LLMs are deployed in production, the cost of evaluation—both compute and human annotation—becomes a bottleneck. APEX's incremental evaluation (skipping already-evaluated datapoints) and budget-constrained stratified sampling are practical engineering solutions that make prompt optimization viable at scale.
The paper also implicitly makes a philosophical point: prompt optimization is not just about searching the space of prompts more cleverly. It's about searching the space of evaluations more efficiently. The prompt and the data are co-dependent—you can't optimize one without being smart about the other.
Key Takeaways
| What APEX Does | Why It Works | Result |
|---|---|---|
| Stratifies data into Easy/Hard/Mixed tiers | Mixed tier contains discriminative and addressable examples | Focuses compute on high-signal data |
| Prioritizes Mixed-Fail for mutation | These are errors that some prompts solve | Generates targeted, productive mutations |
| Stratified sampling for selection | Most datapoints provide zero ranking signal | Cuts evaluation cost by 10x+ for same quality |
| Dynamic re-stratification each round | Data utility changes as prompts improve | Avoids stale signals, captures emerging opportunities |
| Incremental evaluation | Skips already-evaluated datapoints | Eliminates redundant compute |
For anyone running prompt optimization in production, the message is clear: your data strategy matters as much as your search strategy. APEX makes that strategy dynamic, principled, and—crucially—compatible with black-box APIs.
The paper is available at arXiv:2606.11459.
References
- Wang, F., Si, S., Hsieh, C.-J., & Dhillon, I. S. (2026). APEX: Automated Prompt Engineering eXpert with Dynamic Data Selection. arXiv:2606.11459.
- Pryzant, R., et al. (2023). APO: Automatic Prompt Optimization. EMNLP 2023.
- Agrawal, S., et al. (2025). GEPA: Genetic Pareto-front for Multi-Objective Agent Optimization.
- Zhou, C., et al. (2023a). LIMA: Less Is More for Alignment. NeurIPS 2023.
- Hsieh, C.-J., et al. (2024). AELP: Automatic Engineering of Long Prompts.
- Xia, M., et al. (2024). LESS: Selecting Data for Fine-Tuning with Gradient Similarity.
- Chen, L., et al. (2024b). AlpaGasus: Training a Better LLM with Fewer Data.