You tweak the system message to fix a formatting issue. Suddenly the model stops following constraints. You patch the constraints section. Now the output format is wrong again. Sound familiar?

This is the credit assignment problem in prompt optimization, and until January 2026, nobody had a clean solution for it.

The Problem With Treating Prompts Like Blocks

Most prompt optimization methods treat your prompt as one big blob of text. TextGrad, the best-known approach, works like this: a critic model reads the whole prompt, generates natural-language feedback about what went wrong, and a solver rewrites the whole thing. Simple enough.

The problem is what happens next. When you rewrite an entire prompt based on global feedback, you have no idea which part of the feedback addresses which part of the prompt. The critic says "the model is producing inconsistent outputs and ignoring constraints," and the rewrite touches everything. The system role gets rephrased. The task description shifts. Constraints get reordered. Maybe the output format changes too, even though it was working fine.

This creates two compounding failures.

First, side effects. A fix for the constraints section bleeds into the context section. The critic's feedback about output format accidentally alters the task description. Each optimization round scrambles sections that were already working well.

Second, prompt bloat. Every rewrite cycle adds new text. Old instructions linger. Redundant constraints pile up. The prompt grows longer and more contradictory, making the next round of optimization even harder.

Prith Sharma and Austin Z. Henley at Carnegie Mellon University named these problems and built a solution. They call it Modular Prompt Optimization, or MPO.

What MPO Does Differently

MPO starts from an assumption that most optimization methods ignore: different parts of a prompt do different jobs.

A real prompt has sections. There is a system role that sets the model's persona. A context section that provides background. A task description that says what to do. Constraints that say what not to do. An output format that specifies structure. Each of these sections has a distinct function, and an error in one section does not mean the other sections are broken.

MPO formalizes this by defining a fixed prompt schema with five semantic sections:

  • System Role — who the model should be
  • Relevant Context — background information
  • Task Details — what the model should do
  • Constraints — what the model should not do or limit
  • Output Format — how the model should structure its response

This schema never changes during optimization. MPO does not add new sections, remove sections, or reorder them. It only improves the content within each section.

How Section-Local Textual Gradients Work

Here is the core mechanism. At each optimization round, MPO sends each section to a critic language model separately. The critic sees the section being evaluated and the rest of the prompt for context. It generates a textual gradient for that specific section. A textual gradient is just natural-language feedback describing how to improve that one section.

The math is straightforward. For section k at iteration t:

Δst^(k) = C(st^(k), pt \ st^(k))

The critic C looks at section k and the surrounding context, then produces a delta for section k alone. No other sections get modified by this step.

After generating gradients for all sections, MPO applies each gradient to its corresponding section using textual aggregation. The original section text and the gradient feedback get combined. Then comes a de-duplication step where an LLM removes redundant content and consolidates overlapping instructions within each section.

The updated sections get reassembled into a new prompt. Same schema. Same structure. Better content in each slot.

This loop can repeat for multiple rounds. Each round targets the sections that need improvement while leaving well-performing sections alone.

Why This Solves Credit Assignment

The credit assignment problem is simple to state and hard to solve: when the model produces a bad output, which part of the prompt caused it?

In monolithic approaches like TextGrad, the critic generates one block of feedback for the entire prompt. The solver then rewrites everything. There is no mechanism to say "the constraints section is causing the problem, but the task description and output format are fine."

MPO solves this by construction. Each section gets its own gradient. If the constraints section is producing errors, the critic generates feedback for the constraints section. The system role, context, task description, and output format stay untouched.

This has three practical consequences:

Targeted fixes. You improve only the sections that need improving. Well-performing sections are preserved exactly as they are, rather than being risked to the chaos of a full-prompt rewrite.

No side effects. A fix in the constraints section cannot accidentally break the output format, because the output format section is never touched during that update cycle.

Controlled growth. De-duplication after each round prevents the prompt from accumulating redundant instructions. Each section stays lean and focused.

