Prompt-R1: Collaborative Automatic Prompting Framework via End-to-end Reinforcement Learning

Wenjin Liu, Haoran Luo, Xueyuan Lin, Haoming Liu, Tiesunlong Shen, Jiapu Wang, Rui Mao, Erik Cambria

TL;DR

Prompt-R1 introduces an end-to-end reinforcement learning framework that trains a small-scale LLM to act as an autonomous prompt agent for large-scale LLMs. By treating the large LLM as an interactive environment, Prompt-R1 optimizes multi-turn prompt generation using a novel double-constrained reward system, eliminating the need for manual prompt engineering or expensive large-model fine-tuning.

An example of a Prompt-R1 agent working with a large-scale LLM

What Problem Does This Paper Address?

While large language models (LLMs) excel at complex reasoning, extracting their full potential requires highly precise and context-aware prompts. Most human users struggle to craft these effective prompts, especially for deep reasoning or multi-turn interactions.

To bypass this, researchers typically resort to two approaches: fine-tuning the large models (which is computationally prohibitive) or using automatic prompt optimization (APO) techniques. However, existing APO methods are often static, rely on cumbersome API-dependent layers, or lack the ability to dynamically adapt prompts across multi-turn conversations. Prompt-R1 addresses these limitations by establishing a resource-efficient, plug-and-play collaboration paradigm between small and large LLMs.

Comparison of Prompt-R1 against traditional interaction and optimization paradigms

Methods

The core architecture of Prompt-R1 frames prompt optimization as a multi-turn reinforcement learning problem:

  1. Agent-Environment Interaction: A small-scale LLM acts as the Agent ($S$), and a large-scale LLM acts as the Environment ($L$). Using a ReAct-based template, the agent iteratively generates internal reasoning (<think>) and an interaction prompt (<interaction_prompt>), which is passed to the large LLM environment.
  2. Double-Constrained Reward: To prevent the agent from generating unparseable or low-quality prompts (reward hacking), the authors designed a gated reward function. The final correctness reward ($R_{ans}$, measured via token-level F1) is only credited if the agent strictly satisfies formatting constraints ($R_{fmt}$), such as non-emptiness and structural completeness.
  3. Group Relative Policy Optimization (GRPO): Prompt-R1 employs GRPO to update the agent's policy. GRPO optimizes the model by comparing a group of sampled trajectories, normalizing rewards within the group to stabilize training without requiring a separate, memory-heavy critic model.
An overview of the Prompt-R1 framework

Datasets

The framework was evaluated across 12 public datasets covering four distinct tasks:

  • Multi-hop Reasoning: 2WikiMultihopQA, HotpotQA
  • Mathematical Computation: GSM8K, DAPO Math 17K
  • Standard QA: MusiQue, PopQA
  • Text Generation: BookSum, WritingPrompts (W.P.)

To evaluate out-of-distribution (OOD) generalization, the authors tested the trained agent on four unseen datasets: MathQA, SQuAD v2, TriviaQA, and XSum.

Key Insights and Ideas

  • Asymmetric Collaboration: A small model doesn't need to possess deep reasoning capabilities itself; it only needs to learn how to effectively steer a larger, more capable model through strategic questioning.
  • Gated Rewards Stabilize RL: Coupling format compliance with answer correctness ensures that the agent learns to maintain structural discipline throughout multi-turn reasoning, preventing performance collapse.
  • Cross-Model Transferability: An agent trained on one specific large LLM environment can successfully generalize to guide entirely different, unseen large LLMs (e.g., transferring from an open-source model to GPT-5 or DeepSeek-V3) without any additional training.

Key Results

Prompt-R1 consistently outperformed standard baselines (including Chain-of-Thought and state-of-the-art APO methods like OPRO and TextGrad) across all tasks.

  • Performance Gains: Compared to the baseline GPT-4o-mini, Prompt-R1 achieved an average absolute improvement of +9.12% in Exact Match (EM), +8.09% in F1 score, and +3.55% in Semantic Similarity (SSim).
  • OOD Generalization: On out-of-distribution datasets, the framework significantly boosted the performance of six diverse large LLMs, showing the most pronounced gains on models with weaker baselines.
Comparison of the average values of EM, F1, and SSim scores on OOD datasets
  • Zero-Cost Training Efficiency: Training the agent using a locally deployed, open-source model (GPT-OSS-20B) as the environment yielded performance competitive with training via commercial APIs (GPT-4o-mini), offering a highly cost-effective deployment strategy.

Limitations and Future Work

The authors note that Prompt-R1 relies heavily on historical context. If the agent introduces errors or ambiguities in the early turns of a conversation, these errors propagate rapidly, compromising the final output. Additionally, multi-turn interactions naturally incur higher token overhead and latency.

Future work will focus on:

  • Implementing context compression and selective summarization to reduce computational overhead.
  • Refining the RL reward mechanisms to incorporate more diverse feedback.
  • Exploring advanced memory mechanisms to better handle long-range dependencies in complex, multi-turn reasoning.

Summary updated

BibTeX
@inproceedings{liu2026prompt,
  author = {Wenjin Liu and Haoran Luo and Xueyuan Lin and Haoming Liu and Tiesunlong Shen and Jiapu Wang and Rui Mao and Erik Cambria},
  title = {{Prompt-R1: Collaborative Automatic Prompting Framework via End-to-end Reinforcement Learning}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2026},
  doi = {10.18653/v1/2026.findings-acl.799},
}
Figure