One function. Any text artifact. Better than domain-specific optimizers.

What if you could optimize a CUDA kernel, an agent architecture, a cloud scheduling policy, and a system prompt with the exact same API call? Not similar calls. The same call. Same parameters. Same optimizer.

That is what optimize_anything delivers. Researchers at UC Berkeley and MIT released a universal text optimization API that treats every problem as the same thing: improve a text artifact given a scoring function. The results are startling. The system discovers agent architectures that nearly triple ARC-AGI accuracy (32.5% to 89.5%), finds scheduling algorithms that cut cloud costs by 40%, generates CUDA kernels where 87% match or beat PyTorch baselines, and outperforms AlphaEvolve on circle packing. All from one interface.

The paper, accepted at ACM CAIS 2026 in San Jose, is available on arXiv as 2605.19633. The code is open-source at github.com/gepa-ai/gepa. You can install it today with pip install gepa.


The Core Insight

Most optimization frameworks are built for one thing. AlphaEvolve evolves code. GEPA optimizes prompts. Optuna tunes hyperparameters. Each has its own API, its own configuration language, its own assumptions about what you are optimizing.

The Berkeley/MIT team asked a simpler question: what if the artifact does not matter? What matters is that it can be serialized to text and evaluated. A CUDA kernel is text. A prompt is text. An agent architecture is text. A scheduling policy is text. If you can turn it into a string and assign it a score, an LLM can reason about it and propose improvements.

This observation sounds trivial until you see it working across six fundamentally different domains with one codebase.


What It Actually Does

The API has two required inputs: a seed artifact (or a natural-language description in seedless mode) and an evaluator function. The evaluator returns a score and optional diagnostic feedback called Actionable Side Information (ASI). The LLM proposer reads this feedback, diagnoses failures, and proposes targeted fixes. Each mutation inherits accumulated lessons from all ancestors in the search tree.

Here is the simplest form:

import gepa.optimize_anything as oa

def evaluate(candidate: str) -> tuple[float, dict]:
    result = execute_code(candidate)
    return result.score, {
        "Error": result.stderr,
        "Output": result.stdout,
        "Runtime": f"{result.time_ms:.1f}ms",
    }

result = oa.optimize_anything(
    seed_candidate="<your artifact>",
    evaluator=evaluate,
)

That is it. No mutation prompts. No island configurations. No EVOLVE-BLOCK markers. You declare what to optimize and how to measure it. The system handles the search.


The Three Modes

optimize_anything supports three optimization paradigms under one interface. Which mode activates depends solely on whether you provide a dataset and validation set.

Single-Task Search

No dataset needed. The candidate is the solution. The evaluator scores it directly. This is the mode AlphaEvolve and OpenEvolve operate in. The team used it for circle packing, where the artifact is the packing algorithm code and the evaluator returns the packing score plus geometric diagnostics.

Multi-Task Search

Provide a dataset of related tasks. Insights from solving one task transfer to the others. This mode is novel. No prior LLM-evolution framework supports it. In CUDA kernel generation, each task is a different PyTorch operation to accelerate. Multi-task mode converges faster and solves more problems than single-task optimization given the same budget, because optimization patterns discovered for one kernel transfer to others.

Generalization

Provide both a training dataset and a held-out validation set. The optimized artifact must perform well on unseen examples. This is the mode GEPA uses for prompt optimization, but optimize_anything extends it to any text artifact. The team used it for agent architecture discovery, where the agent must generalize to unseen ARC-AGI puzzles.


The Numbers

Here are the headline results across six domains:

Agent architecture discovery (generalization mode): ARC-AGI accuracy on Gemini Flash jumps from 32.5% to 89.5%. That is a 57 percentage point improvement. The system evolved bespoke agent harnesses from scratch.

Cloud scheduling (generalization mode): Discovered scheduling algorithms that cut cloud costs by up to 40%, beating expert heuristics.

CUDA kernel generation (multi-task mode): 87% of generated kernels match or beat PyTorch baselines from KernelBench. Multi-task search outperforms dedicated single-task optimization.

Prompt optimization (generalization mode): GPT-4.1-mini accuracy on AIME-2025 rises from 46.67% to 60.00%.

Circle packing (single-task mode): Outperforms AlphaEvolve's published solution for n=26, confirmed by a controlled rerun against OpenEvolve under matched conditions.

Black-box optimization: Custom solver code generated by optimize_anything matches and exceeds Optuna on numerical optimization tasks.


Why It Works: Actionable Side Information

The single most important design decision is elevating diagnostic feedback to a first-class API contract. Traditional optimizers reduce everything to a scalar reward. They know a candidate failed. They do not know why.

optimize_anything requires evaluators to return ASI: stack traces, profiler data, compiler errors, rendered images, structured error reports, reasoning logs. Anything that would help a human engineer diagnose the failure. An LLM reads this feedback and proposes targeted fixes.

Ablations across three domains show that actionable side information yields 4-6x faster convergence and substantially higher final performance than score-only feedback. This is not a marginal improvement. It is the difference between a system that works and one that does not.

