NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Local Prompt Optimization

Yash Jain, Vishal Chowdhary

Abstract

Automatic Prompt Engineering (APE) typically employs global optimization strategies, treating entire prompts as monolithic blocks for mutation. This approach often fails on complex, "production-grade" prompts where expert-written logic must be preserved and the search space is prohibitively large. We present Local Prompt Optimization (LPO), a modular framework that identifies specific problematic tokens for targeted editing. LPO significantly reduces the optimization search space and improves performance across diverse benchmarks, including a 6% accuracy increase on an 8,000-token production prompt.

Introduction

The performance of Large Language Models (LLMs) is highly contingent on prompt phrasing. While APE frameworks have automated the search for optimal instructions, they generally rely on Global Optimization. This method mutates the entire prompt, which is inefficient for long sequences and can inadvertently destroy critical safety guardrails or expert logic. LPO addresses these issues by focusing the optimization "gradient" on the specific parts of the prompt that contribute to errors.

Methods

LPO introduces a two-stage "Prompt Proposal" process within the standard APE loop. First, an Identification step uses a meta-prompt to analyze failure cases and mark problematic tokens with <edit> tags. Second, a Local Mutation step instructs the optimizer LLM to propose changes only for the tagged tokens, keeping the rest of the prompt static. This approach effectively reduces the search space to a few words rather than the entire prompt vocabulary.

The Local Prompt Optimization (LPO) iterative workflow, highlighting the surgical local optimization step.

Results

Evaluation across mathematical (GSM8k, MultiArith) and general reasoning (BIG-bench Hard) tasks demonstrates that LPO consistently outperforms global methods. Notably, LPO is "plug-and-play," enhancing existing frameworks like APE, APO, and PE2.

Average accuracy gains of Local Optimization over Global Optimization across three different APE frameworks.

In a real-world application involving an 8,000-token production prompt for tool orchestration, LPO achieved a 6% improvement in accuracy, where global methods struggled due to the prompt's complexity. Furthermore, LPO exhibits faster convergence, reaching optimal performance in fewer iterations than global counterparts.

Discussion and Limitations

While LPO offers significant precision and efficiency gains, it currently focuses on English-language prompts. Future work should explore its cross-lingual applicability. Additionally, the high precision of LPO can lead to overfitting on small development sets, necessitating robust search strategies to ensure generalization. Finally, the effectiveness of the identification step currently relies on high-performing models like GPT-4o; the performance of smaller, open-source models in this role remains to be fully explored.

Conclusion

Local Prompt Optimization represents a shift from "black-box" prompt rewriting to a more interpretable and controlled engineering process. By focusing on local edits, LPO enables the optimization of massive production prompts while maintaining the integrity of expert-designed instructions.

Summary updated

BibTeX
@inproceedings{jain2025local,
  author = {Yash Jain and Vishal Chowdhary},
  title = {{Local Prompt Optimization}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.naacl-short.7},
}
Figure