TRPrompt: Bootstrapping Query-Aware Prompt Optimization from Textual Rewards

Andreea Nica, Ivan Zakazov, Nicolas Mario Baldwin, Saibo Geng, Robert WestarXiv 2025 · OpenReview

Abstract

Prompt optimization improves the reasoning abilities of large language models (LLMs) without requiring parameter updates to the target model. Following heuristic-based "Think step by step" approaches, the field has evolved in two main directions: while one group of methods uses textual feedback to elicit improved prompts from general-purpose LLMs in a training-free way, a concurrent line of research relies on numerical rewards to train a special prompt model, tailored for providing optimal prompts to the target model. In this paper, we introduce the Textual Reward Prompt framework (TRPrompt), which unifies these approaches by directly incorporating textual feedback into training of the prompt model. Our framework does not require prior dataset collection and is being iteratively improved with the feedback on the generated prompts. When coupled with the capacity of an LLM to internalize the notion of what a "good" prompt is, the high-resolution signal provided by the textual rewards allows us to train a prompt model yielding state-of-the-art query-specific prompts for the problems from the challenging math datasets GSMHard and MATH.

Introduction

The performance of Large Language Models (LLMs) on complex reasoning tasks, particularly in mathematics, is highly sensitive to the provided prompt. While "Chain-of-Thought" prompting has become a standard, finding the optimal prompt for a specific query remains a challenge. Existing methods generally fall into two categories: train-free iterative refinement using LLM feedback, and trainable methods using numerical rewards.

The authors identify a significant limitation in numerical rewards: they are often "sparse and uninformative." A binary reward (0 or 1) fails to explain why a model failed. TRPrompt addresses this by leveraging textual rewards—natural language critiques—to provide a high-resolution learning signal. This allows a dedicated prompt model to learn specific strategies for guiding a target LLM toward correct solutions.

Methodology: The TRPrompt Framework

TRPrompt utilizes an iterative, three-step bootstrapping pipeline to train a prompt model without requiring pre-existing human-annotated datasets.

The TRPrompt framework's iterative bootstrapping pipeline, consisting of synthetic data creation, supervised fine-tuning, and optimal reward search.
  1. Synthetic Dataset Creation: For a given query, the system generates a prompt. A Target LLM attempts the problem, and a Reward Model (another LLM) compares the output to the ground truth to generate a detailed textual reward (e.g., "The prompt should encourage considering all given information").
  2. Prompt Model Fine-Tuning: A Llama-3-8B model is fine-tuned using Supervised Fine-Tuning (SFT) with LoRA. It learns to map the combination of a Question and an Optimal Textual Reward to the generated Prompt.
  3. Optimal Reward Search: To identify the most effective feedback signal, the researchers employ Textgrad, treating text as a gradient to iteratively search for the feedback strings that maximize performance across the dataset.

Experimental Evaluation

The framework was evaluated on three challenging mathematical reasoning benchmarks: GSM8K (grade-school math), GSMHard (complex numerical variations), and MATH (competition-level problems).

Key Results and Performance

TRPrompt achieved state-of-the-art (SOTA) performance on the most difficult datasets, outperforming existing methods like QPO and Prompt-OIRL. Specifically, it demonstrated a +1% gain on GSMHard and a +2% gain on MATH over previous SOTA benchmarks.

Performance improvement over iterations in arithmetic reasoning tasks and an example of iterative prompt refinement for a word problem.

The prompt model showed significant self-improvement through its iterative training. As shown in the performance delta graph, accuracy on the GSMHard dataset improved by over 7.5% (from 24.21% to 31.76%) over four iterations. Notably, the model demonstrated strong generalization; a model trained on GSMHard outperformed baselines when tested on the MATH dataset, indicating it had internalized generalizable reasoning-guiding skills.

Discussion and Conclusion

A key insight from this research is that text is a superior teacher to numbers. By training on multidimensional critiques rather than binary scores, the model learns specific problem-solving strategies. Furthermore, TRPrompt's query-aware nature allows it to generate instructions tailored to the nuances of individual problems, moving beyond "one-size-fits-all" prompts.

However, the approach has limitations. The "Optimal Reward Search" phase is computationally expensive, accounting for roughly 70% of training time. Additionally, the method is less effective on easier tasks (like GSM8K) where a lack of "failure examples" limits the negative supervision available for refinement. Future work may extend this framework to other domains where numerical rewards are difficult to define, such as creative writing or coding.

Summary updated

BibTeX
@misc{nica2025trprompt,
  author = {Andreea Nica and Ivan Zakazov and Nicolas Mario Baldwin and Saibo Geng and Robert West},
  title = {{TRPrompt: Bootstrapping Query-Aware Prompt Optimization from Textual Rewards}},
  year = {2025},
  eprint = {2507.18618},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.18618},
}
Figure