MoPrO-SD: Modular Prompt Optimization for Stance Detection

Meysam Sabbaghan, Nikesh Gyawali, Arman Zareian Jahromi, Sebastian Loera-Lozano, Doina Caragea, Cornelia CarageaarXiv 2026

TL;DR

MoPrO-SD (Modular Prompt Optimization for Stance Detection) is a new framework that improves how Large Language Models (LLMs) identify attitudes in text by breaking prompts into functional modules (like label definitions and guidelines) and refining them sequentially. By using "class-conditioned" feedback—where errors in "Favor" predictions specifically inform the "Favor" definition—the system achieves significant performance gains over human-written prompts and matches complex state-of-the-art optimization methods.

What Problem Does This Paper Address?

Stance detection—determining if a text is In-Favor, Against, or Neutral toward a target—is a deceptively difficult NLP task. LLMs often struggle with it because stance is frequently expressed through sarcasm, implicit opinions, or context-heavy language.

While we can improve LLM performance through "prompt engineering," the process is notoriously finicky; small changes in wording or example ordering can lead to wild swings in accuracy. Existing automated prompt optimizers tend to treat the prompt as a single "black box" or use general-purpose strategies. The authors of this paper argue that stance detection has a specific semantic structure (the definitions of the three classes) that general optimizers ignore, leading to sub-optimal results.

Methods

The core innovation is MoPrO-SD, which treats prompt optimization as a modular, iterative process.

  1. Modularity: Instead of one long prompt, MoPrO-SD decomposes it into six functional modules: Task Definition, Guidelines, Favor Definition, Against Definition, Neutral Definition, and Output Format.
  2. Sequential Refinement: The framework uses a "coordinate descent" approach. It keeps five modules fixed while an "optimizer LLM" suggests improvements for the sixth, based on performance on a validation set.
  3. Refinement Strategies: The authors tested three levels of sophistication:
  4. Instruction-only (I): The optimizer looks at previous prompt versions and their scores to guess a better version.
  5. Instruction + Reasoning (I+R): The optimizer analyzes an aggregate pool of misclassified examples to identify common failure modes.
  6. Instruction + Per-example Reasoning (I+R+E): The optimizer generates an individual explanation for every error, summarizes these explanations, and then updates the module.
  7. Class-Conditioned Feedback: This is the "secret sauce." When refining the "Against Definition" module, the system only provides the optimizer with examples where the model failed on "Against" labels. This targeted feedback prevents the optimizer from getting "distracted" by unrelated errors.
Figure 1: Overview of MoPrO-SD. Starting from a six-module base prompt, MoPrO-SD sequentially refines the modules using instruction-only (I), instruction with reasoning (I+R), or instruction with per-example reasoning (I+R+E). After each iteration, the updated prompt is evaluated using validation Macro-F1, and the highest-scoring prompt is selected for final test evaluation.

Datasets

The researchers evaluated MoPrO-SD across four diverse datasets:

  • SemEval-2016 Task 6: A classic benchmark covering controversial topics like atheism and climate change.
  • GunStance: Tweets regarding gun control and regulation.
  • COVID-19-Stance: Tweets about masks, school closures, and stay-at-home orders.
  • VaccineStance (New): A newly introduced benchmark curated by the authors. It contains 2,000 human-annotated tweets spanning a decade (2013–2022), providing a robust test for vaccine-related discourse.

Key Insights and Ideas

  • Targeted Feedback Wins: The "class-conditioned" approach—routing specific errors to specific modules—consistently outperformed "pooled" feedback (where all errors are lumped together). This suggests that for classification tasks, modularity should follow the label structure.
  • Reasoning Granularity is Model-Dependent: Interestingly, more reasoning isn't always better. While I+R+E (per-example) was often the strongest, the simpler I+R (aggregate) actually performed better for certain model-dataset pairs.
  • The "External Reasoner" Boost: Using a very powerful model (like GPT-5) to optimize the prompt for a smaller, open-weight model (like Phi-4 or Mistral) yielded massive gains—up to +11.64 Macro-F1 points. This highlights a "teacher-student" dynamic in prompt engineering.
  • Iterative Gains: As shown in the trajectories, most models find useful refinements within the first 3–5 iterations, though continued optimization can sometimes lead to fluctuations rather than monotonic improvement.
Figure 2: Validation Macro-F1 trajectories across 10 optimization iterations using I+R+E. Curves show mean validation Macro-F1 across three independent runs, with shaded regions indicating the corresponding standard deviation.

Key Results

  • Broad Improvement: The I+R+E strategy improved upon the human-written "Base" prompt in 18 out of 20 tested dataset-model combinations.
  • Significant Gains: Some of the largest jumps were seen with the Phi-4 model, which improved from 39.55 to 59.74 (+20.19) on GunStance and from 50.36 to 69.97 (+19.61) on COVID-19-Stance.
  • Competitive Performance: MoPrO-SD achieved results comparable to or better than specialized structured optimizers like UniPrompt and SCULPT, while often being more token-efficient during the optimization phase.
  • Sarcasm Recovery: Qualitative analysis showed that optimized prompts were significantly better at "recovering" the correct stance in sarcastic tweets where surface-level sentiment was misleading.
A case study showing how MoPrO-SD correctly identifies stance in a sarcastic tweet where the base prompt failed.

Limitations and Future Work

  • Task Specificity: The current 6-module structure is hard-coded for 3-class stance detection. Adapting this to tasks with dozens of labels or different reasoning requirements remains a challenge.
  • Optimization Cost: While the final optimized prompt is "free" to use at inference time, the process of finding that prompt requires many LLM calls and validation passes, which can be expensive and time-consuming.
  • Transferability: A prompt optimized for Llama-3 might not work well for Mistral. The authors note that prompts remain highly model- and domain-dependent.
  • Future Directions: The authors suggest exploring more complex label spaces and investigating how to make the modular structure itself more dynamic or automatically discoverable.

Summary updated

BibTeX
@misc{sabbaghan2026mopro,
  author = {Meysam Sabbaghan and Nikesh Gyawali and Arman Zareian Jahromi and Sebastian Loera-Lozano and Doina Caragea and Cornelia Caragea},
  title = {{MoPrO-SD: Modular Prompt Optimization for Stance Detection}},
  year = {2026},
  eprint = {2610.13386},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.13386},
}
Figure