TL;DR
REprompt is a novel multi-agent prompt optimization framework that bridges the gap between vague human intent and the precise specifications required for AI-driven software development. By treating prompts as software requirements, it systematically applies traditional Requirements Engineering (RE) principles—elicitation, analysis, specification, and validation—to automatically generate highly effective system and user prompts. The framework consistently outperforms standard prompt engineering baselines across multiple large language models (LLMs), significantly improving the usability and quality of the resulting software applications.
What Problem Does This Paper Address?
The rise of "vibe-coding" and LLM-based coding agents has shifted the software development paradigm. Instead of writing boilerplate code, developers now use natural language prompts to guide AI agents in generating entire software projects. However, crafting effective prompts remains a major bottleneck. Human users often provide vague, ambiguous, or incomplete instructions (naive prompts), whereas software development demands fine-grained, structured, and dependency-aware specifications.
While automated prompt engineering tools exist, they typically optimize prompts along simplistic dimensions, such as making them longer, more detailed, or safer. They completely ignore the rigorous, methodological principles of Requirements Engineering (RE). This paper addresses this gap by introducing a structured framework that translates raw user ideas into engineering-compliant prompts.
Methods
REprompt introduces a multi-agent architecture that mirrors the four classic stages of requirements development:
- Requirements Elicitation: An Interviewer agent and an Interviewee agent engage in a structured dialogue to flesh out the user's initial prompt. Drawing inspiration from Model-Based Systems Engineering (MBSE), this phase structures raw requirements early on and produces a comprehensive interview record.
- Requirements Analysis: The Interviewer agent analyzes the interview record to produce a preliminary draft of a Software Requirements Specification (SRS), guided by the formal entity categories of the IEEE 29148 standard.
- Requirements Specification: A CoTer (Chain-of-Thought) agent transforms the SRS draft into a structured Chain-of-Thought format. For user prompts, this becomes a JSON-formatted, dependency-aware programming task list. For system prompts, it populates predefined agent prompt templates.
- Requirements Validation: A Critic agent evaluates the generated Chain-of-Thought using structural scoring based on RE principles (completeness, correctness, organization, quality) and prompt engineering guidelines (clarity, conciseness, consistency).
To keep the system grounded, a human-in-the-loop mechanism is integrated at the end of each stage, requiring user confirmation before proceeding to prevent LLM hallucinations. The agents are supported by external knowledge bases (IEEE standards, prompt manuals) and a globally shared context.
Datasets
The authors introduced a new benchmark dataset called APPDev to evaluate user prompt optimization. The dataset consists of 20 distinct application scenarios divided into two primary categories:
- Games (10 scenarios): High-interactivity tasks with complex logic, such as Chess, Go, Tetris, and a sliding block puzzle.
- Tools (10 scenarios): Workplace utility applications with lower interactivity, including a calculator, a clock-in app, and a text sentiment analysis tool.
Key Insights and Ideas
- Prompts as Requirements: The core philosophical insight is that prompts in AI-driven software engineering are fundamentally a new form of software requirements, meaning they can—and should—be governed by formal RE methodologies.
- Upstream Optimization Matters Most: In multi-agent systems, directly optimizing a specific downstream agent isn't always the most effective path. Optimizing upstream agents (like a Team Leader) refines the operational context for the rest of the pipeline, yielding the most significant overall improvements in document and software quality.
- Elicitation and Analysis are Crucial: Ablation studies revealed that omitting either the Elicitation or Analysis phase caused the steepest drops in performance, proving that structured interviewing and drafting are vital to translating human intent accurately.
Key Results
The framework was validated using Qwen2.5-Max, GPT-4, and GPT-5 across two main tasks:
- System Prompt Optimization (MetaGPT): In LLM-as-a-judge evaluations, REprompt-optimized role prompts achieved high scores of up to 4.7 in consistency and 4.5 in communication (out of 5). In human evaluations of the final software artifacts, it achieved an overall user satisfaction score of 5.75 and a usability score of 5.42 (out of 7).
- User Prompt Optimization (YouWare Platform): When tested on the vibe-coding platform YouWare, REprompt significantly outperformed naive prompts and standard Chain-of-Thought baselines. For the challenging games subset, it achieved an overall satisfaction score of 6.30, usability of 6.17, and interface quality of 6.53 (out of 7).
Limitations and Future Work
While highly effective, the authors note a few limitations:
- LLM Stochasticity: The inherent randomness of LLMs means that agents can occasionally fail to generate documentation, requiring a re-execution strategy (up to three attempts).
- Evaluation Scope: Due to computational and manual scoring costs, some ablation and multi-LLM validation experiments were restricted to single-agent optimizations (focusing primarily on the Team Leader agent).
- Model Dependency: The framework was primarily benchmarked on frontier models (GPT-4, GPT-5, Qwen2.5-Max), and performance characteristics may vary when deploying smaller or weaker foundation LLMs.
Summary updated