Your prompt is a mess. You know it. I know it. Everyone who has stared at a 2,000-word system prompt knows it.

You've got task instructions, reasoning steps, output format requirements, tone guidance, verification rules, and edge-case handling all jammed into one bloated text block. When something goes wrong, you have no idea which part broke. When you fix one thing, you break another. And every time you tweak the format section, the reasoning section decides to hallucinate.

A new research paper from CUHK-Shenzhen and Taobao & Tmall Group, accepted at ACL 2026, proposes a solution. It's called Adaptive Prompt Structure Factorization, or aPSF. The idea is simple: stop treating your prompt like a monolith. Break it into semantic factors. Optimize each one independently. Assemble them back together.

The results speak for themselves. aPSF improves accuracy by up to +2.16 percentage points on average across benchmarks. It cuts token costs by 45 to 87 percent on MultiArith. And it reaches peak validation performance in a single optimization step on some tasks.

Let me explain how it works and why it matters.

The Problem With Monolithic Prompts

Most prompt optimization tools treat your prompt as one indivisible string. They propose changes, test them, and keep whatever scores highest. This sounds reasonable. It breaks down fast.

Three problems emerge.

Coupled edits obscure credit assignment. When you change a whole prompt at once, you have no idea which change helped. Did the new reasoning instruction help, or was it the format tweak? You can't tell. The signal is confounded.

Weak controllability. You can't freeze parts of your prompt. If your output schema is perfect but your reasoning instructions need work, too bad. The optimizer might break the schema while fixing the reasoning.

Wasted queries. Because a single mutation often perturbs multiple functional roles at once, many candidate prompts get rejected for reasons unrelated to the actual improvement. The search space is huge and unstructured.

Existing tools like APE and OPRO treat the whole prompt as a single string. Newer tools like ProTeGi and GrIPS apply more localized edits, but they still select candidates at the whole-prompt level. Even recent principle-aware methods like CriSPO and ZERA generate structured critiques to guide refinement, but their optimization still proposes and selects whole-prompt candidates. The credit assignment problem remains.

aPSF takes a different approach entirely.

How aPSF Works

aPSF has two phases. Phase 1 discovers the structure. Phase 2 optimizes it.

Phase 1: Adaptive Structure Discovery

An "Architect" LLM analyzes your task and decomposes the prompt into semantic factors. These factors are task-specific, not some fixed template. For a math task, the factors might be Task Interpretation, Reasoning Procedure, Output Format, and Verification. For a logic puzzle, they might be different entirely.

The key insight: aPSF does not commit to a predefined taxonomy. The Architect LLM discovers the factor structure from the task itself. This is what makes it adaptive.

You can start from scratch or from an existing prompt. In from-scratch mode, the Architect looks at the task description and sample examples, then proposes both the factor schema (what roles exist and in what order) and the initial content for each factor. In initial-prompt mode, you hand it something like "Let's think step by step" and it analyzes the core reasoning approach, extends it into a full task-specific instruction, and decomposes that into factors.

The output is an ordered list of factor texts. The final prompt is just these factors concatenated together with newlines between them. Simple assembly.

Phase 2: Interventional Factor Optimization

This is where aPSF shines. Instead of editing the whole prompt, it edits one factor at a time while freezing all the others.

Here's the process:

  1. The "Worker" LLM runs the assembled prompt on validation examples and produces answers.
  2. An evaluator scores the answers and identifies representative failure cases.
  3. The Architect LLM diagnoses the failures and produces an error profile.
  4. Based on the error profile, the Architect selects the bottleneck factor, the one most responsible for current failures.
  5. The Architect proposes candidate edits for just that one factor.
  6. Each candidate is tested by swapping it into the assembled prompt while keeping all other factors frozen.
  7. The best candidate is accepted if it improves the validation score.

This is coordinate-style optimization applied to prompts. Edit one dimension. Hold the rest constant. Measure the marginal contribution. Accept or reject.

The error-guided factor selection is what makes this efficient. If the model is getting the math right but formatting the answers wrong, aPSF routes the optimization budget to the Format factor. If reasoning is the problem, it targets the Reasoning factor. The budget follows the bottleneck.