The ASI mechanism also enables multimodal feedback. In the SVG optimization demo, the evaluator renders the SVG as a PNG, scores it with a vision-language model, and passes the rendered image back as ASI. The proposer literally sees what it is improving.


Pareto-Efficient Search

Prior frameworks optimize for an aggregate score. A candidate that excels on bicycle structure but struggles with pelican anatomy gets discarded because its average is low. optimize_anything uses Pareto-dominance selection instead. Candidates are preserved if they excel on any subset of metrics, even if they are weak on others. This preserves complementary strengths across iterations and enables multi-objective optimization without hand-tuned weights.


The GEPA Connection

optimizeanything is part of the GEPA project (Genetic-Pareto Evolutionary Prompt Optimization). GEPA was previously known as a state-of-the-art prompt optimizer. optimizeanything extends GEPA's Pareto-based search to arbitrary text artifacts and adds the single-task and multi-task modes.

GEPA itself was selected as an oral presentation at ICLR 2026, placing it in the top 2% of submissions. The system is already built into DSPy, the Stanford declarative prompt programming framework, and is trusted by teams at Shopify, Databricks, and Dropbox.


Declarative Design

The API is inspired by DSPy's principle of programming, not prompting. You do not hand-craft mutation prompts or configure island topologies. You write an evaluator and call optimize_anything. The system handles prompt construction, reflection, candidate selection, and search strategy.

This matters because it lowers the barrier to optimization. You do not need to be a prompt engineering expert to optimize a prompt. You do not need to be a CUDA expert to optimize a kernel. You need to be able to write an evaluator and define what better means.


Seedless Mode

In some domains, providing even a bad starting artifact requires expertise. The system supports seedless mode, where you provide only a natural-language objective and the LLM bootstraps the first candidate from scratch. The team demonstrated this on a 3D modeling task, where the objective was simply "model a 3D unicorn." The LLM generated an initial SVG-like representation, and the system optimized it.


Comparison to Prior Work

Feature AlphaEvolve GEPA optimize_anything
Code evolution Yes No Yes
Prompt optimization No Yes Yes
Agent architecture No No Yes
Multi-task search No No Yes
Generalization No Yes Yes
SI as first-class API Partial Partial Yes
Declarative interface No Partial Yes

Prior frameworks each support exactly one mode. AlphaEvolve, OpenEvolve, and ShinkaEvolve operate exclusively in single-task mode. GEPA and MIPROv2 operate in generalization mode but only for prompts. optimize_anything is the first system to support all three modes and apply them across fundamentally different domains.


Practical Implications

For practitioners, optimize_anything offers three immediate advantages.

First, it replaces multiple tools with one. Instead of maintaining separate pipelines for prompt optimization, code evolution, and hyperparameter tuning, you write evaluators and call one function.

Second, it works on API-only models. No weights access needed. You can optimize GPT-5, Claude, or Gemini directly through their APIs. This removes the infrastructure burden of fine-tuning pipelines.

Third, it produces interpretable traces. Every mutation includes a natural-language reflection explaining why the change was made. You can see why each prompt changed. This is invaluable for debugging complex agent behaviors.

The authors note that GEPA complements rather than replaces RL and fine-tuning. Use GEPA for rapid initial optimization (minutes to hours, API-only access). Then apply RL or fine-tuning for additional gains when you have abundant data and cheap rollouts.


Getting Started

Installation is one line:

pip install gepa

Basic usage:

import gepa

trainset, valset, _ = gepa.examples.aime.init_dataset()
seed_prompt = {"system_prompt": "You are a helpful assistant..."}

result = gepa.optimize(
    seed_candidate=seed_prompt,
    trainset=trainset,
    valset=valset,
    task_lm="openai/gpt-4.1-mini",
    max_metric_calls=150,
    reflection_lm="openai/gpt-5",
)

For custom systems, subclass the adapter and define your evaluator. The documentation at gepa-ai.github.io/gepa includes examples for DSPy integration, custom adapters, and all three optimization modes.


The Bigger Picture

optimize_anything is evidence that LLM-based text optimization is a general-purpose problem-solving paradigm, not a narrow technique for prompt engineering. When you strip away domain-specific scaffolding, the underlying operation is always the same: serialize an artifact, evaluate it, reflect on the diagnostics, and propose improvements. The Berkeley/MIT team proved this paradigm works across agent architectures, systems code, numerical optimization, and visual design.

This is not hype. The numbers are measured and reproducible. The code is open-source. The API is available today.

If you build AI systems, the question is no longer whether text optimization can help your domain. The question is whether you have written an evaluator for it yet.


Paper: arXiv:2605.19633, accepted at ACM CAIS 2026

Code: github.com/gepa-ai/gepa

Docs: gepa-ai.github.io/gepa

Authors: Lakshya A Agrawal, Donghyun Lee, Shangyin Tan, Wenjie Ma, Karim Elmaaroufi, Rohit Sandadi, Sanjit A. Seshia, Koushik Sen, Dan Klein, Ion Stoica, Joseph E. Gonzalez, Omar Khattab (MIT), Alexandros G. Dimakis, Matei Zaharia (UC Berkeley)