RLPE: Teaching LLMs to Prompt with Reinforcement Learning
cs.AI
Submitted: 2026-10-13
Updated: 2026-10-13
Comments: 25 pages, 6 figures
Code: https://github.com/BytedTsinghua-SIA/Enigmata
License: http://creativecommons.org/licenses/by/4.0/
The gist: Prompting is a widely used method for adapting general-purpose LLMs to domain-specific tasks.
Terminology
Abstract
Prompting is a widely used method for adapting general-purpose LLMs to domain-specific tasks. Effective prompts can be tedious to create manually, so prompt writing is increasingly handed to LLMs, with recent work training LLMs to write prompts for other models. These techniques either write prompts without observing how the task model behaves, blind to the failure modes the prompt should address, or must run alongside the task LLM at inference time, adding overhead to every query. Neither reflects how prompt engineering is often practiced. To close this gap, we introduce Reinforcement Learned Prompt Engineering (RLPE), which trains a model to analyze traces of a separate task model and write a prompt targeting the failures it observes. RLPE rewards the trained model strictly on prompt performance, so it learns the prompting strategies that improve the task model. The prompt is generated once and reused across the task, so inference does not require the trained model. Since RLPE needs only query access to the model it prompts, it is also compatible with closed-source models. We apply RLPE to Enigmata, BIG-Bench Extra Hard, and PlanBench. We train a 9B-parameter model that writes better prompts than state-of-the-art frontier models (gpt-5.6-sol and claude-opus-5) and prompt optimizers (GEPA and TextGrad) on 2/3 benchmarks. Although the model is never explicitly trained to iterate on prompts, this capability emerges at a level that matches or beats frontier models. The learned prompting capability also generalizes, with the trained model improving task models 6x larger than the one it trained with, including ones from entirely different model families, and matching claude-opus-5 on a fourth benchmark held out from training.
Sources
- GEPA: Reflective Prompt Evolution Can Outperform Reinforcement Learning
- How to Train Your Advisor: Steering Black-Box LLMs with Advisor Models
- PRL: Prompts from Reinforcement Learning
- Enigmata: Scaling Logical Reasoning in Large Language Models with Synthetic Verifiable Puzzles
- DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning
- RLPrompt: Optimizing Discrete Text Prompts with Reinforcement Learning
- Gemma 4 Technical Report
- Prompt-R1: Collaborative Automatic Prompting Framework via End-to-end Reinforcement Learning
- gpt-oss-120b & gpt-oss-20b Model Card
- OpenAI GPT-5 System Card
- Training language models to follow instructions with human feedback
- ToolRL: Reward is All Tool Learning Needs
- DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models
- PrefPO: Pairwise Preference Prompt Optimization
- Prompting in the Wild: An Empirical Study of Prompt Evolution in Software Repositories
- PlanBench: An Extensible Benchmark for Evaluating Large Language Models on Planning and Reasoning about Change
- Large Language Models as Optimizers
- Retroformer: Retrospective Large Language Agents with Policy Gradient Optimization
- TextGrad: Automatic "Differentiation" via Text
- Large Language Models Are Human-Level Prompt Engineers
Related papers
- MAVEN-T: Reinforced Heterogeneous Distillation for Real-Time Multi-Agent Trajectory Prediction
- Model Discovery Agent: LLM-assisted Bayesian experiment design for data-efficient discovery of mechanistic world models
- Agents' Last Exam
- The Clinician's Veto: Navigating Trust, Liability, and Uncertainty in Autonomous AI Prescribing
- MindHelper: Closed-Loop Embodied Mental-State Reasoning for Precision Intervention
- Incumbent Advantage: Brand Bias and Cognitive Manipulation Dynamics in LLM Recommendation Systems