Every prompt engineering method that uses few-shot demonstrations has the same problem. The examples come from the training data. You pick the best ones, order them carefully, and hope they generalize. But what if the optimal few-shot example is one that never existed in your dataset? What if the model could generate novel demonstrations that capture semantic patterns humans cannot see?

PRL (Prompts from Reinforcement Learning) does exactly this. A paper from Heinrich Heine University Düsseldorf, submitted to ICLR 2026, shows that an RL-trained prompt generator spontaneously creates synthetic few-shot examples that outperform prompts built from real training data. The method achieves state-of-the-art results across text classification, text simplification, and mathematical reasoning benchmarks, and remains competitive on summarization.

The key insight is simple but striking: the RL training process was never told to use few-shot examples. The model figured that out on its own.

What PRL Does

PRL has three components:

  1. Prompt Generator: A trainable language model that produces prompts. Before generating a prompt, it first outputs a reasoning trace, a rationale about what makes a good prompt for this task. Then it writes the prompt itself.
  1. Evaluation Model: A frozen LLM that takes the generated prompt and runs it against training data. The answers it produces determine the reward signal.
  1. Prompt Selection: During training, the generator periodically produces candidate prompts. These get evaluated on a validation set. The best one wins.

The reward function combines four components. Two reward the generator directly: token usage (did it use the required XML-style delimiters?) and structure (did it follow the reasoning-then-answer format?). Two reward the evaluation model: format (did the output match the expected format?) and alignment (was the answer correct?).

This is straightforward RL training with GRPO (Group Relative Policy Optimization), the same algorithm used to train DeepSeek-R1. What makes PRL unusual is what the model learns to do without being asked.

The Emergent Few-Shot Behavior

Here is the central finding. The researchers gave the prompt generator a base prompt and asked it to refine the prompt for each task. They did not include few-shot examples in the training objective. They did not encourage the model to add demonstrations. The reward function only measured whether the evaluation model got the right answer.

Yet as training progressed, the model started inserting synthetic few-shot examples into its generated prompts. These were not copies of training data. The model generated entirely new input-output pairs. The examples it invented captured subtle semantic patterns that the training data did not explicitly represent.

Table 2 in the paper shows this progression clearly. Early in training, PRL produces a short instruction-style prompt. By later iterations, the prompt includes synthetic few-shot demonstrations with realistic-looking examples that never appeared in the training set.

This behavior emerged consistently across most benchmarks. The model discovered that few-shot prompting works better than instruction-only prompting, and it learned to generate the demonstrations itself rather than selecting from a pool.

This is a meaningful departure from how prior methods handle demonstrations.

How PRL Differs From Selection-Based Methods

The prompt optimization landscape has two main families of methods.

Selection methods (APE, EvoPrompt, PromptAgent, GRACE, APO) search over existing candidates. When they use few-shot examples, they select from training data. APE generates multiple candidate instructions with an LLM and filters by performance. EvoPrompt evolves a population of prompts using genetic operators. PromptAgent iteratively edits prompts based on feedback. All of these operate within the space of what already exists.

Generation methods create new content. PRL is in this family, but it goes further than prior generation approaches. RLPrompt (Deng et al., 2022) also uses RL for prompt generation, but it produces short, often non-interpretable prompts. PRL generates full natural-language prompts with reasoning traces, and it generates novel few-shot examples that were never in the training data.

PromptWizard (Agarwal et al., 2025) is the closest prior method. It can also synthesize novel in-context examples rather than relying solely on training demonstrations. The key difference is that PRL uses RL to learn how to generate these examples through task feedback, while PromptWizard uses iterative critique-and-rewrite cycles.

The practical consequence is important. PRL's generated prompts can capture task-relevant patterns that no human annotator would think to include and no training example would explicitly demonstrate.

Benchmark Results

PRL evaluates across four task families using Qwen2.5-7B-Instruct as both the prompt generator and the evaluation model. All experiments run for 48 hours on two NVIDIA A100 GPUs.

Text Classification (7 datasets)

