The Research Report
The End of the Monolithic Prompt: How aPSF Decomposes, Diagnoses, and Optimizes One Factor at a Time
You've been writing prompts wrong. Not wrong in the sense that they don't work—many of your prompts probably work fine. Wrong in the sense that when they break, you have no idea which part broke, and when you fix one part, you accidentally break another.
A new framework called Adaptive Prompt Structure Factorization (aPSF), published on arXiv and accepted at ACL 2026, proposes a fundamentally different way to think about prompt optimization. Instead of treating your prompt as one monolithic block of text and tweaking it blindly, aPSF breaks it into semantic factors, figures out which factor is causing failures, and optimizes just that factor while leaving everything else alone.
The results are striking: up to +2.16 percentage points average accuracy improvement over baselines, 45-87% token cost reduction on MultiArith, and peak validation performance reached in a single optimization step on some tasks.
But the real breakthrough isn't the numbers. It's the idea that prompts have structure, and that structure should be discovered, diagnosed, and optimized—not guessed at.
Let me walk you through how this works, why existing approaches fail, and what it means for anyone who writes prompts for a living.
The Monolith Problem
Here's how most prompt optimization works today. You write a prompt. You test it. It gets 72% accuracy. You want 80%. So you rewrite the whole prompt. Test again. 74%. Tweak again. 71%. Tweak again. 76%. And on and on.
Tools like APE, OPRO, ProTeGi, and GrIPS automate this loop with varying degrees of sophistication. APE proposes entirely new prompts at each iteration. OPRO uses an LLM as an optimizer that generates candidate prompts. ProTeGi applies localized edits like paraphrasing or adding constraints. GrIPS uses phrase-level operations like deletion and swapping.
But they all share a fundamental problem: they treat the prompt as one indivisible unit. When a candidate prompt scores higher than the current one, you have no way of knowing why it scored higher. Was it the improved reasoning instructions? The clearer output format? The better role description? You can't tell. The signal is confounded.
This has three consequences:
- Obfuscated credit assignment. When you change everything at once, you can't attribute improvements to specific changes. This makes debugging nearly impossible.
- No selective freezing. If your output format is perfect but your reasoning instructions need work, you can't protect the good part. The optimizer might break the format while trying to fix the reasoning.
- Wasted search budget. A single edit to one semantic role often perturbs multiple functions. Many candidate prompts get rejected not because the intended change was bad, but because an unintended side effect was. This wastes queries and slows convergence.
Even the newer principle-aware methods like CriSPO and ZERA, which generate structured critiques or evolve optimization principles, still propose and select whole-prompt candidates. The critique guides what to change, but the unit of optimization remains the entire prompt.
aPSF changes the unit of optimization from the whole prompt to individual semantic factors.
How aPSF Works: Two Phases
aPSF operates in two phases. The first phase discovers structure. The second phase optimizes it.
Phase 1: Adaptive Structure Discovery
You give aPSF a task description and optionally some example problems. An "Architect" LLM analyzes the task and decomposes the prompt into semantic factors.
These factors are not predetermined. This is crucial. aPSF doesn't use a fixed template like "role + context + task + format + constraints." Instead, the Architect discovers the factor structure from the task itself. For a math word problem, the factors might be Task Interpretation, Reasoning Procedure, Output Format, and Verification. For a multiple-choice logic problem, they might be Problem Understanding, Strategy Selection, Step-by-Step Reasoning, and Answer Extraction.
There are two modes for structure discovery:
From-scratch mode. The Architect looks at the task description and example data, then proposes both the factor schema (what roles exist and in what order) and the initial content for each factor. No initial prompt required.
Initial-prompt mode. You provide an existing prompt like "Let's think step by step." The Architect analyzes its core reasoning approach, extends it into a full task-specific instruction, and decomposes that into factors. This is useful when you have a known-good starting point.
The output of Phase 1 is an ordered list of factor texts: B = (f₁, f₂, ..., fₖ). The assembled prompt is simply these factors concatenated with newlines:
prompt = concat(f₁, f₂, ..., fₖ)
This seems almost too simple. The power is in what comes next.
Phase 2: Interventional Factor Optimization
Phase 2 is where aPSF differentiates itself from every other prompt optimizer. Here's the loop:
- Execute. The "Worker" LLM runs the assembled prompt on validation examples and produces answers.
- Evaluate and diagnose. An evaluator scores the answers and collects representative failure cases. The Architect LLM examines these failures and produces an error diagnosis—a lightweight summary of what's going wrong and which factor is most responsible. For example: "15 out of 20 failures are reasoning errors (wrong calculation steps), 5 are formatting errors (missing units)." This diagnosis points to the Reasoning factor as the bottleneck.
- Select the bottleneck factor. Based on the error diagnosis, the Architect selects the factor most responsible for current failures. This is error-guided factor selection, and it's the key efficiency mechanism.
- Generate candidate edits. The Architect proposes N candidate edits for just the selected factor. All other factors remain frozen.
- Interventional scoring. Each candidate is scored by swapping it into the assembled prompt while keeping every other factor identical. The marginal contribution of each candidate is measured as the difference between its score and the current prompt's score. This is interventional: you're isolating the effect of changing one factor.
- Accept or reject. The best candidate is accepted if it improves the validation score by at least a threshold δ. Otherwise, the current factor text is kept.
This loop repeats for up to T_max steps. There's also a warm-start phase where each factor gets optimized once in order, before the error-guided selection kicks in.
The result: every improvement is attributable. When the validation score goes from 82% to 84%, you know exactly which factor change caused it. And you know which factor wasn't touched, so it's guaranteed not to have regressed.
Why Interventional Scoring Matters
The interventional scoring mechanism deserves special attention because it's what separates aPSF from "just split your prompt into sections and optimize each one."
Consider an analogy from clinical trials. If you want to know whether a drug works, you can't just give it to patients and see if they improve. Maybe they would have improved anyway. You need a control group—patients who are identical in every way except they didn't get the drug. The difference between the treatment group and the control group is the marginal effect of the drug.
aPSF applies the same logic to prompt optimization. When testing a candidate edit for Factor k, the "control" is the current prompt with all factors unchanged. The "treatment" is the current prompt with Factor k replaced by the candidate. Everything else is held constant. The score difference is the marginal contribution of that candidate edit.
This is what the paper calls "interventional factor-level scoring," and it's a direct application of the logic of controlled experiments to prompt optimization. Without it, you're back to confounded changes where you can't tell what helped.
The Numbers
The researchers tested aPSF on six reasoning benchmarks across two worker models (Qwen2.5-7B-Instruct and Llama-3.1-8B-Instruct) and two architect models (Qwen3-8B and gpt-oss-120b). They compared against OPRO, APE, ProTeGi, GrIPS, ZERA, and CriSPO.
Key results with Qwen2.5-7B as worker and Qwen3-8B as architect:
| Benchmark | aPSF | Best Baseline (CriSPO) | Δ |
|---|---|---|---|
| GSM8K | 90.03% | 89.40% | +0.63 |
| AQUA | 82.50% | 81.48% | +1.02 |
| MultiArith | 99.30% | 98.94% | +0.36 |
| GSM-Hard | 54.77% | 55.94% | -1.17 |
| Average | 81.65% | 81.44% | +0.21 |
With Llama-3.1-8B as worker, the gap widens:
| Benchmark | aPSF | Best Baseline | Δ |
|---|---|---|---|
| GSM8K | 85.62% | 84.15% (ZERA) | +1.47 |
| AQUA | 71.50% | 69.00% (GrIPS) | +2.50 |
| MultiArith | 98.33% | 98.22% (ZERA) | +0.11 |
| GSM-Hard | 35.98% | 34.94% (CriSPO) | +1.04 |
| Average | 72.86% | 71.70% | +1.16 |
The strongest architect (gpt-oss-120b) pushes aPSF to an average of 82.68% on Qwen2.5-7B, a +2.16 percentage point advantage over the best baseline.
The efficiency story is equally compelling. On MultiArith, aPSF reduces token costs by 45-87% compared to baselines. And it reaches peak validation performance in a single optimization step on that benchmark, while baselines need multiple steps to converge.
Ablations: What Makes aPSF Tick?
The paper includes ablation studies that isolate each component's contribution:
Error-guided selection vs. round-robin. When aPSF cycles through factors in fixed order instead of routing to the bottleneck, performance drops. The error-guided routing concentrates the optimization budget where it matters most. When reasoning errors dominate, you fix reasoning. When formatting errors dominate, you fix formatting. This is efficient in the same way that adaptive testing is more efficient than testing everything equally.
Interventional scoring vs. whole-prompt scoring. When candidates are scored at the whole-prompt level instead of measuring marginal contribution per factor, credit assignment becomes noisy. The interventional approach gives a cleaner signal.
Single-factor vs. multi-factor updates. Editing multiple factors simultaneously reintroduces the confounding problem. The whole point of factorization is to isolate changes. Editing multiple factors at once defeats that purpose.
From-scratch vs. initial-prompt mode. Both work. Starting from an existing prompt gives a slight head start, but the from-scratch mode catches up because the Architect discovers the right structure from the task itself.
Architect quality matters. Using a stronger architect (gpt-oss-120b vs. Qwen3-8B) improves results. The architect needs to understand the task deeply enough to decompose it meaningfully and diagnose errors accurately.
What This Means in Practice
Let's get concrete. Here's what aPSF means for different kinds of practitioners.
For prompt engineers. You should be thinking in factors, not monoliths. When you write a prompt, decompose it into semantic sections: task interpretation, reasoning approach, output format, verification, constraints. Label them. When something breaks, diagnose which section broke and edit only that section. You don't need the full aPSF framework to benefit from this mindset—it just automates what you can do manually with better attribution.
For teams running prompt optimization at scale. aPSF offers a concrete, tested, open-source framework. The code is on GitHub. It works with any OpenAI-compatible endpoint. You can use local models via Ollama or vLLM. The two-model architecture (Architect + Worker) adds some complexity, but the cost savings from fewer optimization steps and lower token usage more than compensate.
For anyone building automated prompt pipelines. The factorized approach creates reusable building blocks. Once you have a good Format factor, you can transfer it to different tasks that need the same output format. Once you have a good Verification factor, you can reuse it across domains. This composability is impossible with monolithic prompts.
For researchers. aPSF opens up prompt optimization as a diagnostic tool. The factor-level attribution lets you study which semantic dimensions matter most for different tasks. The error profiles tell you not just that a prompt fails, but why it fails, at a structural level.
Limitations Worth Knowing
aPSF isn't perfect. The authors are transparent about this.
The factorization quality depends on the Architect LLM. A weaker architect produces worse factor structures. The paper shows this clearly: Qwen3-8B as architect gives different results than gpt-oss-120b. The architect needs to understand the task deeply enough to decompose it meaningfully.
The approach requires a well-defined scoring function. This is easy for tasks like math (is the answer correct?) and harder for open-ended generation (is this response helpful?). The paper focuses on reasoning benchmarks where correctness is unambiguous.
The factor schema is fixed after Phase 1. If the initial decomposition misses an important semantic dimension, Phase 2 can only optimize existing factors—it can't add new ones. A natural extension would be allowing the schema to evolve during optimization.
The two-model setup adds architectural complexity. You need both an Architect and a Worker LLM. In production, this means managing two model endpoints, though the cost savings from fewer optimization steps partially offset this overhead.
The Broader Shift: From Strings to Programs
aPSF is part of a broader shift in how we think about prompts. The old model: prompts are strings, you edit them with string operations. The new model: prompts are programs with semantic structure, and optimization should respect that structure.
DSPy was an early articulation of this shift. It treats prompts as modules in a programmatic pipeline and optimizes them within a user-defined scaffold. But DSPy requires you to define the scaffold yourself. aPSF discovers the scaffold automatically.
SAMMO takes a similar approach, optimizing prompts and demonstrations within a user-specified program structure. Again, the structure is provided, not discovered.
CriSPO and ZERA generate structured critiques and principles to guide optimization, but they still operate at the whole-prompt level for candidate selection. aPSF's contribution is making the factorization explicit and persistent—and then using it for interventional, single-factor optimization with error-guided selection.
The key intellectual move is treating prompts as compositional programs where each factor is an independent, optimizable module. This gives you three things that monolithic optimization can't:
- Attribution. You know which change caused which improvement.
- Controllability. You can freeze parts you trust and optimize only what needs work.
- Efficiency. You direct your optimization budget at the bottleneck instead of spraying it across the whole prompt.
The Practical Takeaway
You don't need to implement aPSF from scratch to benefit from its core insight. The framework is available on GitHub, and it's compatible with any OpenAI-compatible API. But even without running the code, the conceptual shift is valuable:
Decompose your prompts. Break them into semantic factors. Label each one. Know what each section does.
Diagnose before you edit. When performance drops, look at the error profile. Is the model getting the reasoning right but the format wrong? Fix the format. Is it misunderstanding the task? Fix the task interpretation.
Edit surgically. Change one factor at a time. Measure the effect. If it helps, keep it. If it hurts, revert it. Don't rewrite the whole prompt when only one section needs work.
Think in factors, not strings. Your prompt is not a text blob. It's a program with semantic structure. Treat it like one.
The research community is converging on this view from multiple directions. aPSF makes it concrete, testable, and reproducible. The paper is clear, the code is open, and the results are strong. If you're serious about prompt optimization, this is the framework to watch.
References
- Liu, H., Wang, Z., Guo, Y., Shou, H., & Tang, X. (2026). Adaptive Prompt Structure Factorization: A Framework for Self-Discovering and Optimizing Compositional Prompt Programs. arXiv:2604.06699. Accepted at ACL 2026.
- Code: https://github.com/luckyboyLiu/aPSF
- Zhou, Y. et al. (2022). Large Language Models Are Human-Level Prompt Engineers (APE). arXiv:2211.01910.
- Yang, C. et al. (2023). Large Language Models as Optimizers (OPRO). arXiv:2309.03409.
- Pryzant, R. et al. (2023). Automatic Prompt Optimization with Gradient Descent and Beam Search (ProTeGi). arXiv:2305.03495.
- Prasad, A. et al. (2023). GrIPS: Gradient-free, Edit-based Instruction Search for Prompting. arXiv:2203.07206.
- He, H. et al. (2025). CriSPO: Multi-Aspect Critique and Revision for Prompt Optimization.
- Yi, J. et al. (2025). ZERA: Zero-Shot Principle-Aware Prompt Optimization.
- Khattab, O. et al. (2024). DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines.
- Schnabel, J. & Neville, J. (2024). SAMMO: A Framework for Prompt Optimization.