arXiv:2610.19062cs.AIOct 2026

Manuscript Offprint

arXiv:2610.19062

RLPE: Teaching LLMs to Prompt with Reinforcement Learning

Rahul Singhal, Karime Maamari, Pradyumna Tambwekar

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

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.

1 Introduction

General-purpose large language models (LLMs) are adapted to specific tasks largely through prompting [Liu et al., 2023], so finding effective prompts grows more valuable as LLMs take on more tasks. Automated prompt-optimization tools use LLMs to generate and search for high-performing prompts and have shown broad success [Agrawal et al., 2025, Yuksekgonul et al., 2024]. But these tools are bounded by the prompting ability of the models powering them, which remains largely understudied.

Recent work has begun directly training models to write prompts. PRewrite [Kong et al., 2024], PRL [Batorski et al., 2025], and Prompt-MII [Xiao et al., 2025] train models to produce prompts from task descriptions or labeled examples. Trained this way, a model never observes the prompted model's behavior, making it unclear what its prompts should correct. Advisor Models [Asawa et al., 2025] and Prompt-R1 [Liu et al., 2025] train a model that works alongside the prompted model, advising it on each query. Here the trained model does observe the prompted model's behavior, but it must run with the prompted model on every query, adding inference overhead and limiting practical use. Neither captures the process of prompt engineering: inspecting outputs, spotting failure modes, and incorporating the fixes into a reusable prompt.

40th Conference on Neural Information Processing Systems (NeurIPS 2026). Workshop: .

--- baseline prompt

Enigmata

BBEH

PlanBench (plan optimal)

Figure

Figure 1: RLPE writes the strongest prompts on 2/3 benchmarks. Bars = prompt performance (SE bars if performance is averaged); dashed line = baseline prompt performance. RLPE (bolded) leads on Enigmata (0.52 RLPE vs. 0.45 gpt-5.6-sol) and BBEH (0.27 RLPE vs. 0.23 gpt-5.6-sol), and on PlanBench is competitive with every method except claude-opus-5 (0.47 RLPE vs. 0.58 claude-opus-5). One untrained-policy generation on PlanBench failed to parse (scored 0).

We introduce Reinforcement Learned Prompt Engineering (RLPE), which trains a prompt-writing model under conditions that better mirror prompt engineering practice. We train an advisor model to write prompts for a task model, the model performing the task. To write a prompt, the advisor is shown a batch of traces, each with a question the task model attempted, its response, and the response's correctness, exposing precisely how the task model performs. The advisor generates a static prompt used for every question the task model answers, so the advisor never runs per query. During training, we run the task model with each prompt and reward the advisor by the measured performance. RLPE is practical to use. It needs only query access to the task model, so it is compatible with closed-source models (Section 5.3). Also, RLPE training is cheap, requiring modest compute and no reference prompts or LLM judges, since performance alone provides the reward.

We train a 9B-parameter model via Group Relative Policy Optimization (GRPO) [Shao et al., 2024] that writes more performant prompts than state-of-the-art frontier models and prompt optimizers. It surpasses gpt-5.6-sol, claude-opus-5, GEPA, and TextGrad on Enigmata [Chen et al., 2025a] and BIG-Bench Extra Hard (BBEH) [Kazemi et al., 2025], and matches nearly all baselines on PlanBench [Valmeekam et al., 2022] (Figure 1). These prompts are written from scratch, using only traces with no existing prompt to build on. Practitioners more often revise prompts than write new ones [Tafreshipour et al., 2025], so we evaluate iteration as a skill, in which the advisor is given a prompt to revise as well. Although prompt iteration is never directly trained, the capability emerges, with RLPE matching or beating frontier models at revising prompts (Figure 2).

Training for effective prompting is far less useful without transfer beyond the task model and dataset used in training. We test the advisor along these generalization axes. Although trained with one task model, our advisor improves task models six times larger and models from other model families (Figure 4). On JustLogic [Chen et al., 2025b], a fourth, held-out benchmark, the trained model consistently beats the untrained policy and is competitive with frontier models (Table 1). These results suggest the learned prompting ability is general, not narrowly tuned to its training setup.

An overview of our contributions is as follows:

• We introduce Reinforcement Learned Prompt Engineering (RLPE), a training framework that mirrors prompt engineering more faithfully than previous work: an advisor model reads task-model traces, writes a prompt, and is rewarded by how well that prompt performs.

• We train a 9B-parameter advisor model that beats state-of-the-art frontier models (gpt-5.6-sol and claude-opus-5) and prompt-optimizer tools (GEPA and TextGrad) on two out of three benchmarks. This advisor also effectively iterates on prompts, a capability that emerges without direct training and matches or exceeds frontier models.

• We provide evidence that the learned prompting capability generalizes. The trained advisor improves task models six times larger than its training task model, as well as models from entirely different model families. Additionally, all trained advisors beat the untrained policy and match claude-opus-5 on a held-out benchmark not seen during training.