CertBrain
CoursesBlog
Sign in
← Back to decks
Sign in to save your progress, vote, and build your own decks.Sign in

Prompting Techniques

Prompting techniques are repeatable ways of structuring a prompt to get better answers without changing the model. This lesson covers the ones the exam names: zero-shot, single-shot and few-shot prompting, chain-of-thought prompting and prompt templates. Exam questions usually describe a task and…

11 cards
Study this deck

Prompting Techniques

Prompting techniques are repeatable ways of structuring a prompt to get better answers without changing the model. This lesson covers the ones the exam names: zero-shot, single-shot and few-shot prompting, chain-of-thought prompting and prompt templates. Exam questions usually describe a task and a problem with the output, then ask which technique fits best.

Zero-shot prompting

A zero-shot prompt gives the model an instruction and the input, with no worked examples. "Classify the sentiment of this headline as positive, negative or neutral" is zero-shot. It works well for common, clearly described tasks that a capable foundation model has seen many times in training. It's also the cheapest option, because the prompt is short. Zero-shot is the natural first attempt: start here, and only add more if the answers miss the mark.

Single-shot and few-shot prompting

A "shot" is one example: a sample input paired with the output you want. A single-shot (or one-shot) prompt includes one example. A few-shot prompt includes several, often three to five for simple classification tasks. AWS also calls this in-context learning, because the model learns the pattern from examples inside the prompt rather than through retraining.

Examples are most useful when the task has a format, style or set of labels the model wouldn't guess. Think of company-specific ticket categories, or a house style for product descriptions. AWS's guidance on good shots: make them diverse, covering common and edge cases; match the complexity of the real inputs; keep them relevant; and avoid bias, since a lopsided set of examples produces lopsided answers. The trade-off is cost: every example adds input tokens to every request.

Chain-of-thought prompting

Chain-of-thought (CoT) prompting asks the model to reason step by step before giving its answer. That can be as simple as adding "Think step by step" or as guided as listing the steps to follow. It improves accuracy on multi-step problems such as calculations, multi-part analysis and complex reasoning. Because the reasoning is visible, it also makes mistakes easier to spot.

CoT has costs. The model writes more, so it uses more output tokens and takes longer. AWS advises skipping it for simple tasks that don't need it.

Prompt templates

A prompt template is a reusable prompt with fixed parts and placeholders for the parts that change, such as customer_message or product_name. A template can hold the instruction, the context, few-shot examples and the output format, so every request gets the same proven structure. Templates make results more consistent across a team and let a tested prompt be reused in many places. Amazon Bedrock Prompt Management stores templates with variables, covered in its own lesson.

TechniqueAdd to the promptBest forMain cost
Zero-shotInstruction onlyCommon, clear tasksLowest
Single-shotOne exampleShowing one formatSlightly more input tokens
Few-shotSeveral examplesCustom labels, styles or formatsMore input tokens
Chain-of-thought"Reason step by step"Multi-step reasoningMore output tokens and latency
Prompt templateFixed structure with placeholdersConsistency and reuseUpfront design effort

On the exam

Match the problem to the technique. If the model uses the wrong labels or format, add examples (few-shot). If it fails at multi-step calculations or logic, use chain-of-thought. If every team member writes the prompt differently and results vary, use a template. If the task is simple and the answers are already good, zero-shot is the cheapest choice. A common trap is choosing fine-tuning when a few examples in the prompt would do. Few-shot prompting changes nothing about the model itself.

Quiz me on this
An analyst asks a foundation model to sort news headlines into positive, negative or neutral, giving only the instruction and the headline, with no examples. Which technique is this?
  1. Few-shot prompting
  2. Chain-of-thought prompting
  3. ✓ Zero-shot prompting
  4. Single-shot prompting
A utility company wants a model to tag customer emails with its own internal categories, such as "Meter Dispute" and "Payment Plan". With instruction-only prompts, the model keeps inventing category names of its own. The company can't retrain the model. What should it do?
  1. ✓ Add a few labeled example emails to the prompt
  2. Raise the temperature so the model explores more labels
  3. Ask the model to explain its reasoning step by step
  4. Switch to a model with a larger context window
A logistics firm uses a model to estimate delivery costs from a rate table, surcharges and discounts. The model often skips a step and returns a wrong total. Responses must stay fast and cheap for the firm's simple yes-or-no address checks, which also use the model. What is the BEST approach?
  1. Add chain-of-thought instructions to every prompt the firm sends
  2. Fine-tune the model on past cost estimates and address checks together
  3. Use few-shot examples of yes-or-no answers for the cost estimates
  4. ✓ Use chain-of-thought for cost estimates only, not address checks
A support team of 20 agents each writes their own prompts to summarize customer calls. The summaries vary widely in structure and quality. The team wants every summary built the same way from a proven prompt. What should it use?
  1. Chain-of-thought prompting for every summary request
  2. ✓ A shared prompt template with a call placeholder
  3. A higher temperature so the model writes more freely
  4. Zero-shot prompts that each agent writes as needed
A retailer's few-shot prompt for classifying product reviews includes five examples, all of them glowing five-star reviews. The model now labels many mixed and negative reviews as positive. Which change BEST addresses the cause?
  1. ✓ Replace them with varied examples, including mixed and negative reviews
  2. Remove all of the examples and switch to a pure zero-shot prompt instead
  3. Add chain-of-thought instructions while keeping the same examples
  4. Add many more five-star examples so the pattern is clearer
What is the main trade-off of chain-of-thought prompting?
  1. It requires labeled training data before you can use it with a model
  2. It permanently changes the model's weights for later requests
  3. It can only be used with image generation models
  4. ✓ It adds output tokens and latency, raising cost
Zero-shot prompting
A prompt that gives the task and input but includes no example input-output pairs.
Shot (in prompting)
One example input paired with the output you want. Prompts are named by how many shots they include: zero-shot has none, few-shot has a few.
What makes good few-shot examples?
Diverse (common and edge cases), matched to the real task's complexity, relevant, and free of bias.
Chain-of-thought (CoT) prompting
Asking the model to reason step by step before answering; helps multi-step problems but adds output tokens and latency.
Prompt template
A reusable prompt with fixed parts and placeholders for changing content, giving consistent structure across requests.