LESSON 10 / 215·2 min readFoundation

Prompt engineering, zero-shot, and few-shot prompting

Must knowConcept lesson
01 Understand02 Recall03 Prepare

Words made simple

A few useful meanings before you read the explanation.

Latency
How long a request takes to return a result. Lower latency usually means a shorter wait for the user.

Overview

  • Prompt engineering is writing clear task instructions, inputs, constraints, and output expectations.
  • Zero-shot prompting gives instructions without examples; few-shot prompting adds a small number of input/output examples.
  • A prompt is part of the application contract, not a spell that makes the model infallible.

Why this matters

Ambiguous requests cause avoidable mistakes and inconsistent output.

An everyday example

Asking an employee “handle this” is weaker than giving the goal, acceptable evidence, output format, and two examples.

A technical example

“Classify as claim_status, policy_question, or other. Return other if unclear.” Add examples of “Where is my payout?” and “What does my policy cover?” for few-shot classification.

How it works

  1. Define the task
  2. Separate instructions from data
  3. Provide representative examples if needed
  4. Specify unknown behavior
  5. Evaluate on held-out cases
  6. Version the prompt.

Architecture and flow

Task contract + examples + input → model → validated output → eval results.

The insurance assistant example

“Explain only the provided policy passages. If no passage supports the answer, say you cannot confirm and offer escalation.”

When to use it

Start zero-shot; add few-shot examples when recurring errors concern boundaries, format, or domain wording.

When to avoid it

Do not pack examples into every request when code can perform the task or when examples contain private customer data.

Interview answer

“I write prompts as testable task specifications: clear goal, trusted context, output contract, and abstention rules. Examples help clarify difficult boundaries.”

Benefits, trade-offs, and production considerations

  • Use a representative dataset rather than fixing one prompt for one memorable failure.
  • Do not request hidden chain-of-thought logs; ask for a concise decision explanation and evidence references.
  • Too many examples increase latency and can bias outputs.
PAUSE & RECALL

Can you explain it without the notes?

Prompt engineering, zero-shot, and few-shot prompting

Use your own words. Explain an example and one limitation before checking the explanation.

Check your explanation

Prompt engineering is writing clear task instructions, inputs, constraints, and output expectations. Zero-shot prompting gives instructions without examples; few-shot prompting adds a small number of input/output examples. A prompt is part of the application…

CONNECT IT TO YOUR INTERVIEW

Turn this concept into a clear answer.

Practice this concept
YOUR NEXT STEP

Keep connecting the ideas.

Next lesson: Structured output and JSON output

Adapted from 13_AI.MD · “Prompt engineering, zero-shot, and few-shot prompting”. Examples are study fragments; framework behavior can depend on your version.