Abstract
Automating prompt engineering for generative tasks—such as creative writing or domain-specific query generation—is challenging because standard metrics like accuracy are often inapplicable. While human feedback provides the most reliable evaluation, it is too expensive for iterative optimization loops. This paper introduces PLHF (Prompt Learning with Human Feedback), a duo-module framework that bridges this gap. By optimizing a specialized "Evaluator" LLM on a small set of human-scored examples, PLHF creates a high-fidelity proxy for human judgment. This proxy then automates the optimization of the primary "Responder" LLM. Experimental results across four diverse datasets show that PLHF consistently outperforms generic LLM judges, achieving significant gains in tasks like industrial SQL-QA and automated essay scoring.
Introduction: The Challenge of Generative Evaluation
The rapid evolution of Large Language Models (LLMs) has spurred interest in automated prompt engineering. Frameworks like DSPy and TextGrad have shown success in optimizing prompts for classification or extraction tasks where metrics like "Accuracy" or "F1-score" are easily defined. However, for generative tasks—writing jokes, grading essays, or generating complex SQL queries—defining a mathematical metric is notoriously difficult.
Commonly, developers use "Exact Match" (which is often too rigid) or employ powerful models like GPT-4 as "LLM-as-a-judge." Yet, as shown in Figure 1, generic LLM judges often fail to capture the specific "vibe," context, or domain expertise required by human users. A joke might be structurally sound but unfunny to a specific audience, or a math problem might be technically correct but "too easy" for the intended pedagogical level.
Methodology: The PLHF Framework
To address these limitations, PLHF proposes a two-stage optimization process involving two distinct LLM modules: the Evaluator ($E$) and the Responder ($R$).
1. The Evaluator Optimization
The process begins with a small set of "Labeled Samples"—triplets consisting of an input, an output, and a human-assigned score. The Evaluator module is tasked with predicting these human scores. Using prompt optimization techniques, the Evaluator’s prompt ($P_E$) is iteratively refined to minimize the loss ($L$) between its predicted scores ($S$) and the ground-truth human labels ($S_{label}$). This "calibrates" the Evaluator to mimic the specific tastes and standards of the human experts.
2. The Responder Optimization
Once the Evaluator is calibrated, it remains fixed and serves as the automated metric for the main task. The Responder ($R$)—the model responsible for generating the final output—is then optimized. Its prompt ($P_R$) is iteratively adjusted to maximize the scores assigned by the Evaluator.
This duo-module approach ensures that human experts are only required once at the start of the process to provide the initial "few-shot" labels, rather than being stuck in the loop of every optimization iteration.
Experimental Evaluation
The researchers tested PLHF across four distinct domains: Schema Guided Dialogue (SGD), Automated Essay Scoring (AES-ASAP & AES-2.0), and Industrial SQL-QA.
Key Results
PLHF demonstrated superior performance compared to zero-shot LLM judges and traditional embedding-based metrics:
- Domain Accuracy: In the Industrial SQL-QA dataset, PLHF improved accuracy by 18.92% over the baseline, whereas using a raw GPT-4o judge only yielded a 5.41% improvement.
- Quality Alignment: For essay scoring, PLHF achieved an 8.45%–8.68% improvement in output quality. In contrast, using "Exact Match" as a metric actually degraded performance, highlighting the need for nuanced evaluation.
- Efficiency: The system proved robust even with very limited data, showing significant gains with only 10–20 human-labeled samples.
Discussion and Insights
The primary insight of PLHF is that the evaluation metric itself should be treated as an optimization target. By first "learning" the metric from human feedback, the system provides a much more accurate "gradient" for the Responder to follow. This approach is particularly valuable in industrial settings where expert time is the most significant bottleneck.
However, the framework does have limitations. It introduces higher computational overhead due to the dual optimization loops. Furthermore, the system is inherently sensitive to the quality of the initial human labels; if the provided "expert" feedback is inconsistent or biased, the Evaluator will struggle to provide a reliable signal for the Responder.
Conclusion
PLHF offers a scalable path toward high-quality automated prompt engineering for complex generative tasks. By transforming few-shot human feedback into a persistent, optimized Evaluator, it allows developers to align LLM outputs with specific human preferences without the cost of continuous human intervention.
Summary updated