PRL achieves the highest average accuracy across all seven classification benchmarks: SST-2, CR, MR, SST-5, AG's News, TREC, and SUBJ.

The headline numbers:

  • PRL averages 82.14% across all seven datasets
  • The next best method (GA) averages 81.14%
  • PRL beats APE by 2.58 percentage points on average
  • PRL beats EvoPrompt by 1.00 percentage points on average

On individual datasets, PRL achieves best or second-best results on six out of seven tasks. It hits 96.32% on SST-2, 91.27% on MR, 84.36% on AG's News, and 56.21% on SST-5 (the hardest dataset in the benchmark).

The SST-5 result is worth noting. At 56.21%, PRL substantially outperforms all other methods on this fine-grained five-class sentiment task, where every other method struggles to exceed 55%.

Text Simplification

On the simplification task (measured by SARI score), PRL improves by:

  • +6.93 over APE
  • +6.01 over EvoPrompt

This is the largest relative improvement across all task families. Text simplification requires understanding nuanced linguistic transformations, and PRL's generated few-shot examples appear to capture these transformations better than instruction-only approaches.

Mathematical Reasoning

PRL also demonstrates strong performance on mathematical reasoning tasks. The paper includes results on domain-knowledge and math benchmarks, where the model's ability to generate targeted synthetic examples proves valuable for step-by-step reasoning tasks.

Summarization

On the SAMSum summarization dataset (ROUGE scores), PRL remains competitive but does not achieve the same dominant position as on classification and simplification:

  • +4.32 ROUGE over APE
  • +2.12 ROUGE over EvoPrompt

The researchers note that summarization has inherently more subjective evaluation criteria, which may explain why the gains are more moderate compared to tasks with cleaner correctness signals.

Ablation: Prompt Selection Matters

PRL without prompt selection (PRL -PS) still performs well, averaging 79.50% on classification. But prompt selection, which periodically evaluates candidate prompts on a validation set and keeps the best, lifts PRL to 82.14%. This 2.64 percentage point gap confirms that the selection mechanism contributes real value.

Why Novel Demonstrations Matter

The core finding of PRL is not just that RL-based prompt optimization works. It is that RL discovers something that selection-based methods cannot reach: demonstration examples that do not exist in the training data.

Think about what this means. When you select few-shot examples from training data, you are limited to the distribution of examples that human annotators created. The examples represent what humans think is important. But the model may benefit from examples that highlight edge cases, decision boundaries, or semantic patterns that humans would not naturally write down.

PRL generates examples that are optimized for task performance, not for human interpretability. The paper notes that these generated examples often contain "subtle semantic cues, ones that may elude human perception but are crucial for guiding LLM behavior." A human annotator writing movie review examples for sentiment classification would probably write balanced, clear examples. PRL might generate examples that sit precisely on the decision boundary between positive and negative sentiment, providing the model with exactly the information it needs to make that distinction.

The fact that few-shot prompting emerged spontaneously during RL training is itself a significant finding. It suggests that in-context learning is not just a human-designed technique but something that emerges naturally when a model is optimizing for task performance. The model discovers on its own that providing examples works better than just giving instructions.

Practical Implications

For prompt engineers: PRL offers a path to better prompts that does not require manual example crafting. Instead of spending hours choosing and ordering demonstrations, you can let an RL-trained generator discover optimal examples for your task.

For production teams: The 48-hour training time on two A100s is non-trivial but feasible. The resulting prompts are single, reusable prompts for one LLM call, which means no additional inference cost at deployment time. The prompt is the artifact you ship.

For researchers: The emergent few-shot behavior raises interesting questions. What exactly is the model learning when it generates synthetic examples? Can we interpret these generated examples to understand what patterns matter for different tasks? The paper opens a research direction into analyzing what RL-discovered demonstrations capture that human-selected ones miss.

For the broader field: PRL joins a growing family of RL-based prompt optimization methods, but it is the first to demonstrate that RL can generate novel demonstrations rather than just selecting from training data. This shifts the optimization space from "which existing examples work best?" to "what examples would work best?" That is a fundamentally different question, and PRL shows it is a productive one.

Limitations and Open Questions

