1.9 Prompt engineering
How to word prompts and set sampling options to get the result you want.
Key points
NVIDIA describes chain-of-thought prompting as providing few-shot examples where the reasoning process is explained, so the large language model (LLM) shows its reasoning when it answers.
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.”
At a lower temperature the model is more conservative and only picks higher-probability tokens. NVIDIA notes lower temperatures suit definitive tasks like question answering or summarization.
What NVIDIA says (2)
“Lower temperatures are suitable for more definitive tasks like question-answering or summarization.”
“At a lower temperature, the model is more conservative and is limited to choosing tokens with higher probabilities.”
NVIDIA defines zero-shot as prompting the model without any example of the expected behavior. For example, a zero-shot prompt simply asks a question.
What NVIDIA says (2)
“Zero-shot means prompting the model without any example of expected behavior from the model.”
“For example, a zero-shot prompt asks a question.”
System prompting adds a system-level prompt to the user prompt. It gives the large language model (LLM) specific, detailed instructions on how to behave.
What NVIDIA says (1)
“This approach involves adding a system-level prompt in addition to the user prompt to provide specific and detailed instructions to the LLMs to behave as intended.”
Key terms
- Prompt engineering: Shaping the input prompt to get the output you want, without changing the model's weights.
- Zero-shot prompt: A prompt with no examples of the expected behavior.
- Few-shot prompt: A prompt that includes a few example prompt-and-answer pairs.
- Chain-of-thought prompting: Prompting the model with worked reasoning so it shows its reasoning steps.
- Temperature: A sampling setting: lower values make output more predictable, higher values more varied.
- System prompt: An instruction added before the user's prompt that tells the LLM how to behave.
Try it
Sample question
Which prompt technique helps a large language model (LLM) on multi-step reasoning by showing worked reasoning in the examples?
Show the answer
Answer: Few-shot chain-of-thought prompting
NVIDIA describes chain-of-thought prompting as providing few-shot examples where the reasoning process is explained, so the large language model (LLM) shows its reasoning when it answers.
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.”
Practice 1.9 (4 questions) Full Core Machine Learning and AI Knowledge guide
← 1.8 Text embeddings · 1.10 Traditional ML with Python packages →