Introduction
Creating high-fidelity mobile app prototypes is a cornerstone of Requirements Elicitation (RE), allowing stakeholders to visualize abstract needs early in the development cycle. However, manual prototype creation is often a bottleneck, requiring significant time and expertise in specialized design tools. While automated approaches using sketches or screenshots exist, generating functional GUIs from natural language descriptions remains an underdeveloped frontier. This research explores how structured prompting strategies can enable Large Language Models (LLMs), specifically GPT-4, to transform high-level human intent into functional HTML/CSS code.
Methodology: Structured Prompting Strategies
The study evaluates five prompting strategies designed to bridge the gap between simple text descriptions and complex UI code. These strategies range from basic instructions to multi-step decomposition:
- Instruction Prompting: A direct, single-step request for code generation.
- Chain-of-Thought (CoT-ZS): A zero-shot approach instructing the model to "think step-by-step" through feature identification, component listing, and layout creation before coding.
- CoT-FS (Few-Shot): The CoT approach supplemented with two input/output examples.
- Prompt Decomposition (PD-ZS): A sequential interaction where the task is broken into four distinct prompts. The output of one stage (e.g., feature list) serves as the input for the next.
- PD-FS (Few-Shot): The decomposed approach enhanced with real-world examples.
By decomposing the task, the researchers provide the LLM with more "computation cycles" (token space) to refine design logic independently of syntax generation, preventing the model from jumping straight into code without a plan.
Experimental Setup
To evaluate these methods, the authors developed a curated dataset of 30 diverse mobile GUIs sampled from the Rico dataset, spanning 21 app domains. High-level descriptions were generated by GPT-4 and manually verified for accuracy. A group of 20 expert crowd-workers then evaluated 150 resulting prototypes based on three metrics: Accuracy of Features (AoF), Quantity of Features (QoF), and Visual Appeal (VA).
Key Results and Analysis
The results indicate that structured prompting significantly enhances both the functional depth and aesthetic quality of generated GUIs.
Feature Richness and Accuracy
While GPT-4 maintained high Accuracy of Features (AoF) across all methods, the Quantity of Features (QoF) saw a dramatic improvement with Prompt Decomposition. The median QoF score rose from 2.8 (Instruction) to 3.8 (PD-ZS). For instance, a translation app prototype evolved from a simple text box to a comprehensive interface including voice input, language detection, and "favorite" buttons when using decomposed prompts.
The Role of Few-Shot Examples
Structure alone was insufficient for high-quality aesthetics. Visual Appeal (VA) improved significantly when "Few-Shot" examples were introduced (PD-FS). These examples guided the model toward mobile-first design patterns, resulting in better icon integration, cleaner spacing, and more professional color palettes compared to the generic web-style layouts produced by zero-shot methods.
Discussion and Future Work
Despite the advancements, several challenges remain. The model occasionally produced "hallucinations," such as generating desktop-wide layouts despite mobile instructions or using text placeholders (e.g., "Chart goes here") instead of functional components. Alignment issues, where UI elements overlapped or fell outside the intended container, were also noted.
Future research will focus on testing these strategies across a broader range of LLMs and developing pipelines to import generated code directly into design tools like Figma, enabling a seamless transition from automated prototyping to human-led design refinement.
Summary updated