2.9 Prompt engineering principles

NCA-GENM · Core Machine Learning and AI Knowledge (20% of the exam) · Official objective: “Apply prompt engineering principles to craft prompts that achieve desired results.”

Zero-shot and few-shot prompts, chain of thought and temperature.

Key points

  1. 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.”

    — An Introduction to Large Language Models: Prompt Engineering and P-Tuning

  2. 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.”

    — An Introduction to Large Language Models: Prompt Engineering and P-Tuning

  3. 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.”

    — How to Get Better Outputs from Your Large Language Model

Key terms

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.”

— An Introduction to Large Language Models: Prompt Engineering and P-Tuning

Practice 2.9 (3 questions) Full Core Machine Learning and AI Knowledge guide

← 2.8 Energy-efficient, trustworthy models · 2.10 TensorFlow and PyTorch →