I see lots of people asking about how to do this or how to do that with prompts. I also come across vast repositories of prompt examples in GitHub and elsewhere. However, many of the prompts are just variations of the same pattern.
Defining patterns has been an important part of software engineering for decades (since the Gang of Four) and I believe that it is similarly better for people to learn some core patterns rather than lots of specific instances.
In the LinkedIn post below I summarise a number of patterns, but this is not a complete list.
I like the idea of using patterns, especially success patterns. However, I have some concerns that a lot of time could be invested in patterns that will ultimately be proven to be brittle spell-casting techniques bound to a specific model. Am I overthinking this fear?
Scaffolding is more about putting supports around what you are building - it is not the building itself. As an example from Data Visualization, Alberto Cairo will call all the Labels, Axes, Annotations, etc. the “scaffolding” for the chart - they are not the chart but they support it and help users to understand what is going on.
It could, it could also be a subset of the constraint pattern and also the multi-step! It is not a 1:1 relationship to any of them so can stand, I think, on its own. Also conscious of looking for a balance between too many patterns and to few.
I don’t have a particular favorite - yet! As a fun example, I did have a very vivid dream a few nights ago and asked ChatGPT to “Act as a professional psychologist. Interpret this dream…”
I am currently preparing a longer format “eBook” that will have examples and more description (still working out what it the best way of sharing that). In the meantime, a great way of getting examples is to ask GPT-4! Just copy the text from the article like this:
Given the description of a pattern for prompt engineering below, can you generate some examples:
The Scaffolding Pattern is a design pattern that improves the quality of Large Language Model (LLM)-generated responses by providing a clear structure and guiding the AI towards the desired information. It involves breaking down a prompt into smaller, more focused questions or instructions, which helps maintain focus and coherence in the AI’s response. Benefits of the Scaffolding Pattern include improved clarity and structure, enhanced precision, and reduced ambiguity.
The Scaffolding Pattern is effective in generating well-structured and informative responses. By breaking down prompts into smaller, focused components, you can guide the AI more effectively towards the desired outcome, making your experiences with LLMs more fruitful and productive.
Documenting these prompt engineering patterns is quite helpful! You might also enjoy our recent paper entitled " A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT", which is available at arxiv dot org.