Topic 1
What a prompt is made of
A prompt is an instruction given to a model to perform a task. Chip Huyen's AI Engineering (Ch. 5, "Introduction to Prompting") splits it into up to three parts:
- Task description: what you want, including the role the model should play and the output format.
- Examples of how to do the task. Each example is a shot; a prompt with none is zero-shot.
- The task: the concrete input, such as the question to answer or the text to label.
A few-shot prompt from the book (Ch. 5, Table 5-2):
Label the following item as edible or inedible.
chickpea --> edible
box --> inedible
pizza -->
Predict first
Scroll sideways to see the whole diagram
The task description says what to do, and can include the role to play and the output format.
Text version
- The task description says what to do, and can include the role to play and the output format.
- Examples show how to do it. Each one is a shot; with none, the prompt is zero-shot.
- The task is the concrete input: here the item to label, ending with the same marker the examples used.
- All three end up as one text the model continues. The parts are a way to think, not separate inputs.
Parts: AI Engineering, Ch. 5 "Introduction to Prompting". Prompt text: the compact format of Table 5-2 ("Provide examples").
Hands-On Large Language Models (Ch. 6, "The Basic Ingredients of a Prompt") reaches the same place from the other end: start with an instruction and the data it refers to, then add output indicators such as "Sentiment:" so the model answers with a label instead of a sentence. The arrow in the example plays the same role.
None of these parts is a separate input. They are all text in one sequence that the model continues, and the next pages show how literally that is true.
Quick check