GPS: General Per-Sample Prompter

Pawel Batorski, Paul Swoboda · DOI

Abstract

Prompt engineering remains a significant bottleneck in the deployment of Large Language Models (LLMs), often requiring extensive manual effort or task-specific optimization. We present GPS (General Per-Sample Prompter), a novel framework that automates the generation of optimized, input-specific instructions without requiring task-specific retraining. By leveraging reinforcement learning on a diverse suite of reasoning tasks, GPS learns a transferable meta-skill for prompting. Our results demonstrate that GPS achieves state-of-the-art performance on GSM8K and generalizes effectively to unseen tasks such as summarization and classification, outperforming traditional task-level optimization methods.

Introduction

The performance of Large Language Models is notoriously sensitive to the specific phrasing of prompts. While techniques like Chain-of-Thought (CoT) and Automatic Prompt Engineering (APE) have improved model outputs, they typically rely on a "one-size-fits-all" approach—generating a single static prompt for an entire dataset. However, the optimal instruction for a complex mathematical problem may differ significantly from that of a simple one.

GPS (General Per-Sample Prompter) addresses this by generating a unique, tailored prompt for every individual input. Unlike previous methods that are tied to specific tasks, GPS is designed as a general-purpose tool that can be applied zero-shot to new domains.

The Landscape of Prompt Engineering

Current automatic prompt engineering methods face three primary challenges: task specificity, high data requirements, and a lack of granularity. Most APE tools require thousands of labeled examples and must be re-run from scratch whenever the task changes. Furthermore, they fail to account for the varying complexity within a single dataset.

GPS occupies a unique position as a general-purpose method that incorporates refinement for per-sample optimization.

As shown in the figure above, GPS distinguishes itself from existing methods like Manual Prompting or APE by providing a refined, general-purpose solution that adapts to the specific nuances of each input sample.

The GPS Framework

The GPS architecture consists of a trainable Prompt Generator and a frozen Evaluator Model. The generator is trained to produce instructions that maximize the evaluator's performance on a given task.

Training via Reinforcement Learning

GPS is trained using Group Relative Policy Optimization (GRPO). During training, the generator samples multiple candidate prompts for a single input. These prompts are passed to the Evaluator, and the generator is rewarded based on the accuracy of the Evaluator's final answer. This process allows the model to learn which instructional strategies are most effective for different types of problems.

Regularization and Stability

To ensure the generator learns meaningful instructions rather than simply "leaking" answers, the authors implemented two key regularization techniques:

  1. The Judge Regularizer: A secondary LLM acts as a "judge," penalizing the generator if the generated prompt contains the ground-truth answer.
  2. Sample-Based Regularization: The model is occasionally evaluated using a prompt generated for a different input, encouraging the development of generalizable instructional logic.

At inference time, GPS employs Minimum Bayes Risk (MBR) decoding, selecting the prompt that leads to the highest consensus among multiple evaluator outputs, thereby increasing the stability of the system.

Experimental Setup and Results

The researchers trained GPS on a high-reasoning curriculum including mathematics (GSM8K), logic (CommonSenseQA), and programming (MBPP). To test its generalization capabilities, the model was evaluated zero-shot on entirely different tasks: dialogue summarization (SAMSum), sentence simplification (ASSET), and various classification benchmarks.

Performance and Scaling

GPS achieved a new state-of-the-art score of 87.55% on GSM8K for in-domain prompting. More impressively, it showed strong zero-shot performance on text-based tasks. On the ASSET simplification dataset, GPS-J (the version with the Judge regularizer) achieved the second-best results among all baselines, despite those baselines being task-specific.

The performance benefit of GPS increases as the size of the Evaluator model scales, unlocking latent capabilities in larger models.

A critical finding is the relationship between the prompter and the evaluator's scale. As illustrated in the chart above, the accuracy gains provided by GPS (GPS-J and GPS-SR) become more pronounced as the Evaluator model size increases from 7B to 72B parameters. This suggests that sophisticated per-sample prompting is particularly effective at "unlocking" the latent reasoning capabilities of larger LLMs.

Discussion and Future Work

GPS demonstrates that "how to prompt" is a transferable meta-skill. A model trained on math and code can effectively prompt for summarization, indicating that the underlying logic of clear instruction is universal across domains.

However, the method does introduce higher inference costs due to the multi-sample MBR decoding process. Future research will focus on reducing this overhead and exploring "few-shot" GPS, where the prompter is provided with a small number of task-specific examples at runtime to further refine its output.

By moving away from static instructions toward dynamic, per-sample adaptation, GPS represents a significant step toward more robust and autonomous AI systems.

Summary updated

BibTeX
@misc{batorski2025gps,
  author = {Pawel Batorski and Paul Swoboda},
  title = {{GPS: General Per-Sample Prompter}},
  year = {2025},
  eprint = {2511.21714},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.21714},
}
Figure