The aPSF Connection

MPO is not the only approach tackling structured prompt optimization. Adaptive Prompt Structure Factorization, or aPSF, takes a different angle on the same problem set.

aPSF, published in April 2026 by Haoyue Liu and colleagues at the Chinese University of Hong Kong (Shenzhen), focuses on a question MPO leaves open: what if you do not know what the right schema is?

MPO assumes you start with a fixed, practitioner-defined schema with those five sections. aPSF instead uses an "Architect" model to discover task-specific prompt structures automatically. It breaks the prompt into semantic factors that may differ from task to task.

aPSF also introduces interventional scoring. Rather than updating all sections every round, it estimates which factor is causing the most errors and targets that factor for updates. This is more sample-efficient because you spend optimization budget where it matters most.

The two approaches are complementary. MPO shows that section-local optimization beats global optimization when you have a reasonable schema. aPSF shows that you can discover the schema itself and be even more targeted about which sections to update. A combined system could use MPO's de-duplication and consolidation ideas within aPSF's dynamically discovered structure.

Benchmark Results

Sharma and Henley evaluated MPO on two reasoning benchmarks: ARC-Challenge and MMLU. They used two open-source instruction-tuned solver models: LLaMA-3 8B-Instruct and Mistral-7B-Instruct.

They compared against two baselines:

  • An untuned structured prompt using the same five-section schema, but with no optimization
  • TextGrad, which optimizes the entire prompt as a monolithic block

The results are clear and consistent.

ARC-Challenge: MPO outperforms both baselines across both models. LLaMA-3 8B-Instruct and Mistral-7B-Instruct both show accuracy gains with MPO over the untuned prompt, and both outperform TextGrad by a wider margin.

MMLU: The story is the same on MMLU, with one notable finding. TextGrad actually degrades performance compared to the untuned baseline on MMLU. When you apply global feedback to the entire prompt, the rewrite hurts more than it helps on this benchmark. MPO, by contrast, yields stable gains.

This pattern tells you something important. The problem with monolithic optimization is not that the feedback is bad. It is that applying good feedback to the wrong sections causes damage. MPO's section-local approach avoids this by keeping the scope of each update tight.

The gains come without modifying model parameters or changing the prompt structure. The schema stays fixed. The model stays the same. Only the content within each section improves.

Practical Implications

MPO has several takeaways for anyone working with language models in production.

Structure your prompts. The five-section schema is not just an optimization trick. It is a good practice on its own. Separating system role, context, task details, constraints, and output format makes prompts easier to read, debug, and maintain. MPO gives you an algorithmic reason to do something you should already be doing.

Optimize locally, not globally. When your prompt is structured, optimize section by section. If you are manually iterating on a prompt, change one section at a time and evaluate. If you are building an automated optimizer, follow MPO's approach and generate section-specific feedback rather than whole-prompt feedback.

De-duplicate aggressively. Prompt bloat is real. Every optimization round can add instructions that overlap with existing ones. An explicit de-duplication step keeps each section focused and prevents contradictions from accumulating.

Watch out for TextGrad on complex tasks. The MMLU result where TextGrad hurts performance is a cautionary tale. If your prompt has multiple functional sections, global rewrites can break things. Section-local optimization is safer for any prompt with real structure.

Consider your critic model. MPO uses a separate critic model to generate section-local gradients. The paper uses GPT-4o as the critic with the smaller open-source models as solvers. This means you can use a strong proprietary model for optimization while deploying a cheaper open-source model for inference. The optimization cost is one-time. The inference savings are ongoing.

Schema design matters. MPO assumes a fixed schema, and the results depend on having a reasonable one. If your schema misses important sections or combines functions that should be separated, section-local optimization will help less. Spend time getting your schema right before you optimize.

Where This Goes Next

The authors outline several directions for future work.