The paper acknowledges several limitations:

  • PRL trains a separate prompt generator for each task and dataset. This is not a general-purpose prompt generator. You train it on your specific task.
  • The method requires a frozen evaluation model (Qwen2.5-7B-Instruct in all experiments). The quality of the generated prompt depends on the evaluation model's capabilities.
  • The 48-hour training time on two A100s is a significant compute requirement, though the resulting prompt is reusable at zero additional inference cost.
  • On summarization, PRL is competitive but not dominant. Tasks with subjective evaluation criteria may benefit less from the RL approach.
  • The paper does not compare against multi-module optimization methods like DSPy, MiPRO, or GePA, because those target end-to-end pipeline optimization while PRL targets single-prompt optimization. This is a fair distinction but leaves open the question of how PRL would integrate with pipeline-level approaches.

Getting Started

PRL's code is open source at github.com/Batorskq/prl (13 stars as of this writing). It builds on the ms-swift framework from ModelScope.

To train PRL on the MR dataset:

./scripts/mr/mr_qwen_qwen.sh

For summarization:

./scripts/sum/sum_qwen_qwen.sh

For simplification:

./scripts/sim/sim_qwen_qwen.sh

Benchmark datasets are available from Princeton's LM-BFF collection.

The Bigger Picture

PRL is part of a shift in how we think about prompt optimization. The field has moved through three phases:

  1. Manual crafting: Humans write prompts by hand. Still the most common approach. Limited by human intuition about what examples and instructions matter.
  1. Selection and search: Methods like APE, EvoPrompt, and PromptAgent search over prompt candidates. Better than manual, but constrained to recombining and refining what already exists.
  1. Generative optimization: PRL, PromptWizard, and related methods generate novel prompt content. This opens a fundamentally larger search space.

The emergent few-shot behavior in PRL suggests we are still underestimating what RL can discover in the prompt space. If a model trained only on task performance spontaneously invents few-shot demonstrations that outperform human-selected ones, there may be other prompt strategies that RL can discover that we have not even conceptualized yet.

PRL is not going to replace DSPy or pipeline-level optimization. It operates at a different level. But for single-task prompt optimization, it sets a new benchmark. And the finding that RL can generate novel demonstrations that capture patterns humans miss is worth paying attention to.


Citations:

  • Batorski, P., Kosmala, A., & Swoboda, P. (2025). PRL: Prompts from Reinforcement Learning. arXiv:2505.14412. Under review at ICLR 2026.
  • Code: github.com/Batorskq/prl
  • OpenReview: openreview.net/forum?id=4eYSSSDle6
  • Zhou, Y. et al. (2022). APE: Large Language Models Are Human-Level Prompt Engineers. arXiv:2211.01910.
  • Guo, Q. et al. (2023). EvoPrompt: Connecting LLMs with Evolutionary Algorithms Yields Human-Level Prompt Optimization. arXiv:2309.08532.
  • Pryzant, R. et al. (2023). APO: Automatic Prompt Optimization with Gradient Descent and Beam Search. arXiv:2305.03495.
  • Agarwal, R. et al. (2025). PromptWizard: Task-Aware Prompt Optimization and Generation. Microsoft Research.
  • Shao, Z. et al. (2024). GRPO: Group Relative Policy Optimization. (DeepSeek-R1 training algorithm)

Suggested title: PRL: When Reinforcement Learning Generates Its Own Few-Shot Examples

Word count: ~1,600

Fact-check notes:

  • All benchmark numbers are taken directly from Table 1 in the paper (classification) and the abstract (simplification and summarization). The mathematical reasoning results are referenced in the abstract and Section 4 but specific numbers were not fully visible in the truncated paper text.
  • The emergent few-shot behavior is explicitly stated in the paper's contribution list and demonstrated in Table 2.
  • The 48-hour training time on two A100s is stated in Section 4 of the paper.
  • PromptWizard is the most closely related prior work and is included as a baseline.
  • PRL is distinct from "PRL: Process Reward Learning" (arXiv:2601.10201), which is a different paper about improving LLM reasoning via process reward models.