Prompt Engineering as Code (PEaC): an approach for building modular, reusable, and portable prompts
Prompt engineering is an emerging skill associated with improving the way we interact with Large Language Models (LLMs). However, natural language lacks key features such as modularity, reusability, and portability, which are essential for creating efficient, scalable prompt systems. In programming, these features are managed through Infrastructure as Code (IaC), where developers use modular code to manage infrastructure. This work aims to show how it is possible to achieve the same objective in the prompt engineering sector, too. Prompt Engineering as Code (PEaC) is a novel approach that organizes prompts through a human-readable data serialization language, in order to realize modular, reusable, and portable prompts. We design a syntax language in which prompts can be assembled as modular components, akin to importing functions or defining reusable variables in conventional programming languages. We assess the methodology by showcasing its implementation to multiple LLM-driven applications and evaluating enhancements in prompt management and adaptability. Preliminary findings suggest that PEaC increases prompt reusability, reduces redundancy, and promotes the adaptability of prompt systems across many applications. This method represents progress in the establishment of standardized and scalable engineered prompts.
Authors
- Simon Pietro Romano (ORCID: https://orcid.org/0000-0002-5876-0382)
- Gaetano Perrone (ORCID: https://orcid.org/0000-0001-8238-6426)
Publication Details
- Published
- 2024-11-26
- DOI
- https://doi.org/10.1109/fllm63129.2024.10852434
- Citations
- 3
- Primary Topic
- Formal Methods in Verification
- Type
- article
- Field-Weighted Citation Impact
- 1.08