Multi-step LLM pipelines often fail due to interactions among retrieval, reasoning, and formatting steps, making prompt-only optimization insufficient. To address this, researchers have developed FAPO (Fully Autonomous Prompt Optimization), a framework that allows Claude Code to optimize an LLM pipeline inside a standardized codebase, according to a paper published on arXiv.
How FAPO Works
FAPO evaluates a pipeline, inspects intermediate steps, diagnoses failures, proposes scoped changes, and validates variants repeatedly to optimize against a score function, the paper states. It first tries prompt edits; only when prompt optimization appears insufficient does it change the chain structure within the permitted scope, based on attribution identifying a structural bottleneck.
Benchmark Results
The framework was tested across six benchmarks and three task models. FAPO beat the baseline GEPA in 15 of 18 model-benchmark comparisons. The mean FAPO-GEPA gain was +14.1 percentage points. In 11 model-benchmark comparisons, FAPO won with non-overlapping mean ± trial-standard-deviation ranges, indicating statistically significant improvements.
| Metric | Result |
|---|---|
| FAPO vs GEPA wins (out of 18 comparisons) | 15 |
| Mean FAPO-GEPA gain | +14.1 pp |
| FAPO wins with non-overlapping mean±sd | 11/18 |
| Mean gain on HoVer & IFBench (structural changes) | +33.8 pp (6/6 wins) |
| CTIBench-RCM: GPT-5 test accuracy lift | +4.0 pp |
| CTIBench-RCM: Foundation-Sec-8B-Instruct lift | +7.1 pp |
| CTIBench-RCM: Foundation-Sec-8B-Reasoning lift | +2.0 pp |
Structural Changes and Security Tasks
On six comparisons from HoVer and IFBench where prompt-first search escalated to structural changes, FAPO won all six with a mean gain of +33.8 percentage points. Additionally, FAPO improved performance on security tasks: on CTIBench-RCM, a security CVE-to-CWE task, prompt-only FAPO lifted test accuracy by +4.0 pp on GPT-5, +7.1 pp on Foundation-Sec-8B-Instruct, and +2.0 pp on Foundation-Sec-8B-Reasoning, according to the paper.
Implications for Enterprise AI
The paper positions FAPO as a state-of-the-art pipeline optimization technique for both general-purpose and security-focused tasks. For enterprises building complex LLM pipelines for document processing, reporting, or customer support, FAPO's ability to autonomously diagnose and fix bottlenecks could reduce manual tuning effort and improve accuracy. The technique leverages Claude Code, an AI coding tool, to implement optimizations within a standardized codebase.
While FAPO currently focuses on prompt and chain structure optimization, the authors — Kassianik, Paul, Saglam, Baturay, Zhao, Huaibo, Nelson, Blaine, Vijay, Supriti, Priyanshu, Aman, and Karbasi — suggest that extending the approach to handle larger pipelines with more steps could further enhance its applicability. The results demonstrate that autonomous optimization can yield significant gains, especially when structural changes are needed.