Landscape and Taxonomy of Prompt Engineering Patterns in Software Engineering
Organizations: Waseda University, Tokyo 169-8555, Japan
Abstract
Advancements in large language models (LLMs) have enhanced their ability to handle ambiguous user instructions. However, effective prompt patterns remain crucial for usability and comprehension. This article presents a taxonomy of prompt engineering patterns for software engineering. It is based on a systematic literature review that was conducted in early 2023, when LLMs still faced significant limitations in context length and inference capabilities. Our study explores techniques that enhance the usability and reliability of LLMs, emphasizing the ongoing importance of well-designed prompts in optimizing task performance. Our findings highlight the critical role of prompt patterns in maximizing LLM's potential, even as their capabilities continue to evolve.
Figures & tables
| ID | Category | Subcategory | Pattern Name | Problem | Solution |
| PA1 | Learning approaches | Few-shot learning applications | Example-based few-shot prompting for code generation | Improving LLMs’ code generation efficiency for various tasks without extensive customization or fine-tuning. | Employing few-shot learning in LLMs with strategic examples or prompts for efficient, tailored code generation. |
| PA2 | Abstraction and clue integration for code interpretation | Efficiently retrieve, interpret, and structure SE knowledge while addressing context-specific needs. | Design few-shot prompts or abstract code for better code interpretation, quality, and modularity. | ||
| PA3 | Example-guided prompting for conflict resolution | Time-consuming manual resolution of textual and semantic merge conflicts in software development. | Introduces a merge tool by using k-shot learning for automated merge conflict resolution. | ||
| PA4 | Code sample retrieval | Selecting effective prompts for code-related few-shot learning with LLMs. | Introduces the automated retrieval technique for selecting relevant code demonstrations for prompts. | ||
| PA5 | Zero-shot applications | Zero-shot APR and vulnerability repair | Utilizing LLMs for application error explanations and vulnerability patching in zero-shot settings. | Strategic zero-shot learning prompts for LLMs to clarify error messages and generate secure software patches. | |
| PB1 | Interaction-focused methods | Interactive prompting and iterative refinement | User-model collaboration refinement | Enhancing interactive dialogue, specification-to-model translation, and AI-assisted coding through improved user-model collaboration. | Implement interactive and iterative prompt designs (ReAct) for conversational assistants, object model synthesis, and educational code generation. |
| Pattern | QA by pattern | Pattern | QA by pattern |
|---|---|---|---|
| PA1 | FS, IC, M, F | PB9 | FS, IC, F |
| PA2 | FS, IC, M, F | PB10 | FS, R, Se |
| PA3 | FS, PE, C, IC, M, F | PB11 | FS, IC |
| PA4 | FS, IC, M, F | PC1 | FS, M, F |
| PA5 | FS, Se, M | PC2 | FS, Se, M |
| PB1 | FS, IC, M, F | PC3 | FS, IC, M |
| LLM | Con | Tes | Mai | Des | Reqs | Total |
| Codex | 12 | 14 | 10 | 8 | 4 | 18 |
| GPT-3/3.5 | 7 | 4 | 6 | 6 | 4 | 9 |
| CodeGen | 2 | 2 | 1 | 1 | 1 | 2 |
| PolyCoder | 2 | 1 | 2 | 1 | 0 | 2 |
| Codex | 2 | 1 | 1 | 1 | 0 | 2 |
| LaMDA | 1 | 1 | 1 | 1 | 1 | 1 |
Prompt Engineering
Prompt engineering designs and evaluates instructions, context, examples, and learned prompts to steer AI model behavior.
See all 136 papers