Automated Prompt Engineering: The Definitive Hands-On Guide | by Heiko Hotz | Sep, 2024


Learn how to automate prompt engineering and unlock significant performance improvements in your LLM workload

Towards Data Science
Image by author — Created with Imagen 3

Automated Prompt Engineering (APE) is a technique to automate the process of generating and refining prompts for a Large Language Model (LLM) to improve the model’s performance on a particular task. It uses the idea of prompt engineering which involves manually crafting and testing various prompts and automates the entire process. As we will see it is very similar to automated hyperparameter optimisation in traditional supervised machine learning.

In this tutorial we will dive deep into APE: we will first look at how it works in principle, some of the strategies that can be used to generate prompts, and other related techniques such as exemplar selection. Then we will transition into the hands-on section and write an APE program from scratch, i.e. we won’t use any libraries like DSPy that will do it for us. By doing that we will get a much better understanding of how the principles of APE work and are much better equipped to leverage the frameworks that will offer this functionality out of the box.

Recent Articles

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here