If the same factor keeps getting selected without improvement, the Architect explores other factors to avoid local optima. And if the validation score hits 1.0 (perfect accuracy), optimization stops early.

The Numbers

The researchers tested aPSF on six reasoning benchmarks with 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.

On Qwen2.5-7B with Qwen3-8B as architect:

  • GSM8K: aPSF hit 90.03% vs. CriSPO's 89.40% and ZERA's 89.98%
  • AQUA: aPSF scored 82.50% vs. CriSPO's 81.48% and APE's 81.50%
  • MultiArith: aPSF reached 99.30% vs. CriSPO's 98.94% and ZERA's 99.59%
  • GSM-Hard: aPSF got 54.77% vs. CriSPO's 55.94% (the one benchmark where CriSPO edged ahead)

The average across all four datasets: 81.65% for aPSF vs. 81.44% for CriSPO. That's a +0.21 point advantage.

On Llama-3.1-8B with the same architect, aPSF averaged 72.86% vs. CriSPO's 71.70%. That's a +1.16 point advantage.

With gpt-oss-120b as architect, aPSF averaged 82.68% on Qwen2.5-7B across the four benchmarks. That's +2.16 percentage points over the next best baseline.

The cost savings are dramatic. On MultiArith, aPSF reduced optimization token cost by 45 to 87 percent compared to baselines. And it reached peak validation performance in just one optimization step. Baselines needed multiple steps to converge.

The researchers also tested on BIG-Bench Hard (27 tasks), MMLU (57 subjects), and GPQA. aPSF maintained consistent advantages across these larger evaluation suites.

Ablations: What Actually Matters

The paper includes thorough ablation studies that isolate the contribution of each component.

Error-guided factor selection vs. round-robin. When aPSF cycles through factors in order instead of routing to the bottleneck, performance drops. The error-guided routing is doing real work. It concentrates the optimization budget where it matters most.

Interventional scoring vs. whole-prompt scoring. When aPSF scores candidates at the whole-prompt level instead of measuring marginal contribution per factor, credit assignment becomes noisy. The interventional approach, where you swap one factor and hold the rest constant, gives a cleaner signal.

Single-factor vs. multi-factor updates. Editing multiple factors simultaneously reintroduces the confounding problem. Single-factor edits with frozen context give more precise, attributable improvements.

From-scratch vs. initial-prompt mode. Both modes work well. Starting from an existing prompt like "Let's think step by step" gives a slight head start, but the from-scratch mode catches up quickly because the Architect discovers the right structure from the task itself.

Why This Matters

aPSF matters for three reasons.

First, it makes prompt optimization interpretable. When aPSF improves accuracy by 2 points, you can trace exactly which factor change caused the improvement. The paper's execution traces show this clearly. Factor 3 (Rationale) was updated at step 2 because reasoning errors dominated the failure profile. The update improved the score by 1.5 points. You can see the cause and effect. This is a big deal for anyone who needs to understand and trust their prompt engineering process.

Second, it makes prompts composable and reusable. Once you have a factorized prompt, you can swap individual factors between tasks. Need the same output format for a different reasoning task? Reuse the Format factor. The decomposition creates reusable building blocks, not disposable one-shot prompts.

Third, it cuts costs. The 45-87% token reduction on MultiArith is not a rounding error. In production settings where you're running prompt optimization at scale, this translates directly to API dollars saved. Reaching peak performance in one step instead of five or ten is a massive efficiency gain.

The Bigger Picture

aPSF sits at an interesting intersection in the prompt engineering world.

On one side, you have manual prompt engineering. Humans write prompts, test them, tweak them, and iterate. This works but doesn't scale. On the other side, you have automated prompt optimizers that treat the whole prompt as a black box. These scale but sacrifice interpretability and controllability.

aPSF bridges the gap. It automates the optimization but preserves the structure that humans care about. You can still read the individual factors. You can still freeze the parts you trust. You can still trace which change caused which improvement.

