FLARE: Few-shot Learning-based Adaptive Reflective Engine
Summary
FLARE is a new framework that combines few-shot learning with reflective mechanisms to optimize instructions for LLMs, outperforming GEPA across multiple benchmarks including HotPotQA, tool calling, and GoEmotions.
View Cached Full Text
Cached at: 08/05/26, 07:41 AM
# FLARE: Few-shot Learning-based Adaptive Reflective Engine
Source: [https://arxiv.org/html/2608.02919](https://arxiv.org/html/2608.02919)
Dhanasekar Sundararaman, Bharat Gandhi, Aashna Garg, Minjie Li
###### Abstract\.
Large language models \(LLMs\) are increasingly deployed in complex, compound AI systems where performance hinges on the quality of prompts\. Recent state\-of\-the\-art optimizers like GEPA \(Genetic\-Pareto\) have argued that reflective instruction evolution can outperform traditional reinforcement learning and few\-shot optimization\. In this work, we challenge this shift by introducing FLARE \(Few\-shot Learning\-based Adaptive Reflective Engine\), a framework that leverages advanced reflective mechanisms and a small set of few\-shot reference examples to optimize instructions\. We evaluate our method across a diverse suite of benchmarks—spanning retrieval\-augmented reasoning \(HotPotQA, MedQA, 2WikiMultiHopQA\), tool calling, and multi\-label emotion classification \(GoEmotions\)—using the GPT\-5 series of models\. Our results demonstrate that FLARE consistently outperforms GEPA, winning on every task–model pair: it achieves gains of up to \+14\.2 points on HotPotQA \(52\.2 vs\. GEPA’s 42\.2 with GPT\-5\-Chat\), reaches 87\.0% on tool calling \(vs\. 81\.0% for GEPA\), and lifts GoEmotions micro\-F1 to 52\.7% \(\+15\.3\) with GPT\-5\.1 on the full 5,408\-example test split, more than doubling GEPA’s \+5\.7 gain\. Beyond raw accuracy, FLARE is also strikingly data\-efficient: on GoEmotions it reaches its peak performance using as few as 100 validation examples, while remaining markedly more stable across random seeds than GEPA\. Our findings suggest that while reflective instructions are powerful, the strategic optimization of few\-shot learning remains a critical frontier for maximizing the potential of next\-generation LLMs\.
## 1\.Introduction
The advent of Frontier Large Language Models \(LLMs\) has shifted the challenge of AI development from model training to the engineering of complex, compound AI systems\. In these systems, performance is governed by the quality of prompts, which must orchestrate reasoning, tool manipulation, and domain\-specific logic\. However, manual prompt refinement is unscalable and often fails to capture the subtle nuances required for peak performance\. Automated prompt optimization has emerged as a solution, moving from simple discrete searches to sophisticated reflective frameworks\.
A prominent recent advancement isGenetic\-Pareto\(GEPA\)\(Agrawal et al\.,[2025](https://arxiv.org/html/2608.02919#bib.bib2)\), which utilizes natural language reflection to evolve high\-level instructions\. GEPA posits a significant shift in the field: as models become more capable, instruction\-only evolution can outperform traditional few\-shot optimization\. While GEPA provides a powerful mechanism for rule discovery, we argue that instruction\-only reflection often lacks thegroundingnecessary for tasks where the delta between success and failure lies in subtle execution patterns that abstract rules cannot fully capture\.
In this work, we introduce FLARE \(Few\-shot Learning\-based Adaptive Reflective Engine\),111Official implementation:[https://github\.com/microsoft/FLARE\-\-\-Few\-shot\-Learning\-based\-Adaptive\-Reflective\-Engine](https://github.com/microsoft/FLARE---Few-shot-Learning-based-Adaptive-Reflective-Engine)a framework that grounds reflective prompt optimization in explicit, per\-instance failure signals\. Whereas GEPA reflects on execution traces to evolve high\-level instructions and searches a candidate pool via genetic–Pareto selection, FLARE uses the reasoning capabilities of a frontier GPT\-5\-series model to diagnose*concrete*mistakes and repair them directly\.
In our fine\-grained error\-aware feedback loop, a frontier GPT\-5\-series model performs a specialized ”thinking” phase over each validation example alongside the primary model’s prediction and an explicit correctness label \(Match: WRONG\)\. Rather than evolving abstract rules, it autonomously diagnoses the root cause of each failure and rewrites the prompt with targeted corrections, turning every observed mistake into a direct, surgical instruction update\. This lets the model adapt its predictive logic based on a grounded, model\-driven analysis of its own shortcomings\.
Our empirical evaluation on the GPT\-5 series demonstrates that this iterative, error\-focused grounding significantly outperforms GEPA’s instruction\-only evolution across a wide array of benchmarks:
- •Data\-Efficient Classification:On multi\-label emotion classification \(GoEmotions\) with GPT\-5\.1, FLARE lifts micro\-F1 to52\.7%, a\+15\.3improvement over the baseline that more than doubles GEPA’s\+5\.7gain—while reaching its peak with as few as 100 validation examples\.
- •Superior Reasoning Capabilities:OnHotPotQAwith GPT\-5\-Chat, FLARE achieves an optimized mean of52\.2, a\+14\.2improvement over the baseline and a10\-point leadover GEPA \(42\.2\)\.
- •Gains in Complex Tool Usage:For tool\-calling tasks, our framework achieves87\.0%accuracy, compared to the81\.0%ceiling reached by GEPA\.
The core contribution of this paper is the demonstration that prompt optimization is most effective when reflection is grounded in the iterative diagnosis of concrete failure modes\. By coupling error\-aware feedback with a small set of few\-shot reference examples, we show that the recently argued ”shift” away from few\-shot grounded optimization is premature\. In its place, we offer a state\-of\-the\-art methodology for maximizing the utility of today’s most capable models\.
## 2\.Related Work
Recent advances in automated prompt optimization have demonstrated significant improvements in LLM performance across various tasks\. DSPy\(Khattab et al\.,[2023](https://arxiv.org/html/2608.02919#bib.bib10)\)introduces a declarative framework that compiles language model calls into self\-improving pipelines, enabling systematic optimization of prompts through programmatic composition\. Building on this foundation, GEPA\(Agrawal et al\.,[2025](https://arxiv.org/html/2608.02919#bib.bib2)\)demonstrates that reflective prompt evolution can outperform traditional reinforcement learning approaches by iteratively refining prompts based on performance feedback\. Yang et al\.\(Yang et al\.,[2023](https://arxiv.org/html/2608.02919#bib.bib19)\)propose OPRO, which frames prompt optimization as an optimization problem where LLMs themselves serve as optimizers, using meta\-prompting to generate and refine task\-specific instructions on benchmarks such as GSM8K\. Within the DSPy ecosystem, the BootstrapFewShot optimizer\(Khattab et al\.,[2023](https://arxiv.org/html/2608.02919#bib.bib10)\)synthesizes few\-shot demonstrations from labeled examples, while MIPROv2\(Opsahl\-Ong et al\.,[2024](https://arxiv.org/html/2608.02919#bib.bib13)\)jointly optimizes instructions and demonstrations through Bayesian search over candidate proposals; GEPA reports surpassing MIPROv2, which motivates our choice of GEPA as the primary optimization baseline\.
Beyond these general\-purpose methods, optimizing prompts for RAG systems presents unique challenges due to the interaction between retrieval and generation components\. Rodrigues and Branco\(Rodrigues and Branco,[2024](https://arxiv.org/html/2608.02919#bib.bib16)\)apply meta\-prompting techniques to RAG pipelines to improve end\-to\-end performance, and Opsahl\-Ong et al\.\(Opsahl\-Ong et al\.,[2024](https://arxiv.org/html/2608.02919#bib.bib13)\)optimize instructions and demonstrations for multi\-stage language model programs, achieving strong results on multi\-hop question answering datasets like HotPotQA\(Yang et al\.,[2018](https://arxiv.org/html/2608.02919#bib.bib20)\)\. RAG\-Gym\(Xiong et al\.,[2025](https://arxiv.org/html/2608.02919#bib.bib18)\)instead supervises the search process of retrieval agents, evaluating performance on multi\-hop datasets including HotPotQA and 2WikiMultiHopQA\(Ho et al\.,[2020](https://arxiv.org/html/2608.02919#bib.bib6)\)\. Complementary approaches enhance RAG through architectural innovations rather than prompt design: IRCoT\(Trivedi et al\.,[2023](https://arxiv.org/html/2608.02919#bib.bib17)\)interleaves retrieval with chain\-of\-thought reasoning, Self\-RAG\(Asai et al\.,[2023](https://arxiv.org/html/2608.02919#bib.bib3)\)learns when to retrieve and critically evaluate retrieved content, Active RAG\(Jiang et al\.,[2023](https://arxiv.org/html/2608.02919#bib.bib8)\)determines when retrieval is necessary during generation, and LongRAG\(Jiang et al\.,[2024](https://arxiv.org/html/2608.02919#bib.bib7)\)leverages long\-context LLMs to process more retrieved documents simultaneously, while Park et al\.\(Park et al\.,[2025](https://arxiv.org/html/2608.02919#bib.bib14)\)emulate RAG behavior through prompt engineering without an explicit retriever\. More general frameworks such as Promptomatix\(Murthy et al\.,[2025](https://arxiv.org/html/2608.02919#bib.bib12)\)—which we adopt as a baseline—and APE\(Zhou et al\.,[2022](https://arxiv.org/html/2608.02919#bib.bib21)\)automatically search the prompt space to synthesize high\-performing prompts across tasks\. Finally, for classification, Pryzant et al\.\(Pryzant et al\.,[2023](https://arxiv.org/html/2608.02919#bib.bib15)\)propose automatic prompt optimization using gradient descent and beam search, and Lieander et al\.\(Lieander et al\.,[2025](https://arxiv.org/html/2608.02919#bib.bib11)\)introduce a two\-gradient approach that combines multiple optimization signals to improve LLM classification\. Beyond the research literature, commercial providers also ship prompt\-optimization tooling; we additionally compare against OpenAI’s Prompt Optimizer,222[https://developers\.openai\.com/api/docs/guides/prompt\-optimizer](https://developers.openai.com/api/docs/guides/prompt-optimizer)a dashboard tool that rewrites a user\-supplied prompt according to current best practices, optionally guided by dataset annotations and grader results, which we include as a widely used practitioner baseline \(denotedOpenAIin our tables\)\.
Algorithm 1FLARE1:Training set
𝒟tr\\mathcal\{D\}\_\{tr\}, validation set
𝒟val\\mathcal\{D\}\_\{val\}, test set
𝒟te\\mathcal\{D\}\_\{te\}, metric
m\(⋅\)m\(\\cdot\), iterations
NN
2:Best\-performing prompt
p⋆p^\{\\star\}
3:Initialize LM
ℒ\\mathcal\{L\}\(
τ=1\.0\\tau=1\.0,
kmax=16,000k\_\{\\max\}=16\{,\}000\); load system instruction
ssyss\_\{\\text\{sys\}\}
4:Convert datasets:
𝒯←ϕ\(𝒟tr\)\\mathcal\{T\}\\leftarrow\\phi\(\\mathcal\{D\}\_\{tr\}\),
𝒱←ϕ\(𝒟val\)\\mathcal\{V\}\\leftarrow\\phi\(\\mathcal\{D\}\_\{val\}\),
ℰ←ϕ\(𝒟te\)\\mathcal\{E\}\\leftarrow\\phi\(\\mathcal\{D\}\_\{te\}\)
5:Extract
p0←Instr\(P0\)p\_\{0\}\\leftarrow\\mathrm\{Instr\}\(P\_\{0\}\); evaluate
s0val←m\(p0;𝒱\)s^\{\\text\{val\}\}\_\{0\}\\leftarrow m\(p\_\{0\};\\mathcal\{V\}\),
s0te←m\(p0;ℰ\)s^\{\\text\{te\}\}\_\{0\}\\leftarrow m\(p\_\{0\};\\mathcal\{E\}\)
6:Initialize
p⋆←p0p^\{\\star\}\\leftarrow p\_\{0\},
sbestval←s0val\\;s^\{\\text\{val\}\}\_\{\\text\{best\}\}\\leftarrow s^\{\\text\{val\}\}\_\{0\},
H←∅\\;H\\leftarrow\\emptyset\(window size
ℓ=3\\ell=3\)
7:for
i=1i=1to
NNdo
8:
p←𝒪\(p⋆,𝒯,𝒱,ssys,sbestval,H\)p\\leftarrow\\mathcal\{O\}\(p^\{\\star\},\\mathcal\{T\},\\mathcal\{V\},s\_\{\\text\{sys\}\},s^\{\\text\{val\}\}\_\{\\text\{best\}\},H\)⊳\\trianglerightcomplete train set𝒯\\mathcal\{T\}, not a sample
9:Evaluate
sval←m\(p;𝒱\)s^\{\\text\{val\}\}\\leftarrow m\(p;\\mathcal\{V\}\),
ste←m\(p;ℰ\)\\;s^\{\\text\{te\}\}\\leftarrow m\(p;\\mathcal\{E\}\)
10:Append
sval,stes^\{\\text\{val\}\},s^\{\\text\{te\}\}to
ℛval,ℛte\\mathcal\{R\}\_\{\\text\{val\}\},\\mathcal\{R\}\_\{\\text\{te\}\}⊳\\trianglerighttest tracked for reporting only
11:
H←lastℓ\(H∪\{\(sval,ψ\(p\)\)\}\)H\\leftarrow\\text\{last\}\_\{\\ell\}\\bigl\(H\\cup\\\{\(s^\{\\text\{val\}\},\\psi\(p\)\)\\\}\\bigr\)
12:if
sval\>sbestvals^\{\\text\{val\}\}\>s^\{\\text\{val\}\}\_\{\\text\{best\}\}then
13:
sbestval←svals^\{\\text\{val\}\}\_\{\\text\{best\}\}\\leftarrow s^\{\\text\{val\}\},
p⋆←p\\;p^\{\\star\}\\leftarrow p⊳\\trianglerightselect by validation
14:endif
15:endfor
16:return
p⋆p^\{\\star\}⊳\\trianglerightvalidation\-maximizing prompt, not the final iteration
## 3\.The FLARE Algorithm
FLARE implements an iterative, error\-driven approach to prompt optimization using Azure OpenAI\. Unlike GEPA’s population\-based Pareto frontier evolution, OpenAI’s single\-pass best\-practices rewriting, or Promptomatix’s synthetic\-data\-driven pipeline, our approach operates as a direct feedback loop where an LLM meta\-optimizer𝒪\\mathcal\{O\}continuously refines a promptppagainst task\-specific validation performance\. This architecture enables the optimizer to learn from concrete failure patterns rather than relying on population diversity or synthetic demonstrations, resulting in targeted improvements that directly address observed weaknesses in model behavior\.
The process begins by initializing language modelℒ\\mathcal\{L\}with fixed decoding parameters \(temperatureτ=1\.0\\tau=1\.0, max completion tokenskmax=16,000k\_\{\\max\}=16\{,\}000\) and converting the training, validation, and test sets into model\-compatible formats𝒯←ϕ\(𝒟tr\)\\mathcal\{T\}\\leftarrow\\phi\(\\mathcal\{D\}\_\{tr\}\),𝒱←ϕ\(𝒟val\)\\mathcal\{V\}\\leftarrow\\phi\(\\mathcal\{D\}\_\{val\}\), andℰ←ϕ\(𝒟te\)\\mathcal\{E\}\\leftarrow\\phi\(\\mathcal\{D\}\_\{te\}\), where transformationϕ\\phiconstructs DSPy Example objects with appropriate input\-output field mappings\. A base promptp0←Instr\(P0\)p\_\{0\}\\leftarrow\\mathrm\{Instr\}\(P\_\{0\}\)is extracted from the task\-specific signature and evaluated via metricm\(⋅\)m\(\\cdot\)to establish baseline scoress0vals^\{\\text\{val\}\}\_\{0\}ands0tes^\{\\text\{te\}\}\_\{0\}\. This initialization phase also involves computing predictionsy^i←ℒ\(p0,xi\)\\hat\{y\}\_\{i\}\\leftarrow\\mathcal\{L\}\(p\_\{0\},x\_\{i\}\)for all validation examples, creating an initial error profile that informs the first optimization step\.
OverNNoptimization iterations, the optimizer updates the prompt through a structured refinement process\. At iterationtt, the meta\-optimizer receives the current best\-performing promptpt−1⋆p\_\{t\-1\}^\{\\star\}along with detailed feedback constructed from validation predictions\. Specifically, for each validation example\(xi,yi\)∈𝒱\(x\_\{i\},y\_\{i\}\)\\in\\mathcal\{V\}, we compute the predictiony^i←ℒ\(pt−1⋆,xi\)\\hat\{y\}\_\{i\}\\leftarrow\\mathcal\{L\}\(p\_\{t\-1\}^\{\\star\},x\_\{i\}\)and construct an error signal
ei=\{CORRECTifm\(y^i,yi\)=1WRONG\(yi,y^i\)otherwisee\_\{i\}=\\begin\{cases\}\\texttt\{CORRECT\}&\\text\{if \}m\(\\hat\{y\}\_\{i\},y\_\{i\}\)=1\\\\ \\texttt\{WRONG\}\(y\_\{i\},\\hat\{y\}\_\{i\}\)&\\text\{otherwise\}\\end\{cases\}that includes both the ground truthyiy\_\{i\}and the model’s incorrect predictiony^i\\hat\{y\}\_\{i\}\. The optimizer then generates an improved prompt as
pt←𝒪\(pt−1⋆,𝒯,\{\(xi,yi,ei\)\}i=1\|𝒱\|,ssys,ct,Ht\),p\_\{t\}\\leftarrow\\mathcal\{O\}\(p\_\{t\-1\}^\{\\star\},\\,\\mathcal\{T\},\\,\\\{\(x\_\{i\},y\_\{i\},e\_\{i\}\)\\\}\_\{i=1\}^\{\|\\mathcal\{V\}\|\},\\,s\_\{\\text\{sys\}\},\\,c\_\{t\},\\,H\_\{t\}\),where𝒯\\mathcal\{T\}is the*complete*training set provided for context,ssyss\_\{\\text\{sys\}\}encodes task\-specific optimization objectives \(e\.g\., “maximize F1\-score for multi\-label classification”\),ct=st−1valc\_\{t\}=s^\{\\text\{val\}\}\_\{t\-1\}is the current validation score, andHt=\{\(sjval,ψ\(pj\)\)\}j=max\(0,t−3\)t−1H\_\{t\}=\\\{\(s^\{\\text\{val\}\}\_\{j\},\\psi\(p\_\{j\}\)\)\\\}\_\{j=\\max\(0,t\-3\)\}^\{t\-1\}maintains a sliding window of theℓ=3\\ell=3most recent iterations\. The meta\-optimizer operates with temperatureτ𝒪=1\.0\\tau\_\{\\mathcal\{O\}\}=1\.0\(matching the evaluation model\) and max tokensk𝒪=16,000k\_\{\\mathcal\{O\}\}=16\{,\}000, retaining stochasticity to encourage exploration of the prompt space\. Notably, both the meta\-optimizer and evaluation model use the same stochastic decoding parameters, rather than employing deterministic inference for evaluation\.
Each iteration re\-evaluates the updated prompt on both validation and test sets to produce new scoresstvals^\{\\text\{val\}\}\_\{t\}andsttes^\{\\text\{te\}\}\_\{t\}\. These scores are appended to result listsℛval=\[s0val,…,stval\]\\mathcal\{R\}\_\{\\text\{val\}\}=\[s^\{\\text\{val\}\}\_\{0\},\\ldots,s^\{\\text\{val\}\}\_\{t\}\]andℛte=\[s0te,…,stte\]\\mathcal\{R\}\_\{\\text\{te\}\}=\[s^\{\\text\{te\}\}\_\{0\},\\ldots,s^\{\\text\{te\}\}\_\{t\}\], enabling longitudinal performance tracking\. To select the best\-performing prompt, we trackp⋆=argmaxpjsjvalp^\{\\star\}=\\arg\\max\_\{p\_\{j\}\}s^\{\\text\{val\}\}\_\{j\}based on*validation performance*throughout optimization; the held\-out test set is used solely for reporting and never informs prompt selection\. The optimization runs forNNiterations and returns the validation\-maximizing promptp⋆p^\{\\star\}\.
The orchestration layer supports multiple task types—classification, RAG, and tool calling—with specialized DSPy signatures and conversion functionsϕtask\\phi\_\{\\text\{task\}\}\. For classification tasks,ϕ\\phimaps raw labels to sets of emotion IDs; for tool calling, it parses conversational histories and expected tool sequences\. In the tool calling domain, the conversion process is particularly nuanced: when ground truth contains multi\-tool sequences\[t1,…,tk\]\[t\_\{1\},\\ldots,t\_\{k\}\], we generatekkseparate training examples, each focusing on a single tool calltjt\_\{j\}with its specific arguments, thereby providing the optimizer with fine\-grained feedback on individual tool selection and parameter extraction decisions\. This decomposition enables the meta\-optimizer to identify whether errors stem from incorrect tool selection, malformed argument values, or improper JSON formatting\. The complete training set𝒯\\mathcal\{T\}is provided to the meta\-optimizer at each iteration, ensuring full visibility into available training patterns without sampling\-induced variance\.
The longitudinal historyHtH\_\{t\}provides the meta\-optimizer with critical performance context across iterations, enabling it to identify whether prompt modifications are producing monotonic improvements, oscillating around a local optimum, or exploring entirely new solution directions\. By exposing both score trajectories and prompt evolution patterns, the history mechanism allows𝒪\\mathcal\{O\}to make increasingly informed refinements—for instance, detecting when repeated attempts to improve a specific error pattern are counterproductive and pivoting to alternative reformulation strategies\. Furthermore, system instructionsssyss\_\{\\text\{sys\}\}are task\-dependent and encode domain\-specific constraints such as “output must be valid JSON matching the tool schema” for tool calling, guiding the meta\-optimizer toward solutions that satisfy both accuracy and format requirements\. The stochastic decoding parameters \(τ=1\.0\\tau=1\.0for both optimization and evaluation\) introduce variability across runs, enabling more diverse exploration of the prompt space during the meta\-optimization process\.
## 4\.Experimental Setup
### 4\.1\.Datasets
We evaluate the FLARE approach across three diverse tasks, each presenting unique challenges for language models:
1. \(1\)Classification \(Emotion Detection\): Multi\-label emotion classification from the GoEmotions dataset\(Demszky et al\.,[2020](https://arxiv.org/html/2608.02919#bib.bib5)\)\. The task requires identifying multiple emotions from 28 possible emotion labels in text snippets\. We evaluate classification on the*full*held\-out test split \(5,408 examples\) and, holding the reference exemplar set fixed at 50 examples, sweep the validation\-set size from 10 to 1,000 to study data efficiency \(Table[2](https://arxiv.org/html/2608.02919#S5.T2)\)\. Here the reference exemplars are the labeled examples shown to the optimizer as in\-context references, while the validation set is what drives the error\-based optimization signal\.
2. \(2\)Tool Calling: Function calling and argument extraction tasks drawn from theτ2\\tau^\{2\}\-bench benchmark\(Barres et al\.,[2025](https://arxiv.org/html/2608.02919#bib.bib4)\)\(airline and retail customer\-service domains\), reformulated as a single\-turn tool\-selection task\. Each example provides a conversational context from which the model must select the appropriate tool and extract correct parameters from natural language\.
3. \(3\)Retrieval\-Augmented Generation \(RAG\): Question\-answering tasks from HotPotQA\(Yang et al\.,[2018](https://arxiv.org/html/2608.02919#bib.bib20)\), MedQA\(Jin et al\.,[2020](https://arxiv.org/html/2608.02919#bib.bib9)\), and 2WikiMultiHopQA\(Ho et al\.,[2020](https://arxiv.org/html/2608.02919#bib.bib6)\)datasets requiring reasoning over retrieved documents, with multi\-hop reasoning in the case of HotPotQA and 2WikiMultiHopQA\. The dataset includes complex queries that necessitate synthesizing information from multiple retrieved passages to generate accurate answers\.
### 4\.2\.Evaluation Metrics
We employ task\-specific evaluation metrics aligned with the Azure AI Evaluation framework:
- •Classification: F1\-score to handle the multi\-label nature of emotion detection
- •Tool Calling: Combined metric averaging three sub\-metrics: 1. \(1\)Tool Call Accuracy for correct tool selection 2. \(2\)Intent Resolution for capturing user intent 3. \(3\)Task Adherence for following specifications
- •RAG: A retrieval\-aware composite scoring factual accuracy against retrieved context, computed as0\.3×0\.3\\timesretrieval\+0\.7×\+\\,0\.7\\timesgeneration quality
### 4\.3\.Hyperparameters
We use Azure OpenAI GPT\-5\.1 and GPT\-5\-Chat as the meta\-optimizer responsible for analyzing validation performance and rewriting prompts; optimized prompts are then evaluated once on the held\-out test dataset\. The model operates with temperature=1\.0 to encourage diverse prompt variations and escape local optima\. The number of optimization iterations was set to 40\. Unless otherwise noted, all reported scores are the mean±\\pmstandard deviation over three independent runs \(seeds\)\. The complete implementation is built on the DSPy framework333[https://github\.com/stanfordnlp/dspy](https://github.com/stanfordnlp/dspy), enabling modular prompt templates with automatic signature generation and structured prediction formats\.
## 5\.Results and Discussion
Table 1\.Performance comparison of prompt optimization methods on the classification task\. For FLARE and GEPA, we report each method’s best configuration across the validation\-set\-size sweep \(full sweep in Table[2](https://arxiv.org/html/2608.02919#S5.T2)\); GEPA uses its best of the light/heavy budgets\. Best optimized score per dataset\-LLM combination is shown inbold\.Table 2\.Validation\-set\-size ablation on the classification task\. All scores are micro\-F1 \(%\), mean±\\pmSD over 3 seeds\. Best optimized score per row is shown inbold\. GEPA is reported for both the*light*and*heavy*budgets\.Figure 1\.Data efficiency on the GoEmotions classification task\. Test micro\-F1 \(%\) on the full held\-out split \(5,408 examples\) as a function of validation\-set size \(log scale\), for GPT\-5\.1 \(left\) and GPT\-5\-Chat \(right\)\. Lines show the mean over 3 seeds; shaded bands denote±\\pm1 SD\. FLARE rises steeply and peaks with as few as 100 validation examples before plateauing, while GEPA remains largely flat across validation sizes and budgets and exhibits substantially higher variance\.Table 3\.Performance comparison of prompt optimization methods on tool calling tasks\. Best optimized scores per dataset\-LLM combination are shown inbold\. OpenAI’s optimizer is omitted here as it rewrites prompts from examples alone and cannot act on the tool\-execution loop this task requires\.Table 4\.Performance comparison of prompt optimization methods on retrieval\-augmented generation \(RAG\) tasks across different datasets and LLMs\. Best optimized scores per dataset\-LLM combination are shown inbold\. On RAG we compare only FLARE and GEPA: the metric is a retrieval\-aware composite \(0\.3×0\.3\\timesretrieval\+0\.7×\+\\,0\.7\\timesgeneration quality\), and only these two optimize against task execution over the retrieval pipeline, whereas Promptomatix and OpenAI’s optimizer rewrite prompts from examples alone and cannot influence the retrieval\-weighted component\.Our experimental evaluation across three diverse tasks reveals several key insights about the effectiveness and efficiency of prompt optimization methods, with particular emphasis on our FLARE optimizer\.
### 5\.1\.Overall Performance Trends
FLARE demonstrates superior performance across the majority of dataset\-LLM combinations, achieving the best optimized scores in all 10 task\-model pairs\. The improvements range from modest gains of \+1\.6 percentage points \(2WikiMultiHopQA with GPT\-5\.1\) to substantial improvements of \+15\.3 percentage points \(GoEmotions with GPT\-5\.1\)\. This consistent advantage across diverse task types suggests that FLARE’s optimization strategy generalizes well across different reasoning modalities, including retrieval\-augmented generation, tool calling, and classification\.
Notably, the performance gains are not uniform across tasks\. Classification sees the strongest improvements: on GoEmotions FLARE achieves up to \+15\.3 points with GPT\-5\.1 \(\+14\.6 with GPT\-5\-Chat\), and retrieval\-augmented tasks such as HotPotQA follow closely with up to \+14\.2 points on GPT\-5\-Chat\. This suggests that prompt optimization is particularly effective for tasks where explicit instruction refinement can significantly guide model behavior\. In contrast, multi\-hop reasoning tasks like 2WikiMultiHopQA show more modest improvements \(\+1\.6 to \+3\.0 points\), possibly due to the inherent complexity of the retrieval and inference chain that cannot be fully addressed through prompt optimization alone\.
Across tasks, FLARE’s run\-to\-run variability is generally comparable to or lower than competing methods \(e\.g\. MedQA with GPT\-5\-Chat at51\.6±0\.751\.6\\pm 0\.7\)\.
### 5\.2\.Case Study: Data Efficiency on GoEmotions
While the aggregate results establish that FLARE is effective, they do not by themselves reveal*how much supervision*each method needs to reach that effectiveness, nor*how reliably*it does so\. The GoEmotions classification task is uniquely suited to answering these questions: it is the one benchmark for which we run a full ablation, sweeping the validation\-set size across eight settings \(\|𝒟val\|∈\{10,20,30,50,100,200,500,1000\}\|\\mathcal\{D\}\_\{val\}\|\\in\\\{10,20,30,50,100,200,500,1000\\\}\), evaluating GEPA under both a*light*and a*heavy*optimization budget, and repeating every configuration over three seeds on the full held\-out test split of 5,408 examples\. This design lets us treat GoEmotions as a controlled case study of*data efficiency*—performance as a function of the supervision provided—rather than a single point estimate\. The results are reported in Table[2](https://arxiv.org/html/2608.02919#S5.T2)and visualized in Figure[1](https://arxiv.org/html/2608.02919#S5.F1)\.
Sample efficiency\.The defining feature of FLARE on GoEmotions is how little validation data it needs to reach its best performance\. With GPT\-5\.1, FLARE already improves over the zero\-shot baseline by roughly six points using only ten validation examples \(42\.78±1\.3042\.78\\pm 1\.30at\|𝒟val\|=10\|\\mathcal\{D\}\_\{val\}\|\{=\}10versus a37\.5%37\.5\\%baseline\), and it reaches its peak of52\.72±0\.7852\.72\\pm 0\.78with just one hundred examples\. Beyond that point, adding an order of magnitude more validation data \(up to1,0001\{,\}000examples\) does not help—performance settles into a5050–51%51\\%plateau\. In other words, essentially all of FLARE’s attainable gain is captured within the first hundred labeled validation instances, and the marginal value of further supervision is negligible\. The same qualitative shape holds for GPT\-5\-Chat, where FLARE rises from41\.0041\.00at\|𝒟val\|=10\|\\mathcal\{D\}\_\{val\}\|\{=\}10to48\.6948\.69at1,0001\{,\}000, with the bulk of the improvement realized early\. This steep\-then\-flat trajectory is the central efficiency claim of the paper: FLARE’s reflective feedback loop extracts a strong prompt from a handful of examples rather than requiring large labeled validation sets\.
Budget does not substitute for a better search\.A natural hypothesis is that GEPA’s weaker performance simply reflects an insufficient optimization budget\. The light/heavy comparison rules this out\. Increasing GEPA’s budget from light to heavy yields only sporadic and inconsistent gains: on GPT\-5\-Chat the heavy budget helps only at the two smallest validation sizes \(\|𝒟val\|=10\|\\mathcal\{D\}\_\{val\}\|\{=\}10and2020, at44\.1944\.19and44\.8744\.87\), while at every larger size it is matched or beaten by the light budget\. Across the entire sweep GEPA stays confined to a narrow3939–45%45\\%band regardless of budget or validation size, and for every\|𝒟val\|≥30\|\\mathcal\{D\}\_\{val\}\|\{\\geq\}30both budgets fall decisively below FLARE\. Within the range of budgets we tested, spending more compute on GEPA’s evolutionary search does not improve its accuracy, whereas FLARE’s reflective updates reach a substantially higher plateau—evidence that FLARE’s advantage comes from a more sample\-efficient search rather than a larger one\.
Stability and variance\.Efficiency is only useful if it is dependable, and here FLARE has a second, complementary advantage: it is markedly more stable across seeds\. FLARE’s standard deviations remain tight throughout the sweep—between roughly0\.30\.3and2\.12\.1points for both models—so its reported means are trustworthy operating points rather than lucky draws\. GEPA, and especially GEPA under the heavy budget, is far more volatile: on GPT\-5\-Chat the heavy budget swings by±7\.59\\pm 7\.59at\|𝒟val\|=10\|\\mathcal\{D\}\_\{val\}\|\{=\}10and±5\.42\\pm 5\.42at\|𝒟val\|=100\|\\mathcal\{D\}\_\{val\}\|\{=\}100, and the light budget on GPT\-5\.1 shows comparable spread \(±5\.16\\pm 5\.16at\|𝒟val\|=10\|\\mathcal\{D\}\_\{val\}\|\{=\}10\)\. The shaded±1\\pm 1SD bands in Figure[1](https://arxiv.org/html/2608.02919#S5.F1)make this contrast visually immediate: FLARE traces a thin, well\-separated curve while GEPA’s bands are wide and overlap the baseline\. Practically, this means that not only does FLARE reach a higher score with less data, but a practitioner running it once is much more likely to obtain that score\.
Consistency across models\.Finally, the efficiency profile is not an artifact of a single backbone\. Both GPT\-5\.1 and GPT\-5\-Chat exhibit the same steep\-rise\-then\-plateau behavior for FLARE and the same flat, high\-variance behavior for GEPA; the two models differ mainly by a roughly three\-to\-four point vertical offset that reflects their intrinsic capability gap rather than any change in the optimization dynamics\. This cross\-model consistency strengthens the interpretation that the observed data efficiency is a property of the FLARE algorithm itself\.
FLARE does re\-score every candidate on the full validation set, spending roughly2\.3×2\.3\\timesthe model\-evaluation calls of GEPA \(heavy\) at its best configuration \(\|𝒟val\|=100\|\\mathcal\{D\}\_\{val\}\|\{=\}100, GPT\-5\.1\)\. But since the light/heavy ablation shows that extra compute does not lift GEPA’s accuracy, and prompt optimization is a one\-time offline cost, we consider these additional calls a favorable trade\-off for the higher and more stable accuracy FLARE delivers\.
### 5\.3\.Task\-Specific Insights
Classification \(GoEmotions\):On the full 5,408\-example test split, FLARE lifts GPT\-5\.1 micro\-F1 from a 37\.5% zero\-shot baseline to52\.7%\(\+15\.3 points; Table[1](https://arxiv.org/html/2608.02919#S5.T1)\), substantially outperforming GEPA \(43\.6%, \+5\.7\), OpenAI \(47\.8%, \+11\.6\), and Promptomatix \(38\.0%, \+1\.3\)\. Beyond the headline gain, the validation\-set\-size sweep in Table[2](https://arxiv.org/html/2608.02919#S5.T2)and Figure[1](https://arxiv.org/html/2608.02919#S5.F1)highlights FLARE’s data efficiency: it climbs steeply with even a handful of validation examples \(42\.8% at\|𝒟val\|=10\|\\mathcal\{D\}\_\{val\}\|\{=\}10\), peaks at 52\.7% with only 100 examples, and then plateaus around 50–51% as the validation set grows to 1,000\. GEPA, by contrast, remains flat at roughly 39–44% across all validation sizes regardless of budget\. This demonstrates that FLARE’s reflective feedback extracts a strong prompt from very little supervision, whereas simply enlarging the validation set yields diminishing returns\.
Tool Calling:High baseline performance \(74\-78\.6%\) combined with modest but consistent improvements \(\+2\.0 to \+9\.0 points\) suggests that modern LLMs already possess strong tool\-calling capabilities, but optimized prompts can still refine function selection and parameter specification\.
RAG Tasks \(HotPotQA, MedQA, 2WikiMultiHopQA\):The moderate\-to\-substantial improvements \(1\.6 to 14\.2 points\) suggest that prompt optimization helps models better orchestrate retrieval and reasoning processes\. We restrict the RAG comparison to FLARE and GEPA because the RAG metric is a retrieval\-aware composite \(0\.3×0\.3\\timesretrieval\+0\.7×\+\\,0\.7\\timesgeneration\), scored against an external corpus; Promptomatix and OpenAI’s optimizer refine prompts from labeled examples alone and have no mechanism to act on the retrieval stage, making them ill\-suited to a retrieval\-weighted objective\. The decreasing returns on 2WikiMultiHopQA may indicate limitations in addressing multi\-step retrieval errors through prompting alone, suggesting potential for hybrid approaches combining prompt optimization with improved retrieval mechanisms\.
## 6\.Limitations and Conclusion
While FLARE demonstrates strong performance, one limitation warrants discussion\. The variability in performance across task types suggests that no single optimizer is universally optimal\. Future work could explore adaptive or ensemble optimization strategies that select or combine methods based on task characteristics\.
In conclusion, FLARE reframes prompt optimization as an error\-aware, reflectively grounded search that diagnoses concrete failures on a small set of reference examples and rewrites the prompt to address them directly\. It wins on every task–model pair, and—as our GoEmotions case study shows—does so data\-efficiently and stably, indicating that the advantage of reflective grounded optimization stems from the quality of its search rather than its scale\. We hope this motivates further work on error\-driven optimization and the strategic use of few\-shot supervision\.
###### Acknowledgements\.
We thank Yabin Liu and Xiaoying Guo at Microsoft for their thoughtful feedback on prompt optimization and their help with presentations\.
## References
- \(1\)
- Agrawal et al\.\(2025\)Lakshya A\. Agrawal, Shangyin Tan, Dilara Soylu, Noah Ziems, Rishi Khare, Krista Opsahl\-Ong, Arnav Singhvi, Herumb Shandilya, Michael J\. Ryan, Meng Jiang, Christopher Potts, Koushik Sen, Alexandros G\. Dimakis, Ion Stoica, Dan Klein, Matei Zaharia, and Omar Khattab\. 2025\.GEPA: Reflective Prompt Evolution Can Outperform Reinforcement Learning\.arXiv:2507\.19457[https://arxiv\.org/abs/2507\.19457](https://arxiv.org/abs/2507.19457)
- Asai et al\.\(2023\)Akari Asai, Zeqiu Wu, Yizhong Wang, Avirup Sil, and Hannaneh Hajishirzi\. 2023\.Self\-RAG: Learning to Retrieve, Generate, and Critique through Self\-Reflection\.arXiv:2310\.11511[https://arxiv\.org/abs/2310\.11511](https://arxiv.org/abs/2310.11511)
- Barres et al\.\(2025\)Victor Barres, Honghua Dong, Soham Ray, Xujie Si, and Karthik Narasimhan\. 2025\.τ2\\tau^\{2\}\-Bench: Evaluating Conversational Agents in a Dual\-Control Environment\.arXiv:2506\.07982[https://arxiv\.org/abs/2506\.07982](https://arxiv.org/abs/2506.07982)
- Demszky et al\.\(2020\)Dorottya Demszky, Dana Movshovitz\-Attias, Jeongwoo Ko, Alan Cowen, Gaurav Nemade, and Sujith Ravi\. 2020\.GoEmotions: A Dataset of Fine\-Grained Emotions\.arXiv:2005\.00547[https://arxiv\.org/abs/2005\.00547](https://arxiv.org/abs/2005.00547)
- Ho et al\.\(2020\)Xanh Ho, Anh\-Khoa Duong Nguyen, Saku Sugawara, and Akiko Aizawa\. 2020\.Constructing a Multi\-Hop QA Dataset for Comprehensive Evaluation of Reasoning Steps\. In*Proceedings of the 28th International Conference on Computational Linguistics \(COLING\)*\.[doi:10\.18653/v1/2020\.coling\-main\.580](https://doi.org/10.18653/v1/2020.coling-main.580)
- Jiang et al\.\(2024\)Ziyan Jiang, Xueguang Ma, and Wenhu Chen\. 2024\.LongRAG: Enhancing Retrieval\-Augmented Generation with Long\-context LLMs\.arXiv:2406\.15319[https://arxiv\.org/abs/2406\.15319](https://arxiv.org/abs/2406.15319)
- Jiang et al\.\(2023\)Zhengbao Jiang, Frank F\. Xu, Luyu Gao, Zhiqing Sun, Qian Liu, Jane Dwivedi\-Yu, Yiming Yang, Jamie Callan, and Graham Neubig\. 2023\.Active Retrieval Augmented Generation\. In*Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing \(EMNLP\)*\.[doi:10\.18653/v1/2023\.emnlp\-main\.495](https://doi.org/10.18653/v1/2023.emnlp-main.495)
- Jin et al\.\(2020\)Di Jin, Eileen Pan, Nassim Oufattole, Wei\-Hung Weng, Hanyi Fang, and Peter Szolovits\. 2020\.What Disease does this Patient Have? A Large\-scale Open Domain Question Answering Dataset from Medical Exams\.arXiv:2009\.13081[https://arxiv\.org/abs/2009\.13081](https://arxiv.org/abs/2009.13081)
- Khattab et al\.\(2023\)Omar Khattab, Arnav Singhvi, Paridhi Maheshwari, Zhiyuan Zhang, Keshav Santhanam, Sri Vardhamanan, Saiful Haq, Ashutosh Sharma, Thomas T\. Joshi, Hanna Moazam, Heather Miller, Matei Zaharia, and Christopher Potts\. 2023\.DSPy: Compiling Declarative Language Model Calls into Self\-Improving Pipelines\.arXiv:2310\.03714[https://arxiv\.org/abs/2310\.03714](https://arxiv.org/abs/2310.03714)
- Lieander et al\.\(2025\)Anthony Jethro Lieander, Hui Wang, and Karen Rafferty\. 2025\.Prompt Optimization with Two Gradients for Classification in Large Language Models\.*AI*6, 8 \(2025\)\.[doi:10\.3390/ai6080182](https://doi.org/10.3390/ai6080182)
- Murthy et al\.\(2025\)Rithesh Murthy, Ming Zhu, Liangwei Yang, Jielin Qiu, Juntao Tan, Shelby Heinecke, Caiming Xiong, Silvio Savarese, and Huan Wang\. 2025\.Promptomatix: An Automatic Prompt Optimization Framework for Large Language Models\.arXiv:2507\.14241[https://arxiv\.org/abs/2507\.14241](https://arxiv.org/abs/2507.14241)
- Opsahl\-Ong et al\.\(2024\)Krista Opsahl\-Ong, Michael J\. Ryan, Josh Purtell, David Broman, Christopher Potts, Matei Zaharia, and Omar Khattab\. 2024\.Optimizing Instructions and Demonstrations for Multi\-Stage Language Model Programs\.arXiv:2406\.11695[https://arxiv\.org/abs/2406\.11695](https://arxiv.org/abs/2406.11695)
- Park et al\.\(2025\)Joon Park, Kyohei Atarashi, Koh Takeuchi, and Hisashi Kashima\. 2025\.Emulating Retrieval Augmented Generation via Prompt Engineering for Enhanced Long Context Comprehension in LLMs\.arXiv:2502\.12462[https://arxiv\.org/abs/2502\.12462](https://arxiv.org/abs/2502.12462)
- Pryzant et al\.\(2023\)Reid Pryzant, Dan Iter, Jerry Li, Yin Tat Lee, Chenguang Zhu, and Michael Zeng\. 2023\.Automatic Prompt Optimization with “Gradient Descent” and Beam Search\.arXiv:2305\.03495[https://arxiv\.org/abs/2305\.03495](https://arxiv.org/abs/2305.03495)
- Rodrigues and Branco \(2024\)João Rodrigues and António Branco\. 2024\.Meta\-prompting Optimized Retrieval\-augmented Generation\. In*Progress in Artificial Intelligence \(EPIA 2024\)*\.[doi:10\.1007/978\-3\-031\-73503\-5\_17](https://doi.org/10.1007/978-3-031-73503-5_17)
- Trivedi et al\.\(2023\)Harsh Trivedi, Niranjan Balasubramanian, Tushar Khot, and Ashish Sabharwal\. 2023\.Interleaving Retrieval with Chain\-of\-Thought Reasoning for Knowledge\-Intensive Multi\-Step Questions\. In*Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics \(ACL\)*\.[doi:10\.18653/v1/2023\.acl\-long\.557](https://doi.org/10.18653/v1/2023.acl-long.557)
- Xiong et al\.\(2025\)Guangzhi Xiong, Qiao Jin, Xiao Wang, Yin Fang, Haolin Liu, Yifan Yang, Fangyuan Chen, Zhixing Song, Dengyu Wang, Minjia Zhang, Zhiyong Lu, and Aidong Zhang\. 2025\.RAG\-Gym: Systematic Optimization of Language Agents for Retrieval\-Augmented Generation\.arXiv:2502\.13957[https://arxiv\.org/abs/2502\.13957](https://arxiv.org/abs/2502.13957)
- Yang et al\.\(2023\)Chengrun Yang, Xuezhi Wang, Yifeng Lu, Hanxiao Liu, Quoc V\. Le, Denny Zhou, and Xinyun Chen\. 2023\.Large Language Models as Optimizers\.arXiv:2309\.03409[https://arxiv\.org/abs/2309\.03409](https://arxiv.org/abs/2309.03409)
- Yang et al\.\(2018\)Zhilin Yang, Peng Qi, Saizheng Zhang, Yoshua Bengio, William W\. Cohen, Ruslan Salakhutdinov, and Christopher D\. Manning\. 2018\.HotpotQA: A Dataset for Diverse, Explainable Multi\-hop Question Answering\. In*Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing \(EMNLP\)*\.[doi:10\.18653/v1/D18\-1259](https://doi.org/10.18653/v1/D18-1259)
- Zhou et al\.\(2022\)Yongchao Zhou, Andrei Ioan Muresanu, Ziwen Han, Keiran Paster, Silviu Pitis, Harris Chan, and Jimmy Ba\. 2022\.Large Language Models Are Human\-Level Prompt Engineers\.arXiv:2211\.01910[https://arxiv\.org/abs/2211\.01910](https://arxiv.org/abs/2211.01910)
## Appendix A: FLARE Iterative Improvement Process for Multi\-Label Emotion Classification
### Overview
This appendix documents the iterative prompt optimization process for multi\-label emotion classification \(GoEmotions\) tasks using FLARE\. The optimization ran for 40 iterations using GPT\-5\.1\. The validation\-maximizing prompt was reached at iteration 20 and returned as the final promptp⋆p^\{\\star\}\(iterations 21–40 produced no further validation improvement\), improving from an initial test score of37\.46to52\.72\(\+15\.3 percentage points improvement\)\. Below we show representative iterations \(1, 10, and 20\)\.
### Initial Prompt \(Baseline\)
Youareanexpertemotionclassifier\.Classifythegivenemotions
expressedinthegiventextwithproperreasoning\.Thisisa
multi\-labeltaskwheretextcanexpressmultipleemotions
simultaneously\.Theemotioncategoriesare:0=admiration,1=amusement,
2=anger,3=annoyance,4=approval,5=caring,6=confusion,7=curiosity,
8=desire,9=disappointment,10=disapproval,11=disgust,
12=embarrassment,13=excitement,14=fear,15=gratitude,16=grief,
17=joy,18=love,19=nervousness,20=optimism,21=pride,
22=realization,23=relief,24=remorse,25=sadness,26=surprise,
27=neutral\.RespondwithalistofemotionIDs\(0\-27\)thatapplyto
thetextinbracketformat,suchas\[5,12,26\]formultipleemotions
or\[27\]forsingleemotions\.
### Iteration 1
#### LLM Feedback:
The main error patterns: \(1\) over\-predicting non\-neutral emotions \(especially curiosity, caring, excitement, anger/disapproval\) for short or ambiguous texts that should be \[27\]; \(2\) conflating anger/annoyance/disapproval/disgust and missing when something is just mocking or dismissive; \(3\) over\-adding secondary labels like gratitude→admiration, fear→caring, etc\.; \(4\) misreading sarcasm, insults, and ”lol” language as amusement or anger instead of the labeled class; \(5\) missing subtle labels like caring, curiosity, optimism, love, realization when they are clearly intended; \(6\) confusion between optimism vs\. speculation, grief vs\. neutral reporting of death, and disappointment vs\. neutral criticism\. The new prompt tightens when to use \[27\], adds strict rules to avoid ”padding” with extra emotions, and gives explicit decision rules and keyword/pattern cues for the most commonly confused categories\.
Optimized Prompt:
Youareanexpertmulti\-labelemotionclassifier\.
Yourtask:
\-Readasingleshorttext\(oftenasocial\-mediacomment\)\.
\-DecidewhichemotionIDsfrom0\-27areexpressed\.
\-OutputONLYaJSON\-stylelistofIDs,e\.g\.‘\[5,12,26\]‘or‘\[27\]‘\.
\-DoNOToutputanywords,explanations,orextracharacters\.
EmotionIDs:
0=admiration,1=amusement,2=anger,3=annoyance,4=approval,5=caring,
6=confusion,7=curiosity,8=desire,9=disappointment,10=disapproval,
11=disgust,12=embarrassment,13=excitement,14=fear,15=gratitude,
16=grief,17=joy,18=love,19=nervousness,20=optimism,21=pride,
22=realization,23=relief,24=remorse,25=sadness,26=surprise,
27=neutral\.
GENERALRULES
1\.Ifnoclearemotionisexpressed,outputONLY‘\[27\]‘\.
2\.DoNOTaddextraemotionsjustbecausetheyarecompatible\.Only
labelemotionsthatareclearlypresentfromwordingorcontext\.
3\.Multi\-labelisallowedonlywhenmultipledistinctemotionsare
clearlyexpressed\(e\.g\.,"Thanks,thisissoexciting\!"→\\rightarrow\[13,15\]\)\.
4\.Sarcasm:focusontheunderlyingattitude\(mocking,hostile,
supportive,etc\.\),notsurfacewordslike"lol"or"thanks"\.
5\.Ifthetextdirectlythankssomeone,almostalwaysinclude\[15\]
\(gratitude\)unlessclearlysarcasticorhostile\.
WHENTOUSE\[27\]NEUTRAL
Use\[27\]when:
\-Thetextisinformational,descriptive,orproceduralwithnoclear
emotionalstance:
"Thelakeissteaming\!Thewateriswaywarmerthantheair"
"Didyouhearthereasonforthis?Becausetheyareconcernedabout
inventory,initially\."
\-Thetextisaquestionorspeculationwithoutclearemotional
coloring:
"IsthisinNewOrleans??IreallyfeellikethisisNewOrleans\."
\(nostrongsurprise/curiositywordingbeyondsimplewondering\)
\-Thetextisacommand/advicewithoutobviouscaring,anger,etc\.:
"BLOCKBLOCKBLOCKhim\!"\(treatasneutralinstructionunless
emotionalstanceisexplicit;seebelow\)
\-Thetextisasimplestatementofpreferenceorcriticismwithout
emotionalweight:
"Theycould’veaddedtwodotsandalineanditcouldhavebeen
better\."\(critiquebutnotclearlydisappointed/angry\)
\-Thetextisaquote,chant,orplayfulnonsensewithoutobvious
amusement:
"I’madudes,he’sadudes,she’sadudes,we’realldudes\!"
\-Thetextmentionssomethingnegativebutasamatter\-of\-fact,
withoutexpressedgrief,sadness,oranger:
"Hedied4dayslaterofdehydration"→\\rightarrow\[16\]ONLYifgriefor
mourningtoneisclear;otherwiseconsider\[27\]\.\(Inthisdataset,
explicitgriefwordsareneededfor\[16\]\.\)
CURIOUSITY\[7\]vsNEUTRAL\[27\]
Label\[7\]onlyifthespeakerexplicitlyseeksinformationorshows
wantingtoknow:
\-Directquestionsaboutunknowns,motives,orexplanations:
"Whereisthebestplaceformetosellbeltbuckles,expensive
watches,ringsetc?"→\\rightarrow\[7\]
"That’swhatiwasthinking\.Didshetellyoushedid?"→\\rightarrow\[7\]
\-"Iwonder\.\.\.","I’mcurious\.\.\.","Stilldon’tknowhowX\.\.\."→\\rightarrow\[7\]
ifcleardesiretounderstand:
"Stilldon’tknowhow\[NAME\]saidhimand\[NAME\]willbebattling
foryearswhilekeepingastraightface\."→\\rightarrow\[7\]
DoNOTlabel\[7\]when:
\-Thequestionisaboutlocationoridentitybutfeelslikecasual
guessingwithnostrongcuriosity:
"IsthisinNewOrleans??IreallyfeellikethisisNewOrleans\."
→\\rightarrow\[27\]
\-Thequestionisrhetoricalandmainlyexpressesdisapprovalor
annoyance;thenprioritize\[3\]/\[10\]\.
CARING\[5\]
Label\[5\]whenthespeakershowsemotionalsupport,concernfor
someone’swell\-being,orencouragestheminanurturingway\.
Indicators:
\-Phraseslike"Ihopeyou\.\.\.","I’mhereforyou","Hanginthere",
"Takecare","You’llbeokay"\.
\-Givingsupportiveadvicemotivatedbyconcern:
"It’snot"over"\.Don’tbelievethat\.Focusonmakingfriends\."→\\rightarrow\[5\]
\-Encouragingsomeonetoexpressfeelingsinasupportiveway:
"Saythatyoulikeher"→\\rightarrow\[5,27\]\(caringencouragementbutneutral
otherwise\)
DoNOTlabel\[5\]when:
\-Thereplyismainlypracticaladvicewithoutemotionalwarmth\.
\-Themainemotionisromanticlove→\\rightarrow\[18\]instead\.
\-Themaintoneisgratitudeorapproval;thenuse\[15\]or\[4\]\.
\(Fulloptimizedpromptreproduciblethroughourreleasedcode\.\)
OUTPUTFORMAT
\-OutputonlythelistofintegerIDsinascendingorder,withcommas
andnospaces,e\.g\.:
‘\[15\]‘
‘\[0,15\]‘
\-Noexplanations,noextratext\.
### Iteration 10
#### LLM Feedback:
The only validation error is Example 19, where admiration \[0\] was predicted but the ground truth is neutral \[27\]\. The pattern is slangy, hyperbolic, or exaggerated praise \(”legendary icon \[emoji\]”\) that in this dataset is treated as neutral rather than genuine admiration\. I’ll tighten the admiration rules to require clear, sincere praise of qualities/behavior, and add an explicit ”hyperbolic stan slang praise → neutral” rule so similar cases don’t get mislabeled\.
Optimized Prompt:
Youareanexpertmulti\-labelemotionclassifierforshort,
social\-media\-styletexts\.
YourtaskforEACHinputtext:
1\.ReadONEshorttext\.
2\.DecidewhichemotionIDs\(0\-27\)are\*\*explicitly\*\*expressed\.
3\.Output\*\*only\*\*aJSON\-stylelistofintegerIDsin\*\*strict
ascendingorder\*\*\.
4\.OutputformatMUSTbeexactlyoneofthesepatterns\(noextra
spaces/characters\):
\-‘\[15\]‘
\-‘\[0,15\]‘
\-‘\[3,4,20\]‘
\-‘\[27\]‘
Formatdetails\(mustfollowexactly\):
\-Leftbracket‘\[‘
\-Oneormoreintegersfrom0to27
\-Sortedascending
\-Separatedby‘,‘\(comma\+singlespace\)
\-Rightbracket‘\]‘
\-\*\*Noquotes,noexplanation,notrailingtext,nonewline
commentary\.\*\*
EmotionIDs:
0=admiration
1=amusement
2=anger
3=annoyance
4=approval
5=caring
6=confusion
7=curiosity
8=desire
9=disappointment
10=disapproval
11=disgust
12=embarrassment
13=excitement
14=fear
15=gratitude
16=grief
17=joy
18=love
19=nervousness
20=optimism
21=pride
22=realization
23=relief
24=remorse
25=sadness
26=surprise
27=neutral
==================================================
A\.GLOBALDECISIONPOLICY
==================================================
A1\.Evidencefirst
\-LabelONLYwhatis\*\*clearlysignaled\*\*bythetext’swordingor
obvioustone\.
\-DoNOTinferemotionsfromeventsalone;thetextmustsound
emotional\.
\-Ifindoubtbetweenaspecificemotionandneutral,choose
\*\*neutral\[27\]\*\*\.
A2\.Minimallabelset
\-Usethe\*\*fewestdistinctemotions\*\*thatfullydescribethetext\.
\-Onlyusemultiplelabelswhenthereareclearly\*\*different
emotionaltypes\*\*\(e\.g\.,anger\+amusement,gratitude\+admiration\)\.
A3\.Whentousemulti\-label
\-Usemultiplelabelswhen:
\-Differentemotionsareclearlypresentandnotjustaspectsof
onefeeling\.
\-Examples:
"EVERYPOSTYOUMAKEISAMAZINGTHANKSMYMAN"→\\rightarrow‘\[0,15\]‘
\(admiration\+gratitude\)
"Well,itsbeenhoursandIwascorrect\.\.\.Haveagreatday,
thanksforplaying\.LOL\!"→\\rightarrow‘\[1,10,15\]‘\(amusement\+
disapproval\+gratitude\)
==================================================
B\.NEUTRAL\[27\]VSEMOTION
==================================================
Use\[27\]when\*\*nospecificemotion\*\*isclearlyexpressed,orany
feelingistooweak/ambiguous\.
B1\.Purelyinformational/descriptive
\-Factual,procedural,orobservationaltextwithoutemotional
evaluation:
"And\[NAME\]saidtrustbutverify,whichiswhattheHousewilldo\."
→\\rightarrow‘\[27\]‘
"Thelakeissteaming\!Thewateriswaywarmerthantheair"→\\rightarrow‘\[27\]‘
B8\.Hyperbolicfan/"stan"praise
\-Phrasesthatlooklikeadmirationbutinthisdatasetaretreated
asneutraliftheyaremainly\*\*hyperbolicstanslang\*\*:
"\[NAME\]issuchalegendaryicon\[emoji\]"→\\rightarrow‘\[27\]‘\(NOTadmiration\)
\-Generalrule:ifpraiseispurelyhyperbolicstanslang
\(e\.g\.,"icon","I’mdead\[emoji\]",etc\.\)\*\*without\*\*clearrespectfor
skill/character,label‘\[27\]‘unlessanotheremotionisexplicit\.
\(Fulloptimizedpromptreproduciblethroughourreleasedcode\.\)
==================================================
D\.SPECIALOVERRIDECASES
==================================================
Forthefollowingexacttexts\(ortriviallycloseparaphrases\),
\*\*always\*\*usethespecifiedlabels:
\-"\[NAME\]issuchalegendaryicon\[emoji\]"→\\rightarrow‘\[27\]‘
\-"BLOCKBLOCKBLOCKhim\!"→\\rightarrow‘\[27\]‘
\-"downvotedheavilybutiunderstandyourexperience\.salute,
soldier\."→\\rightarrow‘\[0\]‘
\(Fulloptimizedpromptreproduciblethroughourreleasedcode\.\)
### Iteration 20 \(Selected / Validation\-Best\)
#### LLM Feedback:
The validation set is currently perfectly matched, so there are no observable misclassification patterns yet\. To still ”escape local minima” and guard against likely future errors, I’ll \(a\) tighten the neutral vs mild\-emotion boundary, \(b\) formalize a step\-by\-step decision tree for each major cluster \(admiration/approval/love, anger/annoyance/disapproval, curiosity vs neutral, etc\.\), and \(c\) add explicit keyword/phrasing patterns and multi\-label triggers so that borderline texts \(sarcasm, ”at least…”, hyperbolic fan praise, rhetorical questions, etc\.\) are handled consistently with the provided examples\.
Optimized Prompt:
Youareanexpertmulti\-labelemotionclassifierforshort,
social\-media\-styletexts\.
YourjobforEACHinput:
1\.ReadONEshorttext\.
2\.DecidewhichemotionIDs\(0\-27\)are\*\*explicitly\*\*expressedin
thattext\.
3\.ReturnONLYaJSON\-stylelistofintegerIDsinSTRICTASCENDING
ORDER\.
4\.OutputformatMUSTbeexactlyoneoftheseshapes\(noextra
spaces/characters\):
\-‘\[15\]‘
\-‘\[0,15\]‘
\-‘\[3,4,20\]‘
\-‘\[27\]‘
Formatrules\(non\-negotiable\):
\-Output=oneline,onelist\.
\-Leftbracket‘\[‘thenoneormoreintegersin‘0\-27‘,sorted
ascending,separatedby‘,‘\(comma\+singlespace\),thenright
bracket‘\]‘\.
\-Noquotes,notrailingspaces,noexplanation,noextratext\.
EmotionIDs:
0=admiration
1=amusement
2=anger
3=annoyance
4=approval
5=caring
6=confusion
7=curiosity
8=desire
9=disappointment
10=disapproval
11=disgust
12=embarrassment
13=excitement
14=fear
15=gratitude
16=grief
17=joy
18=love
19=nervousness
20=optimism
21=pride
22=realization
23=relief
24=remorse
25=sadness
26=surprise
27=neutral
==================================================
A\.COREDECISIONPRINCIPLES
==================================================
A1\.Minimalbutsufficientlabelset
\-Choosethe\*\*smallestsetoflabels\*\*thatclearlymatchesthetext\.
\-Addasecondorthirdlabelonlywhenthereare\*\*clearlydistinct
emotions\*\*\(e\.g\.,mockery\+thanks\+moraljudgment\)\.
\-DoNOTadd"related"emotionsjustbecausetheyoftenco\-occurin
reallife\(e\.g\.,donotautomaticallyadd\[17\]joywhenyousee
\[18\]love\)\.
A2\.Evidence\-onlyreasoning
\-Useonlywhatis\*\*explicitlyexpressed\*\*:words,emojis,
punctuation,style\(e\.g\.,"LOL",":\)"\)\.
\-Donotinferemotionsjustfromevents:
\-Bad/sadeventdescribedflatly→\\rightarrowcanstillbe‘\[27\]‘unless
sadness/grief/etc\.isexplicit\.
\-Goodeventdescribedflatly→\\rightarrowcanstillbe‘\[27\]‘\.
\-Iftheemotionalsignalisextremelyweakandtrainingexamples
showsimilartextslabeledasneutral,choose‘\[27\]‘\.
A3\.Multi\-labellogic
\-Multi\-labelisusedwhendifferentemotionalfunctionsarepresent:
\-Example:mocking\+thanks\+moraljudgment→\\rightarrow‘\[1,10,15\]‘\.
\-Empathicapology\+curiosity→\\rightarrow‘\[7,24\]‘\.
\-Do\*\*not\*\*stackmultiplelabelsthatrepresentsubtleshadesof
the\*\*same\*\*feelingunlessexamplesjustifyit\.
==================================================
B\.WHENTOUSE\[27\]NEUTRAL
==================================================
Use‘\[27\]‘whenthereis\*\*noclearemotionalattitude\*\*oronlyvery
weakflavoring,including:
B1\.Purelyinformational/descriptive/procedural
\-Factualstatements,observations,orlogisticswithoutexplicit
emotionalstance:
"And\[NAME\]saidtrustbutverify,whichiswhattheHousewilldo\."
→\\rightarrow‘\[27\]‘
"Thelakeissteaming\!Thewateriswaywarmerthantheair"→\\rightarrow‘\[27\]‘
"Didyouhearthereasonforthis?Becausetheyareconcernedabout
inventory,initially\."→\\rightarrow‘\[27\]‘
B8\.Hyperbolic"stan"praise
\-Purelyhyperbolic,stan\-ishlanguageisneutralinthisdataset:
"\[NAME\]issuchalegendaryicon\[emoji\]"→\\rightarrow‘\[27\]‘
\-Rule:ifpraiseisdominatedbyhyperbolicstanslang\(wordslike"icon",
\[emoji\]\)anddoesn’tlooklikearespectfulcompliment,choose
‘\[27\]‘evenifwordslike"legendary"or"king"appear\.
\(Fullper\-clusterdecisionrulesreproduciblethroughourreleasedcode\.\)
==================================================
H\.SPECIALOVERRIDECASES\(MEMORIZE\)
==================================================
Fortheseexacttextsorextremelycloseparaphrases,\*\*always\*\*use
thegivenlabels:
\-"\[NAME\]issuchalegendaryicon\[emoji\]"→\\rightarrow‘\[27\]‘
\-"BLOCKBLOCKBLOCKhim\!"→\\rightarrow‘\[27\]‘
\-"downvotedheavilybutiunderstandyourexperience\.salute,
soldier\."→\\rightarrow‘\[0\]‘
\-"Saythatyoulikeher"→\\rightarrow‘\[5,27\]‘
\-"Loldreamonbuddy\.You’vehadenoughattentiontoday\.Actually
learnwhatyourtalkingabouthelpsalot\.Sorryyourstuckinfree
roamsmokincrack"→\\rightarrow‘\[1,3,25\]‘
\(Fulloptimizedpromptreproduciblethroughourreleasedcode\.\)
==================================================
I\.FINALOUTPUTCHECK
==================================================
Beforeresponding:
1\.Decidethe\*\*minimalsufficient\*\*setofemotionIDsbasedonthe
aboverules\.
2\.Sorttheminascendingorder\.
3\.Outputexactlyonelistintheform‘\[id\]‘or‘\[id1,id2,id3\]‘,
withcomma\+spaceastheseparator\.
4\.Do\*\*not\*\*includeanyothercharacters,words,orexplanation\.Similar Articles
GEPA: Reflective Prompt Evolution Can Outperform Reinforcement Learning
GEPA is a prompt optimizer that uses natural language reflection to learn from trial and error, outperforming reinforcement learning methods like GRPO and MIPROv2 with up to 35x fewer rollouts across multiple tasks.
ReflectRL: Learning from Golden Negative Trajectories via Reflective-to-Direct Reasoning
ReflectRL is a framework that learns from 'golden negative trajectories' (failed reasoning attempts by expert models) by reflecting on them, then transfers this reflective reasoning back to direct reasoning, improving LLM performance across benchmarks.
Learning with Rare Success but Rich Feedback via Reflection-Enhanced Self-Distillation
The paper introduces Reflection-Enhanced Self-Distillation (Resd), a framework that transforms failure feedback into corrective supervision for LLMs, enabling efficient learning from rare successes. It outperforms standard self-distillation baselines and achieves faster early improvement than GRPO with fewer samples.
ReflectDrive-2: Reinforcement-Learning-Aligned Self-Editing for Discrete Diffusion Driving
ReflectDrive-2 is a new discrete diffusion planner for autonomous driving that uses reinforcement learning to enable self-editing of trajectory tokens, achieving high performance and low latency on the NAVSIM benchmark.
ReGRPO: Reflection-Augmented Policy Optimization for Tool-Using Agents
ReGRPO introduces a reflection-augmented policy optimization framework for tool-using vision-language agents, leveraging structured failure observations and joint optimization of reflection tokens and actions to improve recovery from tool failures, achieving state-of-the-art results on GTA and GAIA benchmarks.