There has been a lot of chatter in the technology world about AI (artificial intelligence) prompt engineering. I wanted to dive in and learn more about that topic and skillset, so I registered for the “ChatGPT Prompt Engineering for Developers” course through DeepLearning.AI. I’ve taken other AI courses with Andrew Ng and was interested in what he had to teach. This article is the first in a series of posts related to what I’m learning about AI prompt engineering going through the course.
I’ve been interested in using API calls to LLMs (large-language models) to stitch together capabilities and quickly build software applications. Most of us aren’t likely to create a ChatGPT engine. Instead, I’d foresee we’ll be consumers of its capabilities along with other services – either AI-related or not – that allow the creation of unique mashups.
The first distinction is defining the difference between “Base LLMs” and “Instruction Tuned LLMs”.
Base LLMs do things like predicting the next word based on text training data. You could think of this as the prompt you sometimes get in Microsoft Word when you’re typing.
Instruction-tuned LLMs are where most research is going and where the focus of prompt engineering is. These LLM models try to follow instructions. Usually, they start training with a base LLM and further train them using RLHF (reinforcement learning with human feedback). Most practical applications utilize instruction-tuned LLMs.
Dealing with instruction-tuned LLMs is like giving instructions to another person – someone who is bright but doesn’t know the specifics of your task. So, you need to do a couple of essential things to work with these models effectively:
- Give them clear instructions (as you would with someone helping you).
- Give them time to think (just like you would if you gave someone a task)
For example, if you wanted someone to assist you in researching a famous scientist, such as Charles Darwin, it would be helpful to clearly describe whether you wanted them to focus on his scientific work, his personal life, or his role in history.
Additionally, if they were assisting you in writing, you should be clear on the tone they should use. Should they take on the tone of a professional journalist, a scientist, or a write casual note?
Further, if you knew of excellent sources, it would be beneficial to let your assistant know about them. What should they read and reference in advance to write your text?
Therefore, like working with a human assistant, being clear and specific is an important principle for effectively utilizing instruction-tuned LLM.
The second fundamental principle, which we’ll get into during later posts, is giving the instruction-tuned LLMs time to think. Providing this space is similar to allowing your research assistant time to process the instructions, prompts, and parameters you give them to assist in their work.