The paper explicitly positions aPSF against DSPy and SAMMO, two programmatic prompting frameworks. Those tools require the user to define the program scaffold. aPSF discovers the scaffold automatically. This is a meaningful difference. Not everyone wants to hand-craft a prompt program structure before they can start optimizing.

The comparison to principle-aware methods like CriSPO and ZERA is also instructive. Those methods generate structured critiques or evolving principles, but the optimization still operates at the whole-prompt level. aPSF's explicit factorization with interventional single-factor updates gives it both better attribution and better controllability.

Limitations and Open Questions

aPSF is not perfect.

The factorization quality depends on the Architect LLM. A weaker architect produces worse factor structures. The paper shows this clearly: using Qwen3-8B as architect gives different results than using gpt-oss-120b. The architect needs to understand the task deeply enough to decompose it meaningfully.

The approach also adds architectural complexity. You need two LLMs (Architect and Worker) instead of one. The Architect generates factor schemas, diagnoses errors, and proposes candidate edits. The Worker executes the assembled prompt on actual tasks. This two-model setup is more complex than a single-model optimizer, though the cost savings from fewer optimization steps partially offset this.

The factor schema is fixed after Phase 1. If the initial decomposition misses an important semantic dimension, Phase 2 can't add new factors. It can only optimize the existing ones. A natural extension would be allowing the schema to evolve during optimization, inserting or merging factors as needed.

The paper focuses on reasoning benchmarks (math, logic, knowledge QA). It remains to be seen how well aPSF works on open-ended generation tasks where validation scoring is less clear-cut. The approach relies on having a well-defined scoring function, which is easy for "is this answer correct?" and harder for "is this response helpful?"

What This Means for Prompt Engineering

If you're building with LLMs today, aPSF suggests a shift in how you think about prompts.

Stop writing one big prompt. Start thinking in factors. What are the semantic dimensions of your task? What parts serve different functions? Which parts are stable and which need iteration?

You don't need to run the full aPSF framework to benefit from this mindset. Simply decomposing your prompt into labeled sections (Task, Reasoning, Format, Verification) and editing them independently gets you most of the conceptual benefit. The framework automates what you can do manually, and it does it with better attribution and efficiency.

For teams running prompt optimization at scale, aPSF offers a concrete, tested, open-source framework. The code is available on GitHub. It works with any OpenAI-compatible endpoint. You can use local models via Ollama or vLLM. The setup is straightforward.

The deeper lesson is about composability. Prompts are not strings. They are programs with semantic structure. When we treat them as programs, we get better optimization, better interpretability, and better reuse. aPSF makes this concrete.

The next time you're staring at a 2,000-word system prompt trying to figure out which part broke, remember: you don't have one problem. You have several problems hiding in one prompt. Break them apart.


Citations

  • 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. https://arxiv.org/abs/2604.06699
  • Code repository: 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 (GrIPS). 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.

Suggested Title

Stop Writing One Giant Prompt. aPSF Breaks Them Into Pieces and Builds Them Back Better.

Word Count

~1,550 words (body text)

Fact-Check Notes

  • The +2.16 percentage point average improvement comes from the abstract and is confirmed in the gpt-oss-120b architect results table. Verify this number against the final published ACL version, as preprint numbers sometimes change.
  • The 45-87% token cost reduction on MultiArith comes from the abstract. The paper's cost analysis section should be checked for the exact comparison baseline (which optimizer is the reference point for the percentage reduction).
  • The benchmark numbers (90.03% on GSM8K, etc.) are taken from the arXiv preprint tables. These should match the final published version.
  • The claim that aPSF reaches peak validation in 1 step on MultiArith comes from the abstract. The paper's convergence plots in the appendix should be checked for the exact step count across different runs.
  • The paper's ACL 2026 acceptance is stated on the GitHub repo but should be confirmed against the official ACL 2026 proceedings when available.
  • The comparison between aPSF and DSPy/SAMMO is based on the paper's Related Work section. The characterization of DSPy as requiring "user-specified program scaffold" is from the paper's framing and should be read as the authors' interpretation, not an objective claim about DSPy's capabilities.