SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2606.19605 · 2026

FAPO: Fully Automated Prompt Optimization of Multi-Step LLM Pipelines

Amin Karbasi, Aman Priyanshu, Supriti Vijay, Baturay Saglam, Paul Kassianik, Blaine Nelson, Huaibo Zhao

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 6 failures of our instrument; 1 no recorded run), measured 2026-11-24; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2606.19605.json · badge: /api/ran/2606.19605.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
cisco-foundation-ai/fully-automated-prompt-optimization canonical (classifier label)
classifier basis: census
6 ran · 1 no recorded run
FunctionStatusWhere it lives
build_node_context Ran
ran; our contract draft was wrong, not the code
cisco-foundation-ai/fully-automated-prompt-optimization/src/hephaestus/chains/nodes.py
code served (permissive licence) · get_code("4426e9aa374dc40d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from typing import Any, Dict

torch.manual_seed(0)

# Build a state dict with context and step_outputs
state = {
    'context': {
        'user_query': 'What is the capital of France?',
        'previous_answer': 'Paris is the capital.'
    },
    'step_outputs': {
        'search': 'Found information about Paris',
        'summarize': 'Paris is located in France'
    }
}

ARGS = {
    'state': state
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
build_skills_message Ran
ran; our contract draft was wrong, not the code
cisco-foundation-ai/fully-automated-prompt-optimization/src/hephaestus/engine/skills.py
code served (permissive licence) · get_code("ab51493d6402c569")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

# Read the function body to understand what parameters are needed and how they're used
# The function takes:
# - skills_text: str - used in conditions (if not skills_text or not skills_text.strip())
#                      and in string formatting

# The function checks if skills_text is empty/whitespace and returns None if so
# Otherwise it wraps it in a message dict with role 'system' and formatted content

# Test case 1: Non-empty skills text
ARGS = {
    'skills_text': 'Skill 1: Use a calculator for arithmetic.\nSkill 2: Parse JSON documents.\nSkill 3: Search the web for current information.'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
inject_skills_message Ran
ran; our contract draft was wrong, not the code
cisco-foundation-ai/fully-automated-prompt-optimization/src/hephaestus/engine/skills.py
code served (permissive licence) · get_code("48b145c5905d7bb9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from typing import Dict, List, Optional

# Setup for inject_skills_message function
# The function takes:
# 1. messages: List[Dict[str, str]] - a list of message dictionaries with 'role' and content keys
# 2. skills_message: Optional[Dict[str, str]] - an optional dictionary to insert

# Test case 1: messages with system prompt + skills message
messages_with_system = [
    {'role': 'system', 'content': 'You are a helpful assistant.'},
    {'role': 'user', 'content': 'Hello'},
    {'role': 'assistant', 'content': 'Hi there!'}
]

skills_message = {'role': 'system', 'content': 'Available skills: skill1, skill2'}

# Test case 2: messages without system prompt + skills message
messages_without_system = [
    {'role': 'user', 'content': 'Hello'},
    {'role': 'assistant', 'content': 'Hi there!'}
]

# Test case 3: None skills_message
skills_message_none = None

# Test case 4: empty messages
messages_empty = []

# We'll use the first test case as the main ARGS
ARGS = {
    'messages': messages_with_system,
    'skills_message': skills_message
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
render_skills_block Ran
ran; our contract draft was wrong, not the code
cisco-foundation-ai/fully-automated-prompt-optimization/src/hephaestus/engine/skills.py
code served (permissive licence) · get_code("febddcb9482f2c6a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
from pathlib import Path

# Create temporary skill files for testing
temp_dir = tempfile.TemporaryDirectory()
temp_path = Path(temp_dir.name)

# Create skill directory structure
skill1_dir = temp_path / "skills" / "python-basics"
skill1_dir.mkdir(parents=True, exist_ok=True)

skill2_dir = temp_path / "skills" / "data-analysis"
skill2_dir.mkdir(parents=True, exist_ok=True)

# Create skill files with frontmatter and content
skill1_file = skill1_dir / "variant-001.md"
skill1_content = """---
title: Python Basics
author: test
---
<!-- License comment here -->

This is a Python basics skill.
Learn the fundamentals of Python programming.
"""
skill1_file.write_text(skill1_content, encoding='utf-8')

skill2_file = skill2_dir / "variant-001.md"
skill2_content = """---
title: Data Analysis
---

This is a data analysis skill.
Use pandas and numpy for data manipulation.
"""
skill2_file.write_text(skill2_content, encoding='utf-8')

# Create skill file without frontmatter
skill3_dir = temp_path / "skills" / "web-scraping"
skill3_dir.mkdir(parents=True, exist_ok=True)
skill3_file = skill3_dir / "variant-001.md"
skill3_content = """Some web scraping content here."""
skill3_file.write_text(skill3_content, encoding='utf-8')

# Build the arguments
ARGS = {
    "skill_paths": [str(skill1_file), str(skill2_file), str(skill3_file)]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
stratified_split_by_key Ran
ran; our contract draft was wrong, not the code
cisco-foundation-ai/fully-automated-prompt-optimization/src/hephaestus/datasets/stratified_split.py
code served (permissive licence) · get_code("18c83ffd4d1ca689")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import random
from collections import defaultdict
from typing import Any, Callable, Dict, List, Tuple

# Create a simple set of test cases
cases = [
    {"id": 1, "category": "A", "value": 10},
    {"id": 2, "category": "A", "value": 20},
    {"id": 3, "category": "A", "value": 30},
    {"id": 4, "category": "A", "value": 40},
    {"id": 5, "category": "A", "value": 50},
    {"id": 6, "category": "B", "value": 60},
    {"id": 7, "category": "B", "value": 70},
    {"id": 8, "category": "B", "value": 80},
    {"id": 9, "category": "B", "value": 90},
    {"id": 10, "category": "C", "value": 100},
    {"id": 11, "category": "C", "value": 110},
    {"id": 12, "category": "D", "value": 120},
    {"id": 13, "category": "D", "value": 130},
    {"id": 14, "category": "E", "value": 140},
]

# Define a key function that extracts the category
def key_fn(case: Dict[str, Any]) -> str:
    return case["category"]

ARGS = {
    "cases": cases,
    "key_fn": key_fn,
    "dev_fraction": 0.2,
    "seed": 42,
    "rare_threshold": 3,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
summarize Ran
ran; our contract draft was wrong, not the code
cisco-foundation-ai/fully-automated-prompt-optimization/src/hephaestus/analysis/step_attribution.py
code served (permissive licence) · get_code("1c1c3a0f184a196d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from typing import Dict, Any

# Construct a valid attribution dictionary for the summarize function
attribution = {
    "failure_1": {
        "count": 5,
        "heuristic": "format_failure",
        "confidence": "high",
        "retrieval_tier": "hit",
        "tool_failure": False,
    },
    "failure_2": {
        "count": 3,
        "heuristic": "final_step_fallback",
        "confidence": "medium",
        "retrieval_tier": "partial",
        "tool_failure": False,
    },
    "failure_3": {
        "count": 2,
        "heuristic": "tool_failure_timeout",
        "confidence": "low",
        "retrieval_tier": "miss",
        "tool_failure": True,
        "tool_error_type": "timeout",
    },
    "failure_4": {
        "count": 4,
        "heuristic": "retrieval_empty",
        "confidence": "high",
        "retrieval_tier": "miss",
        "tool_failure": False,
    },
    "failure_5": {
        "count": 1,
        "heuristic": "tool_failure_not_found",
        "confidence": "medium",
        "retrieval_tier": "hit",
        "tool_failure": True,
        "tool_error_type": "not_found",
    },
    "failure_6": {
        "count": 2,
        "heuristic": "cascade_downstream",
        "confidence": "low",
        "retrieval_tier": "partial",
        "tool_failure": False,
    },
    "failure_7": {
        "count": 3,
        "heuristic": "empty_intermediate",
        "confidence": "high",
        "retrieval_tier": "hit",
        "tool_failure": False,
    },
}

ARGS = {
    "attribution": attribution
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
attribute_failures Not yet run
unverified (harvested, no recorded run)
cisco-foundation-ai/fully-automated-prompt-optimization/src/hephaestus/analysis/step_attribution.py
code served (permissive licence) · get_code("861c602f1414649c")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 7 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Multi-step LLM pipelines fail through interactions among retrieval, reasoning, and formatting steps, so prompt-only optimization can miss bottlenecks in the chain. We present Fully Automated Prompt Optimization (FAPO), a framework that lets Claude Code optimize an LLM pipeline inside a standardized codebase. FAPO evaluates a pipeline, inspects intermediate steps, diagnoses failures, proposes scoped changes, and validates variants repeatedly to optimize against a score function. It first tries prompt edits and, only when prompt optimization appears insufficient, changes chain structure within the permitted scope when attribution identifies a structural bottleneck. Across six benchmarks and three task models, FAPO beats the baseline GEPA in 15 of 18 model-benchmark comparisons. In 11 model-benchmark comparisons, FAPO wins with non-overlapping mean ± trial-standard-deviation ranges, and the mean FAPO-GEPA gain is +14.1 pp. In the six HoVer and IFBench comparisons where prompt-first search escalated to structural changes, FAPO wins all six with a mean gain of +33.8 pp. FAPO also improves performance on security tasks: on CTIBench-RCM, a security CVE-to-CWE task, prompt-only FAPO lifts 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. These results position FAPO as a state-of-the-art pipeline optimization technique for both general-purpose and security-focused tasks.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2606.19605")
get_code_for_paper("2606.19605")
have("2606.19605")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2606.19605.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2606.19605.svg)](https://syntology.ai/paper/2606.19605)

Connect an agent — have() is free.