Using stronger open-source models as critics is an obvious next step. The current setup uses GPT-4o as the critic, which is effective but costly. If a smaller open-source model can generate useful section-local gradients, the whole pipeline becomes more accessible.

Prompt safety and robustness is another direction. MPO's structured approach gives you a natural framework for studying how section-local updates interact with safety constraints. If you have a system role designed to prevent jailbreaks, does MPO preserve those protections during optimization? Does it amplify them? These are open questions.

The aPSF work suggests a third direction: instead of assuming a fixed schema, discover the optimal structure for each task. A system that combines MPO's section-local optimization with aPSF's automatic structure discovery would be more flexible and potentially more effective.

Finally, evaluating MPO on a broader range of tasks beyond reasoning benchmarks would show how general the approach is. Code generation, creative writing, multi-step planning, and tool use all involve structured prompts. Section-local optimization should help there too, but the evidence is not yet in.

The Bigger Picture

Prompt engineering has been mostly manual and ad hoc. When something goes wrong, you stare at the whole prompt, make a guess about what to change, and hope for the best. TextGrad and similar methods automated this, but they automated the guessing part, not the diagnosing part.

MPO brings diagnosis into the loop. By decomposing the prompt into sections and evaluating each one independently, you get targeted feedback about what is actually broken. The optimization becomes more like debugging and less like throwing darts.

For small open-source models that depend heavily on clear, well-structured prompts, this matters a lot. These models do not have the parameter space to compensate for vague or contradictory instructions. Every section needs to be sharp. MPO gives you a principled way to sharpen each section without dulling the others.

The paper is Modular Prompt Optimization: Optimizing Structured Prompts with Section-Local Textual Gradients by Prith Sharma and Austin Z. Henley, Carnegie Mellon University, January 2026.


Citations

  • Sharma, P. & Henley, A.Z. (2026). Modular Prompt Optimization: Optimizing Structured Prompts with Section-Local Textual Gradients. arXiv:2601.04055. https://arxiv.org/abs/2601.04055
  • Yuksekgonul, M. et al. (2024). TextGrad: Automatic "Differentiation" via Text. arXiv:2406.07496. https://arxiv.org/abs/2406.07496
  • Liu, H. et al. (2026). Adaptive Prompt Structure Factorization: A Framework for Self-Discovering and Optimizing Compositional Prompt Programs. arXiv:2604.06699. https://arxiv.org/abs/2604.06699
  • OpenAI (2025). GPT-4 Prompt Engineering Guidelines. Referenced in paper as citation [19].
  • Anthropic (2025). Claude Prompt Engineering Guidelines. Referenced in paper as citation [2].

Suggested Title

Stop Rewriting the Whole Prompt: How Section-Local Gradients Fix Prompt Optimization

Word Count

1,748

Fact-Check Notes

  • Specific accuracy numbers for ARC-Challenge and MMLU: The HTML version of the paper does not render the result tables cleanly. The paper states MPO "consistently outperforms" both baselines and that TextGrad degrades performance on MMLU, but I was unable to extract the exact percentage numbers from the available versions. The paper's Figure 2 contains a chart showing these results visually. Before publishing, confirm the specific accuracy percentages from the PDF tables.
  • aPSF relationship: The task brief mentions that MPO "pairs with" aPSF. The two papers are from different research groups and are not formally connected. aPSF (April 2026) builds on similar ideas of structured prompt optimization but adds automatic schema discovery and interventional factor scoring. I described them as complementary rather than paired, which is accurate. Confirm with Brian if a different framing is intended.
  • Critic model: The paper references GPT-4o as the critic model in its evaluation setup, but I did not find this explicitly stated in the abstract or methodology sections I accessed. The paper may specify the critic in its experimental details section. Confirm before publishing.
  • Five-section schema: The schema (System Role, Relevant Context, Task Details, Constraints, Output Format) is explicitly described in the paper. This is confirmed.