2.9 Prompt engineering principles
Zero-shot and few-shot prompts, chain of thought and temperature.
Key points
Prompt engineering is writing model inputs to get the output you want. A zero-shot prompt simply asks, with no examples.
What NVIDIA says (1)
“Zero-shot means prompting the model without any example of expected behavior from the model.”
Few-shot prompting includes examples in the prompt. When the examples show reasoning, the model tends to show its own. LLM means large language model.
What NVIDIA says (1)
“Do this by providing some few-shot examples, where the reasoning process is explained. When the LLM answers the prompt, it shows its reasoning process as well.”
Temperature controls how random the token choice is. At low temperature the model picks higher-probability tokens.
What NVIDIA says (1)
“Lower temperatures are suitable for more definitive tasks like question-answering or summarization.”
Key terms
- Prompt engineering: Writing model inputs to get the output you want.
- Zero-shot: Doing a task with no examples given in the prompt or for training.
- Few-shot prompting: Putting a few worked examples in the prompt to show the model what to do.
- Temperature: A sampling setting that controls how random the next-token choice is.
Try it
Sample question
What is a zero-shot prompt?
Show the answer
Answer: A prompt with no example of the expected behavior
Prompt engineering is writing model inputs to get the output you want. A zero-shot prompt simply asks, with no examples.
What NVIDIA says (1)
“Zero-shot means prompting the model without any example of expected behavior from the model.”
Practice 2.9 (3 questions) Full Core Machine Learning and AI Knowledge guide
← 2.8 Energy-efficient, trustworthy models · 2.10 TensorFlow and PyTorch →